-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1207 from visualize-admin/feat/login-ui
feat: Login UI improvements
- Loading branch information
Showing
10 changed files
with
316 additions
and
107 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,88 @@ | ||
import { TabContext, TabList, TabPanel } from "@mui/lab"; | ||
import { Box, Tab, Theme, Typography } from "@mui/material"; | ||
import { makeStyles } from "@mui/styles"; | ||
import clsx from "clsx"; | ||
import React from "react"; | ||
|
||
import { ParsedConfig } from "@/db/config"; | ||
import { ProfileVisualizationsTable } from "@/login/components/profile-tables"; | ||
import { useRootStyles } from "@/login/utils"; | ||
import useEvent from "@/utils/use-event"; | ||
|
||
const useStyles = makeStyles<Theme>((theme) => ({ | ||
section: { | ||
marginTop: theme.spacing(6), | ||
}, | ||
tabList: { | ||
minHeight: "fit-content", | ||
|
||
"& .MuiTabs-flexContainer": { | ||
height: "fit-content", | ||
}, | ||
}, | ||
tabPanel: { | ||
padding: 0, | ||
}, | ||
tabPanelContent: { | ||
padding: theme.spacing(6), | ||
}, | ||
tab: { | ||
height: 48, | ||
minHeight: 0, | ||
padding: "0 1rem", | ||
textTransform: "none", | ||
}, | ||
})); | ||
|
||
type ProfileContentTabsProps = { | ||
userConfigs: ParsedConfig[]; | ||
}; | ||
|
||
export const ProfileContentTabs = (props: ProfileContentTabsProps) => { | ||
const { userConfigs } = props; | ||
const [value, setValue] = React.useState("Home"); | ||
const handleChange = useEvent((_: React.SyntheticEvent, v: string) => { | ||
setValue(v); | ||
}); | ||
const rootClasses = useRootStyles(); | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<TabContext value={value}> | ||
<Box className={clsx(rootClasses.section, classes.section)}> | ||
<Box className={rootClasses.sectionContent}> | ||
<Box sx={{ borderBottom: 1, borderColor: "divider" }}> | ||
<TabList className={classes.tabList} onChange={handleChange}> | ||
{["Home", "My visualizations", "My favorite datasets"].map( | ||
(d) => ( | ||
<Tab key={d} className={classes.tab} label={d} value={d} /> | ||
) | ||
)} | ||
</TabList> | ||
</Box> | ||
</Box> | ||
</Box> | ||
<TabPanel className={classes.tabPanel} value="Home"> | ||
<Box className={classes.tabPanelContent}> | ||
<ProfileVisualizationsTable userConfigs={userConfigs} /> | ||
</Box> | ||
</TabPanel> | ||
<TabPanel className={classes.tabPanel} value="My visualizations"> | ||
<Box | ||
className={classes.tabPanelContent} | ||
sx={{ bgcolor: "background.paper" }} | ||
> | ||
<ProfileVisualizationsTable userConfigs={userConfigs} /> | ||
</Box> | ||
</TabPanel> | ||
<TabPanel className={classes.tabPanel} value="My favorite datasets"> | ||
<Box | ||
className={classes.tabPanelContent} | ||
sx={{ bgcolor: "background.paper" }} | ||
> | ||
<Typography variant="h2">My favorite datasets</Typography> | ||
</Box> | ||
</TabPanel> | ||
</TabContext> | ||
); | ||
}; |
This file contains 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,54 @@ | ||
import { Box, Button, Link, Theme, Typography } from "@mui/material"; | ||
import { makeStyles } from "@mui/styles"; | ||
import { User } from "@prisma/client"; | ||
import clsx from "clsx"; | ||
import { signOut } from "next-auth/react"; | ||
|
||
import { useRootStyles } from "@/login/utils"; | ||
|
||
const useStyles = makeStyles<Theme>((theme) => ({ | ||
section: { | ||
paddingTop: theme.spacing(6), | ||
backgroundColor: theme.palette.muted.main, | ||
}, | ||
topRow: { | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "space-between", | ||
}, | ||
browseButton: { | ||
width: "fit-content", | ||
}, | ||
})); | ||
|
||
type ProfileHeaderProps = { | ||
user: User; | ||
}; | ||
|
||
export const ProfileHeader = (props: ProfileHeaderProps) => { | ||
const { user } = props; | ||
const rootClasses = useRootStyles(); | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Box className={clsx(rootClasses.section, classes.section)}> | ||
<Box className={rootClasses.sectionContent}> | ||
<Box className={classes.topRow}> | ||
<Typography variant="h1">{user.name}</Typography> | ||
<Button component={Link} href="/browse"> | ||
Browse all datasets | ||
</Button> | ||
</Box> | ||
<Button | ||
className={classes.browseButton} | ||
variant="text" | ||
color="primary" | ||
size="small" | ||
onClick={async () => await signOut()} | ||
> | ||
Log out | ||
</Button> | ||
</Box> | ||
</Box> | ||
); | ||
}; |
Oops, something went wrong.
1ffddfc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
visualization-tool – ./
visualization-tool-alpha.vercel.app
visualization-tool-ixt1.vercel.app
visualization-tool-git-main-ixt1.vercel.app