-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Changing locales * Changes to Redux models and services * Rebuild of cases components, allowing for CRUD * Fixing found type errors
- Loading branch information
1 parent
1d60cc9
commit 98aa2b5
Showing
35 changed files
with
1,349 additions
and
518 deletions.
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
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,22 +1,24 @@ | ||
import React, { FC, useEffect } from 'react'; | ||
import { Spin } from 'antd'; | ||
import { connect } from 'dva'; | ||
import { connect, useDispatch } from 'dva'; | ||
|
||
import { Case } from '@/services/definitions'; | ||
import { ReduxResourceState } from '@/utils/reduxModel'; | ||
|
||
export interface CaseNameProps { | ||
id: number; | ||
cases: Case[]; | ||
dispatch: Function; | ||
cases: ReduxResourceState<Case>; | ||
} | ||
|
||
const CaseName: FC<CaseNameProps> = ({ id, cases, dispatch }) => { | ||
const CaseName: FC<CaseNameProps> = ({ id, cases }) => { | ||
const dispatch = useDispatch(); | ||
useEffect(() => { | ||
dispatch({ type: 'cases/fetchOne', payload: id }); | ||
dispatch({ type: 'cases/fetchOne', payload: { id } }); | ||
}, []); | ||
const oneCase = cases.find(value => value.id === id); | ||
const oneCase = cases.data.find(value => value.id === id); | ||
if (!oneCase) return <Spin />; | ||
|
||
return <div>{oneCase ? oneCase.name : <Spin />}</div>; | ||
return <>{oneCase.name}</>; | ||
}; | ||
|
||
export default connect(({ cases }: CaseNameProps) => ({ cases }))(CaseName); |
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
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,22 +1,44 @@ | ||
import component from './en-US/component'; | ||
import globalHeader from './en-US/globalHeader'; | ||
import menu from './en-US/menu'; | ||
import { menuLocale } from './en-US/menu'; | ||
import pwa from './en-US/pwa'; | ||
import settingDrawer from './en-US/settingDrawer'; | ||
import settings from './en-US/settings'; | ||
import BaseLocales from './pl-PL'; | ||
import { structuredLocale } from '../utils/structedLocale'; | ||
import { casesLocale } from '../pages/cases/locales/en-US'; | ||
import { globalsLocale } from './en-US/globals'; | ||
|
||
export default { | ||
const [labels] = structuredLocale({ | ||
...menuLocale, | ||
...globalsLocale, | ||
...casesLocale, | ||
}); | ||
|
||
const Locale = { | ||
'navBar.lang': 'Languages', | ||
'layout.user.link.help': 'Help', | ||
'layout.user.link.privacy': 'Privacy', | ||
'layout.user.link.terms': 'Terms', | ||
'app.preview.down.block': 'Download this page to your local project', | ||
'app.welcome.link.fetch-blocks': 'Get all block', | ||
'app.welcome.link.block-list': 'Quickly build standard, pages based on `block` development', | ||
...globalHeader, | ||
...menu, | ||
...settingDrawer, | ||
...settings, | ||
...pwa, | ||
...component, | ||
...labels, | ||
}; | ||
|
||
// Checking if all keys are in both locale | ||
if (new Set(Object.keys(BaseLocales)) !== new Set(Object.keys(Locale))) { | ||
const baseLocaleSet = new Set(Object.keys(BaseLocales)); | ||
const localeSet = new Set(Object.keys(Locale)); | ||
const missingLocaleKeys = Array.from(baseLocaleSet).filter(blKey => !localeSet.has(blKey)); | ||
const missingBaseLocaleKeys = Array.from(localeSet).filter(lKey => !baseLocaleSet.has(lKey)); | ||
|
||
if (missingLocaleKeys.length > 0) | ||
console.error(`Missing locale keys: ${missingLocaleKeys.join(', ')}`); | ||
if (missingBaseLocaleKeys.length > 0) | ||
console.error(`Missing base locale keys: ${missingBaseLocaleKeys.join(', ')}`); | ||
} | ||
|
||
export default Locale; |
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
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 @@ | ||
export const globalsLocale = { | ||
error: 'Błąd', | ||
lists: { | ||
edit: 'Edit', | ||
delete: 'Delete', | ||
create: 'Create', | ||
total: 'Total', | ||
actions: 'Actions', | ||
failedDownload: 'Downloading elements failed', | ||
}, | ||
form: { | ||
save: 'Save', | ||
reset: 'Reset', | ||
}, | ||
}; |
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,32 +1,42 @@ | ||
export default { | ||
'menu.account': 'Account', | ||
'menu.account.center': 'Account Center', | ||
'menu.account.logout': 'Logout', | ||
'menu.account.settings': 'Account Settings', | ||
'menu.account.trigger': 'Trigger Error', | ||
'menu.admin': 'admin', | ||
'menu.cases': 'Cases', | ||
'menu.cases.new': 'New', | ||
'menu.cases.list': 'List', | ||
'menu.tags': 'Tags', | ||
'menu.exception': 'Exception', | ||
'menu.exception.not-find': '404', | ||
'menu.exception.not-permission': '403', | ||
'menu.exception.server-error': '500', | ||
'menu.exception.trigger': 'Trigger', | ||
'menu.home': 'Home', | ||
'menu.institutions': 'Institutions', | ||
'menu.institutions.new': 'New', | ||
'menu.institutions.list': 'List', | ||
'menu.features': 'Features', | ||
'menu.features.list': 'List', | ||
'menu.letters': 'Letters', | ||
'menu.letters.list': 'List', | ||
'menu.letters.channels': 'Channels', | ||
'menu.users': 'Users', | ||
'menu.login': 'Login', | ||
'menu.more-blocks': 'More Blocks', | ||
'menu.register': 'Register', | ||
'menu.register.result': 'Register Result', | ||
'menu.welcome': 'Welcome', | ||
export const menuLocale = { | ||
menu: { | ||
home: 'Homepage', | ||
cases: { | ||
self: 'Cases', | ||
new: 'New', | ||
edit: 'Edit', | ||
list: 'List', | ||
}, | ||
tags: { | ||
self: 'Tags', | ||
new: 'New', | ||
edit: 'Edit', | ||
list: 'List', | ||
}, | ||
institutions: { | ||
self: 'Institutions', | ||
new: 'New', | ||
edit: 'Edit', | ||
list: 'List', | ||
}, | ||
letters: { | ||
self: 'Letters', | ||
new: 'New', | ||
edit: 'Edit', | ||
list: 'List', | ||
}, | ||
features: { | ||
self: 'Features', | ||
new: 'New', | ||
edit: 'Edit', | ||
list: 'List', | ||
}, | ||
channels: { | ||
self: 'Channels', | ||
new: 'New', | ||
edit: 'Edit', | ||
list: 'List', | ||
}, | ||
users: 'Users', | ||
}, | ||
}; |
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,5 +1,29 @@ | ||
import menu from './pl-PL/menu'; | ||
import component from './pl-PL/component'; | ||
import globalHeader from './pl-PL/globalHeader'; | ||
import pwa from './pl-PL/pwa'; | ||
import settingDrawer from './pl-PL/settingDrawer'; | ||
import settings from './pl-PL/settings'; | ||
import { menuLocale } from './pl-PL/menu'; | ||
import { structuredLocale } from '../utils/structedLocale'; | ||
import { casesLocale } from '../pages/cases/locales/pl-PL'; | ||
import { globalsLocale } from './pl-PL/globals'; | ||
|
||
const [labels, keys] = structuredLocale({ | ||
...menuLocale, | ||
...globalsLocale, | ||
...casesLocale, | ||
}); | ||
export const localeKeys = keys; | ||
|
||
export default { | ||
...menu, | ||
'navBar.lang': 'Języki', | ||
'layout.user.link.help': 'Pomoc', | ||
'layout.user.link.privacy': 'Prywatność', | ||
'layout.user.link.terms': 'Regulamin', | ||
...globalHeader, | ||
...settingDrawer, | ||
...settings, | ||
...pwa, | ||
...component, | ||
...labels, | ||
}; |
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 default { | ||
'component.tagSelect.expand': 'Rozwiń', | ||
'component.tagSelect.collapse': 'Zwiń', | ||
'component.tagSelect.all': 'Wszystkie', | ||
}; |
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,14 @@ | ||
export default { | ||
'component.globalHeader.search': 'Szukaj', | ||
'component.globalHeader.help': 'Pomoc', | ||
'component.globalHeader.notification': 'Powiadomienie', | ||
'component.globalHeader.notification.empty': 'Przeczytałeś wszystkie powiadomienia.', | ||
'component.globalHeader.message': 'Widomość', | ||
'component.globalHeader.message.empty': 'Przeczytałeś wszystkie wiadomości.', | ||
'component.globalHeader.event': 'Zdarzenia', | ||
'component.globalHeader.event.empty': 'Przeczytałeś wszystkie zdarzenia.', | ||
'component.noticeIcon.clear': 'Wyczyść', | ||
'component.noticeIcon.cleared': 'Wyczyszczono', | ||
'component.noticeIcon.empty': 'Brak powiadomień', | ||
'component.noticeIcon.view-more': 'Zobacz więcej', | ||
}; |
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 @@ | ||
export const globalsLocale = { | ||
error: 'Błąd', | ||
lists: { | ||
edit: 'Edycja', | ||
delete: 'Usuń', | ||
create: 'Utwórz', | ||
total: 'Łącznie', | ||
actions: 'Akcje', | ||
failedDownload: 'Nie udało się pobrać elementów', | ||
}, | ||
form: { | ||
save: 'Zapisz', | ||
reset: 'Wyczyść', | ||
}, | ||
}; |
Oops, something went wrong.