1- import {
2- LogoutIcon ,
3- MoonIcon ,
4- SunIcon ,
5- LoginIcon ,
6- } from '@heroicons/react/outline'
1+ import { LoginIcon , LogoutIcon , } from '@heroicons/react/outline'
72import clsx from 'clsx'
8- import { buildArray } from 'common/util/array'
9- import Router , { useRouter } from 'next/router'
10- import { useUser } from 'web/hooks/use-user'
11- import { firebaseLogin , firebaseLogout } from 'web/lib/firebase/users'
12- import { withTracking } from 'web/lib/service/analytics'
13- import { ProfileSummary } from './profile-summary'
14- import { Item , SidebarItem } from './sidebar-item'
3+ import { buildArray } from 'common/util/array'
4+ import Router , { useRouter } from 'next/router'
5+ import { useUser } from 'web/hooks/use-user'
6+ import { firebaseLogout } from 'web/lib/firebase/users'
7+ import { withTracking } from 'web/lib/service/analytics'
8+ import { ProfileSummary } from './profile-summary'
9+ import { Item , SidebarItem } from './sidebar-item'
1510import SiteLogo from '../site-logo'
16- import { Button , ColorType , SizeType } from 'web/components/buttons/button'
11+ import { Button , ColorType , SizeType } from 'web/components/buttons/button'
1712import { signupRedirect } from 'web/lib/util/signup'
18- import { useProfile } from 'web/hooks/use-profile'
19- import { useTheme } from 'web/hooks/use-theme'
13+ import { useProfile } from 'web/hooks/use-profile'
2014
2115export default function Sidebar ( props : {
2216 className ?: string
2317 isMobile ?: boolean
2418 navigationOptions : Item [ ]
2519} ) {
26- const { className, isMobile } = props
20+ const { className, isMobile} = props
2721 const router = useRouter ( )
2822 const currentPage = router . pathname
2923
3024 const user = useUser ( )
3125 const profile = useProfile ( )
3226
33- const { theme, setTheme } = useTheme ( )
34-
35- const toggleTheme = ( ) => {
36- setTheme ( theme === 'auto' ? 'dark' : theme === 'dark' ? 'light' : 'auto' )
37- }
3827 const navOptions = props . navigationOptions
3928
40- const bottomNavOptions = bottomNav ( ! ! user , theme , toggleTheme )
29+ const bottomNavOptions = bottomNav ( ! ! user )
4130
4231 return (
4332 < nav
4433 aria-label = "Sidebar"
4534 className = { clsx ( 'flex h-screen flex-col h-full max-h-screen overflow-y-auto' , className ) }
4635 >
47- < SiteLogo />
36+ < SiteLogo />
4837
49- { user === undefined && < div className = "h-[56px]" /> }
38+ { user === undefined && < div className = "h-[56px]" /> }
5039
51- { user && ! isMobile && < ProfileSummary user = { user } className = "mb-3" /> }
40+ { user && ! isMobile && < ProfileSummary user = { user } className = "mb-3" /> }
5241
5342 < div className = "mb-4 flex flex-col gap-1" >
5443 { navOptions . map ( ( item ) => (
55- < SidebarItem key = { item . name } item = { item } currentPage = { currentPage } />
44+ < SidebarItem key = { item . name } item = { item } currentPage = { currentPage } />
5645 ) ) }
5746
58- { user === null && < SignUpButton className = "mt-4" text = "Sign up" /> }
47+ { user === null && < SignUpButton className = "mt-4" text = "Sign up" /> }
5948 { /*{user === null && <SignUpAsMatchmaker className="mt-2" />}*/ }
6049
6150 { user && profile === null && (
@@ -66,7 +55,7 @@ export default function Sidebar(props: {
6655 </ div >
6756 < div className = "mb-6 mt-auto flex flex-col gap-1" >
6857 { bottomNavOptions . map ( ( item ) => (
69- < SidebarItem key = { item . name } item = { item } currentPage = { currentPage } />
58+ < SidebarItem key = { item . name } item = { item } currentPage = { currentPage } />
7059 ) ) }
7160 </ div >
7261 </ nav >
@@ -82,39 +71,10 @@ const logout = async () => {
8271
8372const bottomNav = (
8473 loggedIn : boolean ,
85- theme : 'light' | 'dark' | 'auto' | 'loading' ,
86- toggleTheme : ( ) => void
8774) =>
8875 buildArray < Item > (
89- {
90- name : theme ?? 'auto' ,
91- children :
92- theme === 'light' ? (
93- 'Light'
94- ) : theme === 'dark' ? (
95- 'Dark'
96- ) : (
97- < >
98- < span className = "hidden dark:inline" > Dark</ span >
99- < span className = "inline dark:hidden" > Light</ span > (auto)
100- </ >
101- ) ,
102- icon : ( { className, ...props } ) => (
103- < >
104- < MoonIcon
105- className = { clsx ( className , 'hidden dark:block' ) }
106- { ...props }
107- />
108- < SunIcon
109- className = { clsx ( className , 'block dark:hidden' ) }
110- { ...props }
111- />
112- </ >
113- ) ,
114- onClick : toggleTheme ,
115- } ,
116- ! loggedIn && { name : 'Sign in' , icon : LoginIcon , href : '/signin' } ,
117- loggedIn && { name : 'Sign out' , icon : LogoutIcon , onClick : logout }
76+ ! loggedIn && { name : 'Sign in' , icon : LoginIcon , href : '/signin' } ,
77+ loggedIn && { name : 'Sign out' , icon : LogoutIcon , onClick : logout }
11878 )
11979
12080export const SignUpButton = ( props : {
@@ -123,7 +83,7 @@ export const SignUpButton = (props: {
12383 color ?: ColorType
12484 size ?: SizeType
12585} ) => {
126- const { className, text, color, size } = props
86+ const { className, text, color, size} = props
12787
12888 return (
12989 < Button
@@ -137,20 +97,20 @@ export const SignUpButton = (props: {
13797 )
13898}
13999
140- export const SignUpAsMatchmaker = ( props : {
141- className ?: string
142- size ?: SizeType
143- } ) => {
144- const { className, size } = props
145-
146- return (
147- < Button
148- color = { 'indigo-outline' }
149- size = { size ?? 'md' }
150- onClick = { firebaseLogin }
151- className = { clsx ( 'w-full' , className ) }
152- >
153- Sign up as matchmaker
154- </ Button >
155- )
156- }
100+ // export const SignUpAsMatchmaker = (props: {
101+ // className?: string
102+ // size?: SizeType
103+ // }) => {
104+ // const {className, size} = props
105+ //
106+ // return (
107+ // <Button
108+ // color={'indigo-outline'}
109+ // size={size ?? 'md'}
110+ // onClick={firebaseLogin}
111+ // className={clsx('w-full', className)}
112+ // >
113+ // Sign up as matchmaker
114+ // </Button>
115+ // )
116+ // }
0 commit comments