- Notifications
You must be signed in to change notification settings - Fork925
feat(site): move history into sidebar#11413
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
e7d633d
72ed777
e66151a
1110997
dcf8f32
ec87d6b
1dacdd9
0f56e29
3449731
df7f8b6
4e8fbf9
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { Interpolation, Theme, useTheme } from "@mui/material/styles"; | ||
import { ComponentProps, HTMLAttributes } from "react"; | ||
import { Link, LinkProps } from "react-router-dom"; | ||
import { TopbarIconButton } from "./Topbar"; | ||
export const Sidebar = (props: HTMLAttributes<HTMLDivElement>) => { | ||
const theme = useTheme(); | ||
return ( | ||
<div | ||
css={{ | ||
width: 260, | ||
borderRight: `1px solid ${theme.palette.divider}`, | ||
height: "100%", | ||
overflow: "auto", | ||
flexShrink: 0, | ||
padding: "8px 0", | ||
display: "flex", | ||
flexDirection: "column", | ||
gap: 1, | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
export const SidebarLink = (props: LinkProps) => { | ||
return <Link css={styles.sidebarItem} {...props} />; | ||
}; | ||
export const SidebarItem = (props: HTMLAttributes<HTMLButtonElement>) => { | ||
Member
| ||
return <button css={styles.sidebarItem} {...props} />; | ||
}; | ||
export const SidebarCaption = (props: HTMLAttributes<HTMLSpanElement>) => { | ||
return ( | ||
<span | ||
css={{ | ||
fontSize: 10, | ||
lineHeight: 1.2, | ||
padding: "12px 16px", | ||
display: "block", | ||
textTransform: "uppercase", | ||
fontWeight: 500, | ||
letterSpacing: "0.1em", | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
export const SidebarIconButton = ( | ||
props: { isActive: boolean } & ComponentProps<typeof TopbarIconButton>, | ||
) => { | ||
const theme = useTheme(); | ||
return ( | ||
<TopbarIconButton | ||
css={[ | ||
{ opacity: 0.75, "&:hover": { opacity: 1 } }, | ||
props.isActive && { | ||
opacity: 1, | ||
position: "relative", | ||
"&::before": { | ||
content: '""', | ||
position: "absolute", | ||
left: 0, | ||
top: 0, | ||
bottom: 0, | ||
width: 2, | ||
backgroundColor: theme.palette.primary.main, | ||
height: "100%", | ||
}, | ||
}, | ||
]} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
const styles = { | ||
sidebarItem: (theme) => ({ | ||
fontSize: 13, | ||
lineHeight: 1.2, | ||
color: theme.palette.text.primary, | ||
textDecoration: "none", | ||
padding: "8px 16px", | ||
display: "block", | ||
textAlign: "left", | ||
background: "none", | ||
border: 0, | ||
"&:hover": { | ||
backgroundColor: theme.palette.action.hover, | ||
}, | ||
}), | ||
} satisfies Record<string, Interpolation<Theme>>; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { Interpolation, Theme, useTheme } from "@emotion/react"; | ||
import Skeleton from "@mui/material/Skeleton"; | ||
import { WorkspaceBuild } from "api/typesGenerated"; | ||
import { BuildIcon } from "components/BuildIcon/BuildIcon"; | ||
import { createDayString } from "utils/createDayString"; | ||
import { | ||
getDisplayWorkspaceBuildStatus, | ||
getDisplayWorkspaceBuildInitiatedBy, | ||
} from "utils/workspace"; | ||
export const WorkspaceBuildData = ({ build }: { build: WorkspaceBuild }) => { | ||
const theme = useTheme(); | ||
const statusType = getDisplayWorkspaceBuildStatus(theme, build).type; | ||
return ( | ||
<div css={styles.root}> | ||
<BuildIcon | ||
transition={build.transition} | ||
css={{ | ||
width: 16, | ||
height: 16, | ||
color: theme.palette[statusType].light, | ||
}} | ||
/> | ||
<div css={{ overflow: "hidden" }}> | ||
<div | ||
css={{ | ||
textTransform: "capitalize", | ||
color: theme.palette.text.primary, | ||
textOverflow: "ellipsis", | ||
overflow: "hidden", | ||
whiteSpace: "nowrap", | ||
}} | ||
> | ||
{build.transition} by{" "} | ||
<span css={{ fontWeight: 500 }}> | ||
{getDisplayWorkspaceBuildInitiatedBy(build)} | ||
</span> | ||
</div> | ||
<div | ||
css={{ | ||
fontSize: 12, | ||
color: theme.palette.text.secondary, | ||
marginTop: 2, | ||
}} | ||
> | ||
{createDayString(build.created_at)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export const WorkspaceBuildDataSkeleton = () => { | ||
return ( | ||
<div css={styles.root}> | ||
<Skeleton variant="circular" width={16} height={16} /> | ||
<div> | ||
<Skeleton variant="text" width={94} height={16} /> | ||
<Skeleton | ||
variant="text" | ||
width={60} | ||
height={14} | ||
css={{ marginTop: 2 }} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
const styles = { | ||
root: { | ||
display: "flex", | ||
flexDirection: "row", | ||
alignItems: "center", | ||
gap: 12, | ||
lineHeight: "1.4", | ||
}, | ||
} satisfies Record<string, Interpolation<Theme>>; |
Uh oh!
There was an error while loading.Please reload this page.