Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/v0.1.0-beta4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ NIGHTLY BUILDS
- Flow Nightly now updates itself to the newest nightly build, on Windows, macOS and Linux. A nightly build installed before this change needs one new install by hand first.
- The Nightly release and Flow Nightly's update window list what has changed since the last release, from the changelog of the next one.

SUPPORT
- The Support Flow page is simpler. Open Collective and Patreon sit in one list, and cryptocurrency shows one coin at a time: pick a coin to see its QR code, network and full address, with a button to copy it.

FIXES
- The rows on the About page that open something, such as Changelog, can be reached and opened with the keyboard.
- Playlist cards show all four covers when two of the songs share a cover.
Expand Down
73 changes: 73 additions & 0 deletions src/components/donations/CryptoDonationCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { useState } from "react";
import { Copy } from "lucide-react";
import { Button } from "../ui/Button";
import { SegmentedControl } from "../ui/SegmentedControl";
import { copyText } from "../../lib/clipboard";
import { getString } from "../../lib/i18n/index";
import { CRYPTO_METHODS } from "../../lib/supportLinks";
import { useUiStore } from "../../store/useUiStore";

/** One coin at a time, so the page shows a single QR code instead of a wall of them. */
export function CryptoDonationCard() {
const [ticker, setTicker] = useState(CRYPTO_METHODS[0]!.ticker);
const method = CRYPTO_METHODS.find((item) => item.ticker === ticker) ?? CRYPTO_METHODS[0]!;

const copyAddress = async () => {
const copied = await copyText(method.address);
useUiStore.getState().showToast({
variant: copied ? "success" : "error",
message: getString(copied ? "donations_address_copied" : "donations_copy_failed"),
});
};

return (
<section className="space-y-2">
<h2 className="px-1 text-sm font-semibold text-primary">{getString("donations_crypto_label")}</h2>
<div className="rounded-2xl bg-surface-row p-5">
<SegmentedControl
stretch
label={getString("donations_crypto_label")}
value={ticker}
onChange={setTicker}
options={CRYPTO_METHODS.map((item) => ({ value: item.ticker, label: item.name }))}
/>

<div className="mt-5 flex flex-col items-center gap-5 sm:flex-row sm:items-start">
<div className="shrink-0 rounded-xl bg-chrome-white p-2.5">
<img src={method.qr} alt={getString("donations_qr_alt", method.name)} className="h-40 w-40 rounded-md" />
</div>

<div className="flex w-full min-w-0 flex-1 flex-col gap-3">
<div className="flex items-center gap-2">
<span className="text-base font-medium text-chrome-neutral-100">{method.name}</span>
<span className="rounded-full bg-surface-container-high px-2 py-0.5 text-[11px] font-semibold text-chrome-neutral-300">
{method.ticker}
</span>
</div>
<dl className="flex flex-col gap-3 text-sm">
<div>
<dt className="text-xs text-chrome-neutral-500">{getString("donations_network_label")}</dt>
<dd className="mt-0.5 text-chrome-neutral-200">{method.network}</dd>
</div>
<div>
<dt className="text-xs text-chrome-neutral-500">{getString("donations_address_label")}</dt>
<dd
dir="ltr"
className="mt-1 select-text break-all rounded-lg bg-surface-container px-3 py-2 font-mono text-xs leading-relaxed text-chrome-neutral-200"
>
{method.address}
</dd>
</div>
</dl>
<Button variant="tonal" onClick={() => void copyAddress()} className="self-start">
<Copy className="h-4 w-4" />
{getString("donations_copy_address")}
</Button>
</div>
</div>

<p className="mt-5 text-xs text-chrome-neutral-400">{getString("donations_crypto_hint")}</p>
</div>
</section>
);
}
30 changes: 30 additions & 0 deletions src/components/donations/SupportMethodRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { ReactNode } from "react";

interface SupportMethodRowProps {
icon: ReactNode;
title: string;
badge?: string;
description: string;
action: ReactNode;
}

/** One way to give, laid out like a settings row so the page reads as one list. */
export function SupportMethodRow({ icon, title, badge, description, action }: SupportMethodRowProps) {
return (
<div className="flex flex-wrap items-center gap-x-4 gap-y-3 px-5 py-4">
<span className="grid h-10 w-10 shrink-0 place-items-center rounded-full bg-surface-container-high text-chrome-neutral-100">
{icon}
</span>
<div className="min-w-0 flex-1 basis-56">
<div className="flex flex-wrap items-center gap-2">
<h2 className="text-sm font-medium text-chrome-neutral-100">{title}</h2>
{badge && (
<span className="rounded-full border border-chrome-neutral-700 px-2 py-0.5 text-[11px] font-semibold text-chrome-neutral-300">{badge}</span>
)}
</div>
<p className="mt-0.5 text-xs text-chrome-neutral-400">{description}</p>
</div>
<div className="shrink-0">{action}</div>
</div>
);
}
1 change: 1 addition & 0 deletions src/lib/i18n/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,7 @@
"donations_crypto_label": "Cryptocurrency",
"donations_crypto_hint": "Scan a QR code with a compatible wallet, or copy the address. Always verify the address and network before sending.",
"donations_network_label": "Network",
"donations_address_label": "Address",
"donations_copy_address": "Copy address",
"donations_address_copied": "Address copied to clipboard",
"donations_copy_failed": "Could not copy address",
Expand Down
46 changes: 46 additions & 0 deletions src/lib/supportLinks.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,48 @@
export const OPEN_COLLECTIVE_URL = "https://opencollective.com/flow-tube";
export const PATREON_URL = "https://patreon.com/A_EDev";

export type CryptoMethod = {
name: string;
ticker: string;
network: string;
address: string;
qr: string;
};

export const CRYPTO_METHODS: readonly CryptoMethod[] = [
{
name: "Bitcoin",
ticker: "BTC",
network: "Bitcoin",
address: "bc1qgmkkxxvzvsymtpfazqfl93jw6k4jgy0xmrtnv8",
qr: "/donations/bitcoin.png",
},
{
name: "Ethereum",
ticker: "ETH",
network: "ERC-20",
address: "0xfbac6f464fec7fe458e318971a42ba45b305b70e",
qr: "/donations/ethereum.png",
},
{
name: "Solana",
ticker: "SOL",
network: "Solana",
address: "7b3SLgiVPb8qQUvERSPGRWoFoiGEDvkFuY98M1GEngug",
qr: "/donations/solana.png",
},
{
name: "USDT",
ticker: "USDT",
network: "TRC-20",
address: "TRz7VDrTWwCLCfQmYBEJakqcZgbFNWfUMP",
qr: "/donations/usdt-trc20.png",
},
{
name: "Monero",
ticker: "XMR",
network: "Monero",
address: "8AgaxZnpEvT8VXJpczpL7BQejwSEw97saJmKYqq4zKErbe9bkYSwUhJ813msPPbdYhF11oz4N7tfEj4Zi6k27fKD83ca1if",
qr: "/donations/monero.png",
},
];
Loading
Loading