- Notifications
You must be signed in to change notification settings - Fork928
refactor(site): Group template permissions, settings and variables under a settings layout#6737
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
17 commits Select commitHold shift + click to select a range
5ea1d23
Add template settings
BrunoQuaresmab40c8e7
Move permissions page
BrunoQuaresma13086b4
Move template variables
BrunoQuaresma674647c
Add schedule
BrunoQuaresmaf5a9673
Remove schedule from general settings
BrunoQuaresmace33a5c
Fix update
BrunoQuaresma51ae1cd
Remove permissiosn from tab
BrunoQuaresmad657b70
Remove go back button
BrunoQuaresma54fd3c3
Make template name on sidebar a link
BrunoQuaresma27093d4
Remove variables version
BrunoQuaresma7f139d7
Add titles
BrunoQuaresmad3081e8
Fix title
BrunoQuaresmae17ca38
Fix test for schedule
BrunoQuaresma020d79d
Fix tests
BrunoQuaresma9fb5b07
Fix tests
BrunoQuaresma2f44ba0
Fix stories
BrunoQuaresmab04f454
Fix e2e char
BrunoQuaresmaFile 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
2 changes: 1 addition & 1 deletionsite/e2e/tests/listTemplates.spec.ts
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
35 changes: 27 additions & 8 deletionssite/src/AppRouter.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
19 changes: 0 additions & 19 deletionssite/src/components/GoBackButton/GoBackButton.tsx
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
2 changes: 1 addition & 1 deletionsite/src/components/IconField/LazyIconField.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
1 change: 1 addition & 0 deletionssite/src/components/SettingsLayout/Sidebar.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
43 changes: 14 additions & 29 deletionssite/src/components/TemplateLayout/TemplateLayout.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
7 changes: 0 additions & 7 deletionssite/src/components/TemplateLayout/TemplatePageHeader.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
2 changes: 1 addition & 1 deletionsite/src/i18n/en/templateSettingsPage.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
File renamed without changes.
149 changes: 149 additions & 0 deletionssite/src/pages/TemplateSettingsPage/Sidebar.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,149 @@ | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import ScheduleIcon from "@material-ui/icons/TimerOutlined" | ||
import VariablesIcon from "@material-ui/icons/CodeOutlined" | ||
import { Template } from "api/typesGenerated" | ||
import { Stack } from "components/Stack/Stack" | ||
import { FC, ElementType, PropsWithChildren, ReactNode } from "react" | ||
import { Link, NavLink } from "react-router-dom" | ||
import { combineClasses } from "util/combineClasses" | ||
import GeneralIcon from "@material-ui/icons/SettingsOutlined" | ||
import SecurityIcon from "@material-ui/icons/LockOutlined" | ||
import { Avatar } from "components/Avatar/Avatar" | ||
const SidebarNavItem: FC< | ||
PropsWithChildren<{ href: string; icon: ReactNode }> | ||
> = ({ children, href, icon }) => { | ||
const styles = useStyles() | ||
return ( | ||
<NavLink | ||
end | ||
to={href} | ||
className={({ isActive }) => | ||
combineClasses([ | ||
styles.sidebarNavItem, | ||
isActive ? styles.sidebarNavItemActive : undefined, | ||
]) | ||
} | ||
> | ||
<Stack alignItems="center" spacing={1.5} direction="row"> | ||
{icon} | ||
{children} | ||
</Stack> | ||
</NavLink> | ||
) | ||
} | ||
const SidebarNavItemIcon: React.FC<{ icon: ElementType }> = ({ | ||
icon: Icon, | ||
}) => { | ||
const styles = useStyles() | ||
return <Icon className={styles.sidebarNavItemIcon} /> | ||
} | ||
export const Sidebar: React.FC<{ template: Template }> = ({ template }) => { | ||
const styles = useStyles() | ||
return ( | ||
<nav className={styles.sidebar}> | ||
<Stack | ||
direction="row" | ||
alignItems="center" | ||
className={styles.templateInfo} | ||
> | ||
<Avatar src={template.icon} variant="square" fitImage /> | ||
<Stack spacing={0} className={styles.templateData}> | ||
<Link className={styles.name} to={`/templates/${template.name}`}> | ||
{template.display_name !== "" | ||
? template.display_name | ||
: template.name} | ||
</Link> | ||
<span className={styles.secondary}>{template.name}</span> | ||
</Stack> | ||
</Stack> | ||
<SidebarNavItem href="" icon={<SidebarNavItemIcon icon={GeneralIcon} />}> | ||
General | ||
</SidebarNavItem> | ||
<SidebarNavItem | ||
href="permissions" | ||
icon={<SidebarNavItemIcon icon={SecurityIcon} />} | ||
> | ||
Permissions | ||
</SidebarNavItem> | ||
<SidebarNavItem | ||
href="variables" | ||
icon={<SidebarNavItemIcon icon={VariablesIcon} />} | ||
> | ||
Variables | ||
</SidebarNavItem> | ||
<SidebarNavItem | ||
href="schedule" | ||
icon={<SidebarNavItemIcon icon={ScheduleIcon} />} | ||
> | ||
Schedule | ||
</SidebarNavItem> | ||
</nav> | ||
) | ||
} | ||
const useStyles = makeStyles((theme) => ({ | ||
sidebar: { | ||
width: 245, | ||
flexShrink: 0, | ||
}, | ||
sidebarNavItem: { | ||
color: "inherit", | ||
display: "block", | ||
fontSize: 14, | ||
textDecoration: "none", | ||
padding: theme.spacing(1.5, 1.5, 1.5, 2), | ||
borderRadius: theme.shape.borderRadius / 2, | ||
transition: "background-color 0.15s ease-in-out", | ||
marginBottom: 1, | ||
position: "relative", | ||
"&:hover": { | ||
backgroundColor: theme.palette.action.hover, | ||
}, | ||
}, | ||
sidebarNavItemActive: { | ||
backgroundColor: theme.palette.action.hover, | ||
"&:before": { | ||
content: '""', | ||
display: "block", | ||
width: 3, | ||
height: "100%", | ||
position: "absolute", | ||
left: 0, | ||
top: 0, | ||
backgroundColor: theme.palette.secondary.dark, | ||
borderTopLeftRadius: theme.shape.borderRadius, | ||
borderBottomLeftRadius: theme.shape.borderRadius, | ||
}, | ||
}, | ||
sidebarNavItemIcon: { | ||
width: theme.spacing(2), | ||
height: theme.spacing(2), | ||
}, | ||
templateInfo: { | ||
marginBottom: theme.spacing(2), | ||
}, | ||
templateData: { | ||
overflow: "hidden", | ||
}, | ||
name: { | ||
fontWeight: 600, | ||
overflow: "hidden", | ||
textOverflow: "ellipsis", | ||
whiteSpace: "nowrap", | ||
color: theme.palette.text.primary, | ||
textDecoration: "none", | ||
}, | ||
secondary: { | ||
color: theme.palette.text.secondary, | ||
fontSize: 12, | ||
overflow: "hidden", | ||
textOverflow: "ellipsis", | ||
}, | ||
})) |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.