UpdateDialog on InstallScreen

This commit is contained in:
Fedor Indutny 2023-03-20 13:42:00 -07:00 committed by GitHub
parent 28adb58c69
commit 1d1b124a92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 443 additions and 26 deletions

View file

@ -13,11 +13,19 @@ import { useAnimated } from '../hooks/useAnimated';
import { Spinner } from './Spinner';
export type ActionSpec = {
text: string;
action: () => unknown;
style?: 'affirmative' | 'negative';
autoClose?: boolean;
};
} & (
| {
text: string;
id?: string;
}
| {
text: string | JSX.Element;
id: string;
}
);
export type OwnProps = Readonly<{
actions?: Array<ActionSpec>;
@ -117,7 +125,11 @@ export const ConfirmationDialog = React.memo(function ConfirmationDialogInner({
) : null}
{actions.map((action, i) => (
<Button
key={action.text}
key={
typeof action.text === 'string'
? action.id ?? action.text
: action.id
}
disabled={isSpinning}
onClick={() => {
action.action();