-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
6,984 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root=true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "ishare-c35bb" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,5 @@ typings/ | |
# dotenv environment variables file | ||
.env | ||
|
||
|
||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# ishare | ||
|
||
[![Build Status](https://travis-ci.org/oSoc17/istwaar.svg?branch=master)](https://travis-ci.org/oSoc17/istwaar) | ||
[![Build Status](https://travis-ci.org/oSoc17/ishare.svg?branch=develop)](https://travis-ci.org/oSoc17/istwaar) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"hosting": { | ||
"public": "build", | ||
"rewrites": [ | ||
{ | ||
"source": "**", | ||
"destination": "/index.html" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "test", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"connected-react-router": "^4.2.3", | ||
"firebase": "^4.1.3", | ||
"react": "^15.6.1", | ||
"react-dom": "^15.6.1", | ||
"react-redux": "^5.0.5", | ||
"react-router-dom": "^4.1.1", | ||
"react-scripts": "1.0.10", | ||
"redux": "^3.7.1", | ||
"redux-devtools-extension": "^2.13.2", | ||
"redux-thunk": "^2.2.0" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test --env=jsdom", | ||
"eject": "react-scripts eject" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="theme-color" content="#000000"> | ||
<!-- | ||
manifest.json provides metadata used when your web app is added to the | ||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> | ||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript> | ||
You need to enable JavaScript to run this app. | ||
</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "192x192", | ||
"type": "image/png" | ||
} | ||
], | ||
"start_url": "./index.html", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { Route, Redirect } from 'react-router-dom'; | ||
|
||
const ProtectedRoute = ({ render, isAuthorized, redirectUrl, ...otherProps }) => | ||
<Route | ||
{...otherProps} | ||
render={ | ||
isAuthorized | ||
? render | ||
: props => | ||
<Redirect | ||
to={{ pathname: redirectUrl, state: { from: props.location } }} | ||
/> | ||
} | ||
/>; | ||
|
||
export default ProtectedRoute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { test } from '../redux/actions'; | ||
import { Route, Switch, Redirect } from 'react-router-dom'; | ||
import { ConnectedRouter } from 'connected-react-router'; | ||
import Home from './Home'; | ||
import Story from './Story'; | ||
import './App.css'; | ||
|
||
class App extends Component { | ||
componentDidMount() { | ||
this.props.test(); | ||
} | ||
|
||
render() { | ||
const { history, user } = this.props; | ||
|
||
return ( | ||
<div className="app"> | ||
<ConnectedRouter history={history}> | ||
<Switch> | ||
<Route | ||
path="/" | ||
exact | ||
render={props => <Home user={user} {...props} />} | ||
/> | ||
<Route | ||
path="/story/:storyId" | ||
render={props => <Story user={user} {...props} />} | ||
/> | ||
<Route render={() => <Redirect to="/" />} /> | ||
</Switch> | ||
</ConnectedRouter> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = state => ({ | ||
user: state.user, | ||
room: state.room | ||
}); | ||
|
||
export default connect(mapStateToProps, { test })(App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
|
||
const Home = () => <div>This is home!</div>; | ||
|
||
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import App from './App'; | ||
import store, { history } from '../redux/store'; | ||
|
||
const Root = () => | ||
<Provider store={store}> | ||
<App history={history} /> | ||
</Provider>; | ||
|
||
export default Root; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Root from './Root'; | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<Root />, div); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
|
||
const Story = () => <div>This is a Story!</div>; | ||
|
||
export default Story; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import firebase from 'firebase'; | ||
|
||
// Initialize Firebase | ||
const config = { | ||
apiKey: "AIzaSyAmVHUHVmO5OS1-pKcLP_YkPwffWFhdIu0", | ||
authDomain: "ishare-c35bb.firebaseapp.com", | ||
databaseURL: "https://ishare-c35bb.firebaseio.com", | ||
projectId: "ishare-c35bb", | ||
storageBucket: "ishare-c35bb.appspot.com", | ||
messagingSenderId: "530521724254" | ||
}; | ||
|
||
firebase.initializeApp(config); | ||
|
||
export const firebaseDatabase = firebase.database(); | ||
export const firebaseStorage = firebase.storage; | ||
export const firebaseAuth = firebase.auth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
font-family: sans-serif; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import './index.css'; | ||
import Root from './containers/Root'; | ||
import registerServiceWorker from './registerServiceWorker'; | ||
|
||
ReactDOM.render(<Root />, document.getElementById('root')); | ||
|
||
registerServiceWorker(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const actionTypes = { | ||
test: 'TEST' | ||
}; | ||
|
||
export const test = () => ({ type: actionTypes.test }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { combineReducers } from 'redux'; | ||
import { reducer as user } from './user'; | ||
import { reducer as room } from './room'; | ||
|
||
export const rootReducer = combineReducers({ | ||
user, | ||
room | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { actionTypes } from '../actions'; | ||
|
||
const initialState = {}; | ||
|
||
export const reducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
case actionTypes.test: | ||
return state; | ||
default: | ||
return state; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { actionTypes } from '../actions'; | ||
|
||
const initialState = { | ||
authPending: true, | ||
isAuthorized: false, | ||
id: '', | ||
name: '', | ||
error: null | ||
}; | ||
|
||
export const reducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
case actionTypes.logout: | ||
return Object.assign({}, initialState, { authPending: false }); | ||
case actionTypes.fetchUserAuthFulfilled: | ||
return Object.assign({}, state, { | ||
...action.user, | ||
isAuthorized: true, | ||
authPending: false | ||
}); | ||
case actionTypes.fetchUserAuthRejected: | ||
return Object.assign({}, state, { | ||
error: action.error, | ||
isAuthorized: false, | ||
authPending: false | ||
}); | ||
default: | ||
return state; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { createStore, applyMiddleware } from 'redux'; | ||
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly'; | ||
import { createBrowserHistory } from 'history'; | ||
import { connectRouter, routerMiddleware } from 'connected-react-router'; | ||
import { rootReducer } from './modules'; | ||
import thunk from 'redux-thunk'; | ||
|
||
export const history = createBrowserHistory(); | ||
const middlewares = [thunk, routerMiddleware(history)]; | ||
|
||
const store = createStore( | ||
connectRouter(history)(rootReducer), | ||
composeWithDevTools(applyMiddleware(...middlewares)) | ||
); | ||
|
||
export default store; |
Oops, something went wrong.