-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Axel Boberg <[email protected]>
- Loading branch information
1 parent
e1e97fb
commit 7d65476
Showing
8 changed files
with
163 additions
and
0 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,68 @@ | ||
import React from 'react' | ||
import { SharedContext } from '../../sharedContext' | ||
|
||
import { Modal } from '../Modal' | ||
import { Icon } from '../Icon' | ||
|
||
import content from './onboarding.json' | ||
|
||
import './style.css' | ||
|
||
export function Onboarding ({ onClose = () => {} }) { | ||
const [open, setOpen] = React.useState(false) | ||
const [shared, applyShared] = React.useContext(SharedContext) | ||
|
||
React.useEffect(() => { | ||
console.log('Getting time', new Date(content.updatedAt).getTime(), shared?._userDefaults?.didCompleteOnboarding) | ||
|
||
if (shared?._userDefaults == null) { | ||
return | ||
} | ||
|
||
if (shared?._userDefaults?.didCompleteOnboarding >= new Date(content.updatedAt).getTime()) { | ||
return | ||
} | ||
|
||
setOpen(true) | ||
}, [shared?._userDefaults]) | ||
|
||
function handleClose () { | ||
applyShared({ | ||
_userDefaults: { | ||
didCompleteOnboarding: new Date(content.updatedAt).getTime() | ||
} | ||
}) | ||
setOpen(false) | ||
} | ||
|
||
return ( | ||
<Modal open={open} size='small'> | ||
<div className='Onboarding'> | ||
<h1>{content.heading}</h1> | ||
<div className='Onboarding-paragraphs'> | ||
{ | ||
content.paragraphs.map(paragraph => { | ||
return ( | ||
<div className='Onboarding-paragraph'> | ||
<div className='Onboarding-paragraphIcon'> | ||
{ | ||
paragraph.icon && | ||
<Icon name={paragraph.icon} /> | ||
} | ||
</div> | ||
<div> | ||
<h3>{paragraph.heading}</h3> | ||
{paragraph.body || ''} | ||
</div> | ||
</div> | ||
) | ||
}) | ||
} | ||
</div> | ||
<div className='Onboarding-footer'> | ||
<button className='Button Button--primary' onClick={() => handleClose()}>Get started</button> | ||
</div> | ||
</div> | ||
</Modal> | ||
) | ||
} |
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,26 @@ | ||
{ | ||
"updatedAt": "2024-05-16T11:41:00", | ||
"heading": "Welcome to Bridge", | ||
"paragraphs": [ | ||
{ | ||
"icon": "edit", | ||
"heading": "Customize the workspace", | ||
"body": "Enter the edit mode to change the layout of your workspace, this mode is always available next to settings in the top right" | ||
}, | ||
{ | ||
"icon": "widget", | ||
"heading": "Widgets", | ||
"body": "Use widgets to add functionality to your workspace" | ||
}, | ||
{ | ||
"icon": "rundown", | ||
"heading": "Rundown", | ||
"body": "Add items to your rundown by right-clicking or dragging them in" | ||
}, | ||
{ | ||
"icon": "inspector", | ||
"heading": "Inspector", | ||
"body": "The inspector lets you edit items" | ||
} | ||
] | ||
} |
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,25 @@ | ||
.Onboarding { | ||
display: flex; | ||
padding: 30px; | ||
height: 100%; | ||
|
||
flex-direction: column; | ||
box-sizing: border-box; | ||
} | ||
|
||
.Onboarding-paragraphs { | ||
height: 100%; | ||
margin: 15px 20px 0; | ||
text-align: left; | ||
} | ||
|
||
.Onboarding-paragraph { | ||
display: flex; | ||
margin-bottom: 15px; | ||
|
||
align-items: center; | ||
} | ||
|
||
.Onboarding-paragraphIcon { | ||
margin-right: 15px; | ||
} |
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