Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: use emotion for styling (pt. 4)#10149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 25 commits intomainfromemotional-damage-4
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
25 commits
Select commitHold shift + click to select a range
95e9688
emotion: `TemplateScheduleForm`
aslilacOct 9, 2023
b0cdf3f
emotion: `Form` & `FormFooter`
aslilacOct 9, 2023
a7343f0
emotion: `LastUsed`
aslilacOct 9, 2023
4407eda
emotion: `OptionsTable`
aslilacOct 9, 2023
c824abc
emotion: `Dialog`
aslilacOct 9, 2023
ae5c50d
emotion: `Expander`
aslilacOct 9, 2023
8f28843
emotion: `Margins`
aslilacOct 9, 2023
f2d257c
emotion: `WorkspaceOutdatedTooltip`
aslilacOct 9, 2023
65cf2a5
emotion: `ExternalAuth`
aslilacOct 9, 2023
3bab8b2
emotion: `CreateTokenForm`
aslilacOct 9, 2023
4e48356
emotion: `AgentVersion`
aslilacOct 9, 2023
d597c7b
emotion: `Typography`
aslilacOct 9, 2023
e48ec94
emotion: `UserOrGroupAutocomplete`
aslilacOct 9, 2023
4d96e15
emotion: `SetupPageView`
aslilacOct 9, 2023
2d7fd61
emotion: `TemplateSchedulePageView`
aslilacOct 9, 2023
2373c01
emotion: `TemplateSettingsPageView`
aslilacOct 9, 2023
be3657f
emotion: `TemplateSchedulePageView`
aslilacOct 9, 2023
da73bc8
🧹
aslilacOct 9, 2023
9ce12e8
emotion: `ChangeVersionDialog`
aslilacOct 9, 2023
d621d05
emotion: `TemplatePermissionsPageView`
aslilacOct 9, 2023
6b3d6e0
🧹
aslilacOct 9, 2023
81ed84a
emotion: `FullScreenLoader`
aslilacOct 9, 2023
a672222
🧹
aslilacOct 10, 2023
11b9307
Merge branch 'main' into emotional-damage-4
aslilacOct 10, 2023
050a336
Merge branch 'main' into emotional-damage-4
aslilacOct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletionssite/src/components/DeploySettingsLayout/OptionsTable.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
import { makeStyles } from "@mui/styles";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
import TableCell from "@mui/material/TableCell";
import TableContainer from "@mui/material/TableContainer";
import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
import { type FC } from "react";
import Box from "@mui/material/Box";
import { css } from "@emotion/react";
import type { ClibaseOption } from "api/typesGenerated";
import {
OptionConfig,
OptionConfigFlag,
OptionDescription,
OptionName,
OptionValue,
} from "components/DeploySettingsLayout/Option";
import { FC } from "react";
import { optionValue } from "./optionValue";
import Box from "@mui/material/Box";
import { ClibaseOption } from "api/typesGenerated";

