Skip to content

Commit

Permalink
Merge pull request #2 from ReputationVIP/team-settings
Browse files Browse the repository at this point in the history
Add TeamSettings React component
  • Loading branch information
bobey authored Jun 11, 2016
2 parents 2b2d3ce + 7a56d26 commit bc678f5
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 43 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ ecmascript # Enable ECMAScript2015+ syntax in app code

autopublish # Publish all data to the clients (for prototyping)
insecure # Allow all DB writes from clients (for prototyping)
react-meteor-data
2 changes: 2 additions & 0 deletions .meteor/versions
22 changes: 2 additions & 20 deletions client/main.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
<head>
<title>simple</title>
<title>MoodTracker.io</title>
</head>

<body>
<h1>Welcome to Meteor!</h1>

{{> hello}}
{{> info}}
<div id="render-target"></div>
</body>

<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>

<template name="info">
<h2>Learn Meteor!</h2>
<ul>
<li><a href="https://www.meteor.com/try">Do the Tutorial</a></li>
<li><a href="http://guide.meteor.com">Follow the Guide</a></li>
<li><a href="https://docs.meteor.com">Read the Docs</a></li>
<li><a href="https://forums.meteor.com">Discussions</a></li>
</ul>
</template>
22 changes: 0 additions & 22 deletions client/main.js

This file was deleted.

9 changes: 9 additions & 0 deletions client/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';

import App from '../imports/ui/App.jsx';

Meteor.startup(() => {
render(<App />, document.getElementById('render-target'));
});
3 changes: 3 additions & 0 deletions imports/api/teams.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Mongo } from 'meteor/mongo';

export const Teams = new Mongo.Collection('teams');
37 changes: 37 additions & 0 deletions imports/ui/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { Component, PropTypes } from 'react';
import TeamSettings from './TeamSettings';
import { createContainer } from 'meteor/react-meteor-data';

import { Teams } from '../api/teams.js';

// App component - represents the whole app
class App extends Component {

render() {
return (
<div className="container">
<header>
<h1>MoodTracker</h1>

<TeamSettings team={this.props.team} />
</header>
</div>
);
}
}

App.propTypes = {
team: PropTypes.object.isRequired
};

export default createContainer(() => {
if (!Teams.findOne({})) {
Teams.insert({
name: 'My Team'
});
}

return {
team: Teams.findOne({})
};
}, App);
28 changes: 28 additions & 0 deletions imports/ui/TeamSettings.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, { Component, PropTypes } from 'react';

export default class TeamParameters extends Component {
render() {
return (
<div>
<h2>Configure your team settings ({this.props.team.name})</h2>
<form>
<div class="form-row">
<label for="teamName">Team name</label>
<input id="teamName" type="text" />
</div>

<div class="form-row">
<label for="notificationHour">When will Slack asks your team its daily mood?</label>
<input id="notificationHour" type="text" />
</div>

<button type="submit">Update Settings</button>
</form>
</div>
);
}
}

TeamParameters.propTypes = {
team: PropTypes.object.isRequired
};
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"start": "meteor run"
},
"dependencies": {
"meteor-node-stubs": "~0.2.0"
"meteor-node-stubs": "~0.2.0",
"react": "^15.1.0",
"react-addons-pure-render-mixin": "^15.1.0",
"react-dom": "^15.1.0"
}
}
1 change: 1 addition & 0 deletions server/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import '../imports/api/teams.js';

Meteor.startup(() => {
// code to run on server at startup
Expand Down

0 comments on commit bc678f5

Please sign in to comment.