Skip to content

Commit 23db1ce

Browse files
committed
silly
1 parent c2424b3 commit 23db1ce

File tree

16 files changed

+32
-361
lines changed

16 files changed

+32
-361
lines changed

site/src/components/Callout/Callout.stories.tsx

Lines changed: 0 additions & 71 deletions
This file was deleted.

site/src/components/Callout/Callout.tsx

Lines changed: 0 additions & 37 deletions
This file was deleted.

site/src/components/Dialogs/ConfirmDialog/ConfirmDialog.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const Example: Story = {
2020
args: {
2121
description: "Do you really want to delete me?",
2222
hideCancel: false,
23-
type: "danger",
23+
type: "delete",
2424
},
2525
};
2626

site/src/components/Dialogs/ConfirmDialog/ConfirmDialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const CONFIRM_DIALOG_DEFAULTS: Record<
1717
ConfirmDialogType,
1818
ConfirmDialogTypeConfig
1919
> = {
20-
danger: {
21-
confirmText: "Delete", // TODO: this feels gross given the rename of delete -> danger
20+
delete: {
21+
confirmText: "Delete",
2222
hideCancel: false,
2323
},
2424
info: {

site/src/components/Dialogs/DeleteDialog/DeleteDialog.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
import {
2-
type FC,
3-
type FormEvent,
4-
type PropsWithChildren,
5-
useId,
6-
useState,
7-
} from "react";
81
import TextField from "@mui/material/TextField";
2+
import { type Interpolation, type Theme } from "@emotion/react";
3+
import { type FC, type FormEvent, useId, useState } from "react";
94
import { ConfirmDialog } from "../ConfirmDialog/ConfirmDialog";
10-
import { Callout } from "../../Callout/Callout";
115

126
export interface DeleteDialogProps {
137
isOpen: boolean;
@@ -23,7 +17,7 @@ export interface DeleteDialogProps {
2317
confirmText?: string;
2418
}
2519

26-
export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
20+
export const DeleteDialog: FC<DeleteDialogProps> = ({
2721
isOpen,
2822
onCancel,
2923
onConfirm,
@@ -56,7 +50,7 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
5650

5751
return (
5852
<ConfirmDialog
59-
type="danger"
53+
type="delete"
6054
hideCancel={false}
6155
open={isOpen}
6256
title={title ?? `Delete ${entity}`}
@@ -71,7 +65,7 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
7165
{verb ?? "Deleting"} this {entity} is irreversible!
7266
</p>
7367

74-
{Boolean(info) && <Callout type="danger">{info}</Callout>}
68+
{Boolean(info) && <div css={styles.callout}>{info}</div>}
7569

7670
<p>Are you sure you want to proceed?</p>
7771

@@ -110,3 +104,13 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
110104
/>
111105
);
112106
};
107+
108+
const styles = {
109+
callout: (theme) => ({
110+
backgroundColor: theme.experimental.roles.danger.background,
111+
border: `1px solid ${theme.experimental.roles.danger.outline}`,
112+
borderRadius: theme.shape.borderRadius,
113+
color: theme.experimental.roles.danger.text,
114+
padding: "8px 16px",
115+
}),
116+
} satisfies Record<string, Interpolation<Theme>>;

site/src/components/Dialogs/Dialog.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import MuiDialog, { DialogProps as MuiDialogProps } from "@mui/material/Dialog";
2-
import { type FC, type ReactNode } from "react";
3-
import { ConfirmDialogType } from "./types";
4-
import { type Interpolation, type Theme } from "@emotion/react";
52
import LoadingButton, { LoadingButtonProps } from "@mui/lab/LoadingButton";
63
import { type Interpolation, type Theme } from "@emotion/react";
74
import { type FC, type ReactNode } from "react";
@@ -24,7 +21,7 @@ export interface DialogActionButtonsProps {
2421
}
2522

2623
const typeToColor = (type: ConfirmDialogType): LoadingButtonProps["color"] => {
27-
if (type === "danger") {
24+
if (type === "delete") {
2825
return "secondary";
2926
}
3027
return "primary";
@@ -61,7 +58,7 @@ export const DialogActionButtons: FC<DialogActionButtonsProps> = ({
6158
disabled={disabled}
6259
type="submit"
6360
css={[
64-
type === "danger" && styles.dangerButton,
61+
type === "delete" && styles.dangerButton,
6562
type === "success" && styles.successButton,
6663
]}
6764
>

site/src/components/Dialogs/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type ConfirmDialogType = "danger" | "info" | "success";
1+
export type ConfirmDialogType = "delete" | "info" | "success";

site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type CSSObject, type Interpolation, type Theme } from "@emotion/react";
22
import Button from "@mui/material/Button";
33
import Paper from "@mui/material/Paper";
44
import dayjs from "dayjs";
5-
import { useState } from "react";
5+
import { type FC, useState } from "react";
66
import { compareAsc } from "date-fns";
77
import { type GetLicensesResponse } from "api/api";
88
import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog";
@@ -17,13 +17,13 @@ type LicenseCardProps = {
1717
isRemoving: boolean;
1818
};
1919

20-
export const LicenseCard = ({
20+
export const LicenseCard: FC<LicenseCardProps> = ({
2121
license,
2222
userLimitActual,
2323
userLimitLimit,
2424
onRemove,
2525
isRemoving,
26-
}: LicenseCardProps) => {
26+
}) => {
2727
const [licenseIDMarkedForRemoval, setLicenseIDMarkedForRemoval] = useState<
2828
number | undefined
2929
>(undefined);
@@ -34,7 +34,7 @@ export const LicenseCard = ({
3434
return (
3535
<Paper key={license.id} elevation={2} css={styles.licenseCard}>
3636
<ConfirmDialog
37-
type="danger"
37+
type="delete"
3838
hideCancel={false}
3939
open={licenseIDMarkedForRemoval !== undefined}
4040
onConfirm={() => {

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/ScheduleDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const ScheduleDialog: FC<PropsWithChildren<ScheduleDialogProps>> = ({
126126
disabled={disabled}
127127
onCancel={!hideCancel ? onClose : undefined}
128128
onConfirm={onConfirm || onClose}
129-
type="danger"
129+
type="delete"
130130
/>
131131
</DialogActions>
132132
</Dialog>

site/src/pages/TemplateVersionEditorPage/FileDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const DeleteFileDialog: FC<DeleteFileDialogProps> = ({
109109
}) => {
110110
return (
111111
<ConfirmDialog
112-
type="danger"
112+
type="delete"
113113
onClose={onClose}
114114
open={open}
115115
onConfirm={onConfirm}

site/src/pages/UserSettingsPage/SSHKeysPage/SSHKeysPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const SSHKeysPage: FC = () => {
4040
</Section>
4141

4242
<ConfirmDialog
43-
type="danger"
43+
type="delete"
4444
hideCancel={false}
4545
open={isConfirmingRegeneration}
4646
confirmLoading={regenerateSSHKeyMutation.isLoading}

site/src/pages/UserSettingsPage/TokensPage/ConfirmDeleteDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const ConfirmDeleteDialog: FC<ConfirmDeleteDialogProps> = ({
3434

3535
return (
3636
<ConfirmDialog
37-
type="danger"
37+
type="delete"
3838
title="Delete Token"
3939
description={
4040
<>

site/src/pages/UsersPage/UsersPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export const UsersPage: FC<PropsWithChildren> = () => {
177177
/>
178178

179179
<ConfirmDialog
180-
type="danger"
180+
type="delete"
181181
hideCancel={false}
182182
open={userToSuspend !== undefined}
183183
confirmLoading={suspendUserMutation.isLoading}

site/src/pages/WorkspacePage/WorkspaceDeleteDialog/WorkspaceDeleteDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const WorkspaceDeleteDialog: FC<WorkspaceDeleteDialogProps> = ({
4444

4545
return (
4646
<ConfirmDialog
47-
type="danger"
47+
type="delete"
4848
hideCancel={false}
4949
open={isOpen}
5050
title="Delete Workspace"

site/src/pages/WorkspacesPage/BatchActions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export const BatchDeleteConfirmation: FC<BatchDeleteConfirmationProps> = ({
136136

137137
return (
138138
<ConfirmDialog
139-
type="danger"
139+
type="delete"
140140
open={open}
141141
onClose={() => {
142142
setStage("consequences");

0 commit comments

Comments
 (0)