const OptionsTable: FC<{
options: ClibaseOption[];
}> = ({ options }) => {
const styles = useStyles();

if (options.length === 0) {
return <p>No options to configure</p>;
}

return (
<TableContainer>
<Table className={styles.table}>
<Table
css={(theme) => css`
& td {
padding-top: ${theme.spacing(3)};
padding-bottom: ${theme.spacing(3)};
}

& td:last-child,
& th:last-child {
padding-left: ${theme.spacing(4)};
}
`}
>
<TableHead>
<TableRow>
<TableCell width="50%">Option</TableCell>
Expand DownExpand Up@@ -96,17 +106,4 @@ const OptionsTable: FC<{
);
};

const useStyles = makeStyles((theme) => ({
table: {
"& td": {
paddingTop: theme.spacing(3),
paddingBottom: theme.spacing(3),
},

"& td:last-child, & th:last-child": {
paddingLeft: theme.spacing(4),
},
},
}));

export default OptionsTable;
207 changes: 17 additions & 190 deletionssite/src/components/Dialogs/ConfirmDialog/ConfirmDialog.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
import DialogActions from "@mui/material/DialogActions";
import {makeStyles} from "@mui/styles";
import {ReactNode, FC, PropsWithChildren } from "react";
import {type Interpolation, type Theme} from "@emotion/react";
import {type FC,typePropsWithChildren, type ReactNode } from "react";
import {
Dialog,
DialogActionButtons,
DialogActionButtonsProps,
} from "../Dialog";
import { ConfirmDialogType } from "../types";
import Checkbox from "@mui/material/Checkbox";
import FormControlLabel from "@mui/material/FormControlLabel";
import { Stack } from "@mui/system";
import type { ConfirmDialogType } from "../types";

interface ConfirmDialogTypeConfig {
confirmText: ReactNode;
Expand DownExpand Up@@ -58,8 +55,8 @@ export interface ConfirmDialogProps
readonly title: string;
}

constuseStyles =makeStyles((theme) => ({
dialogWrapper: {
conststyles = {
dialogWrapper:(theme) => ({
"& .MuiPaper-root": {
background: theme.palette.background.paper,
border: `1px solid ${theme.palette.divider}`,
Expand All@@ -69,19 +66,19 @@ const useStyles = makeStyles((theme) => ({
"& .MuiDialogActions-spacing": {
padding: `0 ${theme.spacing(5)} ${theme.spacing(5)}`,
},
},
dialogContent: {
}),
dialogContent:(theme) => ({
color: theme.palette.text.secondary,
padding: theme.spacing(5),
},
dialogTitle: {
}),
dialogTitle:(theme) => ({
margin: 0,
marginBottom: theme.spacing(2),
color: theme.palette.text.primary,
fontWeight: 400,
fontSize: theme.spacing(2.5),
},
dialogDescription: {
}),
dialogDescription:(theme) => ({
color: theme.palette.text.secondary,
lineHeight: "160%",
fontSize: 16,
Expand All@@ -97,8 +94,8 @@ const useStyles = makeStyles((theme) => ({
"& > p": {
margin: theme.spacing(1, 0),
},
},
}));
}),
} satisfies Record<string, Interpolation<Theme>>;

/**
* Quick-use version of the Dialog component with slightly alternative styles,
Expand All@@ -117,8 +114,6 @@ export const ConfirmDialog: FC<PropsWithChildren<ConfirmDialogProps>> = ({
title,
type = "info",
}) => {
const styles = useStyles({ type });

const defaults = CONFIRM_DIALOG_DEFAULTS[type];

if (typeof hideCancel === "undefined") {
Expand All@@ -127,16 +122,14 @@ export const ConfirmDialog: FC<PropsWithChildren<ConfirmDialogProps>> = ({

return (
<Dialog
className={styles.dialogWrapper}
css={styles.dialogWrapper}
onClose={onClose}
open={open}
data-testid="dialog"
>
<div className={styles.dialogContent}>
<h3 className={styles.dialogTitle}>{title}</h3>
{description && (
<div className={styles.dialogDescription}>{description}</div>
)}
<div css={styles.dialogContent}>
<h3 css={styles.dialogTitle}>{title}</h3>
{description && <div css={styles.dialogDescription}>{description}</div>}
</div>

<DialogActions>
Expand All@@ -154,169 +147,3 @@ export const ConfirmDialog: FC<PropsWithChildren<ConfirmDialogProps>> = ({
</Dialog>
);
};

export interface ScheduleDialogProps extends ConfirmDialogProps {
readonly inactiveWorkspacesToGoDormant: number;
readonly inactiveWorkspacesToGoDormantInWeek: number;
readonly dormantWorkspacesToBeDeleted: number;
readonly dormantWorkspacesToBeDeletedInWeek: number;
readonly updateDormantWorkspaces: (confirm: boolean) => void;
readonly updateInactiveWorkspaces: (confirm: boolean) => void;
readonly dormantValueChanged: boolean;
readonly deletionValueChanged: boolean;
}

export const ScheduleDialog: FC<PropsWithChildren<ScheduleDialogProps>> = ({
cancelText,
confirmLoading,
disabled = false,
hideCancel,
onClose,
onConfirm,
type,
open = false,
title,
inactiveWorkspacesToGoDormant,
inactiveWorkspacesToGoDormantInWeek,
dormantWorkspacesToBeDeleted,
dormantWorkspacesToBeDeletedInWeek,
updateDormantWorkspaces,
updateInactiveWorkspaces,
dormantValueChanged,
deletionValueChanged,
}) => {
const styles = useScheduleStyles({ type });

const defaults = CONFIRM_DIALOG_DEFAULTS["delete"];

if (typeof hideCancel === "undefined") {
hideCancel = defaults.hideCancel;
}

const showDormancyWarning =
dormantValueChanged &&
(inactiveWorkspacesToGoDormant > 0 ||
inactiveWorkspacesToGoDormantInWeek > 0);
const showDeletionWarning =
deletionValueChanged &&
(dormantWorkspacesToBeDeleted > 0 ||
dormantWorkspacesToBeDeletedInWeek > 0);

return (
<Dialog
className={styles.dialogWrapper}
onClose={onClose}
open={open}
data-testid="dialog"
>
<div className={styles.dialogContent}>
<h3 className={styles.dialogTitle}>{title}</h3>
<>
{showDormancyWarning && (
<>
<h4>{"Dormancy Threshold"}</h4>
<Stack direction="row" spacing={5}>
<div className={styles.dialogDescription}>{`
This change will result in ${inactiveWorkspacesToGoDormant} workspaces being immediately transitioned to the dormant state and ${inactiveWorkspacesToGoDormantInWeek} over the next seven days. To prevent this, do you want to reset the inactivity period for all template workspaces?`}</div>
<FormControlLabel
sx={{
marginTop: 2,
}}
control={
<Checkbox
size="small"
onChange={(e) => {
updateInactiveWorkspaces(e.target.checked);
}}
/>
}
label="Reset"
/>
</Stack>
</>
)}

{showDeletionWarning && (
<>
<h4>{"Dormancy Auto-Deletion"}</h4>
<Stack direction="row" spacing={5}>
<div
className={styles.dialogDescription}
>{`This change will result in ${dormantWorkspacesToBeDeleted} workspaces being immediately deleted and ${dormantWorkspacesToBeDeletedInWeek} over the next 7 days. To prevent this, do you want to reset the dormancy period for all template workspaces?`}</div>
<FormControlLabel
sx={{
marginTop: 2,
}}
control={
<Checkbox
size="small"
onChange={(e) => {
updateDormantWorkspaces(e.target.checked);
}}
/>
}
label="Reset"
/>
</Stack>
</>
)}
</>
</div>

<DialogActions>
<DialogActionButtons
cancelText={cancelText}
confirmDialog
confirmLoading={confirmLoading}
confirmText="Submit"
disabled={disabled}
onCancel={!hideCancel ? onClose : undefined}
onConfirm={onConfirm || onClose}
type="delete"
/>
</DialogActions>
</Dialog>
);
};

const useScheduleStyles = makeStyles((theme) => ({
dialogWrapper: {
"& .MuiPaper-root": {
background: theme.palette.background.paper,
border: `1px solid ${theme.palette.divider}`,
width: "100%",
maxWidth: theme.spacing(125),
},
"& .MuiDialogActions-spacing": {
padding: `0 ${theme.spacing(5)} ${theme.spacing(5)}`,
},
},
dialogContent: {
color: theme.palette.text.secondary,
padding: theme.spacing(5),
},
dialogTitle: {
margin: 0,
marginBottom: theme.spacing(2),
color: theme.palette.text.primary,
fontWeight: 400,
fontSize: theme.spacing(2.5),
},
dialogDescription: {
color: theme.palette.text.secondary,
lineHeight: "160%",
fontSize: 16,

"& strong": {
color: theme.palette.text.primary,
},

"& p:not(.MuiFormHelperText-root)": {
margin: 0,
},

"& > p": {
margin: theme.spacing(1, 0),
},
},
}));
Loading

[8]ページ先頭

©2009-2025 Movatter.jp