mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-02-20 07:37:26 -05:00
* refactor job manager ui * huge improvements to job ui api * improve indexer errors * minor improvements * make icon bigger + improve styling * Update useJobInfo.tsx better * improve job status reporting * fix job indexer backend for ui responsiveness * attempt at debugging job.getRunning slow invalidation during indexer's walk phase * remove progress debounce, invalidate has its own throttle layer * hotfix ghost jobs * basic pause/resume * pause functionality immaculate * pause resume working for first job in group, testable on indexer phase two * WIP - refactored job manager - added better job api * fix merge issues * add throttle to job update events and correct index * improve front end job data handling * move subscription to job * wip active job indicator * minor tweak * Isolated subscriptions for job events + cleanup Co-authored-by: Brendan Allan <Brendonovich@users.noreply.github.com> Co-authored-by: Oscar Beaumont <oscar@otbeaumont.me> * mutable ctx * plz let me build rspc typesafe errors Jamie * fix merge * working job reporting * fix thumbnail text * faster tick speed * fix error --------- Co-authored-by: Brendan Allan <Brendonovich@users.noreply.github.com> Co-authored-by: Oscar Beaumont <oscar@otbeaumont.me>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { Clipboard } from 'phosphor-react';
|
|
import { Button, Dialog, Input, UseDialogProps, dialogManager, useDialog } from '@sd/ui';
|
|
import { useZodForm } from '@sd/ui/src/forms';
|
|
import { ReactNode } from 'react';
|
|
|
|
interface Props extends UseDialogProps {
|
|
title: string; // dialog title
|
|
description?: string; // description of the dialog
|
|
children?: ReactNode; // dialog content
|
|
value?: string; // value to be displayed as text or in an input box
|
|
label?: string; // button label
|
|
inputBox?: boolean; // whether the dialog should display the `value` in a disabled input box or as text
|
|
}
|
|
|
|
const AlertDialog = (props: Props) => {
|
|
// maybe a copy-to-clipboard button would be beneficial too
|
|
return (
|
|
<Dialog
|
|
title={props.title}
|
|
form={useZodForm()}
|
|
dialog={useDialog(props)}
|
|
ctaLabel={props.label !== undefined ? props.label : 'Done'}
|
|
onCancelled={false}
|
|
>
|
|
{props.description && <div className="mb-3 text-sm">{props.description}</div>}
|
|
{props.children}
|
|
{props.inputBox ? (
|
|
<Input
|
|
value={props.value}
|
|
disabled
|
|
className="mt-3"
|
|
right={
|
|
<Button
|
|
type="button"
|
|
onClick={() => {
|
|
props.value && navigator.clipboard.writeText(props.value);
|
|
}}
|
|
size="icon"
|
|
>
|
|
<Clipboard className="h-4 w-4" />
|
|
</Button>
|
|
}
|
|
/>
|
|
) : (
|
|
<div className="text-sm">{props.value}</div>
|
|
)}
|
|
</Dialog>
|
|
);
|
|
};
|
|
|
|
export function showAlertDialog(props: Omit<Props & { children?: ReactNode }, 'id'>) {
|
|
dialogManager.create((dp) => <AlertDialog {...dp} {...props} />);
|
|
}
|