- Notifications
You must be signed in to change notification settings - Fork928
feat: add warning if workspace page becomes stale#4375
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
7da8608
added a warning summary component
Kira-Pilota15a59f
added warning to workspace page
Kira-Pilot59ceb62
consolidated warnings
Kira-Pilot5db509b
prettier
Kira-Pilot5aeb6e2
updated design
Kira-Pilotdec2566
Merge remote-tracking branch 'origin/main' into add-stale-warning/kir…
Kira-PilotFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
35 changes: 35 additions & 0 deletionssite/src/components/WarningAlert/WarningAlert.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Story } from "@storybook/react" | ||
import { WarningAlert, WarningAlertProps } from "./WarningAlert" | ||
import Button from "@material-ui/core/Button" | ||
export default { | ||
title: "components/WarningAlert", | ||
component: WarningAlert, | ||
} | ||
const Template: Story<WarningAlertProps> = (args) => <WarningAlert {...args} /> | ||
export const ExampleWithDismiss = Template.bind({}) | ||
ExampleWithDismiss.args = { | ||
text: "This is a warning", | ||
dismissible: true, | ||
} | ||
const ExampleAction = ( | ||
<Button onClick={() => null} size="small"> | ||
Button | ||
</Button> | ||
) | ||
export const ExampleWithAction = Template.bind({}) | ||
ExampleWithAction.args = { | ||
text: "This is a warning", | ||
actions: [ExampleAction], | ||
} | ||
export const ExampleWithActionAndDismiss = Template.bind({}) | ||
ExampleWithActionAndDismiss.args = { | ||
text: "This is a warning", | ||
actions: [ExampleAction], | ||
dismissible: true, | ||
} |
61 changes: 61 additions & 0 deletionssite/src/components/WarningAlert/WarningAlert.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useState, FC, ReactElement } from "react" | ||
import Collapse from "@material-ui/core/Collapse" | ||
import { Stack } from "components/Stack/Stack" | ||
import { makeStyles, Theme } from "@material-ui/core/styles" | ||
import { colors } from "theme/colors" | ||
import ReportProblemOutlinedIcon from "@material-ui/icons/ReportProblemOutlined" | ||
import Button from "@material-ui/core/Button" | ||
import { useTranslation } from "react-i18next" | ||
export interface WarningAlertProps { | ||
text: string | ||
dismissible?: boolean | ||
actions?: ReactElement[] | ||
} | ||
export const WarningAlert: FC<WarningAlertProps> = ({ | ||
text, | ||
dismissible = false, | ||
actions = [], | ||
}) => { | ||
const { t } = useTranslation("common") | ||
const [open, setOpen] = useState(true) | ||
const classes = useStyles() | ||
return ( | ||
<Collapse in={open}> | ||
<Stack | ||
className={classes.alertContainer} | ||
direction="row" | ||
alignItems="center" | ||
spacing={0} | ||
justifyContent="space-between" | ||
> | ||
<Stack direction="row" spacing={1}> | ||
<ReportProblemOutlinedIcon fontSize="small" className={classes.alertIcon} /> | ||
{text} | ||
</Stack> | ||
<Stack direction="row"> | ||
{actions.length > 0 && actions.map((action) => <div key={String(action)}>{action}</div>)} | ||
{dismissible && ( | ||
<Button size="small" onClick={() => setOpen(false)} variant="outlined"> | ||
{t("ctas.dismissCta")} | ||
</Button> | ||
)} | ||
</Stack> | ||
</Stack> | ||
</Collapse> | ||
) | ||
} | ||
const useStyles = makeStyles<Theme>((theme) => ({ | ||
alertContainer: { | ||
border: `1px solid ${colors.orange[7]}`, | ||
borderRadius: theme.shape.borderRadius, | ||
padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`, | ||
backgroundColor: `${colors.gray[16]}`, | ||
}, | ||
alertIcon: { | ||
color: `${colors.orange[7]}`, | ||
}, | ||
})) |
17 changes: 11 additions & 6 deletionssite/src/components/Workspace/Workspace.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
45 changes: 13 additions & 32 deletionssite/src/components/WorkspaceDeletedBanner/WorkspaceDeletedBanner.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
47 changes: 19 additions & 28 deletionssite/src/components/WorkspaceScheduleBanner/WorkspaceScheduleBanner.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletionssite/src/i18n/en/common.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletionssite/src/i18n/en/workspacePage.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.