Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sambehrens committed Jan 31, 2019
0 parents commit d5ecca8
Show file tree
Hide file tree
Showing 48 changed files with 13,327 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
package-lock.json
.DS_Store
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Poodl

Welcome to Poodl!

**To get your development environment setup, follow the instructions below.**

_Before starting development, familiarize yourself with the merge strategy in the wiki_

### Ensure that you have yarn, npm, and node installed

If you are not sure if you do, type `yarn -v`, `npm -v`, and `node -v` and it will either say `command not found` or tell you a version number.

If any of the above are not installed, using homebrew, type `brew install yarn` or `brew install node`. npm comes with node

We are on `yarn 1`, `npm 6`, and `node 8`

Make sure you have the correct yarn installed

### Clone the repository onto your computer

`git clone <remote>`

### Install dependencies

`npm install && npm run client-install`

### Start development server

`yarn start:dev`

### Publish your changes

See the wiki page for our git merging strategy
23 changes: 23 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
44 changes: 44 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
34 changes: 34 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"classnames": "^2.2.6",
"jwt-decode": "^2.2.0",
"node-sass": "^4.11.0",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-redux": "^5.1.1",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.1",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:5000",
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
Binary file added client/public/favicon.ico
Binary file not shown.
26 changes: 26 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!-- Compiled and minified CSS -->
<link
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
<title>Poodl</title>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
</body>
</html>
15 changes: 15 additions & 0 deletions client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
68 changes: 68 additions & 0 deletions client/src/actions/authActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import axios from "axios";
import setAuthToken from "../utils/setAuthToken";
import jwt_decode from "jwt-decode";

import { GET_ERRORS, SET_CURRENT_USER, USER_LOADING } from "./types";

// Register User
export const registerUser = (userData, history) => dispatch => {
axios
.post("/api/users/register", userData)
.then(res => history.push("/login"))
.catch(err =>
dispatch({
type: GET_ERRORS,
payload: err.response.data
})
);
};

// Login - get user token
export const loginUser = userData => dispatch => {
axios
.post("/api/users/login", userData)
.then(res => {
// Save to localStorage

// Set token to localStorage
const { token } = res.data;
localStorage.setItem("jwtToken", token);
// Set token to Auth header
setAuthToken(token);
// Decode token to get user data
const decoded = jwt_decode(token);
// Set current user
dispatch(setCurrentUser(decoded));
})
.catch(err =>
dispatch({
type: GET_ERRORS,
payload: err.response.data
})
);
};

// Set logged in user
export const setCurrentUser = decoded => {
return {
type: SET_CURRENT_USER,
payload: decoded
};
};

// User loading
export const setUserLoading = () => {
return {
type: USER_LOADING
};
};

// Log user out
export const logoutUser = () => dispatch => {
// Remove token from local storage
localStorage.removeItem("jwtToken");
// Remove auth header for future requests
setAuthToken(false);
// Set current user to empty object {} which will set isAuthenticated to false
dispatch(setCurrentUser({}));
};
3 changes: 3 additions & 0 deletions client/src/actions/types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const GET_ERRORS = "GET_ERRORS";
export const USER_LOADING = "USER_LOADING";
export const SET_CURRENT_USER = "SET_CURRENT_USER";
4 changes: 4 additions & 0 deletions client/src/assets/stylesheets/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import './layout/header.scss';
@import './layout/footer.scss';
@import './buttons.scss';
@import './field.scss';
77 changes: 77 additions & 0 deletions client/src/assets/stylesheets/buttons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@import "./palette.scss";

.button {
border: 1px solid transparent;
border-radius: 5px;
box-shadow: none;
-webkit-appearance: none;

&:focus {
outline: 0;
border-color: blue;
}

&.small {
padding: 4px 12px;
font-size: 12px;
}

&.medium {
padding: 5px 16px;
font-size: 14px;
}

&.large {
padding: 6px 20px;
font-size: 16px;
}

&.primary {
background-color: $button-primary;
border-color: $button-primary;
color: #fff;

&:hover {
background-color: $button-primary-hover;
border-color: $button-primary-hover;
}

&:active {
background-color: $button-primary-active;
border-color: $button-primary-active;
}
}

&.secondary {
border-color: $button-primary;
color: $button-primary;
background-color: #fff;

&:hover {
background-color: $button-primary;
color: #fff;
}

&:active {
border-color: $button-primary-active;
color: #fff;
background-color: $button-primary-active;
}
}

&.tertiary {
border-color: $button-primary;
color: $button-primary;
background-color: #fff;

&:hover {
border-color: $button-primary-hover;
color: $button-primary-hover;
}

&:active {
border-color: $button-primary-active;
color: $button-primary-active;
}
}
}
29 changes: 29 additions & 0 deletions client/src/assets/stylesheets/field.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@import "./palette.scss";

.field {
border: 1px solid transparent;
border-radius: 5px;
box-shadow: none;
-webkit-appearance: none;
background-color: $gray-2;

&::placeholder {
color: $gray-4;
}

&:focus {
outline: 0;
border-color: $button-primary;
background-color: $gray-1;
}

&.normal {
padding: 5px 0px 5px 5px;
font-size: 14px;
}

&.large {
padding: 8px 0px 8px 5px;
font-size: 16px;
}
}
11 changes: 11 additions & 0 deletions client/src/assets/stylesheets/layout/footer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@import '../palette.scss';

.footer {
position: absolute;
bottom: 0;
width: 100%;
border-top: 1px #ccc solid;
height: 60px;
text-align: center;
color: #ccc;
}
Loading

0 comments on commit d5ecca8

Please sign in to comment.