Browse Source

updating for this year

logicp 5 years ago
parent
commit
016236c903
6 changed files with 505 additions and 393 deletions
  1. 2 3
      src/App.js
  2. 21 22
      src/form.js
  3. BIN
      src/invite.jpeg
  4. 17 17
      src/server/index.js
  5. BIN
      xmas.sqlite
  6. 465 351
      yarn.lock

+ 2 - 3
src/App.js

@@ -55,15 +55,14 @@ class App extends Component {
     })
   }
 
-  render() {
+ render() {
     return (
       <div className="App" style={styles.main}>
 
         <header className="App-header" style={styles.meat}>
-          <div id='main-image' style={styles.logo}/>
+          <div id='main-image' style={styles.logo} />
           <ChristmasForm />
         </header>
-
       </div>
     );
   }

+ 21 - 22
src/form.js

@@ -35,17 +35,16 @@ const styles = theme => ({
   }
 });
 
-const cats = [
-  'Cool Cat',
-  'Bad Kitty',
-  'King of the Jungle',
-  'Incel cat',
-  'C-ch-at-d',
-  'Sabretooth Bro',
-  'Higher order being',
-  'Decadent feline',
-  'Trapped in the litter box',
-  'All claw and no meow'
+const superheroes = [
+  'Sabre Claus',
+  'Rudolph Mistletoe',
+  'Mr. Frosty',
+  'Scrooge',
+  'John McClane',
+  'Midnight Snacking Gremlin',
+  'Grinch',
+  'Tiny Tim',
+  'Jesus'
 ]
 
 const partyHosts = ['In-Young', 'Emmanuel']
@@ -54,7 +53,7 @@ const MakeAttendees = (attendees) => {
   const items = []
   if (attendees) {
     for (let i = 0; i < attendees.length; i++) {
-      items.push(<div style={{flex: 1}}key={i}>{i+1}. <div>Name: <span className='attendee-name'>{attendees[i].name}</span></div><div>Type: <span className='attendee-name'>{attendees[i].cat ? attendees[i].cat : 'Cat hater'}</span></div>{partyHosts.indexOf(attendees[i].name) < 0 && attendees[i].guest ? <div><span className='attendee-name'> ...with an extra guest!! ;)</span> </div> : '' }
+      items.push(<div style={{flex: 1}}key={i}>{i+1}. <div>Name: <span className='attendee-name'>{attendees[i].name}</span></div><div>Type: <span className='attendee-name'>{attendees[i].superhero ? attendees[i].superhero : 'The Villain of All Things Christmas'}</span></div>{partyHosts.indexOf(attendees[i].name) < 0 && attendees[i].guest ? <div><span className='attendee-name'> ...with an extra guest!! ;)</span> </div> : '' }
       <br /><br /></div>)
     }
   }
@@ -68,7 +67,7 @@ class TextFields extends React.Component {
     super(props)
     this.state = {
       name: '',
-      cat: '',
+      superhero: '',
       significantOther: false,
       attendees: undefined
     }
@@ -87,17 +86,17 @@ class TextFields extends React.Component {
   };
 
   handleFoodSelect = (event) => {
-    this.setState({cat: event.target.value})
+    this.setState({superhero: event.target.value})
   }
 
   handleSignificantOther = () => {
     this.setState({significantOther: !this.state.significantOther})
   }
 
-  Cats = () => {
+  Superheroes = () => {
     const items = []
-    for (let i = 0; i < cats.length; i++) {
-      items.push(<MenuItem key={i} value={cats[i]}>{cats[i]}</MenuItem>)
+    for (let i = 0; i < superheroes.length; i++) {
+      items.push(<MenuItem key={i} value={superheroes[i]}>{superheroes[i]}</MenuItem>)
     }
 
     return items
@@ -107,7 +106,7 @@ class TextFields extends React.Component {
     if (this.state.name && this.state.name.length > 0) {
       const body = JSON.stringify({
         name: this.state.name,
-        cat: this.state.cat,
+        superhero: this.state.superhero,
         guest: this.state.significantOther,
       })
 
@@ -162,7 +161,7 @@ class TextFields extends React.Component {
           />
       </div>
       <FormControl className='food-select'>
-        <InputLabel htmlFor="food-helper">What sort of cat are you?</InputLabel>
+        <InputLabel htmlFor="food-helper">Your ultimate celebrative festivian of the season</InputLabel>
         <Select
           value={this.state.cat}
           onChange={this.handleFoodSelect}
@@ -170,9 +169,9 @@ class TextFields extends React.Component {
           <MenuItem value="">
             <em>The hell you talking about</em>
           </MenuItem>
-          {this.Cats()}
+          {this.Superheroes()}
         </Select>
-        <FormHelperText>Calling all cats and jive turkeys</FormHelperText>
+        <FormHelperText>Your courage is needed to maximize festivities</FormHelperText>
       </FormControl>
       <div style={styles.fullWidth}>
       <br />
@@ -210,4 +209,4 @@ TextFields.propTypes = {
   classes: PropTypes.object.isRequired,
 };
 
-export default withStyles(styles)(TextFields);
+export default withStyles(styles)(TextFields);

BIN
src/invite.jpeg


+ 17 - 17
src/server/index.js

@@ -12,10 +12,10 @@ const database = new Sequelize({
 const Attendee = database.define('attendee', {
   name: Sequelize.STRING,
   guest: Sequelize.BOOLEAN,
-  cat: Sequelize.STRING
+  superhero: Sequelize.STRING
 });
 
-// const whitelist = ['http://localhost:3001', 'http://localhost', 'http://127.0.0.1', 'http://christmas.logicp.ca']
+const whitelist = ['http://localhost:3001', 'http://localhost', 'http://127.0.0.1', 'http://christmas.logicp.ca']
 
 // const corsOptions = {
 //   origin: function (origin, callback) {
@@ -69,10 +69,10 @@ class App {
             .spread( attendee => {
               console.log(attendee)
               attendee.guest = req.body.significantOther
-              attendee.cat = req.body.cat
+              attendee.superhero = req.body.superhero
               Attendee.update({
                 name: req.body.name,
-                cat: req.body.cat,
+                superhero: req.body.superhero,
                 guest: req.body.significantOther
               }, {
                 where: {
@@ -91,20 +91,20 @@ class App {
 const app = new App().express
 
 app.listen(3002)
-// app.options('/attendee', function (req, res) {
-//   res.setHeader("Access-Control-Allow-Origin", whitelist.join('|'));
-//   res.setHeader('Access-Control-Allow-Methods', '*');
-//   res.setHeader("Access-Control-Allow-Headers", "*");
-//   res.end();
-// });
+ app.options('/attendee', function (req, res) {
+   res.setHeader("Access-Control-Allow-Origin", whitelist.join('|'));
+   res.setHeader('Access-Control-Allow-Methods', '*');
+   res.setHeader("Access-Control-Allow-Headers", "*");
+   res.end();
+});
 
-// app.all('*', function(req, res, next) {
-//   if (whitelist.indexOf(req.headers.origin) >= 0){
-//       res.header("Access-Control-Allow-Origin", req.headers.origin);
-//   }
-//   res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
-//   next();
-// })
+ app.all('*', function(req, res, next) {
+   if (whitelist.indexOf(req.headers.origin) >= 0){
+       res.header("Access-Control-Allow-Origin", req.headers.origin);
+   }
+   res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
+   next();
+ })
 
 database.sync().then(() => {
     console.log(`Listening on port ${3002}`);

BIN
xmas.sqlite


File diff suppressed because it is too large
+ 465 - 351
yarn.lock


Some files were not shown because too many files changed in this diff