refactor: use API from new i18n package
This commit is contained in:
@@ -3,8 +3,9 @@ import { useCallback, useMemo, useState } from 'react';
|
|||||||
import { CloseIcon } from '@toeverything/components/common';
|
import { CloseIcon } from '@toeverything/components/common';
|
||||||
import { IconButton, MuiSnackbar, styled } from '@toeverything/components/ui';
|
import { IconButton, MuiSnackbar, styled } from '@toeverything/components/ui';
|
||||||
import { services } from '@toeverything/datasource/db-service';
|
import { services } from '@toeverything/datasource/db-service';
|
||||||
|
import { useTranslation } from '@toeverything/datasource/i18n';
|
||||||
import { useLocalTrigger } from '@toeverything/datasource/state';
|
import { useLocalTrigger } from '@toeverything/datasource/state';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
const cleanupWorkspace = (workspace: string) =>
|
const cleanupWorkspace = (workspace: string) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
const req = indexedDB.deleteDatabase(workspace);
|
const req = indexedDB.deleteDatabase(workspace);
|
||||||
|
|||||||
@@ -5,13 +5,12 @@ import {
|
|||||||
SideBarViewIcon,
|
SideBarViewIcon,
|
||||||
} from '@toeverything/components/icons';
|
} from '@toeverything/components/icons';
|
||||||
import { IconButton, styled } from '@toeverything/components/ui';
|
import { IconButton, styled } from '@toeverything/components/ui';
|
||||||
|
import { useTranslation } from '@toeverything/datasource/i18n';
|
||||||
import {
|
import {
|
||||||
useCurrentEditors,
|
useCurrentEditors,
|
||||||
useLocalTrigger,
|
useLocalTrigger,
|
||||||
useShowSettingsSidebar,
|
useShowSettingsSidebar,
|
||||||
} from '@toeverything/datasource/state';
|
} from '@toeverything/datasource/state';
|
||||||
import { useCallback, useMemo } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { EditorBoardSwitcher } from './EditorBoardSwitcher';
|
import { EditorBoardSwitcher } from './EditorBoardSwitcher';
|
||||||
import { fsApiSupported } from './FileSystem';
|
import { fsApiSupported } from './FileSystem';
|
||||||
import { CurrentPageTitle } from './Title';
|
import { CurrentPageTitle } from './Title';
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import {
|
|||||||
SettingsIcon,
|
SettingsIcon,
|
||||||
} from '@toeverything/components/icons';
|
} from '@toeverything/components/icons';
|
||||||
import { styled } from '@toeverything/components/ui';
|
import { styled } from '@toeverything/components/ui';
|
||||||
|
import { useTranslation } from '@toeverything/datasource/i18n';
|
||||||
import { cloneElement, useCallback, useMemo, type ReactElement } from 'react';
|
import { cloneElement, useCallback, useMemo, type ReactElement } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Comments } from '../Comments';
|
import { Comments } from '../Comments';
|
||||||
import { useActiveComment } from '../Comments/use-comments';
|
import { useActiveComment } from '../Comments/use-comments';
|
||||||
import { LayoutSettings } from '../Layout';
|
import { LayoutSettings } from '../Layout';
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import {
|
|||||||
styled,
|
styled,
|
||||||
Switch,
|
Switch,
|
||||||
} from '@toeverything/components/ui';
|
} from '@toeverything/components/ui';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { LOCALES, useTranslation } from '@toeverything/datasource/i18n';
|
||||||
import { options } from '../../i18n';
|
|
||||||
import { useSettings } from './use-settings';
|
import { useSettings } from './use-settings';
|
||||||
|
|
||||||
export const SettingsList = () => {
|
export const SettingsList = () => {
|
||||||
@@ -52,7 +51,7 @@ export const SettingsList = () => {
|
|||||||
defaultValue={i18n.language}
|
defaultValue={i18n.language}
|
||||||
onChange={changeLanguage}
|
onChange={changeLanguage}
|
||||||
>
|
>
|
||||||
{options.map(option => (
|
{LOCALES.map(option => (
|
||||||
<Option
|
<Option
|
||||||
key={option.value}
|
key={option.value}
|
||||||
value={option.value}
|
value={option.value}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { styled, Typography } from '@toeverything/components/ui';
|
import { styled, Typography } from '@toeverything/components/ui';
|
||||||
|
import { useTranslation } from '@toeverything/datasource/i18n';
|
||||||
import { useUserAndSpaces } from '@toeverything/datasource/state';
|
import { useUserAndSpaces } from '@toeverything/datasource/state';
|
||||||
import format from 'date-fns/format';
|
import format from 'date-fns/format';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { usePageLastUpdated, useWorkspaceAndPageId } from '../util';
|
import { usePageLastUpdated, useWorkspaceAndPageId } from '../util';
|
||||||
|
|
||||||
export const LastModified = () => {
|
export const LastModified = () => {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { MoveToIcon } from '@toeverything/components/icons';
|
import { MoveToIcon } from '@toeverything/components/icons';
|
||||||
import { ListItem, styled, Typography } from '@toeverything/components/ui';
|
import { ListItem, styled, Typography } from '@toeverything/components/ui';
|
||||||
|
import { useTranslation } from '@toeverything/datasource/i18n';
|
||||||
import { LOGOUT_COOKIES, LOGOUT_LOCAL_STORAGE } from '@toeverything/utils';
|
import { LOGOUT_COOKIES, LOGOUT_LOCAL_STORAGE } from '@toeverything/utils';
|
||||||
import { getAuth, signOut } from 'firebase/auth';
|
import { getAuth, signOut } from 'firebase/auth';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
LOGOUT_LOCAL_STORAGE.forEach(name => localStorage.removeItem(name));
|
LOGOUT_LOCAL_STORAGE.forEach(name => localStorage.removeItem(name));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { message } from '@toeverything/components/ui';
|
import { message } from '@toeverything/components/ui';
|
||||||
|
import { useTranslation } from '@toeverything/datasource/i18n';
|
||||||
import { copyToClipboard } from '@toeverything/utils';
|
import { copyToClipboard } from '@toeverything/utils';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useSettingFlags, type SettingFlags } from './use-setting-flags';
|
import { useSettingFlags, type SettingFlags } from './use-setting-flags';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user