chore: Run prettier
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kieran 2023-08-01 17:09:47 +01:00
parent 90a7d2ca7e
commit 48c48c90c4
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
8 changed files with 78 additions and 48 deletions

View File

@ -53,4 +53,4 @@
.new-stream .tos-link:hover { .new-stream .tos-link:hover {
text-decoration: underline; text-decoration: underline;
} }

View File

@ -17,7 +17,11 @@ function NewStream({ ev, onFinish }: StreamEditorProps) {
useEffect(() => { useEffect(() => {
if (!currentProvider) { if (!currentProvider) {
setCurrentProvider(ev !== undefined ? providers.find(a => a.name.toLowerCase() === "manual")! : providers.at(0)); setCurrentProvider(
ev !== undefined
? providers.find((a) => a.name.toLowerCase() === "manual")!
: providers.at(0)
);
} }
}, [providers, currentProvider]); }, [providers, currentProvider]);
@ -32,7 +36,7 @@ function NewStream({ ev, onFinish }: StreamEditorProps) {
currentProvider.updateStreamInfo(ex); currentProvider.updateStreamInfo(ex);
if (!ev) { if (!ev) {
navigate(`/${eventLink(ex)}`, { navigate(`/${eventLink(ex)}`, {
state: ev state: ev,
}); });
} else { } else {
onFinish?.(ev); onFinish?.(ev);

View File

@ -88,26 +88,41 @@ export function NostrProviderDialog({
function tosInput() { function tosInput() {
if (!info) return; if (!info) return;
return <> return (
<div> <>
<div className="flex g12"> <div>
<input type="checkbox" checked={tos} onChange={e => setTos(e.target.checked)} /> <div className="flex g12">
<p> <input
I have read and agree with {info.name}'s <span className="tos-link" onClick={() => window.open(info.tosLink, "popup", "width=400,height=800")}>terms and conditions</span>. type="checkbox"
</p> checked={tos}
onChange={(e) => setTos(e.target.checked)}
/>
<p>
I have read and agree with {info.name}'s{" "}
<span
className="tos-link"
onClick={() =>
window.open(info.tosLink, "popup", "width=400,height=800")
}
>
terms and conditions
</span>
.
</p>
</div>
</div> </div>
</div> <div>
<div> <AsyncButton
<AsyncButton type="button"
type="button" className="btn btn-primary wide"
className="btn btn-primary wide" disabled={!tos}
disabled={!tos} onClick={acceptTos}
onClick={acceptTos} >
> Continue
Continue </AsyncButton>
</AsyncButton> </div>
</div> </>
</> );
} }
return ( return (
@ -167,26 +182,33 @@ export function NostrProviderDialog({
))} ))}
</div> </div>
</div> </div>
{info.tosAccepted === false ? tosInput() : {info.tosAccepted === false ? (
tosInput()
) : (
<StreamEditor <StreamEditor
onFinish={(ex) => { onFinish={(ex) => {
provider.updateStreamInfo(ex); provider.updateStreamInfo(ex);
others.onFinish?.(ex); others.onFinish?.(ex);
}} }}
ev={{ ev={
tags: [ {
["title", info.streamInfo?.title ?? ""], tags: [
["summary", info.streamInfo?.summary ?? ""], ["title", info.streamInfo?.title ?? ""],
["image", info.streamInfo?.image ?? ""], ["summary", info.streamInfo?.summary ?? ""],
...(info.streamInfo?.content_warning ? [["content-warning", info.streamInfo?.content_warning]] : []), ["image", info.streamInfo?.image ?? ""],
...(info.streamInfo?.tags?.map(a => ["t", a]) ?? []) ...(info.streamInfo?.content_warning
] ? [["content-warning", info.streamInfo?.content_warning]]
} as NostrEvent} : []),
...(info.streamInfo?.tags?.map((a) => ["t", a]) ?? []),
],
} as NostrEvent
}
options={{ options={{
canSetStream: false, canSetStream: false,
canSetStatus: false, canSetStatus: false,
}} }}
/>} />
)}
</> </>
); );
} }

View File

@ -61,8 +61,8 @@ const router = createBrowserRouter([
}, },
{ {
path: "*", path: "*",
element: <CatchAllRoutePage /> element: <CatchAllRoutePage />,
} },
], ],
}, },
{ {

View File

@ -1,6 +1,5 @@
export function CatchAllRoutePage() { export function CatchAllRoutePage() {
//const { ["*"]: param } = useParams(); //const { ["*"]: param } = useParams();
return <b className="error">Not found :(</b> return <b className="error">Not found :(</b>;
} }

View File

@ -4,7 +4,12 @@ import { useLocation, useNavigate, useParams } from "react-router-dom";
import { Helmet } from "react-helmet"; import { Helmet } from "react-helmet";
import { LiveVideoPlayer } from "element/live-video-player"; import { LiveVideoPlayer } from "element/live-video-player";
import { createNostrLink, findTag, getEventFromLocationState, getHost } from "utils"; import {
createNostrLink,
findTag,
getEventFromLocationState,
getHost,
} from "utils";
import { Profile, getName } from "element/profile"; import { Profile, getName } from "element/profile";
import { LiveChat } from "element/live-chat"; import { LiveChat } from "element/live-chat";
import AsyncButton from "element/async-button"; import AsyncButton from "element/async-button";

View File

@ -53,7 +53,7 @@ export interface StreamProviderInfo {
balance?: number; balance?: number;
endpoints: Array<StreamProviderEndpoint>; endpoints: Array<StreamProviderEndpoint>;
tosAccepted?: boolean; tosAccepted?: boolean;
tosLink?: string tosLink?: string;
} }
export interface StreamProviderEndpoint { export interface StreamProviderEndpoint {
@ -66,11 +66,11 @@ export interface StreamProviderEndpoint {
} }
export interface StreamProviderStreamInfo { export interface StreamProviderStreamInfo {
title: string title: string;
summary: string summary: string;
image: string image: string;
tags: Array<string> tags: Array<string>;
content_warning: string content_warning: string;
} }
export class ProviderStore extends ExternalStore<Array<StreamProvider>> { export class ProviderStore extends ExternalStore<Array<StreamProvider>> {

View File

@ -51,7 +51,7 @@ export class OwncastProvider implements StreamProvider {
acceptTos(): Promise<void> { acceptTos(): Promise<void> {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
async #getJson<T>( async #getJson<T>(
method: "GET" | "POST", method: "GET" | "POST",
path: string, path: string,