Skip to content

Commit

Permalink
fe: Rework items in header and footer
Browse files Browse the repository at this point in the history
  • Loading branch information
a3li committed Dec 25, 2024
1 parent 2fb833d commit 15459db
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 93 deletions.
68 changes: 43 additions & 25 deletions atciss-frontend/src/app/atciss/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ export const useAtcissTheme = useTheme as () => AtcissTheme
export const theme: AtcissTheme = {
colors: {
text: "#000",
background: "#fff",
background: "#eaeaea",
inputBackground: "#fff",
primary: "#0082b3",
secondary: "#a0e6fa",
primaryText: "var(--theme-ui-colors-background)",
clockBackground: "#565964",
clockText: "#fff",
darkshadow: "#003e59",
brightshadow: "#90c6da",
darkshadow: "#5c5c5c",
darkshadowNav: "#003e59",
brightshadow: "#ddd",
brightshadowNav: "#90c6da",
green: "#007711",
red: "#770011",
orange: "#b97700",
Expand All @@ -32,10 +35,13 @@ export const theme: AtcissTheme = {
dark: {
text: "#fff",
background: "#222",
inputBackground: "#000",
primary: "#90c6da",
secondary: "#0082b3",
darkshadow: "#003e59",
brightshadow: "#a0e6fa",
darkshadow: "#5c5c5c",
darkshadowNav: "#003e59",
brightshadow: "#ddd",
brightshadowNav: "#a0e6fa",
green: "#33ff99",
red: "#ff7788",
orange: "#ffa333",
Expand Down Expand Up @@ -97,6 +103,18 @@ export const theme: AtcissTheme = {
fontSize: 3,
},
},
cards: {
footer: {
border: 2,
borderStyle: "solid",
p: 1,
px: 4,
borderTopColor: "darkshadow",
borderLeftColor: "darkshadow",
borderBottomColor: "brightshadow",
borderRightColor: "brightshadow",
},
},
buttons: {
primary: {
color: "background",
Expand All @@ -123,48 +141,48 @@ export const theme: AtcissTheme = {
width: "100%",
border: 2,
borderRadius: 0,
borderTopColor: "brightshadow",
borderLeftColor: "brightshadow",
borderBottomColor: "darkshadow",
borderRightColor: "darkshadow",
borderTopColor: "brightshadowNav",
borderLeftColor: "brightshadowNav",
borderBottomColor: "darkshadowNav",
borderRightColor: "darkshadowNav",
borderStyle: "solid",
backgroundColor: "primary",
color: "background",
px: 2,
py: 1,
"&:active": {
borderTopColor: "darkshadow",
borderLeftColor: "darkshadow",
borderBottomColor: "brightshadow",
borderRightColor: "brightshadow",
borderTopColor: "darkshadowNav",
borderLeftColor: "darkshadowNav",
borderBottomColor: "brightshadowNav",
borderRightColor: "brightshadowNav",
},
},
secondaryNav: {
border: 2,
borderRadius: 0,
borderTopColor: "brightshadow",
borderLeftColor: "brightshadow",
borderBottomColor: "darkshadow",
borderRightColor: "darkshadow",
borderTopColor: "brightshadowNav",
borderLeftColor: "brightshadowNav",
borderBottomColor: "darkshadowNav",
borderRightColor: "darkshadowNav",
borderStyle: "solid",
color: "text",
backgroundColor: "secondary",
p: 1,
fontSize: 1,
"&:active": {
borderTopColor: "darkshadow",
borderLeftColor: "darkshadow",
borderBottomColor: "brightshadow",
borderRightColor: "brightshadow",
borderTopColor: "darkshadowNav",
borderLeftColor: "darkshadowNav",
borderBottomColor: "brightshadowNav",
borderRightColor: "brightshadowNav",
},
},
selectedSecondaryNav: {
border: 2,
borderRadius: 0,
borderTopColor: "brightshadow",
borderLeftColor: "brightshadow",
borderBottomColor: "darkshadow",
borderRightColor: "darkshadow",
borderTopColor: "brightshadowNav",
borderLeftColor: "brightshadowNav",
borderBottomColor: "darkshadowNav",
borderRightColor: "darkshadowNav",
borderStyle: "solid",
color: "background",
backgroundColor: "green",
Expand Down
167 changes: 130 additions & 37 deletions atciss-frontend/src/components/atciss/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,134 @@
import { Flex, Link, Text, ThemeUIStyleObject } from "theme-ui"
/** @jsxImportSource theme-ui */
import { selectUser } from "app/auth/slice"
import { useAppSelector } from "app/hooks"
import { Link } from "react-router"
import { Box, Flex, Text, ThemeUIStyleObject, useColorMode } from "theme-ui"

const Footer = ({ sx }: { sx?: ThemeUIStyleObject }) => (
<Flex
sx={{
...sx,
backgroundColor: "primary",
p: ".5em",
justifyContent: "space-between",
color: "primaryText",
}}
>
<Text sx={{ color: "primaryText" }}>ATCISS/IDVS</Text>
<Link
sx={{ color: "primaryText" }}
target="_blank"
href="https://github.com/vatger/atciss"
>
GitHub
</Link>
<Text>
<Link
sx={{ color: "primaryText" }}
target="_blank"
href="https://vatsim-germany.org/imprint"
>
Impressum
</Link>{" "}
&{" "}
<Link
sx={{ color: "primaryText" }}
target="_blank"
href="https://vatsim-germany.org/gdpr"
const Footer = ({ sx }: { sx?: ThemeUIStyleObject }) => {
const user = useAppSelector(selectUser)
const [colorMode, setColorMode] = useColorMode()

return (
<Box sx={{ pt: "1px", backgroundColor: "primary" }}>
<Flex
sx={{
...sx,
backgroundColor: "primary",
justifyContent: "space-between",
color: "primaryText",
borderTop: "2px solid",
borderTopColor: "brightshadow",
}}
>
Datenschutz
</Link>
</Text>
</Flex>
)
<Box variant={"cards.footer"}>
<Text sx={{ color: "primaryText" }}>
ATCISS/IDVS
<Link
sx={{ color: "primaryText" }}
target="_blank"
to="https://github.com/vatger/atciss"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
height="14"
width="14"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
sx={{ verticalAlign: "middle", ml: 2 }}
>
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
</svg>
</Link>
</Text>
</Box>
<Box
variant={"cards.footer"}
sx={{ display: "flex", alignItems: "center" }}
>
<a
sx={{ color: "background" }}
title="Switch between dark and light mode"
onClick={() =>
setColorMode(colorMode === "default" ? "dark" : "default")
}
>
{colorMode === "default" ? (
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
sx={{ display: "block" }}
>
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="feather feather-sun"
sx={{ display: "block" }}
>
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
)}
</a>
</Box>
<Box variant={"cards.footer"}>
<strong>{user?.sub}</strong>{" "}
{user && (
<Link sx={{ color: "primaryText" }} to="logout">
(Logout)
</Link>
)}
</Box>
<Box variant={"cards.footer"} sx={{ flexGrow: 9 }}></Box>
<Box variant={"cards.footer"}>
<Text>
<Link
sx={{ color: "primaryText" }}
target="_blank"
to="https://vatsim-germany.org/imprint"
>
Impressum
</Link>{" "}
&{" "}
<Link
sx={{ color: "primaryText" }}
target="_blank"
to="https://vatsim-germany.org/gdpr"
>
Datenschutz
</Link>
</Text>
</Box>
</Flex>
</Box>
)
}

export { Footer }
39 changes: 12 additions & 27 deletions atciss-frontend/src/components/atciss/Nav.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/** @jsxImportSource theme-ui */

import { Link } from "react-router"
import { Button, Flex, Grid, ThemeUIStyleObject, useColorMode } from "theme-ui"
import { Button, Flex, Grid, ThemeUIStyleObject } from "theme-ui"

import { FIR_SETTINGS } from "app/config"
import { useAppDispatch, useAppSelector } from "app/hooks"
import { Clock } from "components/atciss/Clock"
import { selectActiveFir, setActiveFir } from "services/configSlice"
import { selectUser } from "app/auth/slice"
import { XmSelect } from "./XmSelect"

const Nav = ({ sx }: { sx?: ThemeUIStyleObject }) => {
const dispatch = useAppDispatch()
const activeFir = useAppSelector(selectActiveFir)
const [colorMode, setColorMode] = useColorMode()
const user = useAppSelector(selectUser)

return (
Expand Down Expand Up @@ -92,34 +92,19 @@ const Nav = ({ sx }: { sx?: ThemeUIStyleObject }) => {
justifyContent: "flex-end",
}}
>
<Flex
<XmSelect
value={activeFir}
onChange={(e) => dispatch(setActiveFir(e.target.value))}
sx={{
p: 2,
gap: 2,
alignItems: "flex-start",
minWidth: "6rem",
backgroundColor: "primary",
color: "background",
}}
>
<select
value={activeFir}
onChange={(e) => dispatch(setActiveFir(e.target.value))}
>
{Object.keys(FIR_SETTINGS).map((fir) => (
<option key={fir}>{fir}</option>
))}
</select>

<a
sx={{ color: "background" }}
onClick={() =>
setColorMode(colorMode === "default" ? "dark" : "default")
}
>
{colorMode === "default" ? <>&#x263E;</> : <>&#x263C;</>}
</a>
</Flex>
<Link to="logout" sx={{ gridRow: "2/3" }}>
<Button variant="nav">Logout</Button>
</Link>
{Object.keys(FIR_SETTINGS).map((fir) => (
<option key={fir}>{fir}</option>
))}
</XmSelect>
</Grid>
</Flex>
)
Expand Down
6 changes: 4 additions & 2 deletions atciss-frontend/src/components/atciss/XmInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export const XmInput = (props: PropsWithChildren<InputProps>) => {
py: 1,
borderTopColor: "darkshadow",
borderLeftColor: "darkshadow",
borderBottomColor: "#d6d6d6",
borderRightColor: "#d6d6d6",
borderBottomColor: "brightshadow",
borderRightColor: "brightshadow",
background: "inputBackground",
fontFamily: "body",
...props.sx,
}}
>
Expand Down
6 changes: 4 additions & 2 deletions atciss-frontend/src/components/atciss/XmSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export const XmSelect = (props: PropsWithChildren<SelectProps>) => {
py: 1,
borderBottomColor: "darkshadow",
borderRightColor: "darkshadow",
borderTopColor: "#d6d6d6",
borderLeftColor: "#d6d6d6",
borderTopColor: "brightshadow",
borderLeftColor: "brightshadow",
background: "inputBackground",
fontFamily: "body",
...props.sx,
}}
>
Expand Down

0 comments on commit 15459db

Please sign in to comment.