This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Add welcome window (with Terms and Conditions) #106
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cbd800d
Add welcome window (with Terms and Conditions)
kernelwhisperer 3a15cdb
Change ToS source to siderus.io/tos
kernelwhisperer 5093235
Merge remote-tracking branch 'origin/master' into feature/115-user-ag…
kernelwhisperer 8f456b5
Fix checkbox label on ToSPage
kernelwhisperer 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
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
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,84 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import ToS from './ToS' | ||
|
||
import { | ||
Window, | ||
Content, | ||
Toolbar, | ||
Actionbar, | ||
Button, | ||
CheckBox | ||
} from 'react-photonkit' | ||
|
||
const StyledContent = styled.div` | ||
h1:first-child { | ||
margin-top: 0px; | ||
} | ||
` | ||
|
||
const TermsSection = styled.section` | ||
background: white; | ||
height: calc(100vh - 250px); | ||
overflow: auto; | ||
padding: 0px 10px; | ||
` | ||
|
||
class TermsOfServicePage extends React.Component { | ||
state = { | ||
checked: false | ||
} | ||
|
||
handleCheckChange = () => { | ||
this.setState(prevState => ({ checked: !prevState.checked })) | ||
} | ||
|
||
handleSubmit = (event) => { | ||
event.preventDefault() | ||
if (!this.state.checked) return | ||
|
||
this.props.onAccept() | ||
} | ||
|
||
render () { | ||
const { onQuit } = this.props | ||
const { checked } = this.state | ||
|
||
return ( | ||
<form onSubmit={this.handleSubmit}> | ||
<Window> | ||
<Content> | ||
<StyledContent> | ||
<h1>Terms and Conditions</h1> | ||
<p>In order to continue, you need to accept the Terms and Conditions:</p> | ||
<TermsSection> | ||
<ToS /> | ||
</TermsSection> | ||
<CheckBox | ||
label="I accept terms and conditions" | ||
checked={checked} | ||
onChange={this.handleCheckChange} | ||
/> | ||
</StyledContent> | ||
</Content> | ||
<Toolbar ptType="footer"> | ||
<Actionbar> | ||
<Button text="Quit" ptStyle="default" onClick={onQuit} /> | ||
{ | ||
checked && | ||
<Button | ||
text="Done" | ||
ptStyle="primary" | ||
type="submit" | ||
pullRight | ||
/> | ||
} | ||
</Actionbar> | ||
</Toolbar> | ||
</Window> | ||
</form> | ||
) | ||
} | ||
} | ||
|
||
export default TermsOfServicePage |
Large diffs are not rendered by default.
Oops, something went wrong.
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,38 @@ | ||
import React from 'react' | ||
import OrionLogo from '../../../../docs/logo.svg' | ||
import styled from 'styled-components' | ||
|
||
import { | ||
Window, | ||
Content, | ||
Toolbar, | ||
Actionbar, | ||
Button | ||
} from 'react-photonkit' | ||
|
||
const Centered = styled.div` | ||
text-align: center !important; | ||
` | ||
|
||
function WelcomePage ({ onNext }) { | ||
return ( | ||
<Window> | ||
<Content> | ||
<Centered> | ||
<OrionLogo width='150px' /> | ||
<h1>Siderus Orion</h1> | ||
<h3>Welcome</h3> | ||
<p>Siderus Orion is the easiest way to start using the decentralised web with IPFS and Siderus Network. It supports a larger number of dApps as wel as the IPFS Browser Companion, to speed up your connection when surfing the decentralised web.</p> | ||
<p>This wizard will help you with the initial requirements.</p> | ||
</Centered> | ||
</Content> | ||
<Toolbar ptType="footer"> | ||
<Actionbar> | ||
<Button text="Next" ptStyle="primary" onClick={onNext} pullRight /> | ||
</Actionbar> | ||
</Toolbar> | ||
</Window> | ||
) | ||
} | ||
|
||
export default WelcomePage |
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,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Welcome</title> | ||
<style> | ||
.window-content { | ||
padding: 24px !important; | ||
display: initial !important; | ||
background-color: rgb(236, 236, 236) !important; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="host"></div> | ||
</body> | ||
|
||
<!-- Electron Javascript --> | ||
<script src="loader.js" charset="utf-8"></script> | ||
</html> |
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,7 @@ | ||
import Spinner from 'spin.js' | ||
|
||
var target = document.getElementById('host') | ||
new Spinner().spin(target) | ||
|
||
// After the spinner is rendered, we require the actual component | ||
setTimeout(() => require('./renderer.jsx'), 0) |
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,39 @@ | ||
import React from 'react' | ||
import ReactDom from 'react-dom' | ||
|
||
import WelcomePage from './Components/WelcomePage' | ||
import TermsOfServicePage from './Components/TermsOfServicePage' | ||
import { remote } from 'electron' | ||
import Settings from 'electron-settings' | ||
|
||
class WelcomeWindow extends React.Component { | ||
state = { | ||
page: 0 | ||
} | ||
|
||
handleNext = () => { | ||
this.setState({ page: 1 }) | ||
} | ||
|
||
handleQuit = () => { | ||
window.close() | ||
} | ||
|
||
handleAccept = () => { | ||
Settings.setSync('userAgreement', true) | ||
remote.app.emit('start-orion') | ||
window.close() | ||
} | ||
|
||
render () { | ||
const { page } = this.state | ||
|
||
return ( | ||
page === 0 | ||
? <WelcomePage onNext={this.handleNext} /> | ||
: <TermsOfServicePage onQuit={this.handleQuit} onAccept={this.handleAccept} /> | ||
) | ||
} | ||
} | ||
|
||
ReactDom.render(<WelcomeWindow />, document.querySelector('#host')) |
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,70 @@ | ||
/** | ||
* This window will prompt the user with the a short description about Orion | ||
* and with the Terms and Conditions which need to be read and accepted | ||
*/ | ||
|
||
import path from 'path' | ||
import url from 'url' | ||
|
||
import { BrowserWindow, remote } from 'electron' | ||
|
||
import isRenderer from 'is-electron-renderer' | ||
|
||
// Allow us to use create() in both electron windows and main process | ||
let BrowserWindowClass | ||
if (isRenderer) { | ||
BrowserWindowClass = remote.BrowserWindow | ||
} else { | ||
BrowserWindowClass = BrowserWindow | ||
} | ||
|
||
module.exports = {} | ||
|
||
module.exports.create = function createResolveIPNSWindow (app) { | ||
// Create the browser modal window. | ||
let thisWindow = new BrowserWindowClass({ | ||
title: 'Welcome', | ||
parent: app.mainWindow, | ||
modal: true, | ||
|
||
width: 600, | ||
minWidth: 600, | ||
height: 600, | ||
minHeight: 600, | ||
|
||
maximizable: false, | ||
resizable: true, | ||
fullscreenable: false, | ||
icon: path.join(__dirname, '../../../docs/logo.png'), | ||
|
||
show: false, | ||
webPreferences: { | ||
preload: path.join(__dirname, '../../report.js') | ||
} | ||
}) | ||
|
||
// Show menu only on StorageList | ||
thisWindow.setMenu(null) | ||
|
||
// Show the window only when ready | ||
thisWindow.once('ready-to-show', () => { | ||
thisWindow.show() | ||
}) | ||
|
||
// Load the index.html of the app. | ||
thisWindow.loadURL(url.format({ | ||
pathname: path.join(__dirname, 'index.html'), | ||
protocol: 'file:', | ||
slashes: true | ||
})) | ||
|
||
// Emitted when the window is closed. | ||
thisWindow.on('closed', () => { | ||
// Dereference the window object, usually you would store windows | ||
// in an array if your app supports multi windows, this is the time | ||
// when you should delete the corresponding element. | ||
thisWindow = null | ||
}) | ||
|
||
return thisWindow | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to "I have read and I agree to Siderus Terms and Conditions and Privacy policy"
Can in case change the Terms and Conditions and Privacy Policy to links that will open in the browser? :S