-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
237 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ dev-dist | |
# Editor directories and files | ||
.idea | ||
.DS_Store | ||
.env | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
|
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,27 @@ | ||
import { Link } from "@tanstack/react-router"; | ||
import { CalendarIcon, VStack } from "../components"; | ||
|
||
const options = [ | ||
{ name: "活動/揪人", engName: "Events", pageNav: "/events", icon: CalendarIcon }, | ||
{ name: "拍賣", engName: "Market", pageNav: "/sales", icon: CalendarIcon }, | ||
{ name: "行事曆", engName: "Calendar", pageNav: "/calendar", icon: CalendarIcon }, | ||
{ name: "地圖", engName: "Map", pageNav: "/map", icon: CalendarIcon }, | ||
{ name: "今晚吃什麼", engName: "Dinner Decider", pageNav: "/dinner", icon: CalendarIcon }, | ||
]; | ||
|
||
export const DrawerOption = () => { | ||
return ( | ||
<VStack id="all-nav-func"> | ||
{options.map((option) => ( | ||
<Link to={option.pageNav}> | ||
<li key={option.name}> | ||
<VStack className="justify-start"> | ||
<a>{option.name}</a> | ||
<a>{option.engName}</a> | ||
</VStack> | ||
</li> | ||
</Link> | ||
))} | ||
</VStack> | ||
); | ||
}; |
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,40 @@ | ||
import { Image, VStack } from "../components"; | ||
import { DrawerOption } from "./DrawerOption"; | ||
|
||
const UserInfo = { | ||
name: "NCU APP", | ||
avatar: "src/assets/logo.png" | ||
}; | ||
|
||
export const DrawerSideBar = () => { | ||
return ( | ||
<div className="flex w-fit drawer"> | ||
<input id="my-drawer" type="checkbox" className="drawer-toggle" /> | ||
|
||
{/* Drawer Portal */} | ||
<div className="drawer-content"> | ||
<label htmlFor="my-drawer" className="drawer-button"> | ||
<Image src={UserInfo.avatar} children={undefined} className='w-10 rounded-full'></Image> | ||
</label> | ||
</div> | ||
|
||
{/* Indise Drawer */} | ||
<div className="drawer-side"> | ||
<label htmlFor="my-drawer" aria-label="close sidebar" className="drawer-overlay"></label> | ||
|
||
<ul className="menu bg-base-200 text-base-content min-h-full w-80 p-4"> | ||
{/* Sidebar content here */} | ||
<VStack id="user-avatar"> | ||
<Image src={UserInfo.avatar} children={undefined} className='mb-2 w-10 rounded-full'></Image> | ||
<text className="font-bold">{UserInfo.name}</text> | ||
<text className="text-xs">View Profile</text> | ||
</VStack> | ||
|
||
<div className="divider divider-neutral" /> | ||
|
||
<DrawerOption /> | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,18 +1,24 @@ | ||
import { createRootRoute, Link, Outlet } from '@tanstack/react-router' | ||
|
||
import { createRootRoute, Outlet } from '@tanstack/react-router' | ||
import { HStack } from '../components' | ||
import { DrawerSideBar } from '../components/DrawerSideBar' | ||
export const Route = createRootRoute({ | ||
component: () => ( | ||
|
||
component: RootComponent, | ||
}) | ||
|
||
function RootComponent() { | ||
return ( | ||
<> | ||
<div className="p-2 flex gap-2"> | ||
<div> | ||
<span>NCU App</span> | ||
</div> | ||
<Link to="/events" className="[&.active]:font-bold"> | ||
Events | ||
</Link> | ||
<div className="p-2 gap-2 justify-start"> | ||
<HStack className='bg-rose-300 items-center'> | ||
<DrawerSideBar /> | ||
<div className='flex flex-1 justify-center'> | ||
<span className=''>NCU App</span> | ||
</div> | ||
</HStack> | ||
</div> | ||
<hr /> | ||
|
||
<Outlet /> | ||
</> | ||
), | ||
}) | ||
</ > | ||
) | ||
} |
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,5 @@ | ||
import { createFileRoute } from '@tanstack/react-router' | ||
|
||
export const Route = createFileRoute('/home/infoCard')({ | ||
component: () => <div>Hello /home/infoCard!</div> | ||
}) |
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,35 @@ | ||
import { createFileRoute, Link } from '@tanstack/react-router'; | ||
import { AuthGuard } from '../utils/auth'; | ||
import { supabase } from '../utils/supabase'; | ||
|
||
const styles = { | ||
container: { | ||
flex: 1, | ||
backgroundColor: '#ffffff', | ||
}, | ||
}; | ||
|
||
export const Route = createFileRoute('/')({ | ||
beforeLoad: AuthGuard, | ||
loader: async () => { | ||
const { data, error } = await supabase | ||
.from('user') | ||
.select() | ||
|
||
if (error !== null) { | ||
throw error | ||
} | ||
|
||
return { user: data } | ||
}, | ||
component: HomeIndex | ||
}) | ||
|
||
function HomeIndex() { | ||
return ( | ||
<div style={styles.container}> | ||
<h1>Home</h1> | ||
<Link to="/home/infoCard">Go to /home/infoCard</Link> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.