From dd4c2bae2b7a00585d077f5c7bf2742a218a2020 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 7 Dec 2023 22:50:55 +0000 Subject: [PATCH] chore: formatting --- src/element/nostr-provider-dialog.tsx | 138 +++++++++++++++----------- src/lang.json | 6 ++ src/translations/en.json | 2 + 3 files changed, 89 insertions(+), 57 deletions(-) diff --git a/src/element/nostr-provider-dialog.tsx b/src/element/nostr-provider-dialog.tsx index afc9924..34f11bc 100644 --- a/src/element/nostr-provider-dialog.tsx +++ b/src/element/nostr-provider-dialog.tsx @@ -15,7 +15,12 @@ export function NostrProviderDialog({ showEditor, showForwards, ...others -}: { provider: NostrStreamProvider; showEndpoints: boolean; showEditor: boolean, showForwards: boolean } & StreamEditorProps) { +}: { + provider: NostrStreamProvider; + showEndpoints: boolean; + showEditor: boolean; + showForwards: boolean; +} & StreamEditorProps) { const system = useContext(SnortContext); const [topup, setTopup] = useState(false); const [info, setInfo] = useState(); @@ -134,7 +139,9 @@ export function NostrProviderDialog({

{sortEndpoints(info.endpoints).map(a => ( - setEndpoint(a)}> + setEndpoint(a)}> {a.name} ))} @@ -202,51 +209,59 @@ export function NostrProviderDialog({ return tosInput(); } - return { - provider.updateStreamInfo(system, ex); - others.onFinish?.(ex); - }} - ev={ - { - tags: [ - ["title", info.streamInfo?.title ?? ""], - ["summary", info.streamInfo?.summary ?? ""], - ["image", info.streamInfo?.image ?? ""], - ...(info.streamInfo?.goal ? [["goal", info.streamInfo.goal]] : []), - ...(info.streamInfo?.content_warning ? [["content-warning", info.streamInfo?.content_warning]] : []), - ...(info.streamInfo?.tags?.map(a => ["t", a]) ?? []), - ], - } as NostrEvent - } - options={{ - canSetStream: false, - canSetStatus: false, - }} - />; + return ( + { + provider.updateStreamInfo(system, ex); + others.onFinish?.(ex); + }} + ev={ + { + tags: [ + ["title", info.streamInfo?.title ?? ""], + ["summary", info.streamInfo?.summary ?? ""], + ["image", info.streamInfo?.image ?? ""], + ...(info.streamInfo?.goal ? [["goal", info.streamInfo.goal]] : []), + ...(info.streamInfo?.content_warning ? [["content-warning", info.streamInfo?.content_warning]] : []), + ...(info.streamInfo?.tags?.map(a => ["t", a]) ?? []), + ], + } as NostrEvent + } + options={{ + canSetStream: false, + canSetStatus: false, + }} + /> + ); } function forwardInputs() { if (!info || !showForwards) return; - return
-

- -

+ return ( +
+

+ +

-
- {info.forwards?.map(a => <> -
{a.name}
- { - await provider.removeForward(a.id); - }}> - - -
- )} - { }} /> +
+ {info.forwards?.map(a => ( + <> +
{a.name}
+ { + await provider.removeForward(a.id); + }}> + + +
+ + ))} + {}} /> +
-
+ ); } return ( @@ -258,7 +273,13 @@ export function NostrProviderDialog({ ); } -function AddForwardInputs({ provider, onAdd }: { provider: NostrStreamProvider, onAdd: (name: string, target: string) => void }) { +function AddForwardInputs({ + provider, + onAdd, +}: { + provider: NostrStreamProvider; + onAdd: (name: string, target: string) => void; +}) { const [name, setName] = useState(""); const [target, setTarget] = useState(""); const { formatMessage } = useIntl(); @@ -270,19 +291,22 @@ function AddForwardInputs({ provider, onAdd }: { provider: NostrStreamProvider, onAdd(name, target); } - return <> -
- setName(e.target.value)} /> -
-
- setTarget(e.target.value)} /> -
- - - - -} \ No newline at end of file + return ( + <> +
+ setName(e.target.value)} + /> +
+
+ setTarget(e.target.value)} /> +
+ + + + + ); +} diff --git a/src/lang.json b/src/lang.json index d885f9e..aaf9aa7 100644 --- a/src/lang.json +++ b/src/lang.json @@ -239,6 +239,9 @@ "Qe1MJu": { "defaultMessage": "{name} with {amount}" }, + "QuXHCg": { + "defaultMessage": "Human readable name" + }, "RJ2VxG": { "defaultMessage": "A new version has been detected" }, @@ -275,6 +278,9 @@ "VA/Z1S": { "defaultMessage": "Hide" }, + "W7DNWx": { + "defaultMessage": "Stream Forwarding" + }, "W9355R": { "defaultMessage": "Unmute" }, diff --git a/src/translations/en.json b/src/translations/en.json index a7e1035..29d8a5c 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -79,6 +79,7 @@ "QRRCp0": "Stream URL", "QceMQZ": "Goal: {amount}", "Qe1MJu": "{name} with {amount}", + "QuXHCg": "Human readable name", "RJ2VxG": "A new version has been detected", "RJOmzk": "I have read and agree with {provider}''s {terms}.", "RS6smY": "Raid Message", @@ -91,6 +92,7 @@ "UJBFYK": "Add Card", "UfSot5": "Past Streams", "VA/Z1S": "Hide", + "W7DNWx": "Stream Forwarding", "W9355R": "Unmute", "X2PZ7D": "Create Goal", "XgWvGA": "Reactions",