Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
chore: add transaction hint in checklist
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jul 4, 2024
1 parent 07bffce commit 36b1bd9
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions frontend/src/screens/wallet/OnboardingChecklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useApps } from "src/hooks/useApps";
import { useChannels } from "src/hooks/useChannels";
import { useInfo } from "src/hooks/useInfo";
import { useNodeConnectionInfo } from "src/hooks/useNodeConnectionInfo";
import { useTransactions } from "src/hooks/useTransactions";
import { cn } from "src/lib/utils";

function OnboardingChecklist() {
Expand All @@ -21,9 +22,15 @@ function OnboardingChecklist() {
const { data: channels } = useChannels();
const { data: info, hasChannelManagement, hasMnemonic } = useInfo();
const { data: nodeConnectionInfo } = useNodeConnectionInfo();
const { data: transactions } = useTransactions(false, 1);

const isLoading =
!albyMe || !apps || !channels || !info || !nodeConnectionInfo;
!albyMe ||
!apps ||
!channels ||
!info ||
!nodeConnectionInfo ||
!transactions;

if (isLoading) {
return;
Expand All @@ -41,17 +48,23 @@ function OnboardingChecklist() {
nodeConnectionInfo &&
albyMe?.keysend_pubkey === nodeConnectionInfo?.pubkey;
const hasChannel =
!hasChannelManagement ||
(hasChannelManagement && channels && channels?.length > 0);
!hasChannelManagement || (hasChannelManagement && channels?.length > 0);
const hasBackedUp =
hasMnemonic &&
info &&
info.nextBackupReminder &&
new Date(info.nextBackupReminder).getTime() > new Date().getTime();
const hasCustomApp =
apps && apps.find((x) => x.name !== "getalby.com") !== undefined;
const hasTransaction = transactions?.length > 0;

if (isLinked && hasChannel && (!hasMnemonic || hasBackedUp) && hasCustomApp) {
if (
isLinked &&
!hasChannel &&
(!hasMnemonic || hasBackedUp) &&
hasCustomApp &&
hasTransaction
) {
return;
}

Expand All @@ -63,23 +76,30 @@ function OnboardingChecklist() {
checked: hasChannel,
to: "/channels",
},
{
title: "Send or receive your first payment",
description:
"Use your newly opened channel to make a transaction on the Lightning Network.",
checked: hasTransaction,
to: "/wallet",
},
{
title: "Link your Alby Account",
description: "Link your lightning address & other apps to this hub.",
description: "Link your lightning address & other apps to this Hub.",
checked: isLinked,
to: "/apps",
},
// TODO: enable when we can always migrate funds
/*{
title: "Migrate your balance to your Alby Hub",
title: "Migrate your balance to your Hub",
description: "Move your existing funds into self-custody.",
checked: !hasAlbyBalance,
to: "/onboarding/lightning/migrate-alby",
},*/
{
title: "Connect your first app",
description:
"Seamlessly connect apps and integrate your wallet with other apps from your hub.",
"Seamlessly connect apps and integrate your wallet with other apps from your Hub.",
checked: hasCustomApp,
to: "/appstore",
},
Expand Down

0 comments on commit 36b1bd9

Please sign in to comment.