UI Fixes for branch Login (#849)
This commit is contained in:
commit
59bbad7db1
5 changed files with 68 additions and 37 deletions
|
|
@ -7,8 +7,17 @@ import { alertContext } from "../../contexts/alertContext";
|
||||||
import { AuthContext } from "../../contexts/authContext";
|
import { AuthContext } from "../../contexts/authContext";
|
||||||
import { darkContext } from "../../contexts/darkContext";
|
import { darkContext } from "../../contexts/darkContext";
|
||||||
import { TabsContext } from "../../contexts/tabsContext";
|
import { TabsContext } from "../../contexts/tabsContext";
|
||||||
|
import { gradients } from "../../utils/styleUtils";
|
||||||
import IconComponent from "../genericIconComponent";
|
import IconComponent from "../genericIconComponent";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuLabel,
|
||||||
|
DropdownMenuSeparator,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from "../ui/dropdown-menu";
|
||||||
import { Separator } from "../ui/separator";
|
import { Separator } from "../ui/separator";
|
||||||
import MenuBar from "./components/menuBar";
|
import MenuBar from "./components/menuBar";
|
||||||
|
|
||||||
|
|
@ -17,7 +26,7 @@ export default function Header(): JSX.Element {
|
||||||
const { dark, setDark } = useContext(darkContext);
|
const { dark, setDark } = useContext(darkContext);
|
||||||
const { notificationCenter } = useContext(alertContext);
|
const { notificationCenter } = useContext(alertContext);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { logout, autoLogin, isAdmin } = useContext(AuthContext);
|
const { logout, autoLogin, isAdmin, userData } = useContext(AuthContext);
|
||||||
const { stars } = useContext(darkContext);
|
const { stars } = useContext(darkContext);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
|
@ -31,40 +40,6 @@ export default function Header(): JSX.Element {
|
||||||
{flows.findIndex((f) => tabId === f.id) !== -1 && tabId !== "" && (
|
{flows.findIndex((f) => tabId === f.id) !== -1 && tabId !== "" && (
|
||||||
<MenuBar flows={flows} tabId={tabId} />
|
<MenuBar flows={flows} tabId={tabId} />
|
||||||
)}
|
)}
|
||||||
{!autoLogin && location.pathname !== `/flow/${tabId}` && (
|
|
||||||
<a
|
|
||||||
onClick={() => {
|
|
||||||
logout();
|
|
||||||
navigate("/login");
|
|
||||||
}}
|
|
||||||
className="text-sm font-medium text-muted-foreground transition-colors hover:text-primary cursor-pointer mx-5"
|
|
||||||
>
|
|
||||||
Sign out
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{location.pathname === "/admin" && (
|
|
||||||
<a
|
|
||||||
onClick={() => {
|
|
||||||
navigate("/");
|
|
||||||
}}
|
|
||||||
className="text-sm font-medium text-muted-foreground transition-colors hover:text-primary cursor-pointer"
|
|
||||||
>
|
|
||||||
Home
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{isAdmin &&
|
|
||||||
!autoLogin &&
|
|
||||||
location.pathname !== "/admin" &&
|
|
||||||
location.pathname !== `/flow/${tabId}` && (
|
|
||||||
<a
|
|
||||||
className="text-sm font-medium text-muted-foreground transition-colors hover:text-primary cursor-pointer"
|
|
||||||
onClick={() => navigate("/admin")}
|
|
||||||
>
|
|
||||||
Admin page
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="round-button-div">
|
<div className="round-button-div">
|
||||||
<Link to="/">
|
<Link to="/">
|
||||||
|
|
@ -156,6 +131,40 @@ export default function Header(): JSX.Element {
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{!autoLogin && (
|
||||||
|
<>
|
||||||
|
<Separator orientation="vertical" />
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<button
|
||||||
|
className={
|
||||||
|
"h-7 w-7 rounded-full focus-visible:outline-0 " +
|
||||||
|
gradients[
|
||||||
|
parseInt(userData?.id ?? "", 10) % gradients.length
|
||||||
|
]
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent>
|
||||||
|
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
|
{isAdmin && (
|
||||||
|
<DropdownMenuItem onClick={() => navigate("/admin")}>
|
||||||
|
Admin Page
|
||||||
|
</DropdownMenuItem>
|
||||||
|
)}
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={() => {
|
||||||
|
logout();
|
||||||
|
navigate("/login");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Sign Out
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ export default function InputComponent({
|
||||||
{isForm ? (
|
{isForm ? (
|
||||||
<Form.Control asChild>
|
<Form.Control asChild>
|
||||||
<Input
|
<Input
|
||||||
|
type={password && !pwdVisible ? "password" : "text"}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
required={required}
|
required={required}
|
||||||
|
|
@ -53,6 +54,7 @@ export default function InputComponent({
|
||||||
</Form.Control>
|
</Form.Control>
|
||||||
) : (
|
) : (
|
||||||
<Input
|
<Input
|
||||||
|
type={password && !pwdVisible ? "password" : "text"}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
required={required}
|
required={required}
|
||||||
|
|
@ -76,6 +78,8 @@ export default function InputComponent({
|
||||||
)}
|
)}
|
||||||
{password && (
|
{password && (
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
|
tabIndex={-1}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
editNode
|
editNode
|
||||||
? "input-component-true-button"
|
? "input-component-true-button"
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ export default function LoginPage(): JSX.Element {
|
||||||
|
|
||||||
<Form.Control asChild>
|
<Form.Control asChild>
|
||||||
<Input
|
<Input
|
||||||
|
type="username"
|
||||||
onChange={({ target: { value } }) => {
|
onChange={({ target: { value } }) => {
|
||||||
handleInput({ target: { name: "username", value } });
|
handleInput({ target: { name: "username", value } });
|
||||||
}}
|
}}
|
||||||
|
|
@ -129,12 +130,12 @@ export default function LoginPage(): JSX.Element {
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Form.Submit asChild>
|
<Form.Submit asChild>
|
||||||
<Button className="mr-3 mt-6 w-full">Sign in</Button>
|
<Button className="mr-3 mt-6 w-full" type="submit">Sign in</Button>
|
||||||
</Form.Submit>
|
</Form.Submit>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Link to="/signup">
|
<Link to="/signup">
|
||||||
<Button className="w-full" variant="outline">
|
<Button className="w-full" variant="outline" type="button">
|
||||||
Don't have an account? <b>Sign Up</b>
|
Don't have an account? <b>Sign Up</b>
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ export default function SignUp(): JSX.Element {
|
||||||
|
|
||||||
<Form.Control asChild>
|
<Form.Control asChild>
|
||||||
<Input
|
<Input
|
||||||
|
type="username"
|
||||||
onChange={({ target: { value } }) => {
|
onChange={({ target: { value } }) => {
|
||||||
handleInput({ target: { name: "username", value } });
|
handleInput({ target: { name: "username", value } });
|
||||||
}}
|
}}
|
||||||
|
|
@ -157,6 +158,7 @@ export default function SignUp(): JSX.Element {
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Form.Submit asChild>
|
<Form.Submit asChild>
|
||||||
<Button
|
<Button
|
||||||
|
type="submit"
|
||||||
className="mr-3 mt-6 w-full"
|
className="mr-3 mt-6 w-full"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleSignup();
|
handleSignup();
|
||||||
|
|
|
||||||
|
|
@ -36,3 +36,18 @@ pre {
|
||||||
.gradient-start {
|
.gradient-start {
|
||||||
animation: gradient-motion-start 4s infinite forwards;
|
animation: gradient-motion-start 4s infinite forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input:-webkit-autofill,
|
||||||
|
input:-webkit-autofill:hover,
|
||||||
|
input:-webkit-autofill:focus,
|
||||||
|
textarea:-webkit-autofill,
|
||||||
|
textarea:-webkit-autofill:hover,
|
||||||
|
textarea:-webkit-autofill:focus,
|
||||||
|
select:-webkit-autofill,
|
||||||
|
select:-webkit-autofill:hover,
|
||||||
|
select:-webkit-autofill:focus {
|
||||||
|
-webkit-text-fill-color: black;
|
||||||
|
-webkit-box-shadow: 0 0 0px 1000px #fff6d0 inset;
|
||||||
|
box-shadow: 0 0 0px 1000px #fff6d0 inset;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue