From 2e00f7559105459b209bd17c310587d770a473c2 Mon Sep 17 00:00:00 2001
From: "Rasamoelina, Haja Onjatiana" <26148770+rhahao@users.noreply.github.com>
Date: Thu, 16 Nov 2023 07:55:19 +0300
Subject: [PATCH] refactor(app): update langList path
---
.../features/languageSwitcher/AppLanguage.jsx | 234 +++++------
.../settings/SourcesFormsSettings.jsx | 120 +++---
.../features/whatsNew/AnnouncementItem.jsx | 252 ++++++------
.../features/whatsNew/Announcements.jsx | 56 +--
src/current/states/main.js | 368 +++++++++---------
src/current/utils/updater.js | 2 +-
6 files changed, 516 insertions(+), 516 deletions(-)
diff --git a/src/current/features/languageSwitcher/AppLanguage.jsx b/src/current/features/languageSwitcher/AppLanguage.jsx
index 354c10e391..6c10b20e7d 100644
--- a/src/current/features/languageSwitcher/AppLanguage.jsx
+++ b/src/current/features/languageSwitcher/AppLanguage.jsx
@@ -15,126 +15,126 @@ import Tooltip from '@mui/material/Tooltip';
import TranslateIcon from '@mui/icons-material/Translate';
import Typography from '@mui/material/Typography';
import { appLangState } from '../../states/main';
-import { LANGUAGE_LIST } from '../../locales/langList.js';
+import { LANGUAGE_LIST } from '../../../shared/locales/langList';
import { Setting } from '../../classes/Setting';
const AppLanguage = () => {
- const { t, i18n } = useTranslation('ui');
-
- const [appLang, setAppLang] = useRecoilState(appLangState);
-
- const [anchorEl, setAnchorEl] = useState(null);
- const [appLangLocal, setAppLangLocal] = useState(appLang);
- const [userChange, setUserChange] = useState(false);
-
- const theme = useTheme();
- const largeView = useMediaQuery(theme.breakpoints.up('md'), {
- noSsr: true,
- });
-
- let isMenuOpen = Boolean(anchorEl);
-
- const listUILangs = LANGUAGE_LIST.filter((lang) => lang.isUI === true);
-
- const handleLangChange = async (e) => {
- setUserChange(true);
- const app_lang = e.target.parentElement.dataset.code;
- setAppLangLocal(app_lang);
- await Setting.update({ source_lang: app_lang });
- handleClose();
- window.location.reload();
- };
-
- const handleClick = (event) => {
- setAnchorEl(event.currentTarget);
- };
-
- const handleClose = () => {
- setAnchorEl(null);
- };
-
- const handleLocalizeOpen = () => {
- handleClose();
- };
-
- useEffect(() => {
- const updateLang = async () => {
- if (userChange) {
- await i18n.changeLanguage(appLangLocal);
-
- const isoLang = getI18n().getDataByLanguage(appLangLocal).ui['iso'];
- document.documentElement.setAttribute('lang', isoLang);
-
- setAppLang(appLangLocal);
-
- localStorage.setItem('app_lang', appLangLocal);
- setUserChange(false);
- } else {
- let appLang = localStorage.getItem('app_lang') || 'e';
- await i18n.changeLanguage(appLang);
-
- const isoLang = getI18n().getDataByLanguage(appLang).ui['iso'];
- document.documentElement.setAttribute('lang', isoLang);
-
- setAppLang(appLang);
- }
- };
-
- updateLang();
- }, [appLangLocal, i18n, setAppLang, userChange]);
-
- return (
- <>
-
-
-
- {largeView && {t('changeLanguage')}}
-
-
-
- >
- );
+ const { t, i18n } = useTranslation('ui');
+
+ const [appLang, setAppLang] = useRecoilState(appLangState);
+
+ const [anchorEl, setAnchorEl] = useState(null);
+ const [appLangLocal, setAppLangLocal] = useState(appLang);
+ const [userChange, setUserChange] = useState(false);
+
+ const theme = useTheme();
+ const largeView = useMediaQuery(theme.breakpoints.up('md'), {
+ noSsr: true,
+ });
+
+ let isMenuOpen = Boolean(anchorEl);
+
+ const listUILangs = LANGUAGE_LIST.filter((lang) => lang.isUI === true);
+
+ const handleLangChange = async (e) => {
+ setUserChange(true);
+ const app_lang = e.target.parentElement.dataset.code;
+ setAppLangLocal(app_lang);
+ await Setting.update({ source_lang: app_lang });
+ handleClose();
+ window.location.reload();
+ };
+
+ const handleClick = (event) => {
+ setAnchorEl(event.currentTarget);
+ };
+
+ const handleClose = () => {
+ setAnchorEl(null);
+ };
+
+ const handleLocalizeOpen = () => {
+ handleClose();
+ };
+
+ useEffect(() => {
+ const updateLang = async () => {
+ if (userChange) {
+ await i18n.changeLanguage(appLangLocal);
+
+ const isoLang = getI18n().getDataByLanguage(appLangLocal).ui['iso'];
+ document.documentElement.setAttribute('lang', isoLang);
+
+ setAppLang(appLangLocal);
+
+ localStorage.setItem('app_lang', appLangLocal);
+ setUserChange(false);
+ } else {
+ let appLang = localStorage.getItem('app_lang') || 'e';
+ await i18n.changeLanguage(appLang);
+
+ const isoLang = getI18n().getDataByLanguage(appLang).ui['iso'];
+ document.documentElement.setAttribute('lang', isoLang);
+
+ setAppLang(appLang);
+ }
+ };
+
+ updateLang();
+ }, [appLangLocal, i18n, setAppLang, userChange]);
+
+ return (
+ <>
+
+
+
+ {largeView && {t('changeLanguage')}}
+
+
+
+ >
+ );
};
export default AppLanguage;
diff --git a/src/current/features/settings/SourcesFormsSettings.jsx b/src/current/features/settings/SourcesFormsSettings.jsx
index 326fa7d64c..0066f08fd1 100644
--- a/src/current/features/settings/SourcesFormsSettings.jsx
+++ b/src/current/features/settings/SourcesFormsSettings.jsx
@@ -11,77 +11,77 @@ import MenuItem from '@mui/material/MenuItem';
import TextField from '@mui/material/TextField';
import Typography from '@mui/material/Typography';
import { sourceLangState } from '../../states/main';
-import { LANGUAGE_LIST } from '../../locales/langList';
+import { LANGUAGE_LIST } from '../../../shared/locales/langList';
import { Setting } from '../../classes/Setting';
const SourcesFormsSettings = () => {
- const { t } = useTranslation('ui');
+ const { t } = useTranslation('ui');
- const [sourceLang, setSourceLang] = useRecoilState(sourceLangState);
+ const [sourceLang, setSourceLang] = useRecoilState(sourceLangState);
- const [tempSourceLang, setTempSourceLang] = useState(sourceLang);
+ const [tempSourceLang, setTempSourceLang] = useState(sourceLang);
- const isEditor =
- Setting.cong_role.includes('lmmo') ||
- Setting.cong_role.includes('lmmo-backup') ||
- Setting.cong_role.includes('coordinator');
+ const isEditor =
+ Setting.cong_role.includes('lmmo') ||
+ Setting.cong_role.includes('lmmo-backup') ||
+ Setting.cong_role.includes('coordinator');
- const listSourceLangs = LANGUAGE_LIST.filter((lang) => lang.isSource === true);
+ const listSourceLangs = LANGUAGE_LIST.filter((lang) => lang.isSource === true);
- const handleSourceLangChange = async (e) => {
- if (e.target.value === 'not_set') return;
- setTempSourceLang(e.target.value);
- await Setting.update({ source_lang: e.target.value });
- setSourceLang(e.target.value);
- };
+ const handleSourceLangChange = async (e) => {
+ if (e.target.value === 'not_set') return;
+ setTempSourceLang(e.target.value);
+ await Setting.update({ source_lang: e.target.value });
+ setSourceLang(e.target.value);
+ };
- return (
-
- {t('sourcesFormsSettings')}
-
-
-
- {t('sourceTemplateLangDesc')}
+ return (
+
+ {t('sourcesFormsSettings')}
+
+
+
+ {t('sourceTemplateLangDesc')}
-
- {listSourceLangs.map((lang) => (
-
- ))}
-
-
-
-
- {!isEditor && (
-
- {t('settingLockedMeetingEditor')}
-
- )}
-
- );
+
+ {listSourceLangs.map((lang) => (
+
+ ))}
+
+
+
+
+ {!isEditor && (
+
+ {t('settingLockedMeetingEditor')}
+
+ )}
+
+ );
};
export default SourcesFormsSettings;
diff --git a/src/current/features/whatsNew/AnnouncementItem.jsx b/src/current/features/whatsNew/AnnouncementItem.jsx
index e8eb733141..fdff3b1f7e 100644
--- a/src/current/features/whatsNew/AnnouncementItem.jsx
+++ b/src/current/features/whatsNew/AnnouncementItem.jsx
@@ -14,137 +14,137 @@ import NotificationsActiveIcon from '@mui/icons-material/NotificationsActive';
import Typography from '@mui/material/Typography';
import { dbReadNotification } from '../../indexedDb/dbNotifications';
import { appLangState } from '../../states/main';
-import { LANGUAGE_LIST } from '../../locales/langList';
+import { LANGUAGE_LIST } from '../../../shared/locales/langList';
const styles = {
- announcementAction: {
- borderRadius: '8px',
- '.MuiTouchRipple-ripple .MuiTouchRipple-child': {
- borderRadius: 0,
- backgroundColor: 'rgba(23, 32, 42, .3)',
- },
- },
+ announcementAction: {
+ borderRadius: '8px',
+ '.MuiTouchRipple-ripple .MuiTouchRipple-child': {
+ borderRadius: 0,
+ backgroundColor: 'rgba(23, 32, 42, .3)',
+ },
+ },
};
const AnnouncementItem = ({ announcement }) => {
- const { t } = useTranslation('ui');
-
- const appLang = useRecoilValue(appLangState);
-
- const [sliceWord, setSliceWord] = useState('');
- const [publishedAt, setPublishedAt] = useState('');
- const [hasExpand, setHasExpand] = useState(false);
- const [isExpanded, setIsExpanded] = useState(false);
- const [bodyText, setBodyText] = useState('');
-
- const theme = useTheme();
- const largeView = useMediaQuery(theme.breakpoints.up('sm'), {
- noSsr: true,
- });
-
- const fldKey = LANGUAGE_LIST.find((language) => language.code === appLang).locale;
-
- const localeTitle = announcement.title.find((item) => item.language === fldKey);
- const localeBody = announcement.body.find((item) => item.language === fldKey);
-
- const handleMarkAsRead = async () => {
- await dbReadNotification(announcement.announcement_id, fldKey);
- };
-
- const handleToggleExpand = () => {
- setIsExpanded((prev) => {
- if (prev) setBodyText(sliceWord);
- if (!prev) setBodyText(localeBody.text);
- return !prev;
- });
- };
-
- useEffect(() => {
- const titleModified = localeTitle.modifiedAt;
- const bodyModified = localeBody.modifiedAt;
- let publishedDate = titleModified;
-
- if (bodyModified > titleModified) publishedDate = bodyModified;
-
- let publishedLocale = '';
- if (publishedDate) {
- publishedLocale = dateFormat(new Date(publishedDate), t('shortDateTimeFormat'));
- }
-
- setPublishedAt(publishedLocale);
- }, [localeTitle, localeBody, t]);
-
- useEffect(() => {
- setHasExpand(false);
- setIsExpanded(false);
- if (localeBody.text.length > 400) {
- const split = localeBody.text.slice(0, 120).split(' ');
-
- let finalWord = '';
- for (let i = 0; i < split.length - 1; i++) {
- finalWord = finalWord + split[i] + ' ';
- }
-
- finalWord = finalWord + ' ...';
- setSliceWord(finalWord);
- setBodyText(finalWord);
- setHasExpand(true);
- }
-
- if (localeBody.text.length <= 400) {
- setBodyText(localeBody.text);
- }
- }, [localeBody]);
-
- return (
-
-
-
-
-
- {localeTitle.text}
-
-
-
-
-
-
- {(!localeTitle.isRead || !localeBody.isRead) && (!hasExpand || (hasExpand && isExpanded)) && (
-
-
- {largeView && {t('markAsRead')}}
-
- )}
-
- {hasExpand && (
-
- {isExpanded && }
- {!isExpanded && }
-
- {largeView && (
- {isExpanded ? t('collapse') : t('expand')}
- )}
-
- )}
-
-
-
- {publishedAt}
-
-
-
-
- );
+ const { t } = useTranslation('ui');
+
+ const appLang = useRecoilValue(appLangState);
+
+ const [sliceWord, setSliceWord] = useState('');
+ const [publishedAt, setPublishedAt] = useState('');
+ const [hasExpand, setHasExpand] = useState(false);
+ const [isExpanded, setIsExpanded] = useState(false);
+ const [bodyText, setBodyText] = useState('');
+
+ const theme = useTheme();
+ const largeView = useMediaQuery(theme.breakpoints.up('sm'), {
+ noSsr: true,
+ });
+
+ const fldKey = LANGUAGE_LIST.find((language) => language.code === appLang).locale;
+
+ const localeTitle = announcement.title.find((item) => item.language === fldKey);
+ const localeBody = announcement.body.find((item) => item.language === fldKey);
+
+ const handleMarkAsRead = async () => {
+ await dbReadNotification(announcement.announcement_id, fldKey);
+ };
+
+ const handleToggleExpand = () => {
+ setIsExpanded((prev) => {
+ if (prev) setBodyText(sliceWord);
+ if (!prev) setBodyText(localeBody.text);
+ return !prev;
+ });
+ };
+
+ useEffect(() => {
+ const titleModified = localeTitle.modifiedAt;
+ const bodyModified = localeBody.modifiedAt;
+ let publishedDate = titleModified;
+
+ if (bodyModified > titleModified) publishedDate = bodyModified;
+
+ let publishedLocale = '';
+ if (publishedDate) {
+ publishedLocale = dateFormat(new Date(publishedDate), t('shortDateTimeFormat'));
+ }
+
+ setPublishedAt(publishedLocale);
+ }, [localeTitle, localeBody, t]);
+
+ useEffect(() => {
+ setHasExpand(false);
+ setIsExpanded(false);
+ if (localeBody.text.length > 400) {
+ const split = localeBody.text.slice(0, 120).split(' ');
+
+ let finalWord = '';
+ for (let i = 0; i < split.length - 1; i++) {
+ finalWord = finalWord + split[i] + ' ';
+ }
+
+ finalWord = finalWord + ' ...';
+ setSliceWord(finalWord);
+ setBodyText(finalWord);
+ setHasExpand(true);
+ }
+
+ if (localeBody.text.length <= 400) {
+ setBodyText(localeBody.text);
+ }
+ }, [localeBody]);
+
+ return (
+
+
+
+
+
+ {localeTitle.text}
+
+
+
+
+
+
+ {(!localeTitle.isRead || !localeBody.isRead) && (!hasExpand || (hasExpand && isExpanded)) && (
+
+
+ {largeView && {t('markAsRead')}}
+
+ )}
+
+ {hasExpand && (
+
+ {isExpanded && }
+ {!isExpanded && }
+
+ {largeView && (
+ {isExpanded ? t('collapse') : t('expand')}
+ )}
+
+ )}
+
+
+
+ {publishedAt}
+
+
+
+
+ );
};
export default AnnouncementItem;
diff --git a/src/current/features/whatsNew/Announcements.jsx b/src/current/features/whatsNew/Announcements.jsx
index e9b0677e06..06aece5e03 100644
--- a/src/current/features/whatsNew/Announcements.jsx
+++ b/src/current/features/whatsNew/Announcements.jsx
@@ -3,45 +3,45 @@ import { useRecoilValue } from 'recoil';
import Box from '@mui/material/Box';
import AnnouncementItem from './AnnouncementItem';
import { appLangState, appNotificationsState } from '../../states/main';
-import { LANGUAGE_LIST } from '../../locales/langList';
+import { LANGUAGE_LIST } from '../../../shared/locales/langList';
const Announcements = () => {
- const announcements = useRecoilValue(appNotificationsState);
- const appLang = useRecoilValue(appLangState);
+ const announcements = useRecoilValue(appNotificationsState);
+ const appLang = useRecoilValue(appLangState);
- const [localAnnouncements, setLocalAnnouncements] = useState([]);
+ const [localAnnouncements, setLocalAnnouncements] = useState([]);
- const fldKey = LANGUAGE_LIST.find((language) => language.code === appLang).locale;
+ const fldKey = LANGUAGE_LIST.find((language) => language.code === appLang).locale;
- useEffect(() => {
- const newAnnouncements = announcements.map((announcement) => {
- const localeTitle = announcement.title.find((item) => item.language === fldKey);
- const localeBody = announcement.body.find((item) => item.language === fldKey);
+ useEffect(() => {
+ const newAnnouncements = announcements.map((announcement) => {
+ const localeTitle = announcement.title.find((item) => item.language === fldKey);
+ const localeBody = announcement.body.find((item) => item.language === fldKey);
- const titleModified = localeTitle.modifiedAt;
- const bodyModified = localeBody.modifiedAt;
- let publishedDate = titleModified;
+ const titleModified = localeTitle.modifiedAt;
+ const bodyModified = localeBody.modifiedAt;
+ let publishedDate = titleModified;
- if (bodyModified > titleModified) publishedDate = bodyModified;
+ if (bodyModified > titleModified) publishedDate = bodyModified;
- return { ...announcement, publishedDate };
- });
+ return { ...announcement, publishedDate };
+ });
- newAnnouncements.sort((a, b) => {
- return a.publishedDate < b.publishedDate ? 1 : -1;
- });
+ newAnnouncements.sort((a, b) => {
+ return a.publishedDate < b.publishedDate ? 1 : -1;
+ });
- setLocalAnnouncements(newAnnouncements);
- }, [announcements, fldKey]);
+ setLocalAnnouncements(newAnnouncements);
+ }, [announcements, fldKey]);
- return (
-
- {localAnnouncements.length > 0 &&
- localAnnouncements.map((announcement) => (
-
- ))}
-
- );
+ return (
+
+ {localAnnouncements.length > 0 &&
+ localAnnouncements.map((announcement) => (
+
+ ))}
+
+ );
};
export default Announcements;
diff --git a/src/current/states/main.js b/src/current/states/main.js
index aeecc14c4c..acf3df68ea 100644
--- a/src/current/states/main.js
+++ b/src/current/states/main.js
@@ -1,403 +1,403 @@
import { atom, selector } from 'recoil';
import { getI18n } from 'react-i18next';
-import { LANGUAGE_LIST } from '../locales/langList';
+import { LANGUAGE_LIST } from '../../shared/locales/langList';
export const isLightThemeState = atom({
- key: 'isLightTheme',
- default: typeof window !== 'undefined' && localStorage.getItem('theme') === 'dark' ? false : true,
+ key: 'isLightTheme',
+ default: typeof window !== 'undefined' && localStorage.getItem('theme') === 'dark' ? false : true,
});
export const offlineOverrideState = atom({
- key: 'offlineOverride',
- default: false,
+ key: 'offlineOverride',
+ default: false,
});
export const isAppLoadState = atom({
- key: 'isAppLoad',
- default: true,
+ key: 'isAppLoad',
+ default: true,
});
export const isSetupState = atom({
- key: 'isSetup',
- default: true,
+ key: 'isSetup',
+ default: true,
});
export const apiHostState = atom({
- key: 'apiHost',
- default: '',
+ key: 'apiHost',
+ default: '',
});
export const isAboutOpenState = atom({
- key: 'isAboutOpen',
- default: false,
+ key: 'isAboutOpen',
+ default: false,
});
export const isLoginOpenState = atom({
- key: 'isLoginOpen',
- default: false,
+ key: 'isLoginOpen',
+ default: false,
});
export const appLangState = atom({
- key: 'appLang',
- default: (typeof window !== 'undefined' && localStorage.getItem('app_lang')) || 'e',
+ key: 'appLang',
+ default: (typeof window !== 'undefined' && localStorage.getItem('app_lang')) || 'e',
});
export const uidUserState = atom({
- key: 'uidUser',
- default: '',
+ key: 'uidUser',
+ default: '',
});
export const userPasswordState = atom({
- key: 'userPassowrd',
- default: '',
+ key: 'userPassowrd',
+ default: '',
});
export const monthNamesState = selector({
- key: 'monthNames',
- get: ({ get }) => {
- const appLang = get(appLangState);
-
- let months = [];
- months.push(getI18n().getDataByLanguage(appLang).ui['january']);
- months.push(getI18n().getDataByLanguage(appLang).ui['february']);
- months.push(getI18n().getDataByLanguage(appLang).ui['march']);
- months.push(getI18n().getDataByLanguage(appLang).ui['april']);
- months.push(getI18n().getDataByLanguage(appLang).ui['may']);
- months.push(getI18n().getDataByLanguage(appLang).ui['june']);
- months.push(getI18n().getDataByLanguage(appLang).ui['july']);
- months.push(getI18n().getDataByLanguage(appLang).ui['august']);
- months.push(getI18n().getDataByLanguage(appLang).ui['september']);
- months.push(getI18n().getDataByLanguage(appLang).ui['october']);
- months.push(getI18n().getDataByLanguage(appLang).ui['november']);
- months.push(getI18n().getDataByLanguage(appLang).ui['december']);
-
- return months;
- },
+ key: 'monthNames',
+ get: ({ get }) => {
+ const appLang = get(appLangState);
+
+ let months = [];
+ months.push(getI18n().getDataByLanguage(appLang).ui['january']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['february']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['march']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['april']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['may']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['june']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['july']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['august']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['september']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['october']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['november']);
+ months.push(getI18n().getDataByLanguage(appLang).ui['december']);
+
+ return months;
+ },
});
export const shortDateFormatState = selector({
- key: 'shortDateFormat',
- get: ({ get }) => {
- const appLang = get(appLangState);
- const format = getI18n().getDataByLanguage(appLang).ui['shortDateFormat'];
- return format;
- },
+ key: 'shortDateFormat',
+ get: ({ get }) => {
+ const appLang = get(appLangState);
+ const format = getI18n().getDataByLanguage(appLang).ui['shortDateFormat'];
+ return format;
+ },
});
export const shortDatePickerFormatState = selector({
- key: 'shortDatePickerFormat',
- get: ({ get }) => {
- const appLang = get(appLangState);
- const format = getI18n().getDataByLanguage(appLang).ui['shortDatePickerFormat'];
- return format;
- },
+ key: 'shortDatePickerFormat',
+ get: ({ get }) => {
+ const appLang = get(appLangState);
+ const format = getI18n().getDataByLanguage(appLang).ui['shortDatePickerFormat'];
+ return format;
+ },
});
export const isDeleteDbOpenState = atom({
- key: 'isDeleteDbOpen',
- default: false,
+ key: 'isDeleteDbOpen',
+ default: false,
});
export const isBackupDbOpenState = atom({
- key: 'isBackupDbOpen',
- default: false,
+ key: 'isBackupDbOpen',
+ default: false,
});
export const isBackupOfflineState = atom({
- key: 'isBackupOffline',
- default: false,
+ key: 'isBackupOffline',
+ default: false,
});
export const isBackupOnlineState = atom({
- key: 'isBackupOnline',
- default: false,
+ key: 'isBackupOnline',
+ default: false,
});
export const isRestoreOfflineState = atom({
- key: 'isRestoreOffline',
- default: false,
+ key: 'isRestoreOffline',
+ default: false,
});
export const isRestoreOnlineState = atom({
- key: 'isRestoreOnline',
- default: false,
+ key: 'isRestoreOnline',
+ default: false,
});
export const backupEncryptedState = atom({
- key: 'backupEncrypted',
- default: {},
+ key: 'backupEncrypted',
+ default: {},
});
export const backupJsonDataState = atom({
- key: 'backupJsonData',
- default: undefined,
+ key: 'backupJsonData',
+ default: undefined,
});
export const isUserLoggedState = atom({
- key: 'isUserLogged',
- default: false,
+ key: 'isUserLogged',
+ default: false,
});
export const isCongLoginOpenState = atom({
- key: 'isCongLoginOpen',
- default: false,
+ key: 'isCongLoginOpen',
+ default: false,
});
export const isCongCreateAccountState = atom({
- key: 'isCongCreateAccount',
- default: false,
+ key: 'isCongCreateAccount',
+ default: false,
});
export const isCongSignInState = atom({
- key: 'isCongSignIn',
- default: false,
+ key: 'isCongSignIn',
+ default: false,
});
export const isCongUpdateAccountState = atom({
- key: 'isCongUpdateAccount',
- default: false,
+ key: 'isCongUpdateAccount',
+ default: false,
});
export const isUserSignInState = atom({
- key: 'isUserSignIn',
- default: false,
+ key: 'isUserSignIn',
+ default: false,
});
export const isUserSignUpState = atom({
- key: 'isUserSignUp',
- default: false,
+ key: 'isUserSignUp',
+ default: false,
});
export const isEmailNotVerifiedState = atom({
- key: 'isEmailNotVerified',
- default: false,
+ key: 'isEmailNotVerified',
+ default: false,
});
export const isEmailBlockedState = atom({
- key: 'isEmailBlocked',
- default: false,
+ key: 'isEmailBlocked',
+ default: false,
});
export const isCongAccountCreateState = atom({
- key: 'isCongAccountCreate',
- default: false,
+ key: 'isCongAccountCreate',
+ default: false,
});
export const isShowTermsUseState = atom({
- key: 'isShowLAG',
- default: typeof window !== 'undefined' && localStorage.getItem('termsUse') === 'false' ? false : true,
+ key: 'isShowLAG',
+ default: typeof window !== 'undefined' && localStorage.getItem('termsUse') === 'false' ? false : true,
});
export const visitorIDState = atom({
- key: 'visitorID',
- default: '',
+ key: 'visitorID',
+ default: '',
});
export const qrCodePathState = atom({
- key: 'qrCodePath',
- default: '',
+ key: 'qrCodePath',
+ default: '',
});
export const secretTokenPathState = atom({
- key: 'secretTokenPath',
- default: '',
+ key: 'secretTokenPath',
+ default: '',
});
export const isOnlineState = atom({
- key: 'isOnline',
- default: navigator.onLine,
+ key: 'isOnline',
+ default: navigator.onLine,
});
export const isUserMfaSetupState = atom({
- key: 'isUserMfaSetup',
- default: false,
+ key: 'isUserMfaSetup',
+ default: false,
});
export const isUserMfaVerifyState = atom({
- key: 'isUserMfaVerify',
- default: false,
+ key: 'isUserMfaVerify',
+ default: false,
});
export const isUnauthorizedRoleState = atom({
- key: 'isUnauthorizedRole',
- default: false,
+ key: 'isUnauthorizedRole',
+ default: false,
});
export const isPrecachedState = atom({
- key: 'isPrecached',
- default: false,
+ key: 'isPrecached',
+ default: false,
});
export const showReloadState = atom({
- key: 'showReload',
- default: false,
+ key: 'showReload',
+ default: false,
});
export const waitingWorkerState = atom({
- key: 'waitingWorker',
- default: null,
+ key: 'waitingWorker',
+ default: null,
});
export const isWhatsNewOpenState = atom({
- key: 'isWhatsNewOpen',
- default: false,
+ key: 'isWhatsNewOpen',
+ default: false,
});
export const appNotificationsState = atom({
- key: 'appNotifications',
- default: [],
+ key: 'appNotifications',
+ default: [],
});
export const countNotificationsState = selector({
- key: 'countNotifications',
- get: ({ get }) => {
- const announcements = get(appNotificationsState);
- const appLang = get(appLangState);
- const fldKey = LANGUAGE_LIST.find((language) => language.code === appLang).locale;
+ key: 'countNotifications',
+ get: ({ get }) => {
+ const announcements = get(appNotificationsState);
+ const appLang = get(appLangState);
+ const fldKey = LANGUAGE_LIST.find((language) => language.code === appLang).locale;
- let count = 0;
- for (const announcement of announcements) {
- const findTitleIndex = announcement.title.findIndex((item) => item.language === fldKey);
- let isRead = announcement.title[findTitleIndex].isRead;
+ let count = 0;
+ for (const announcement of announcements) {
+ const findTitleIndex = announcement.title.findIndex((item) => item.language === fldKey);
+ let isRead = announcement.title[findTitleIndex].isRead;
- if (isRead) {
- const findBodyIndex = announcement.body.findIndex((item) => item.language === fldKey);
- isRead = announcement.body[findBodyIndex].isRead;
- }
+ if (isRead) {
+ const findBodyIndex = announcement.body.findIndex((item) => item.language === fldKey);
+ isRead = announcement.body[findBodyIndex].isRead;
+ }
- if (!isRead) count++;
- }
+ if (!isRead) count++;
+ }
- return count;
- },
+ return count;
+ },
});
export const currentNotificationState = atom({
- key: 'currentNotification',
- default: {},
+ key: 'currentNotification',
+ default: {},
});
export const rootModalOpenState = atom({
- key: 'rootModalOpen',
- default: false,
+ key: 'rootModalOpen',
+ default: false,
});
export const backupDbOpenState = atom({
- key: 'backupDbOpen',
- default: false,
+ key: 'backupDbOpen',
+ default: false,
});
export const restoreDbOpenState = atom({
- key: 'restoreDbOpen',
- default: false,
+ key: 'restoreDbOpen',
+ default: false,
});
export const userIDState = atom({
- key: 'userID',
- default: '',
+ key: 'userID',
+ default: '',
});
export const isReEnrollMFAState = atom({
- key: 'isReEnrollMFA',
- default: false,
+ key: 'isReEnrollMFA',
+ default: false,
});
export const userLocalUidState = atom({
- key: 'userLocalUid',
- default: '',
+ key: 'userLocalUid',
+ default: '',
});
export const isMyAssignmentOpenState = atom({
- key: 'isMyAssignmentOpen',
- default: false,
+ key: 'isMyAssignmentOpen',
+ default: false,
});
export const refreshMyAssignmentsState = atom({
- key: 'refreshMyAssignments',
- default: false,
+ key: 'refreshMyAssignments',
+ default: false,
});
export const isCongPersonAddState = atom({
- key: 'isCongPersonAdd',
- default: false,
+ key: 'isCongPersonAdd',
+ default: false,
});
export const sourceLangState = atom({
- key: 'sourceLang',
- default: 'e',
+ key: 'sourceLang',
+ default: 'e',
});
export const isEmailAuthState = atom({
- key: 'isEmailAuth',
- default: false,
+ key: 'isEmailAuth',
+ default: false,
});
export const isAuthProcessingState = atom({
- key: 'isAuthProcessing',
- default: false,
+ key: 'isAuthProcessing',
+ default: false,
});
export const avatarUrlState = atom({
- key: 'avatarUrl',
- default: undefined,
+ key: 'avatarUrl',
+ default: undefined,
});
export const isOAuthAccountUpgradeState = atom({
- key: 'isOAuthAccountUpgrade',
- default: false,
+ key: 'isOAuthAccountUpgrade',
+ default: false,
});
export const userEmailState = atom({
- key: 'userEmail',
- default: '',
+ key: 'userEmail',
+ default: '',
});
export const userConfirmationOpenState = atom({
- key: 'userConfirmationOpen',
- default: false,
+ key: 'userConfirmationOpen',
+ default: false,
});
export const userConfirmationTitleState = atom({
- key: 'userConfirmationTitle',
- default: false,
+ key: 'userConfirmationTitle',
+ default: false,
});
export const userConfirmationMessageState = atom({
- key: 'userConfirmationMessage',
- default: false,
+ key: 'userConfirmationMessage',
+ default: false,
});
export const userConfirmationActionState = atom({
- key: 'userConfirmationAction',
- default: undefined,
+ key: 'userConfirmationAction',
+ default: undefined,
});
export const accountTypeState = atom({
- key: 'accountType',
- default: '',
+ key: 'accountType',
+ default: '',
});
export const isAccountChooseState = atom({
- key: 'isAccountChoose',
- default: false,
+ key: 'isAccountChoose',
+ default: false,
});
export const isFetchingScheduleState = atom({
- key: 'isFetchingSchedule',
- default: true,
+ key: 'isFetchingSchedule',
+ default: true,
});
export const currentMFAStageState = atom({
- key: 'currentMFAStage',
- default: 'setup',
+ key: 'currentMFAStage',
+ default: 'setup',
});
export const refreshScreenState = atom({
- key: 'refreshScreen',
- default: false,
+ key: 'refreshScreen',
+ default: false,
});
export const isEmailLinkAuthenticateState = atom({
- key: 'isEmailLinkAuthenticate',
- default: false,
+ key: 'isEmailLinkAuthenticate',
+ default: false,
});
diff --git a/src/current/utils/updater.js b/src/current/utils/updater.js
index 826b5038a2..0881547486 100644
--- a/src/current/utils/updater.js
+++ b/src/current/utils/updater.js
@@ -1,6 +1,6 @@
import { getI18n } from 'react-i18next';
import appDb from '../../shared/indexedDb/mainDb';
-import { LANGUAGE_LIST } from '../locales/langList.js';
+import { LANGUAGE_LIST } from '../../shared/locales/langList.js';
import { loadApp } from './app';
import { Setting } from '../classes/Setting';
import { Persons } from '../classes/Persons';