Skip to content

Commit 093ec3d

Browse files
authored
fix: improve checkbox text in template schedule settings dialog (coder#13669)
* fix: improve checkbox text in template schedule settings dialog * fix: format * fix: remove (s) plural language * fix: fix format
1 parent 5a0afd8 commit 093ec3d

File tree

2 files changed

+72
-28
lines changed

2 files changed

+72
-28
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { action } from "@storybook/addon-actions";
2+
import type { Meta, StoryObj } from "@storybook/react";
3+
import { ScheduleDialog } from "./ScheduleDialog";
4+
5+
const meta: Meta<typeof ScheduleDialog> = {
6+
title: "pages/TemplateSettingsPage/ScheduleDialog",
7+
component: ScheduleDialog,
8+
args: {
9+
onConfirm: action("onConfirm"),
10+
onClose: action("onClose"),
11+
open: true,
12+
title: "Workspace Scheduling",
13+
},
14+
};
15+
16+
export default meta;
17+
type Story = StoryObj<typeof ScheduleDialog>;
18+
19+
export const DormancyThreshold: Story = {
20+
args: {
21+
dormantValueChanged: true,
22+
inactiveWorkspacesToGoDormant: 1,
23+
inactiveWorkspacesToGoDormantInWeek: 5,
24+
},
25+
};
26+
27+
export const DormancyDeletion: Story = {
28+
args: {
29+
deletionValueChanged: true,
30+
dormantWorkspacesToBeDeleted: 1,
31+
dormantWorkspacesToBeDeletedInWeek: 5,
32+
},
33+
};

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

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Interpolation, Theme } from "@emotion/react";
22
import Checkbox from "@mui/material/Checkbox";
33
import DialogActions from "@mui/material/DialogActions";
44
import FormControlLabel from "@mui/material/FormControlLabel";
5-
import { Stack } from "@mui/system";
65
import type { FC } from "react";
76
import type { ConfirmDialogProps } from "components/Dialogs/ConfirmDialog/ConfirmDialog";
87
import { Dialog, DialogActionButtons } from "components/Dialogs/Dialog";
@@ -68,11 +67,18 @@ export const ScheduleDialog: FC<ScheduleDialogProps> = ({
6867
<>
6968
<h4>Dormancy Threshold</h4>
7069
<p css={styles.dialogDescription}>
71-
This change will result in {inactiveWorkspacesToGoDormant}{" "}
72-
workspaces being immediately transitioned to the dormant state
73-
and {inactiveWorkspacesToGoDormantInWeek} over the next seven
74-
days. To prevent this, do you want to reset the inactivity
75-
period for all template workspaces?
70+
This change will result in{" "}
71+
<strong>{inactiveWorkspacesToGoDormant}</strong>{" "}
72+
{inactiveWorkspacesToGoDormant === 1
73+
? "workspace"
74+
: "workspaces"}{" "}
75+
being immediately transitioned to the dormant state and{" "}
76+
<strong>{inactiveWorkspacesToGoDormantInWeek}</strong>{" "}
77+
{inactiveWorkspacesToGoDormantInWeek === 1
78+
? "workspace"
79+
: "workspaces"}{" "}
80+
over the next 7 days. To prevent this, do you want to reset the
81+
inactivity period for all template workspaces?
7682
</p>
7783
<FormControlLabel
7884
css={{ marginTop: 16 }}
@@ -84,35 +90,40 @@ export const ScheduleDialog: FC<ScheduleDialogProps> = ({
8490
}}
8591
/>
8692
}
87-
label="Reset"
93+
label="Prevent Dormancy - Reset all workspace inactivity periods"
8894
/>
8995
</>
9096
)}
9197

9298
{showDeletionWarning && (
9399
<>
94100
<h4>Dormancy Auto-Deletion</h4>
95-
<Stack direction="row" spacing={5}>
96-
<p css={styles.dialogDescription}>
97-
This change will result in {dormantWorkspacesToBeDeleted}{" "}
98-
workspaces being immediately deleted and{" "}
99-
{dormantWorkspacesToBeDeletedInWeek} over the next 7 days. To
100-
prevent this, do you want to reset the dormancy period for all
101-
template workspaces?
102-
</p>
103-
<FormControlLabel
104-
css={{ marginTop: 16 }}
105-
control={
106-
<Checkbox
107-
size="small"
108-
onChange={(e) => {
109-
updateDormantWorkspaces(e.target.checked);
110-
}}
111-
/>
112-
}
113-
label="Reset"
114-
/>
115-
</Stack>
101+
<p css={styles.dialogDescription}>
102+
This change will result in{" "}
103+
<strong>{dormantWorkspacesToBeDeleted}</strong>{" "}
104+
{dormantWorkspacesToBeDeleted === 1
105+
? "workspace"
106+
: "workspaces"}{" "}
107+
being immediately deleted and{" "}
108+
<strong>{dormantWorkspacesToBeDeletedInWeek}</strong>{" "}
109+
{dormantWorkspacesToBeDeletedInWeek === 1
110+
? "workspace"
111+
: "workspaces"}{" "}
112+
over the next 7 days. To prevent this, do you want to reset the
113+
dormancy period for all template workspaces?
114+
</p>
115+
<FormControlLabel
116+
css={{ marginTop: 16 }}
117+
control={
118+
<Checkbox
119+
size="small"
120+
onChange={(e) => {
121+
updateDormantWorkspaces(e.target.checked);
122+
}}
123+
/>
124+
}
125+
label="Prevent Deletion - Reset all workspace dormancy periods"
126+
/>
116127
</>
117128
)}
118129
</>

0 commit comments

Comments
 (0)