Skip to content

Commit

Permalink
fix: link to open first channel when alby shared funds are available
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jul 10, 2024
1 parent 5a7b68a commit 005f87f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/SidebarHint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function SidebarHint() {
// User has funds to migrate
if (
hasChannelManagement &&
info?.backendType === "LDK" &&
albyBalance &&
albyBalance.sats * (1 - ALBY_SERVICE_FEE) >
ALBY_MIN_BALANCE + 50000 /* accomodate for onchain fees */
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/screens/onboarding/MigrateAlbyFunds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ export default function MigrateAlbyFunds() {
>
Migrate Funds and Open Channel
</LoadingButton>
<Link to="/channels">
<Button variant="link">Explore Other Options</Button>
</Link>
</form>
</>
) : (
Expand Down
24 changes: 14 additions & 10 deletions frontend/src/screens/wallet/OnboardingChecklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
CardHeader,
CardTitle,
} from "src/components/ui/card";
import { ALBY_MIN_BALANCE, ALBY_SERVICE_FEE } from "src/constants";
import { useAlbyBalance } from "src/hooks/useAlbyBalance";
import { useAlbyMe } from "src/hooks/useAlbyMe";
import { useApps } from "src/hooks/useApps";
import { useChannels } from "src/hooks/useChannels";
Expand All @@ -16,7 +18,7 @@ import { useTransactions } from "src/hooks/useTransactions";
import { cn } from "src/lib/utils";

function OnboardingChecklist() {
// const { data: albyBalance } = useAlbyBalance();
const { data: albyBalance } = useAlbyBalance();
const { data: albyMe } = useAlbyMe();
const { data: apps } = useApps();
const { data: channels } = useChannels();
Expand All @@ -30,19 +32,13 @@ function OnboardingChecklist() {
!channels ||
!info ||
!nodeConnectionInfo ||
!transactions;
!transactions ||
!albyBalance;

if (isLoading) {
return;
}

/*const hasAlbyBalance =
hasChannelManagement &&
albyBalance &&
albyBalance.sats * (1 - ALBY_SERVICE_FEE) >
ALBY_MIN_BALANCE + 50000; // accommodate for on-chain fees
*/

const isLinked =
albyMe &&
nodeConnectionInfo &&
Expand All @@ -68,13 +64,21 @@ function OnboardingChecklist() {
return;
}

const canMigrateAlbyFundsToNewChannel =
hasChannelManagement &&
info.backendType === "LDK" &&
albyBalance.sats * (1 - ALBY_SERVICE_FEE) >
ALBY_MIN_BALANCE + 50000; /* accomodate for onchain fees */

const checklistItems = [
{
title: "Open your first channel",
description:
"Establish a new Lightning channel to enable fast and low-fee Bitcoin transactions.",
checked: hasChannel,
to: "/channels",
to: canMigrateAlbyFundsToNewChannel
? "/onboarding/lightning/migrate-alby"
: "/channels",
},
{
title: "Send or receive your first payment",
Expand Down

0 comments on commit 005f87f

Please sign in to comment.