Skip to content

Reset whole tutorial #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a settings page
Signed-off-by: Shubham Shah <shubhamshahrising@gmail.com>
  • Loading branch information
SavvyShah committed Sep 14, 2021
commit 6d105c785e70b15091e67a70d2f1da6dc2b0fcdd
7 changes: 3 additions & 4 deletions web-app/src/containers/Tutorial/components/SideMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,18 @@ const SideMenu = (props: Props) => {
<Icon type="prompt" size="xs" color="#EBEBEB" />
<span style={styles.itemText}>About</span>
</Item>
{/* <Item
<Item
key="settings"
disabled={props.page === 'settings'}
style={props.page === 'settings' ? styles.active : {}}
style={props.page === 'settings' ? styles.active(theme) : {}}
onClick={() => {
onMenuClose()
props.setPage('settings')
}}
>
<Icon type="set" size="small" color="#EBEBEB" />
<span style={styles.itemText}>Settings</span>
</Item>{' '}
*/}
</Item>
</Menu>
</Drawer>
)
Expand Down
70 changes: 65 additions & 5 deletions web-app/src/containers/Tutorial/containers/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,75 @@
import * as React from 'react'
import Button from 'components/Button'
import React, { useState } from 'react'
import { Theme } from '../../../styles/theme'
import Reset from '../components/Reset'

const styles = {
container: {
flexColumn: {
display: 'flex' as 'flex',
flexDirection: 'column' as 'column',
padding: '1rem',
},
container: (theme: Theme) => ({
display: 'flex' as 'flex',
flexDirection: 'column' as 'column',
backgroundColor: theme['$color-white'],
height: 'auto',
}),
header: (theme: Theme) => ({
display: 'flex' as 'flex',
alignItems: 'center',
justifyContent: 'space-between',
height: '2rem',
backgroundColor: theme['$color-fill1-2'],
fontSize: '1rem',
lineHeight: '1rem',
padding: '10px 0.4rem',
}),
content: {
padding: '0.5rem',
},
menu: {},
menuItem: {
display: 'flex' as 'flex',
border: '1px solid rgb(173, 173, 173)',
borderRadius: '5px',
padding: '0.5rem',
},
menuItemHeader: {
fontWeight: 'bold' as 'bold',
},
menuItemContent: {},
menuItemButton: {
marginLeft: 'auto' as 'auto',
},
}

const SettingsPage = () => {
return <div css={styles.container}>Settings coming soon...</div>
interface Props {}

const SettingsPage = (props: Props) => {
const onReset = () => {
console.log('Trigger a reset event here')
}
return (
<div css={styles.container}>
<div css={styles.header}>
<div>Settings</div>
</div>
<div css={styles.content}>
<div css={styles.menu}>
<div css={styles.menuItem}>
<div css={styles.flexColumn}>
<div css={styles.menuItemHeader}>Reset Tutorial</div>
<div css={styles.menuItemContent}>
This will reset the whole tutorial and change the source files back to the first level and first task
checkpoint.
</div>
</div>
<Reset style={styles.menuItemButton} warning onReset={onReset} />
</div>
</div>
</div>
</div>
)
}

export default SettingsPage
3 changes: 2 additions & 1 deletion web-app/src/containers/Tutorial/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ScrollContent from './components/ScrollContent'
import CompletedBanner from './components/CompletedBanner'
import { Theme } from '../../styles/theme'
import { useTheme } from 'emotion-theming'
import SettingsPage from './containers/Settings'

const styles = {
page: {
Expand Down Expand Up @@ -155,7 +156,7 @@ const TutorialPage = (props: PageProps) => {
)}
{page === 'review' && <ReviewPage levels={levels} onResetToPosition={onResetToPosition} />}

{/* {page === 'settings' && <SettingsPage />} */}
{page === 'settings' && <SettingsPage />}
</div>

{props.state === 'Completed' ? (
Expand Down
10 changes: 10 additions & 0 deletions web-app/stories/Settings.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react'
import { storiesOf } from '@storybook/react'
import SideBarDecorator from './utils/SideBarDecorator'
import Settings from '../src/containers/Tutorial/containers/Settings'

storiesOf('Settings', module)
.addDecorator(SideBarDecorator)
.add('Settings Page', () => {
return <Settings />
})