More updates to the RSVP page

Slack message improvements
Font changes
This commit is contained in:
2017-02-13 17:19:22 +00:00
parent b62774e4cf
commit 5725161616
8 changed files with 48 additions and 26 deletions

View File

@@ -21,7 +21,7 @@ class Html extends React.Component {
<meta name="description" content={description} /> <meta name="description" content={description} />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" /> <link rel="apple-touch-icon" href="apple-touch-icon.png" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Palanquin+Dark|Yesteryear" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Palanquin+Dark|Niconne" />
{style && <style id="css" dangerouslySetInnerHTML={{ __html: style }} />} {style && <style id="css" dangerouslySetInnerHTML={{ __html: style }} />}
</head> </head>
<body> <body>

View File

@@ -1,9 +1,6 @@
@import '../variables.css'; @import '../variables.css';
.root { .root {
display: flex;
flex-flow: row wrap;
flex-direction: column;
width: 100%; width: 100%;
margin: 0 0 40px; margin: 0 0 40px;
padding: 20px; padding: 20px;
@@ -11,11 +8,13 @@
border-radius: 14px; border-radius: 14px;
background-color: rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.4);
color: #fff; color: #fff;
text-align: left;
} }
@media (--sm-viewport) { @media (--sm-viewport) {
.root { .root {
width: 50%; width: 40%;
max-width: 400px;
} }
} }
@@ -41,11 +40,14 @@
outline: 0; outline: 0;
border: 3px solid #fff; border: 3px solid #fff;
border-radius: 14px; border-radius: 14px;
background: #fff; background-color: #fff;
color: #616161; color: #616161;
font-size: 18px; font-size: 18px;
line-height: 1.3333333; line-height: 1.3333333;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; transition:
border-color ease-in-out 0.3s,
box-shadow ease-in-out 0.3s,
background-color ease-in-out 0.3s;
} }
.input:focus { .input:focus {

View File

@@ -73,22 +73,15 @@ class RsvpCard extends React.Component {
}); });
if (!this.state.saveCompleted) { if (!this.state.saveCompleted) {
this.setState({ saveSompleted: true }); this.setState({ saveCompleted: true });
this.saveData('completed', true); this.saveData('completed', true);
} }
setTimeout(() => {
this.setState({
summaryState: null,
summary: null,
});
}, 5000);
} }
state[stateKey] = data.success ? 'saved' : 'error'; state[stateKey] = data.success ? 'saved' : 'error';
setTimeout(() => { setTimeout(() => {
this.setState(state); this.setState(state);
}, 500); }, 1000);
}).catch(() => { }).catch(() => {
state[stateKey] = 'error'; state[stateKey] = 'error';
}); });
@@ -106,6 +99,14 @@ class RsvpCard extends React.Component {
this.saveData('dietary', event.target.value); this.saveData('dietary', event.target.value);
}; };
handleDietaryChange = (event) => {
const value = event.target.value;
clearTimeout(this.dietaryChangeTimer);
this.dietaryChangeTimer = setTimeout(() => {
this.saveData('dietary', value);
}, 5000);
}
handleStarterChange = (event) => { handleStarterChange = (event) => {
this.saveData('starter', event.target.value); this.saveData('starter', event.target.value);
}; };
@@ -245,8 +246,10 @@ class RsvpCard extends React.Component {
name="dietary" name="dietary"
autoComplete="off" autoComplete="off"
defaultValue={this.props.person.dietary} defaultValue={this.props.person.dietary}
onChange={this.handleDietaryChange}
onBlur={this.handleDietaryBlur} onBlur={this.handleDietaryBlur}
onFocus={this.props.focusCallback} onFocus={this.props.focusCallback}
placeholder="None"
/> />
<div className={s.iconContainer}> <div className={s.iconContainer}>
{this.state.saveDietary === 'saved' ? <MdCheck size={30} color="green" /> : null} {this.state.saveDietary === 'saved' ? <MdCheck size={30} color="green" /> : null}

View File

@@ -4,7 +4,7 @@
* ======================================================================== */ * ======================================================================== */
--font-family-base: 'Palanquin Dark', 'Segoe UI', 'HelveticaNeue-Light', sans-serif; --font-family-base: 'Palanquin Dark', 'Segoe UI', 'HelveticaNeue-Light', sans-serif;
--font-family-cursive: 'Yesteryear', cursive; --font-family-cursive: 'Niconne', cursive;
/* /*
* Layout * Layout

View File

@@ -32,6 +32,7 @@
margin: 0 auto 40px; margin: 0 auto 40px;
text-align: center; text-align: center;
color: #fff; color: #fff;
text-shadow: 3px 3px 8px var(--colour-nearblack);
font-size: 1.3em; font-size: 1.3em;
} }

View File

@@ -19,28 +19,36 @@
} }
.bgImageFocus { .bgImageFocus {
filter: grayscale(0.4) brightness(1); filter: grayscale(0.4) brightness(0.8);
} }
.container { .container {
padding-top: 5vh; padding-top: 5vh;
margin: 0 20px; margin: 0 20px;
text-align: center;
} }
.heading { .heading {
font-family: var(--font-family-cursive); font-family: var(--font-family-cursive);
color: var(--colour-nearblack);
text-align: center; text-align: center;
margin-top: 0;
font-size: 4em;
color: #fff;
text-shadow: 2px 2px 6px var(--colour-nearblack);
} }
.flexContainer { .flexContainer {
display: flex; display: flex;
flex-direction: row;
flex-flow: row wrap; flex-flow: row wrap;
justify-content: space-around;
} }
@media (--sm-viewport) { .notes {
.flexContainer { display: inline-block;
flex-flow: row nowrap; margin: 0 auto 40px;
} padding: 0 15px;
border: 3px solid #fff;
border-radius: 14px;
background-color: rgba(0, 0, 0, 0.4);
color: #fff;
} }

View File

@@ -35,12 +35,15 @@ class Rsvp extends React.Component {
].join(' ')} ].join(' ')}
/> />
<div className={s.container}> <div className={s.container}>
<h1 className={s.heading}>Répondez, s&#39;il vous plaît</h1> <h1 className={s.heading}>Odpovezte prosím</h1>
<div className={s.flexContainer}> <div className={s.flexContainer}>
{this.props.people.map(person => ( {this.props.people.map(person => (
<RsvpCard key={person.key} person={person} focusCallback={this.focusCallback} /> <RsvpCard key={person.key} person={person} focusCallback={this.focusCallback} />
))} ))}
</div> </div>
<div className={s.notes}>
<p>You can modify the above details up until XX/XX/XXXX</p>
</div>
</div> </div>
</div> </div>
); );

View File

@@ -120,7 +120,12 @@ app.post('/rsvp/save', (req, res) => {
where: { key: req.body.key }, where: { key: req.body.key },
}).then(data => { }).then(data => {
if (data.completed) { if (data.completed) {
sendSlackMsgWithDebounce(`${data.firstname} ${data.lastname} has saved their RSVP:\n${data.firstname} ${data.attending ? 'is' : 'is not'} coming.${data.attending ? `\nStarter: ${starters[data.starter]}\nMain: ${mains[data.main]}\nDietary requirements: ${data.dietary ? data.dietary : 'None'}` : ''}`, req.body.key); const attending = `\nAttending: ${data.attending ? 'Yes' : 'No'}`;
const starter = (data.attending && data.starter !== -1) ? `\nStarter: ${starters[data.starter]}` : '';
const main = (data.attending && data.main !== -1) ? `\nMain: ${mains[data.main]}` : '';
const dietary = (data.attending && data.dietary) ? `\nDietary requirements: ${data.dietary}` : '';
sendSlackMsgWithDebounce(`${data.firstname} ${data.lastname} has saved their RSVP:${attending}${starter}${main}${dietary}`, req.body.key);
} }
res.json({ res.json({
success: true, success: true,