Added the files.
This commit is contained in:
commit
38ccdcbfe5
124 changed files with 32079 additions and 0 deletions
11
client/src/config/apiRoutes.js
Normal file
11
client/src/config/apiRoutes.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* eslint-disable import/no-anonymous-default-export */
|
||||
export default {
|
||||
API_URL: 'http://localhost:3001',
|
||||
user: {
|
||||
user: "/api/v1/staff",
|
||||
},
|
||||
auth: {
|
||||
register: "/api/v1/staff/register",
|
||||
login: "/api/v1/staff/login"
|
||||
},
|
||||
};
|
37
client/src/config/config.js
Normal file
37
client/src/config/config.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { lazy } from 'react'
|
||||
import locales from './locales'
|
||||
import apiRoutes from './apiRoutes'
|
||||
import routes from './routes'
|
||||
import getMenuItems from './menuItems'
|
||||
import themes from './themes'
|
||||
import parseLanguages from 'base-shell/lib/utils/locale'
|
||||
|
||||
const config = {
|
||||
auth: {
|
||||
signInURL: '/',
|
||||
},
|
||||
apiRoutes,
|
||||
routes,
|
||||
locale: {
|
||||
locales,
|
||||
defaultLocale: parseLanguages( 'en'),
|
||||
onError: (e) => {
|
||||
//console.warn(e)
|
||||
return
|
||||
},
|
||||
},
|
||||
menu: {
|
||||
getMenuItems,
|
||||
},
|
||||
theme: {
|
||||
themes,
|
||||
defaultThemeID: 'default',
|
||||
defaultType: 'light',
|
||||
},
|
||||
pages: {
|
||||
LandingPage: lazy(() => import('../pages/LandingPage/LandingPage')),
|
||||
PageNotFound: lazy(() => import('../pages/PageNotFound/PageNotFound')),
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
1
client/src/config/index.js
Normal file
1
client/src/config/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './config.js'
|
43
client/src/config/locales/de.js
Normal file
43
client/src/config/locales/de.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { defineMessages } from 'react-intl'
|
||||
|
||||
const messages = defineMessages({
|
||||
app_name: 'React Meist Gesucht',
|
||||
sign_in: 'Anmelden',
|
||||
sign_out: 'Abmelden',
|
||||
sign_up: 'Anmeldung',
|
||||
email: 'Email',
|
||||
username: 'Nutzername',
|
||||
password: 'Passwort',
|
||||
about: 'Über',
|
||||
home: 'Startseite',
|
||||
page_not_found: 'Seite nicht gefunden',
|
||||
settings: 'Einstellungen',
|
||||
theme: 'Thema',
|
||||
default: 'Standard',
|
||||
red: 'Rot',
|
||||
green: 'Grün',
|
||||
language: 'Sprache',
|
||||
en: 'Englisch',
|
||||
de: 'Deutsch',
|
||||
ru: 'Russisch',
|
||||
menu: 'Menü',
|
||||
menu_mini_mode: 'Mini-Menü',
|
||||
offline: 'Offline',
|
||||
demos:'Demos',
|
||||
dialog_demo:'Demo Dialog',
|
||||
dialog_title:'Dialog titel',
|
||||
dialog_action:'JA, Löschen',
|
||||
dialog_message:`Dialognachricht. Sie können hier so viel Text einfügen, wie Sie möchten.
|
||||
Stellen Sie eine Frage oder zeigen Sie eine Warnung an, bevor Sie etwas löschen.
|
||||
Sie können den Aktionstext auch auf "JA, Löschen" setzen und diese Aktion ausführen, indem Sie eine "handleAction" -Stütze übergeben.
|
||||
Dies erhält einen "handleClose" -Rückruf, mit dem Sie den Dialog schließen können, wenn Ihre Aktion abgeschlossen ist.`,
|
||||
toast_demo:'Demo Toast',
|
||||
filter_demo:'Demo filter',
|
||||
list_page_demo:'List Page Demo mit {count} Zeilen',
|
||||
forgot_password:'Vergessen passwort',
|
||||
password_reset:'Passwort zurücksetzen',
|
||||
password_confirm:'Passwortbestätigung',
|
||||
registration:'Registrierung'
|
||||
})
|
||||
|
||||
export default messages
|
43
client/src/config/locales/en.js
Normal file
43
client/src/config/locales/en.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { defineMessages } from 'react-intl'
|
||||
|
||||
const messages = defineMessages({
|
||||
app_name: 'React Most Wanted',
|
||||
sign_in: 'Sign in',
|
||||
sign_out: 'Sign out',
|
||||
sign_up: 'Sign up',
|
||||
email: 'Email',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
about: 'About',
|
||||
home: 'Home',
|
||||
page_not_found: 'Page not found',
|
||||
settings: 'Settings',
|
||||
theme: 'Theme',
|
||||
default: 'Default',
|
||||
red: 'Red',
|
||||
green: 'Green',
|
||||
language: 'Language',
|
||||
en: 'English',
|
||||
de: 'German',
|
||||
ru: 'Russian',
|
||||
menu: 'Menu',
|
||||
menu_mini_mode: 'Mini menu',
|
||||
offline: 'Offline',
|
||||
demos:'Demos',
|
||||
dialog_demo:'Demo dialog',
|
||||
dialog_title:'Dialog title',
|
||||
dialog_action:'YES, Delete',
|
||||
dialog_message:`Dialog message. You can put as much text as you want here.
|
||||
Ask a question or show a warning befor deleting something.
|
||||
You can also set the action text to somerhing like "YES, Delete" and run that action by passing a "handleAction" prop.
|
||||
This receives a "handleClose" callback with wich you can close the dialog when your action is done.`,
|
||||
toast_demo:'Demo toast',
|
||||
filter_demo:'Demo filter',
|
||||
list_page_demo:'List Page demo with {count} rows',
|
||||
forgot_password:'Forgot password',
|
||||
password_reset:'Password reset',
|
||||
password_confirm:'Password confirm',
|
||||
registration:'Registration'
|
||||
})
|
||||
|
||||
export default messages
|
19
client/src/config/locales/index.js
Normal file
19
client/src/config/locales/index.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const locales = [
|
||||
{
|
||||
locale: 'en',
|
||||
messages: import('./en'),
|
||||
//loadData: import(`@formatjs/intl-relativetimeformat/dist/locale-data/en`),
|
||||
},
|
||||
{
|
||||
locale: 'ru',
|
||||
messages: import('./ru'),
|
||||
//loadData: import(`@formatjs/intl-relativetimeformat/dist/locale-data/ru`),
|
||||
},
|
||||
{
|
||||
locale: 'de',
|
||||
messages: import('./de'),
|
||||
//loadData: import(`@formatjs/intl-relativetimeformat/dist/locale-data/de`),
|
||||
},
|
||||
]
|
||||
|
||||
export default locales
|
43
client/src/config/locales/ru.js
Normal file
43
client/src/config/locales/ru.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { defineMessages } from 'react-intl'
|
||||
|
||||
const messages = defineMessages({
|
||||
app_name: 'React Most Wanted',
|
||||
sign_in: 'Вход',
|
||||
sign_out: 'Выход',
|
||||
sign_up: 'Зарегистрироваться',
|
||||
email: 'Эл. адрес',
|
||||
username: 'Имя пользователя',
|
||||
password: 'Пароль',
|
||||
about: 'О нас',
|
||||
home: 'Главная',
|
||||
page_not_found: 'Страница не найдена',
|
||||
settings: 'Настройки',
|
||||
theme: 'Тема',
|
||||
default: 'По умолчанию',
|
||||
red: 'Красная',
|
||||
green: 'Зелёная',
|
||||
language: 'Язык',
|
||||
en: 'English',
|
||||
de: 'Deutsch',
|
||||
ru: 'Русский',
|
||||
menu: 'Меню',
|
||||
menu_mini_mode: 'Мини меню',
|
||||
offline: 'Офлайн',
|
||||
demos:'Демонстрации',
|
||||
dialog_demo:'Демонстрация диалога',
|
||||
dialog_title:'Заголовок диалога',
|
||||
dialog_action:'Да, удалить',
|
||||
dialog_message:`Диалоговое сообщение. Вы можете поместить сюда сколько угодно текста.
|
||||
Задайте вопрос или покажите предупреждение перед удалением чего-либо.
|
||||
Вы также можете задать для текста действия значение somerhing, например «Да, Удалить», и запустить это действие, передав опору «handleAction».
|
||||
Он получает обратный вызов handleClose, с которым вы можете закрыть диалог, когда ваше действие будет выполнено.`,
|
||||
toast_demo:'Демонстрация toast',
|
||||
filter_demo:'Демонстрация фильтра',
|
||||
list_page_demo:'Демонстрация страницы списка с {count} строками',
|
||||
forgot_password:'Забыли пароль',
|
||||
password_reset:'Сброс пароля',
|
||||
password_confirm:'Подтвердить пароль',
|
||||
registration:'Регистрация',
|
||||
})
|
||||
|
||||
export default messages
|
149
client/src/config/menuItems.js
Normal file
149
client/src/config/menuItems.js
Normal file
|
@ -0,0 +1,149 @@
|
|||
import ChatBubble from '@material-ui/icons/ChatBubble'
|
||||
import DashboardIcon from '@material-ui/icons/Dashboard'
|
||||
import ExitToAppIcon from '@material-ui/icons/ExitToApp'
|
||||
import FilterList from '@material-ui/icons/FilterList'
|
||||
import GetApp from '@material-ui/icons/GetApp'
|
||||
import InfoOutlined from '@material-ui/icons/InfoOutlined'
|
||||
import LanguageIcon from '@material-ui/icons/Language'
|
||||
import LockIcon from '@material-ui/icons/Lock'
|
||||
import QuestionAnswer from '@material-ui/icons/QuestionAnswer'
|
||||
import React from 'react'
|
||||
import SettingsIcon from '@material-ui/icons/SettingsApplications'
|
||||
import StyleIcon from '@material-ui/icons/Style'
|
||||
import Tab from '@material-ui/icons/Tab'
|
||||
import ViewList from '@material-ui/icons/ViewList'
|
||||
import Web from '@material-ui/icons/Web'
|
||||
import allLocales from './locales'
|
||||
import allThemes from './themes'
|
||||
import { store, Action } from "reducers";
|
||||
|
||||
const getMenuItems = (props) => {
|
||||
const {
|
||||
intl,
|
||||
updateLocale,
|
||||
locale,
|
||||
menuContext,
|
||||
themeContext,
|
||||
a2HSContext,
|
||||
auth: authData,
|
||||
} = props
|
||||
const { isAuthMenuOpen, setMiniMode } = menuContext
|
||||
const { themeID, setThemeID } = themeContext
|
||||
const { setAuth } = authData
|
||||
const { isAppInstallable, isAppInstalled, deferredPrompt } = a2HSContext
|
||||
|
||||
const state = store.getState();
|
||||
let isAuthorised = state.Auth.get('authenticated');
|
||||
|
||||
store.subscribe(_ => {
|
||||
isAuthorised = store.getState().Auth.get('authenticated');
|
||||
isAuthorised && setAuth({ isAuthenticated: isAuthorised })
|
||||
})
|
||||
|
||||
setMiniMode(false);
|
||||
|
||||
const localeItems = allLocales.map((l) => {
|
||||
return {
|
||||
value: undefined,
|
||||
visible: true,
|
||||
primaryText: intl.formatMessage({ id: l.locale }),
|
||||
onClick: () => {
|
||||
updateLocale(l.locale)
|
||||
},
|
||||
leftIcon: <LanguageIcon />,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const themeItems = allThemes.map((t) => {
|
||||
return {
|
||||
value: undefined,
|
||||
visible: true,
|
||||
primaryText: intl.formatMessage({ id: t.id }),
|
||||
onClick: () => {
|
||||
setThemeID(t.id)
|
||||
},
|
||||
leftIcon: <StyleIcon style={{ color: t.color }} />,
|
||||
}
|
||||
})
|
||||
|
||||
if (isAuthMenuOpen || !isAuthorised) {
|
||||
return [
|
||||
{
|
||||
value: '/',
|
||||
onClick: isAuthorised
|
||||
? () => {
|
||||
setAuth({ isAuthenticated: false })
|
||||
store.dispatch(Action.LogoutUser())
|
||||
}
|
||||
: () => {},
|
||||
visible: true,
|
||||
primaryText: isAuthorised
|
||||
? intl.formatMessage({ id: 'sign_out' })
|
||||
: intl.formatMessage({ id: 'sign_in' }),
|
||||
leftIcon: isAuthorised ? <ExitToAppIcon /> : <LockIcon />,
|
||||
},
|
||||
]
|
||||
}
|
||||
return [
|
||||
{
|
||||
value: '/home',
|
||||
visible: isAuthorised,
|
||||
primaryText: intl.formatMessage({ id: 'home' }),
|
||||
leftIcon: <DashboardIcon />,
|
||||
},
|
||||
{
|
||||
value: '/staff_context',
|
||||
visible: true,
|
||||
primaryText: 'Staff Context',
|
||||
leftIcon: <Web />,
|
||||
},
|
||||
{
|
||||
value: '/patient_context',
|
||||
visible: true,
|
||||
primaryText: 'Patient Context',
|
||||
leftIcon: <Web />,
|
||||
},
|
||||
{
|
||||
value: '/division_context',
|
||||
visible: true,
|
||||
primaryText: 'Division Context',
|
||||
leftIcon: <Web />,
|
||||
},
|
||||
{ divider: true },
|
||||
{
|
||||
primaryText: intl.formatMessage({ id: 'settings' }),
|
||||
primaryTogglesNestedList: true,
|
||||
leftIcon: <SettingsIcon />,
|
||||
nestedItems: [
|
||||
{
|
||||
primaryText: intl.formatMessage({ id: 'theme' }),
|
||||
secondaryText: intl.formatMessage({ id: themeID }),
|
||||
primaryTogglesNestedList: true,
|
||||
leftIcon: <StyleIcon />,
|
||||
nestedItems: themeItems,
|
||||
},
|
||||
{
|
||||
primaryText: intl.formatMessage({ id: 'language' }),
|
||||
secondaryText: intl.formatMessage({ id: locale }),
|
||||
primaryTogglesNestedList: true,
|
||||
leftIcon: <LanguageIcon />,
|
||||
nestedItems: localeItems,
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
value: null,
|
||||
visible: isAppInstallable && !isAppInstalled,
|
||||
onClick: () => {
|
||||
deferredPrompt.prompt()
|
||||
},
|
||||
primaryText: intl.formatMessage({
|
||||
id: 'install',
|
||||
defaultMessage: 'Install',
|
||||
}),
|
||||
leftIcon: <GetApp />,
|
||||
},
|
||||
]
|
||||
}
|
||||
export default getMenuItems
|
42
client/src/config/routes.js
Normal file
42
client/src/config/routes.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* eslint-disable react/jsx-key */
|
||||
import React, { lazy } from 'react'
|
||||
import AuthorizedRoute from 'base-shell/lib/components/AuthorizedRoute/AuthorizedRoute'
|
||||
import UnauthorizedRoute from 'base-shell/lib/components/UnauthorizedRoute/UnauthorizedRoute'
|
||||
import { Route } from 'react-router-dom'
|
||||
|
||||
const SignIn = lazy(() => import('../pages/SignIn/SignIn'))
|
||||
const SignUp = lazy(() => import('../pages/SignUp/SignUp'))
|
||||
const PasswordReset = lazy(() => import('../pages/PasswordReset/PasswordReset'))
|
||||
const About = lazy(() => import('../pages/About'))
|
||||
const Home = lazy(() => import('../pages/Home/Home'))
|
||||
const StaffContext = lazy(() => import('../pages/StaffContext/wrapper'))
|
||||
const PatientContext = lazy ( () => import('../pages/PatientContext'))
|
||||
const DivisionContext = lazy(() => import('../pages/DivisionContext'))
|
||||
|
||||
const routes = [
|
||||
<UnauthorizedRoute path="/signin" redirectTo="/" exact component={SignIn} />,
|
||||
<UnauthorizedRoute path="/auth/staff/login" redirectTo="/home" exact component={SignIn} />,
|
||||
<UnauthorizedRoute path="/auth/medical/login" redirectTo="/home" exact component={SignIn} />,
|
||||
<UnauthorizedRoute path="/auth/nurse/login" redirectTo="/home" exact component={SignIn} />,
|
||||
<UnauthorizedRoute path="/signup" redirectTo="/" exact component={SignUp} />,
|
||||
<UnauthorizedRoute path="/auth/staff/signup" redirectTo="/home" exact component={SignUp} />,
|
||||
<UnauthorizedRoute path="/auth/medical/signup" redirectTo="/home" exact component={SignUp} />,
|
||||
<UnauthorizedRoute path="/auth/nurse/signup" redirectTo="/home" exact component={SignUp} />,
|
||||
|
||||
<UnauthorizedRoute
|
||||
path="/password_reset"
|
||||
redirectTo="/"
|
||||
exact
|
||||
component={PasswordReset}
|
||||
/>,
|
||||
<Route path="/about" exact component={About} />,
|
||||
|
||||
|
||||
<AuthorizedRoute path="/home" exact component={Home} />,
|
||||
<AuthorizedRoute path="/patient_context" exact component={PatientContext} />,
|
||||
<AuthorizedRoute path="/staff_context" exact component={StaffContext} />,
|
||||
<AuthorizedRoute path="/division_context" exact component={DivisionContext} />,
|
||||
|
||||
]
|
||||
|
||||
export default routes
|
33
client/src/config/themes.js
Normal file
33
client/src/config/themes.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
import red from '@material-ui/core/colors/red'
|
||||
import pink from '@material-ui/core/colors/pink'
|
||||
import green from '@material-ui/core/colors/green'
|
||||
|
||||
const themes = [
|
||||
{
|
||||
id: 'default',
|
||||
},
|
||||
{
|
||||
id: 'red',
|
||||
color: red[500],
|
||||
source: {
|
||||
palette: {
|
||||
primary: red,
|
||||
secondary: pink,
|
||||
error: red,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'green',
|
||||
color: green[500],
|
||||
source: {
|
||||
palette: {
|
||||
primary: green,
|
||||
secondary: red,
|
||||
error: red,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export default themes
|
Loading…
Add table
Add a link
Reference in a new issue