mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 02:12:53 +00:00
changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
.Content {
|
.Content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
min-width: 0;
|
||||||
.post + .post {
|
.post + .post {
|
||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ export default class Preview extends React.Component{
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(i >= this.props.postLimit) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return elements;
|
return elements;
|
||||||
@@ -32,7 +34,7 @@ export default class Preview extends React.Component{
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="Content">
|
<div class="Content">
|
||||||
{posts.length > 0 ? this.insertPosts(posts): ""}
|
{posts.length > 0 ? this.insertPosts(posts): null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default class Index extends React.Component {
|
|||||||
<div>
|
<div>
|
||||||
<Header />
|
<Header />
|
||||||
<div class="Main">
|
<div class="Main">
|
||||||
{typeof this.page === 'undefined' && !fetching ? <Preview posts={this.props.redux.preview.posts} /> : null}
|
{typeof this.page === 'undefined' && !fetching ? <Preview posts={this.props.redux.preview.posts} postLimit={this.props.redux.postLimit}/> : null}
|
||||||
{this.page === 'post' && !fetching ? <Post content={this.props.redux.post}/> : null}
|
{this.page === 'post' && !fetching ? <Post content={this.props.redux.post}/> : null}
|
||||||
{fetching ? loadingElement : null}
|
{fetching ? loadingElement : null}
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ import * as types from "./constants";
|
|||||||
import marked from 'marked';
|
import marked from 'marked';
|
||||||
import 'whatwg-fetch';
|
import 'whatwg-fetch';
|
||||||
|
|
||||||
|
export function increasePostLimit(){
|
||||||
|
return {
|
||||||
|
type: types.INCREASE_POST_LIMIT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initPreview(posts) {
|
function initPreview(posts) {
|
||||||
return {
|
return {
|
||||||
type: types.INIT_PREVIEW,
|
type: types.INIT_PREVIEW,
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ export const INIT_PREVIEW = 'INIT_PREVIEW';
|
|||||||
export const FILTER_PREVIEW = 'FILTER_PREVIEW';
|
export const FILTER_PREVIEW = 'FILTER_PREVIEW';
|
||||||
export const LOAD_POST = 'LOAD_POST';
|
export const LOAD_POST = 'LOAD_POST';
|
||||||
export const FETCHING = 'FETCHING';
|
export const FETCHING = 'FETCHING';
|
||||||
|
export const INCREASE_POST_LIMIT = 'INCREASE_POST_LIMIT';
|
||||||
@@ -14,12 +14,10 @@ const defaultState = {
|
|||||||
preview: {
|
preview: {
|
||||||
posts: []
|
posts: []
|
||||||
},
|
},
|
||||||
filteredPreview: {
|
|
||||||
posts: []
|
|
||||||
},
|
|
||||||
post: "",
|
post: "",
|
||||||
fetched: false,
|
fetched: false,
|
||||||
fetching: false
|
fetching: false,
|
||||||
|
postLimit: 10
|
||||||
};
|
};
|
||||||
|
|
||||||
//default reducer
|
//default reducer
|
||||||
@@ -32,10 +30,6 @@ function reducer(state = defaultState, action) {
|
|||||||
fetched: true,
|
fetched: true,
|
||||||
fetching: false
|
fetching: false
|
||||||
});
|
});
|
||||||
case types.FILTER_PREVIEW:
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
filteredPreview: Object.assign({}, state.filteredPreview, action.posts)
|
|
||||||
});
|
|
||||||
case types.LOAD_POST:
|
case types.LOAD_POST:
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
post: action.post,
|
post: action.post,
|
||||||
@@ -47,6 +41,10 @@ function reducer(state = defaultState, action) {
|
|||||||
fetched : false,
|
fetched : false,
|
||||||
fetching: true
|
fetching: true
|
||||||
});
|
});
|
||||||
|
case types.INCREASE_POST_LIMIT:
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
postLimit : state.postLimit + 10
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//return present state if no actions get called
|
//return present state if no actions get called
|
||||||
|
|||||||
@@ -7,8 +7,9 @@
|
|||||||
"build": "webpack && babel-node metadata.js",
|
"build": "webpack && babel-node metadata.js",
|
||||||
"c9": "webpack-dev-server --port $PORT --host $IP --hot --content-base dist --history-api-fallback",
|
"c9": "webpack-dev-server --port $PORT --host $IP --hot --content-base dist --history-api-fallback",
|
||||||
"dev": "webpack-dev-server --content-base public --inline --hot --history-api-fallback",
|
"dev": "webpack-dev-server --content-base public --inline --hot --history-api-fallback",
|
||||||
"prod": "export NODE_ENV=production && webpack -p && babel-node metadata.js",
|
"prod": "export NODE_ENV=production && webpack -p && babel-node metadata.js && go build",
|
||||||
"prod-win": "set NODE_ENV=production && webpack -p && babel-node metadata.js"
|
"prod-win": "set NODE_ENV=production && webpack -p && babel-node metadata.js && go build",
|
||||||
|
"deploy" : "npm run prod && ./mywebsite"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"github.com/NYTimes/gziphandler"
|
||||||
|
|
||||||
//local import paths relative to app.yaml file
|
//local import paths relative to app.yaml file
|
||||||
"mywebsite/server/controller/api"
|
"mywebsite/server/controller/api"
|
||||||
@@ -35,6 +36,9 @@ func main(){
|
|||||||
|
|
||||||
db.Mongo.Connect()
|
db.Mongo.Connect()
|
||||||
|
|
||||||
|
//register middleware
|
||||||
|
handle := gziphandler.GzipHandler(route.Routes())
|
||||||
|
|
||||||
log.Println("Starting Server...")
|
log.Println("Starting Server...")
|
||||||
log.Println(http.ListenAndServe(":"+strconv.Itoa(configurations.Port), route.Routes()))
|
log.Println(http.ListenAndServe(":"+strconv.Itoa(configurations.Port), handle))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user