Initial commit
This commit is contained in:
7
src/client/global.scss
Normal file
7
src/client/global.scss
Normal file
@@ -0,0 +1,7 @@
|
||||
.text-right {
|
||||
text-align: right
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center
|
||||
}
|
||||
79
src/client/index.js
Normal file
79
src/client/index.js
Normal file
@@ -0,0 +1,79 @@
|
||||
import '@babel/register';
|
||||
import '@babel/polyfill';
|
||||
|
||||
import 'antd/dist/antd.min';
|
||||
import 'antd/dist/antd.min.css';
|
||||
|
||||
import './global.scss';
|
||||
import 'react-responsive-carousel/lib/styles/carousel.css';
|
||||
|
||||
|
||||
import React from 'react';
|
||||
import {Helmet} from "react-helmet";
|
||||
import {render} from 'react-dom';
|
||||
import {Provider} from 'mobx-react';
|
||||
import {BrowserRouter, Route} from 'react-router-dom';
|
||||
|
||||
window.moment = require('moment');
|
||||
// require(`imports-loader?this=>window,fix=>module.exports=0!snapsvg/dist/snap.svg.js`);
|
||||
|
||||
import AppState from '../common/stores/appstate';
|
||||
import Routes from '../common/routes';
|
||||
import RootComponent from "../common/pages/Root";
|
||||
import { LocaleProvider } from 'antd';
|
||||
import enUS from 'antd/lib/locale-provider/en_US';
|
||||
import {getMobileOperatingSystem} from "../common/stores/firebase";
|
||||
import cinnamonSugar from "cinnamon-sugar";
|
||||
import ButterToast from "butter-toast";
|
||||
import * as firebase from "firebase";
|
||||
|
||||
// var injectTapEventPlugin = require("react-tap-event-plugin");
|
||||
// injectTapEventPlugin();
|
||||
|
||||
const initialState = window.__INITIAL_STATE__ || {};
|
||||
|
||||
const appstate = new AppState(Object.assign({
|
||||
token: localStorage.getItem('id_token') || '',
|
||||
userData: {
|
||||
}
|
||||
}, initialState));
|
||||
|
||||
|
||||
// if (getMobileOperatingSystem() !== 'iOS') {
|
||||
firebase.messaging().onMessage((payload) => {
|
||||
console.log("Message received cok.", payload);
|
||||
// alert(payload.notification.body);
|
||||
|
||||
if(payload.data.new_message){
|
||||
appstate.message.pushNewMessage(payload.data);
|
||||
}
|
||||
|
||||
if(payload.data.notification_type == 'notification'){
|
||||
appstate.notification.unread_notif+=1
|
||||
}
|
||||
const toast = cinnamonSugar({
|
||||
kind: 'crisp',
|
||||
theme: 'info',
|
||||
// picture: 'http://lorempixel.com/150/150/people',
|
||||
title: <a href={'inbox/'}>{payload.notification.title}</a>, // you can also add jsx code here!
|
||||
// message: JSON.stringify(payload), // you can also add jsx code here!
|
||||
message: payload.notification.body, // you can also add jsx code here!
|
||||
toastTimeout: 4000,
|
||||
icon: 'bell' // literally any font awesome 4.7 icon
|
||||
// you may also add here regular butter-toast options, such as toastTimeout,
|
||||
// name, sticky, etc..
|
||||
});
|
||||
ButterToast.raise(toast)
|
||||
});
|
||||
// }
|
||||
|
||||
render(
|
||||
<Provider appstate={ appstate }>
|
||||
<LocaleProvider locale={enUS}>
|
||||
<BrowserRouter>
|
||||
<Route path='/' component={RootComponent} />
|
||||
</BrowserRouter>
|
||||
</LocaleProvider>
|
||||
</Provider>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
Reference in New Issue
Block a user