Skip to content

Commit

Permalink
refactor(web): code formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rocka committed Nov 2, 2024
1 parent 595faf6 commit bb37be5
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 39 deletions.
4 changes: 2 additions & 2 deletions web/liveman/components/dialog-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const StreamTokenDialog = forwardRef<IStreamTokenDialog>((_, ref) => {
</div>
<div className="form-control mt-4">
<label className="label px-0 pb-0">Permissions:</label>
{AllPermissions.map(p => (
{AllPermissions.map(p =>
<label class="label justify-start gap-2">
<Checkbox
size="sm"
Expand All @@ -92,7 +92,7 @@ export const StreamTokenDialog = forwardRef<IStreamTokenDialog>((_, ref) => {
/>
<span>{p}</span>
</label>
))}
)}
</div>
</Modal.Body>
<Modal.Actions>
Expand Down
4 changes: 2 additions & 2 deletions web/liveman/components/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ export function Login({ show, onSuccess }: LoginProps) {
</Modal.Header>
{/* @ts-expect-error -- size */}
<Tabs variant="bordered" size="lg" className="my-4">
{AuthTypes.map(t => (
{AuthTypes.map(t =>
<Tabs.Tab className="text-base" active={t === authType} onClick={() => setAuthType(t)}>{t}</Tabs.Tab>
))}
)}
</Tabs>
{typeof errMsg === 'string' ? <Alert status="error" >{errMsg}</Alert> : null}
<form onSubmit={handleLogin}>
Expand Down
10 changes: 5 additions & 5 deletions web/liveman/components/nodes-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function NodesTable() {
size="sm"
color="ghost"
endIcon={<ArrowPathIcon className="size-4 stroke-current" />}
onClick={() => nodes.updateData()}
onClick={nodes.updateData}
>Refresh</Button>
</div>

Expand All @@ -40,15 +40,15 @@ export function NodesTable() {
<span>API URL</span>
</Table.Head>
<Table.Body>
{nodes.data.map(n => (
{nodes.data.map(n =>
<Table.Row>
<span>{n.alias}</span>
<span>{n.status}</span>
<span>{n.duration}</span>
<NodeStrategyLabel strategy={n.strategy} />
<Link href={n.url} target="_blank">{n.url}</Link>
</Table.Row>
))}
)}
</Table.Body>
</Table>
</>
Expand All @@ -66,9 +66,9 @@ function NodeStrategyLabel({ strategy }: NodeStrategyLabelProps) {
<Tooltip
position="bottom"
className="before:font-mono before:text-start before:whitespace-pre before:whitespace-break-spaces"
message={entries.map(([k, v]) => `${k} = ${v}`).join('\n')}
message={entries.map(kv => kv.join(' = ')).join('\n')}
>
<div className="font-mono flex gap-1 items-center">
<div className="font-mono flex items-center gap-1">
<InformationCircleIcon className="size-4" />
<span>{entries[0].join(' = ')}...</span>
</div>
Expand Down
24 changes: 10 additions & 14 deletions web/shared/components/dialog-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,16 @@ export const PreviewDialog = forwardRef<IPreviewDialog, Props>((props, ref) => {
</Modal.Body>
<Modal.Actions className="mt-0">
<div className="mr-auto">
{
typeof latency === 'string' ? (
<Button
color="ghost"
className="font-normal"
animation={false}
startIcon={<ClockIcon className="size-5 stroke-current" />}
>
Latency: {latency}
</Button>
) : (
<Button color="info" onClick={handleDecodeLatency}>Decode Latency</Button>
)
}
{typeof latency === 'string' ? (
<Button
color="ghost"
className="font-normal"
animation={false}
startIcon={<ClockIcon className="size-5 stroke-current" />}
>Latency: {latency}</Button>
) : (
<Button color="info" onClick={handleDecodeLatency}>Decode Latency</Button>
)}
</div>
<Button color="error" onClick={handlePreviewStop}>Stop</Button>
<Button onClick={handleCloseDialog}>Hide</Button>
Expand Down
17 changes: 8 additions & 9 deletions web/shared/components/dialog-web-stream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,14 @@ export const WebStreamDialog = forwardRef<IWebStreamDialog, Props>((props, ref)
</Collapse.Details>
</Modal.Body>
<Modal.Actions className="mt-0">
{refWhipClient.current
? <Button color="error" onClick={handleStreamStop}>Stop</Button>
: (
<>
<Button color="info" onClick={handleEncodeLatencyStart}>Encode Latency</Button>
<Button onClick={handleDisplayMediaStart}>Start</Button>
</>
)
}
{refWhipClient.current ? (
<Button color="error" onClick={handleStreamStop}>Stop</Button>
) : (
<>
<Button color="info" onClick={handleEncodeLatencyStart}>Encode Latency</Button>
<Button onClick={handleDisplayMediaStart}>Start</Button>
</>
)}
<Button onClick={handleCloseDialog}>Hide</Button>
</Modal.Actions>
<canvas ref={refCanvas} class="hidden" width={1280} height={720}></canvas>
Expand Down
5 changes: 1 addition & 4 deletions web/shared/components/page-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { ITokenContext, TokenContext } from '../context';

export type PageLayoutProps = ITokenContext & PropsWithChildren;

export function PageLayout({
token,
children
}: PageLayoutProps) {
export function PageLayout({ token, children }: PageLayoutProps) {
return (
<TokenContext.Provider value={{ token }}>
<PageHeader />
Expand Down
6 changes: 3 additions & 3 deletions web/shared/components/streams-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export function StreamsTable(props: StreamTableProps) {
size="sm"
color="ghost"
endIcon={<ArrowPathIcon className="size-4 stroke-current" />}
onClick={() => streams.updateData()}
onClick={streams.updateData}
>Refresh</Button>
</div>

Expand Down Expand Up @@ -214,7 +214,7 @@ export function StreamsTable(props: StreamTableProps) {
refPreviewStreams.current.delete(s);
}
}}
onStop={() => { handlePreviewStop(s); }}
onStop={() => handlePreviewStop(s)}
/>
)}

Expand All @@ -230,7 +230,7 @@ export function StreamsTable(props: StreamTableProps) {
refWebStreams.current.delete(s);
}
}}
onStop={() => { handleWebStreamStop(s); }}
onStop={() => handleWebStreamStop(s)}
/>
)}
</>
Expand Down

0 comments on commit bb37be5

Please sign in to comment.