11import * as React from 'react'
22import { useState } from 'react'
33import { Footer } from './style/Footer'
4- import { Main , Info , Headline , Title } from './style/Main'
4+ import { Main , Info , Headline , Title , TitleActions } from './style/Main'
55import { Theme , dark , light } from './style/theme'
66import { GlobalStyle } from './style/Global'
77import { Schedule } from './Schedule'
@@ -13,6 +13,8 @@ import { ThemeSwitcher } from './ThemeSwitcher'
1313
1414import LockIcon from 'feather-icons/dist/icons/lock.svg'
1515import UnLockIcon from 'feather-icons/dist/icons/unlock.svg'
16+ import EyeOffIcon from 'feather-icons/dist/icons/eye-off.svg'
17+ import EyeIcon from 'feather-icons/dist/icons/eye.svg'
1618import { TimeZoneSelector } from './timezones'
1719
1820export const App = ( ) => {
@@ -35,12 +37,16 @@ export const App = () => {
3537 1730 : 'Dinner Break' ,
3638 1900 : 'Evening Activities' ,
3739 } ,
40+ hidePastSessions : false ,
3841 }
3942 const hash =
4043 new URLSearchParams ( window . location . search ) . get ( 'schedule' ) ??
4144 new URL ( window . location . href ) . hash ?. substr ( 1 ) ??
4245 false
4346
47+ const hidePastSessionsDefault =
48+ new URLSearchParams ( window . location . search ) . get ( 'hidePastSessions' ) !== null
49+
4450 if ( hash ) {
4551 cfg = {
4652 ...cfg ,
@@ -56,6 +62,9 @@ export const App = () => {
5662 const [ updatedTimeZone , updateTimeZone ] = useState ( cfg . tz )
5763 const [ updatedSessions , updateSessions ] = useState ( cfg . sessions )
5864 const [ editing , setEditing ] = useState ( false )
65+ const [ hidePastSessions , setHidePastSessions ] = useState (
66+ hidePastSessionsDefault ,
67+ )
5968 return (
6069 < ThemeProvider theme = { theme } >
6170 < GlobalStyle />
@@ -99,6 +108,7 @@ export const App = () => {
99108 onChange = { ( { target : { value } } ) => updateTimeZone ( value ) }
100109 />
101110 </ DateEditor >
111+
102112 < ThemeSwitcher
103113 currentTheme = { theme }
104114 darkTheme = { dark }
@@ -140,17 +150,24 @@ export const App = () => {
140150 < Headline >
141151 { updatedName } : { updatedDay }
142152 </ Headline >
143- < ThemeSwitcher
144- currentTheme = { theme }
145- darkTheme = { dark }
146- lightTheme = { light }
147- onSwitch = { updateTheme }
148- />
153+ < TitleActions >
154+ < Button onClick = { ( ) => setHidePastSessions ( ( h ) => ! h ) } >
155+ { hidePastSessions && < EyeOffIcon /> }
156+ { ! hidePastSessions && < EyeIcon /> }
157+ </ Button >
158+ < ThemeSwitcher
159+ currentTheme = { theme }
160+ darkTheme = { dark }
161+ lightTheme = { light }
162+ onSwitch = { updateTheme }
163+ />
164+ </ TitleActions >
149165 </ Title >
150166 < Schedule
151167 sessions = { cfg . sessions }
152168 eventTimezoneName = { cfg . tz }
153169 conferenceDate = { cfg . day }
170+ hidePastSessions = { hidePastSessions }
154171 />
155172 </ >
156173 ) }
0 commit comments