Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/first-channel
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jul 24, 2024
2 parents 94f2fdc + 7a92191 commit 69b9951
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 9 deletions.
6 changes: 3 additions & 3 deletions frontend/src/components/QRCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export type Props = {
};

function QRCode({ value, size, level, className }: Props) {
const { theme } = useTheme();
const fgColor = theme === "dark" ? "#FFFFFF" : "#242424";
const bgColor = theme === "dark" ? "#242424" : "#FFFFFF";
const { isDarkMode } = useTheme();
const fgColor = isDarkMode ? "#FFFFFF" : "#242424";
const bgColor = isDarkMode ? "#242424" : "#FFFFFF";

return (
<ReactQRCode
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/components/ui/theme-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ type ThemeProviderState = {
darkMode: string;
setTheme: (theme: Theme) => void;
setDarkMode: (mode: DarkMode) => void;
isDarkMode: boolean;
};

const initialState: ThemeProviderState = {
theme: "default",
setTheme: () => null,
darkMode: "system",
setDarkMode: () => null,
isDarkMode: false,
};

const ThemeProviderContext = createContext<ThemeProviderState>(initialState);
Expand All @@ -46,6 +48,8 @@ export function ThemeProvider({
);
});

const [isDarkMode, setIsDarkMode] = useState<boolean>(false);

useEffect(() => {
const root = window.document.documentElement;

Expand All @@ -66,6 +70,8 @@ export function ThemeProvider({
prefersDark = darkMode === "dark";
}

setIsDarkMode(prefersDark);

if (prefersDark) {
classList.add("dark");
} else {
Expand All @@ -84,6 +90,7 @@ export function ThemeProvider({
localStorage.setItem(storageKey + "-darkmode", darkMode);
setDarkMode(darkMode);
},
isDarkMode,
};

return (
Expand Down
71 changes: 65 additions & 6 deletions frontend/src/screens/channels/Channels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,21 @@ export default function Channels() {
<Card className="flex flex-col">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">
Savings Balance
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<div className="flex flex-row gap-2 items-center">
Savings Balance
<InfoIcon className="h-4 w-4 shrink-0 text-muted-foreground" />
</div>
</TooltipTrigger>
<TooltipContent className="w-[300px]">
Your savings balance (on-chain balance) can be used to open
new lightning channels. When channels are closed, funds from
your channel will be returned to your savings balance.
</TooltipContent>
</Tooltip>
</TooltipProvider>
</CardTitle>
<Bitcoin className="h-4 w-4 text-muted-foreground" />
</CardHeader>
Expand Down Expand Up @@ -554,7 +568,20 @@ export default function Channels() {
<Card className="flex flex-col">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">
Spending Balance
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<div className="flex flex-row gap-2 items-center">
Spending Balance
<InfoIcon className="h-4 w-4 shrink-0 text-muted-foreground" />
</div>
</TooltipTrigger>
<TooltipContent className="w-[300px]">
Your spending balance is the funds on your side of your
channels, which you can use to make lightning payments.
</TooltipContent>
</Tooltip>
</TooltipProvider>
</CardTitle>
<ArrowUp className="h-4 w-4 text-muted-foreground" />
</CardHeader>
Expand Down Expand Up @@ -584,7 +611,21 @@ export default function Channels() {
<Card className="flex flex-col">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">
Receiving Capacity
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<div className="flex flex-row gap-2 items-center">
Receiving Capacity
<InfoIcon className="h-4 w-4 shrink-0 text-muted-foreground" />
</div>
</TooltipTrigger>
<TooltipContent className="w-[300px]">
Your receiving capacity is the funds owned by your channel
partner, which will be moved to your side when you receive
lightning payments.
</TooltipContent>
</Tooltip>
</TooltipProvider>
</CardTitle>
<ArrowDown className="h-4 w-4 text-muted-foreground" />
</CardHeader>
Expand Down Expand Up @@ -683,14 +724,32 @@ export default function Channels() {
}
}

const channelStatus = channel.active
? "online"
: channel.confirmationsRequired !== undefined &&
channel.confirmations !== undefined &&
channel.confirmationsRequired >
channel.confirmations
? "opening"
: "offline";
if (channelStatus === "opening") {
channelWarning = `Channel is currently being opened (${channel.confirmations} of ${channel.confirmationsRequired} confirmations). Once the required confirmation are reached, you will be able to send and receive on this channel.`;
}
if (channelStatus === "offline") {
channelWarning =
"This channel is currently offline and cannot be used to send or receive payments. Please contact Alby Support for more information.";
}

return (
<TableRow key={channel.id} className="channel">
<TableCell>
{channel.active ? (
{channelStatus == "online" ? (
<Badge variant="positive">Online</Badge>
) : channelStatus == "opening" ? (
<Badge variant="outline">Opening</Badge>
) : (
<Badge variant="outline">Offline</Badge>
)}{" "}
)}
</TableCell>
<TableCell className="flex flex-row items-center">
<a
Expand Down Expand Up @@ -766,7 +825,7 @@ export default function Channels() {
<TooltipTrigger>
<AlertTriangle className="w-4 h-4 mt-1" />
</TooltipTrigger>
<TooltipContent className="w-[400px]">
<TooltipContent className="max-w-[400px]">
{channelWarning}
</TooltipContent>
</Tooltip>
Expand Down
2 changes: 2 additions & 0 deletions lnclient/ldk/ldk.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events
"02b4552a7a85274e4da01a7c71ca57407181752e8568b31d51f13c111a2941dce3", // LNServer_Wave
"0296b2db342fcf87ea94d981757fdf4d3e545bd5cef4919f58b5d38dfdd73bf5c9", // blocktank
"038ba8f67ba8ff5c48764cdd3251c33598d55b203546d08a8f0ec9dcd9f27e3637", // flashsats
"0370a5392cd7c81ff5128fa656ee6db0c4d11c778fcd6cb98cb6ba3b48394f5705", // lqwd

// Mutinynet
lsp.AlbyMutinynetPlebsLSP().Pubkey,
lsp.OlympusMutinynetLSP().Pubkey,
lsp.MegalithMutinynetLSP().Pubkey,
"0296820bbba5bd33719962bafd69996ee89e03ce7164d8f368cbb85463f5f47876", // flashsats
"035e8a9034a8c68f219aacadae748c7a3cd719109309db39b09886e5ff17696b1b", // lqwd
}

ldkConfig.ListeningAddresses = &listeningAddresses
Expand Down

0 comments on commit 69b9951

Please sign in to comment.