diff --git a/frontend/app/_providers.tsx b/frontend/app/_providers.tsx index 02a867b..e0dd298 100644 --- a/frontend/app/_providers.tsx +++ b/frontend/app/_providers.tsx @@ -32,6 +32,8 @@ const Providers = ({ children }: Props) => { colors: { ...base.colors, background: theme.background.val, + card: theme.background.val, + border: theme.borderColor.val, }, }; }, [theme, colorScheme]); diff --git a/frontend/components/containers/drawer.tsx b/frontend/components/containers/drawer.tsx index b1ffa3a..f5a4d63 100644 --- a/frontend/components/containers/drawer.tsx +++ b/frontend/components/containers/drawer.tsx @@ -10,27 +10,25 @@ import { useLinkBuilder, } from "@react-navigation/native"; import { Link } from "expo-router"; -import Icons from "../ui/icons"; -import { logout } from "@/stores/auth"; +import ThemeSwitcher from "./theme-switcher"; +import UserMenuButton from "./user-menu-button"; const Drawer = (props: DrawerContentComponentProps) => { return ( <> + + + + - - + + ); diff --git a/frontend/components/containers/theme-switcher.tsx b/frontend/components/containers/theme-switcher.tsx index fbd5871..2d401cd 100644 --- a/frontend/components/containers/theme-switcher.tsx +++ b/frontend/components/containers/theme-switcher.tsx @@ -1,28 +1,36 @@ -import React from "react"; -import { Button, GetProps } from "tamagui"; -import Icons from "../ui/icons"; +import React, { useId } from "react"; +import { Switch, GetProps, XStack, Label } from "tamagui"; import useThemeStore from "@/stores/theme"; +import { Ionicons } from "../ui/icons"; -type Props = GetProps & { +type Props = GetProps & { iconSize?: number; }; -const ThemeSwitcher = ({ iconSize = 24, ...props }: Props) => { +const ThemeSwitcher = ({ iconSize = 18, ...props }: Props) => { const { theme, toggle } = useThemeStore(); + const id = useId(); return ( - + } + > + + console.log("logout")} + icon={} + title="Account" + /> + + logout()} + icon={} + title="Logout" + /> + + ); +}; + +const TeamsMenu = () => { + const media = useMedia(); + const user = useUser(); + const teams = user?.teams || []; + + return ( + console.log("logout")} + icon={} + title="Teams" + iconAfter={} + /> + } + > + } + title="Personal" + /> + + {teams.map((team: any) => ( + {team.icon}} title={team.name} /> + ))} + + {teams.length > 0 && } + + } + title="Create Team" + /> + + ); +}; + +export default UserMenuButton; diff --git a/frontend/components/ui/icons.tsx b/frontend/components/ui/icons.tsx index 216e7af..6d6f639 100644 --- a/frontend/components/ui/icons.tsx +++ b/frontend/components/ui/icons.tsx @@ -1,8 +1,12 @@ import MaterialCommunityIcons from "@expo/vector-icons/MaterialCommunityIcons"; +import IoniconsIcon from "@expo/vector-icons/Ionicons"; import { styled } from "tamagui"; export const Icons = styled(MaterialCommunityIcons, { color: "$color", }); +export const Ionicons = styled(IoniconsIcon, { + color: "$color", +}); export default Icons; diff --git a/frontend/components/ui/menu-button.tsx b/frontend/components/ui/menu-button.tsx new file mode 100644 index 0000000..09deef9 --- /dev/null +++ b/frontend/components/ui/menu-button.tsx @@ -0,0 +1,50 @@ +import React from "react"; +import { + GetProps, + ListItem, + Popover, + styled, + withStaticProperties, +} from "tamagui"; + +type MenuButtonProps = GetProps & { + asChild?: boolean; + trigger?: React.ReactNode; + width?: string | number | null; +}; + +const MenuButtonFrame = ({ + asChild, + trigger, + children, + width, + ...props +}: MenuButtonProps) => { + return ( + + {trigger} + + + {children} + + + ); +}; + +const MenuButtonItem = (props: GetProps) => ( + + + +); + +const MenuButton = withStaticProperties(MenuButtonFrame, { + Item: MenuButtonItem, +}); + +export default MenuButton; diff --git a/frontend/hooks/useUser.ts b/frontend/hooks/useUser.ts new file mode 100644 index 0000000..08cf7f1 --- /dev/null +++ b/frontend/hooks/useUser.ts @@ -0,0 +1,10 @@ +import authRepo from "@/repositories/auth"; +import { useQuery } from "@tanstack/react-query"; + +export const useUser = () => { + const { data: user } = useQuery({ + queryKey: ["auth", "user"], + queryFn: authRepo.getUser, + }); + return user; +}; diff --git a/frontend/pages/auth/login.tsx b/frontend/pages/auth/login.tsx index 73eae9e..4563872 100644 --- a/frontend/pages/auth/login.tsx +++ b/frontend/pages/auth/login.tsx @@ -13,6 +13,7 @@ import { loginResultSchema, loginSchema } from "./schema"; import api from "@/lib/api"; import Icons from "@/components/ui/icons"; import authStore from "@/stores/auth"; +import tamaguiConfig from "@/tamagui.config"; export default function LoginPage() { const form = useZForm(loginSchema); @@ -42,7 +43,7 @@ export default function LoginPage() { options={{ contentStyle: { width: "100%", - maxWidth: 600, + maxWidth: tamaguiConfig.media.xs.maxWidth, marginHorizontal: "auto", }, title: "Login", diff --git a/frontend/pages/hosts/components/host-item.tsx b/frontend/pages/hosts/components/host-item.tsx index 834ab39..4a406f8 100644 --- a/frontend/pages/hosts/components/host-item.tsx +++ b/frontend/pages/hosts/components/host-item.tsx @@ -26,6 +26,7 @@ const HostItem = ({ host, onMultiTap, onTap, onEdit }: HostItemProps) => { name={host.os} size={18} mr="$2" + mt="$1" fallback="desktop-classic" /> @@ -39,9 +40,11 @@ const HostItem = ({ host, onMultiTap, onTap, onEdit }: HostItemProps) => { {onEdit != null && (