Improvements to the demo experience

Explain what the email in the login is for
Make a guess at the users name
Don't mark uploaded files as persisted (since they're not)
This commit is contained in:
Mathias Biilmann Christensen 2016-12-30 09:40:15 -08:00
parent cbd2e7c904
commit 815701bf11
3 changed files with 18 additions and 4 deletions

View File

@ -20,6 +20,11 @@
color: #dd0000;
}
.message {
font-size: 1.1em;
margin: 20px 10px;
}
.button {
padding: .25em 1em;
height: auto;

View File

@ -17,14 +17,15 @@ export default class AuthenticationPage extends React.Component {
this.props.onLogin(this.state);
};
handleEmailChange = (e) => {
this.setState({ email: e.target.value });
handleEmailChange = (value) => {
this.setState({ email: value });
};
render() {
return (<section className={styles.root}>
<Card className={styles.card}>
<img src={logo} width={100} role="presentation" />
<p className={styles.message}>This is a demo, enter your email to start</p>
<Input
type="text"
label="Email"

View File

@ -9,6 +9,15 @@ function getFile(path) {
return obj;
}
function nameFromEmail(email) {
return email
.split('@').shift().replace(/[.-_]/g, ' ')
.split(' ')
.filter(f => f)
.map(s => s.substr(0, 1).toUpperCase() + (s.substr(1) || ''))
.join(' ');
}
export default class TestRepo {
constructor(config) {
this.config = config;
@ -24,7 +33,7 @@ export default class TestRepo {
}
authenticate(state) {
return Promise.resolve({ email: state.email });
return Promise.resolve({ email: state.email, name: nameFromEmail(state.email) });
}
entriesByFolder(collection) {
@ -71,7 +80,6 @@ export default class TestRepo {
} else {
window.repoFiles[folder][fileName].content = entry.raw;
}
mediaFiles.forEach(media => media.uploaded = true);
return Promise.resolve();
}