This commit is contained in:
2023-09-22 12:17:33 +01:00
parent dadf5159bd
commit 5182b65591
8 changed files with 134 additions and 68 deletions

View File

@ -57,20 +57,50 @@ export default function CashuNuts({ token }: { token: string }) {
<div className="flex f-center g16"> <div className="flex f-center g16">
<svg width="30" height="39" viewBox="0 0 30 39" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="30" height="39" viewBox="0 0 30 39" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="Group 47711"> <g id="Group 47711">
<path id="Rectangle 585" d="M29.3809 2.47055L29.3809 11.7277L26.7913 11.021C23.8493 10.2181 20.727 10.3835 17.8863 11.4929C15.5024 12.4238 12.9113 12.6933 10.3869 12.2728L7.11501 11.7277L7.11501 2.47054L10.3869 3.01557C12.9113 3.43607 15.5024 3.1666 17.8863 2.23566C20.727 1.12632 23.8493 0.960876 26.7913 1.7638L29.3809 2.47055Z" fill="url(#paint0_linear_1976_19241)" /> <path
<path id="Rectangle 587" d="M29.3809 27.9803L29.3809 37.2375L26.7913 36.5308C23.8493 35.7278 20.727 35.8933 17.8863 37.0026C15.5024 37.9336 12.9113 38.203 10.3869 37.7825L7.11501 37.2375L7.11501 27.9803L10.3869 28.5253C12.9113 28.9458 15.5024 28.6764 17.8863 27.7454C20.727 26.6361 23.8493 26.4706 26.7913 27.2736L29.3809 27.9803Z" fill="url(#paint1_linear_1976_19241)" /> id="Rectangle 585"
<path id="Rectangle 586" d="M8.494e-08 15.2069L4.89585e-07 24.4641L2.5896 23.7573C5.53159 22.9544 8.6539 23.1198 11.4946 24.2292C13.8784 25.1601 16.4695 25.4296 18.9939 25.0091L22.2658 24.4641L22.2658 15.2069L18.9939 15.7519C16.4695 16.1724 13.8784 15.9029 11.4946 14.972C8.6539 13.8627 5.53159 13.6972 2.5896 14.5001L8.494e-08 15.2069Z" fill="url(#paint2_linear_1976_19241)" /> d="M29.3809 2.47055L29.3809 11.7277L26.7913 11.021C23.8493 10.2181 20.727 10.3835 17.8863 11.4929C15.5024 12.4238 12.9113 12.6933 10.3869 12.2728L7.11501 11.7277L7.11501 2.47054L10.3869 3.01557C12.9113 3.43607 15.5024 3.1666 17.8863 2.23566C20.727 1.12632 23.8493 0.960876 26.7913 1.7638L29.3809 2.47055Z"
fill="url(#paint0_linear_1976_19241)"
/>
<path
id="Rectangle 587"
d="M29.3809 27.9803L29.3809 37.2375L26.7913 36.5308C23.8493 35.7278 20.727 35.8933 17.8863 37.0026C15.5024 37.9336 12.9113 38.203 10.3869 37.7825L7.11501 37.2375L7.11501 27.9803L10.3869 28.5253C12.9113 28.9458 15.5024 28.6764 17.8863 27.7454C20.727 26.6361 23.8493 26.4706 26.7913 27.2736L29.3809 27.9803Z"
fill="url(#paint1_linear_1976_19241)"
/>
<path
id="Rectangle 586"
d="M8.494e-08 15.2069L4.89585e-07 24.4641L2.5896 23.7573C5.53159 22.9544 8.6539 23.1198 11.4946 24.2292C13.8784 25.1601 16.4695 25.4296 18.9939 25.0091L22.2658 24.4641L22.2658 15.2069L18.9939 15.7519C16.4695 16.1724 13.8784 15.9029 11.4946 14.972C8.6539 13.8627 5.53159 13.6972 2.5896 14.5001L8.494e-08 15.2069Z"
fill="url(#paint2_linear_1976_19241)"
/>
</g> </g>
<defs> <defs>
<linearGradient id="paint0_linear_1976_19241" x1="29.3809" y1="6.7213" x2="7.11501" y2="6.7213" gradientUnits="userSpaceOnUse"> <linearGradient
id="paint0_linear_1976_19241"
x1="29.3809"
y1="6.7213"
x2="7.11501"
y2="6.7213"
gradientUnits="userSpaceOnUse">
<stop stop-color="white" /> <stop stop-color="white" />
<stop offset="1" stop-color="white" stop-opacity="0.5" /> <stop offset="1" stop-color="white" stop-opacity="0.5" />
</linearGradient> </linearGradient>
<linearGradient id="paint1_linear_1976_19241" x1="29.3809" y1="32.2311" x2="7.11501" y2="32.2311" gradientUnits="userSpaceOnUse"> <linearGradient
id="paint1_linear_1976_19241"
x1="29.3809"
y1="32.2311"
x2="7.11501"
y2="32.2311"
gradientUnits="userSpaceOnUse">
<stop stop-color="white" /> <stop stop-color="white" />
<stop offset="1" stop-color="white" stop-opacity="0.5" /> <stop offset="1" stop-color="white" stop-opacity="0.5" />
</linearGradient> </linearGradient>
<linearGradient id="paint2_linear_1976_19241" x1="2.70746e-07" y1="19.4576" x2="22.2658" y2="19.4576" gradientUnits="userSpaceOnUse"> <linearGradient
id="paint2_linear_1976_19241"
x1="2.70746e-07"
y1="19.4576"
x2="22.2658"
y2="19.4576"
gradientUnits="userSpaceOnUse">
<stop stop-color="white" /> <stop stop-color="white" />
<stop offset="1" stop-color="white" stop-opacity="0.5" /> <stop offset="1" stop-color="white" stop-opacity="0.5" />
</linearGradient> </linearGradient>
@ -79,15 +109,19 @@ export default function CashuNuts({ token }: { token: string }) {
<FormattedMessage <FormattedMessage
defaultMessage="<h1>{n}</h1> Cashu sats" defaultMessage="<h1>{n}</h1> Cashu sats"
values={{ values={{
h1: (c) => <h1>{c}</h1>, h1: c => <h1>{c}</h1>,
n: <FormattedNumber value={amount} /> n: <FormattedNumber value={amount} />,
}} /> }}
/>
</div> </div>
<small className="xs w-max"> <small className="xs w-max">
<FormattedMessage defaultMessage="<b>Mint:</b> {url}" values={{ <FormattedMessage
b: (c) => <b>{c}</b>, defaultMessage="<b>Mint:</b> {url}"
url: new URL(cashu.token[0].mint).hostname values={{
}} /> b: c => <b>{c}</b>,
url: new URL(cashu.token[0].mint).hostname,
}}
/>
</small> </small>
</div> </div>
<div className="flex g8"> <div className="flex g8">

View File

@ -15,16 +15,30 @@ export function LiveEvent({ ev }: { ev: NostrEvent }) {
function statusLine() { function statusLine() {
switch (status) { switch (status) {
case "live": { case "live": {
return <div className="flex g4"> return (
<div className="flex g4">
<Icon name="signal-01" /> <Icon name="signal-01" />
<b className="uppercase"><FormattedMessage defaultMessage="Live" /></b> <b className="uppercase">
<FormattedMessage defaultMessage="Live" />
</b>
</div> </div>
);
} }
case "ended": { case "ended": {
return <b className="uppercase"><FormattedMessage defaultMessage="Ended" /></b> return (
<b className="uppercase">
<FormattedMessage defaultMessage="Ended" />
</b>
);
} }
case "planned": { case "planned": {
return <b className="uppercase">{new Intl.DateTimeFormat(undefined, { dateStyle: 'full', timeStyle: 'short' }).format(new Date(starts * 1000))}</b> return (
<b className="uppercase">
{new Intl.DateTimeFormat(undefined, { dateStyle: "full", timeStyle: "short" }).format(
new Date(starts * 1000),
)}
</b>
);
} }
} }
} }
@ -33,19 +47,23 @@ export function LiveEvent({ ev }: { ev: NostrEvent }) {
const link = `https://zap.stream/${NostrLink.fromEvent(ev).encode()}`; const link = `https://zap.stream/${NostrLink.fromEvent(ev).encode()}`;
switch (status) { switch (status) {
case "live": { case "live": {
return <Link to={link} target="_blank"> return (
<Link to={link} target="_blank">
<button type="button"> <button type="button">
<FormattedMessage defaultMessage="Join Stream" /> <FormattedMessage defaultMessage="Join Stream" />
</button> </button>
</Link>; </Link>
);
} }
case "ended": { case "ended": {
if (findTag(ev, "recording")) { if (findTag(ev, "recording")) {
return <Link to={link} target="_blank"> return (
<Link to={link} target="_blank">
<button type="button"> <button type="button">
<FormattedMessage defaultMessage="Watch Replay" /> <FormattedMessage defaultMessage="Watch Replay" />
</button> </button>
</Link>; </Link>
);
} }
} }
} }
@ -60,9 +78,7 @@ export function LiveEvent({ ev }: { ev: NostrEvent }) {
{statusLine()} {statusLine()}
</div> </div>
</div> </div>
<div> <div>{cta()}</div>
{cta()}
</div>
</div> </div>
); );
} }

View File

@ -157,14 +157,22 @@ export default function LoginPage() {
await signer.init(); await signer.init();
await delay(500); await delay(500);
await signer.describe(); await signer.describe();
LoginStore.loginWithPubkey(await signer.getPubKey(), LoginSessionType.Nip46, undefined, ["wss://relay.damus.io"], await PinEncrypted.create(nip46Key, pin)); LoginStore.loginWithPubkey(
await signer.getPubKey(),
LoginSessionType.Nip46,
undefined,
["wss://relay.damus.io"],
await PinEncrypted.create(nip46Key, pin),
);
navigate("/"); navigate("/");
} }
function nip46Buttons() { function nip46Buttons() {
return ( return (
<> <>
<AsyncButton type="button" onClick={() => { <AsyncButton
type="button"
onClick={() => {
generateNip46(); generateNip46();
setPin(true); setPin(true);
}}> }}>

View File

@ -60,11 +60,16 @@ export class Nip4ChatSystem extends ExternalStore<Array<Chat>> implements ChatSy
{} as Record<string, Array<NostrEvent>>, {} as Record<string, Array<NostrEvent>>,
); );
return [...Object.entries(chats)].map(([k, v]) => Nip4ChatSystem.createChatObj(encodeTLVEntries("chat4" as NostrPrefix, { return [...Object.entries(chats)].map(([k, v]) =>
Nip4ChatSystem.createChatObj(
encodeTLVEntries("chat4" as NostrPrefix, {
type: TLVEntryType.Author, type: TLVEntryType.Author,
value: k, value: k,
length: 32, length: 32,
}), v)); }),
v,
),
);
} }
static createChatObj(id: string, messages: Array<NostrEvent>) { static createChatObj(id: string, messages: Array<NostrEvent>) {

View File

@ -46,7 +46,7 @@
--header-padding-tb: 10px; --header-padding-tb: 10px;
--btn-color: #fff; --btn-color: #fff;
--primary-gradient: linear-gradient(90deg, rgba(239, 150, 68, 1) 0%, rgba(123, 65, 246, 1) 100%); --primary-gradient: linear-gradient(90deg, rgba(239, 150, 68, 1) 0%, rgba(123, 65, 246, 1) 100%);
--cashu-gradient: linear-gradient(90deg, #40B039, #ADFF2A) --cashu-gradient: linear-gradient(90deg, #40b039, #adff2a);
} }
::-webkit-scrollbar { ::-webkit-scrollbar {

View File

@ -193,6 +193,12 @@
"5ykRmX": { "5ykRmX": {
"defaultMessage": "Send zap" "defaultMessage": "Send zap"
}, },
"6/SF6e": {
"defaultMessage": "<h1>{n}</h1> Cashu sats"
},
"6/hB3S": {
"defaultMessage": "Watch Replay"
},
"65BmHb": { "65BmHb": {
"defaultMessage": "Failed to proxy image from {host}, click here to load directly" "defaultMessage": "Failed to proxy image from {host}, click here to load directly"
}, },
@ -362,6 +368,9 @@
"Dh3hbq": { "Dh3hbq": {
"defaultMessage": "Auto Zap" "defaultMessage": "Auto Zap"
}, },
"Dn82AL": {
"defaultMessage": "Live"
},
"DtYelJ": { "DtYelJ": {
"defaultMessage": "Transfer" "defaultMessage": "Transfer"
}, },
@ -434,6 +443,9 @@
"GL8aXW": { "GL8aXW": {
"defaultMessage": "Bookmarks ({n})" "defaultMessage": "Bookmarks ({n})"
}, },
"GQPtfk": {
"defaultMessage": "Join Stream"
},
"GSye7T": { "GSye7T": {
"defaultMessage": "Lightning Address" "defaultMessage": "Lightning Address"
}, },
@ -459,9 +471,6 @@
"HAlOn1": { "HAlOn1": {
"defaultMessage": "Name" "defaultMessage": "Name"
}, },
"HF4YnO": {
"defaultMessage": "Watch Live!"
},
"HFls6j": { "HFls6j": {
"defaultMessage": "name will be available later" "defaultMessage": "name will be available later"
}, },
@ -725,10 +734,6 @@
"SP0+yi": { "SP0+yi": {
"defaultMessage": "Buy Subscription" "defaultMessage": "Buy Subscription"
}, },
"SX58hM": {
"defaultMessage": "Copy",
"description": "Button: Copy Cashu token"
},
"SYQtZ7": { "SYQtZ7": {
"defaultMessage": "LN Address Proxy" "defaultMessage": "LN Address Proxy"
}, },
@ -747,8 +752,8 @@
"TDR5ge": { "TDR5ge": {
"defaultMessage": "Media in notes will automatically be shown for selected people, otherwise only the link will show" "defaultMessage": "Media in notes will automatically be shown for selected people, otherwise only the link will show"
}, },
"TMfYfY": { "TP/cMX": {
"defaultMessage": "Cashu token" "defaultMessage": "Ended"
}, },
"TpgeGw": { "TpgeGw": {
"defaultMessage": "Hex Salt..", "defaultMessage": "Hex Salt..",
@ -760,9 +765,6 @@
"UDYlxu": { "UDYlxu": {
"defaultMessage": "Pending Subscriptions" "defaultMessage": "Pending Subscriptions"
}, },
"ULotH9": {
"defaultMessage": "Amount: {amount} sats"
},
"UT7Nkj": { "UT7Nkj": {
"defaultMessage": "New Chat" "defaultMessage": "New Chat"
}, },
@ -1049,9 +1051,6 @@
"iNWbVV": { "iNWbVV": {
"defaultMessage": "Handle" "defaultMessage": "Handle"
}, },
"iUsU2x": {
"defaultMessage": "Mint: {url}"
},
"iXPL0Z": { "iXPL0Z": {
"defaultMessage": "Can't login with private key on an insecure connection, please use a Nostr key manager extension instead" "defaultMessage": "Can't login with private key on an insecure connection, please use a Nostr key manager extension instead"
}, },
@ -1428,5 +1427,8 @@
}, },
"zvCDao": { "zvCDao": {
"defaultMessage": "Automatically show latest notes" "defaultMessage": "Automatically show latest notes"
},
"zwb6LR": {
"defaultMessage": "<b>Mint:</b> {url}"
} }
} }

View File

@ -63,6 +63,8 @@
"5u6iEc": "Transfer to Pubkey", "5u6iEc": "Transfer to Pubkey",
"5vMmmR": "Usernames are not unique on Nostr. The nostr address is your unique human-readable address that is unique to you upon registration.", "5vMmmR": "Usernames are not unique on Nostr. The nostr address is your unique human-readable address that is unique to you upon registration.",
"5ykRmX": "Send zap", "5ykRmX": "Send zap",
"6/SF6e": "<h1>{n}</h1> Cashu sats",
"6/hB3S": "Watch Replay",
"65BmHb": "Failed to proxy image from {host}, click here to load directly", "65BmHb": "Failed to proxy image from {host}, click here to load directly",
"6OSOXl": "Reason: <i>{reason}</i>", "6OSOXl": "Reason: <i>{reason}</i>",
"6Yfvvp": "Get an identifier", "6Yfvvp": "Get an identifier",
@ -118,6 +120,7 @@
"DZzCem": "Show latest {n} notes", "DZzCem": "Show latest {n} notes",
"DcL8P+": "Supporter", "DcL8P+": "Supporter",
"Dh3hbq": "Auto Zap", "Dh3hbq": "Auto Zap",
"Dn82AL": "Live",
"DtYelJ": "Transfer", "DtYelJ": "Transfer",
"E8a4yq": "Follow some popular accounts", "E8a4yq": "Follow some popular accounts",
"ELbg9p": "Data Providers", "ELbg9p": "Data Providers",
@ -142,6 +145,7 @@
"G1BGCg": "Select Wallet", "G1BGCg": "Select Wallet",
"GFOoEE": "Salt", "GFOoEE": "Salt",
"GL8aXW": "Bookmarks ({n})", "GL8aXW": "Bookmarks ({n})",
"GQPtfk": "Join Stream",
"GSye7T": "Lightning Address", "GSye7T": "Lightning Address",
"GUlSVG": "Claim your included Snort nostr address", "GUlSVG": "Claim your included Snort nostr address",
"Gcn9NQ": "Magnet Link", "Gcn9NQ": "Magnet Link",
@ -150,7 +154,6 @@
"H0JBH6": "Log Out", "H0JBH6": "Log Out",
"H6/kLh": "Order Paid!", "H6/kLh": "Order Paid!",
"HAlOn1": "Name", "HAlOn1": "Name",
"HF4YnO": "Watch Live!",
"HFls6j": "name will be available later", "HFls6j": "name will be available later",
"HOzFdo": "Muted", "HOzFdo": "Muted",
"HWbkEK": "Clear cache and reload", "HWbkEK": "Clear cache and reload",
@ -237,18 +240,16 @@
"SMO+on": "Send zap to {name}", "SMO+on": "Send zap to {name}",
"SOqbe9": "Update Lightning Address", "SOqbe9": "Update Lightning Address",
"SP0+yi": "Buy Subscription", "SP0+yi": "Buy Subscription",
"SX58hM": "Copy",
"SYQtZ7": "LN Address Proxy", "SYQtZ7": "LN Address Proxy",
"ShdEie": "Mark all read", "ShdEie": "Mark all read",
"Sjo1P4": "Custom", "Sjo1P4": "Custom",
"Ss0sWu": "Pay Now", "Ss0sWu": "Pay Now",
"StKzTE": "The author has marked this note as a <i>sensitive topic</i>", "StKzTE": "The author has marked this note as a <i>sensitive topic</i>",
"TDR5ge": "Media in notes will automatically be shown for selected people, otherwise only the link will show", "TDR5ge": "Media in notes will automatically be shown for selected people, otherwise only the link will show",
"TMfYfY": "Cashu token", "TP/cMX": "Ended",
"TpgeGw": "Hex Salt..", "TpgeGw": "Hex Salt..",
"Tpy00S": "People", "Tpy00S": "People",
"UDYlxu": "Pending Subscriptions", "UDYlxu": "Pending Subscriptions",
"ULotH9": "Amount: {amount} sats",
"UT7Nkj": "New Chat", "UT7Nkj": "New Chat",
"UUPFlt": "Users must accept the content warning to show the content of your note.", "UUPFlt": "Users must accept the content warning to show the content of your note.",
"Up5U7K": "Block", "Up5U7K": "Block",
@ -343,7 +344,6 @@
"iEoXYx": "DeepL translations", "iEoXYx": "DeepL translations",
"iGT1eE": "Prevent fake accounts from imitating you", "iGT1eE": "Prevent fake accounts from imitating you",
"iNWbVV": "Handle", "iNWbVV": "Handle",
"iUsU2x": "Mint: {url}",
"iXPL0Z": "Can't login with private key on an insecure connection, please use a Nostr key manager extension instead", "iXPL0Z": "Can't login with private key on an insecure connection, please use a Nostr key manager extension instead",
"ieGrWo": "Follow", "ieGrWo": "Follow",
"itPgxd": "Profile", "itPgxd": "Profile",
@ -466,5 +466,6 @@
"zcaOTs": "Zap amount in sats", "zcaOTs": "Zap amount in sats",
"zjJZBd": "You're ready!", "zjJZBd": "You're ready!",
"zonsdq": "Failed to load LNURL service", "zonsdq": "Failed to load LNURL service",
"zvCDao": "Automatically show latest notes" "zvCDao": "Automatically show latest notes",
"zwb6LR": "<b>Mint:</b> {url}"
} }