mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 05:58:56 +08:00
refactor(i18n): new hook api (#7273)
# NEW HOOK API
`useI18n`: same as `useAFFiNEI18N`, with additional APIs
```ts
import { useI18n } from '@affine/i18n'
const i18n = useI18n()
i18n['hello world']() -> 你好世界
```
# NEW GLOBAL i18n Instance
`I18n`: use i18n capabilities outside of React
```ts
import { I18n } from '@affine/i18n'
I18n['hello world']() -> 你好世界
```
# NEW TYPES
`I18nKeys` -> all i18n keys
`I18nString` -> An i18n message (key&options)
transfer and store i18n text outside of React
```ts
const msg: I18nString = {
key: 'helloworld',
options: {
arg1: '123'
}
}
I18n.t(msg) -> 你好世界123
```
before:
```ts
registerCommand('open-page', {
name: t('command.open-page')
// ^- translation happens here,
})
```
after:
```ts
registerCommand('open-page', {
name: { key: 'command.open-page' }
// ^- store I18nString here, translate when the command render to UI
})
```
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Button, IconButton } from '@affine/component/ui/button';
|
import { Button, IconButton } from '@affine/component/ui/button';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { CloseIcon } from '@blocksuite/icons/rc';
|
import { CloseIcon } from '@blocksuite/icons/rc';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ export const LocalDemoTips = ({
|
|||||||
onLogin,
|
onLogin,
|
||||||
onEnableCloud,
|
onEnableCloud,
|
||||||
}: LocalDemoTipsProps) => {
|
}: LocalDemoTipsProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const buttonLabel = isLoggedIn
|
const buttonLabel = isLoggedIn
|
||||||
? t['Enable AFFiNE Cloud']()
|
? t['Enable AFFiNE Cloud']()
|
||||||
: t['Sign in and Enable']();
|
: t['Sign in and Enable']();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { Logo1Icon } from '@blocksuite/icons/rc';
|
import { Logo1Icon } from '@blocksuite/icons/rc';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ export const AffineOtherPageLayout = ({
|
|||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const openDownloadLink = useCallback(() => {
|
const openDownloadLink = useCallback(() => {
|
||||||
open(runtimeConfig.downloadUrl, '_blank');
|
open(runtimeConfig.downloadUrl, '_blank');
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
export const useNavConfig = () => {
|
export const useNavConfig = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return useMemo(
|
return useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { ArrowLeftSmallIcon } from '@blocksuite/icons/rc';
|
import { ArrowLeftSmallIcon } from '@blocksuite/icons/rc';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ import type { ButtonProps } from '../../ui/button';
|
|||||||
import { Button } from '../../ui/button';
|
import { Button } from '../../ui/button';
|
||||||
|
|
||||||
export const BackButton: FC<ButtonProps> = props => {
|
export const BackButton: FC<ButtonProps> = props => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
type="plain"
|
type="plain"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
import { Button } from '../../ui/button';
|
import { Button } from '../../ui/button';
|
||||||
@@ -13,7 +13,7 @@ export const ChangeEmailPage = ({
|
|||||||
onChangeEmail: (email: string) => Promise<boolean>;
|
onChangeEmail: (email: string) => Promise<boolean>;
|
||||||
onOpenAffine: () => void;
|
onOpenAffine: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [hasSetUp, setHasSetUp] = useState(false);
|
const [hasSetUp, setHasSetUp] = useState(false);
|
||||||
const [email, setEmail] = useState('');
|
const [email, setEmail] = useState('');
|
||||||
const [isValidEmail, setIsValidEmail] = useState(true);
|
const [isValidEmail, setIsValidEmail] = useState(true);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { PasswordLimitsFragment } from '@affine/graphql';
|
import type { PasswordLimitsFragment } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export const ChangePasswordPage: FC<{
|
|||||||
onSetPassword: propsOnSetPassword,
|
onSetPassword: propsOnSetPassword,
|
||||||
onOpenAffine,
|
onOpenAffine,
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [hasSetUp, setHasSetUp] = useState(false);
|
const [hasSetUp, setHasSetUp] = useState(false);
|
||||||
|
|
||||||
const onSetPassword = useCallback(
|
const onSetPassword = useCallback(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
|
|
||||||
import { Button } from '../../ui/button';
|
import { Button } from '../../ui/button';
|
||||||
@@ -7,7 +7,7 @@ import { AuthPageContainer } from './auth-page-container';
|
|||||||
export const ConfirmChangeEmail: FC<{
|
export const ConfirmChangeEmail: FC<{
|
||||||
onOpenAffine: () => void;
|
onOpenAffine: () => void;
|
||||||
}> = ({ onOpenAffine }) => {
|
}> = ({ onOpenAffine }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthPageContainer
|
<AuthPageContainer
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
|
|
||||||
import { Button } from '../../ui/button';
|
import { Button } from '../../ui/button';
|
||||||
@@ -7,7 +7,7 @@ import { AuthPageContainer } from './auth-page-container';
|
|||||||
export const ConfirmChangeEmail: FC<{
|
export const ConfirmChangeEmail: FC<{
|
||||||
onOpenAffine: () => void;
|
onOpenAffine: () => void;
|
||||||
}> = ({ onOpenAffine }) => {
|
}> = ({ onOpenAffine }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthPageContainer
|
<AuthPageContainer
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { type PasswordLimitsFragment } from '@affine/graphql';
|
import { type PasswordLimitsFragment } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { type Options, passwordStrength } from 'check-password-strength';
|
import { type Options, passwordStrength } from 'check-password-strength';
|
||||||
import { type FC, useEffect, useMemo } from 'react';
|
import { type FC, useEffect, useMemo } from 'react';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
@@ -43,7 +43,7 @@ export const PasswordInput: FC<
|
|||||||
onPrevent: () => void;
|
onPrevent: () => void;
|
||||||
}
|
}
|
||||||
> = ({ passwordLimits, onPass, onPrevent, ...inputProps }) => {
|
> = ({ passwordLimits, onPass, onPrevent, ...inputProps }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const [status, setStatus] = useState<Status | null>(null);
|
const [status, setStatus] = useState<Status | null>(null);
|
||||||
const [confirmStatus, setConfirmStatus] = useState<
|
const [confirmStatus, setConfirmStatus] = useState<
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { PasswordLimitsFragment } from '@affine/graphql';
|
import type { PasswordLimitsFragment } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export const SetPasswordPage: FC<{
|
|||||||
onSetPassword: propsOnSetPassword,
|
onSetPassword: propsOnSetPassword,
|
||||||
onOpenAffine,
|
onOpenAffine,
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [hasSetUp, setHasSetUp] = useState(false);
|
const [hasSetUp, setHasSetUp] = useState(false);
|
||||||
|
|
||||||
const onSetPassword = useCallback(
|
const onSetPassword = useCallback(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { PasswordLimitsFragment } from '@affine/graphql';
|
import type { PasswordLimitsFragment } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback, useRef, useState } from 'react';
|
import { useCallback, useRef, useState } from 'react';
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ export const SetPassword: FC<{
|
|||||||
onLater?: () => void;
|
onLater?: () => void;
|
||||||
onSetPassword: (password: string) => void;
|
onSetPassword: (password: string) => void;
|
||||||
}> = ({ passwordLimits, onLater, onSetPassword, showLater = false }) => {
|
}> = ({ passwordLimits, onLater, onSetPassword, showLater = false }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const [passwordPass, setPasswordPass] = useState(false);
|
const [passwordPass, setPasswordPass] = useState(false);
|
||||||
const passwordRef = useRef('');
|
const passwordRef = useRef('');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
|
|
||||||
import { Button } from '../../ui/button';
|
import { Button } from '../../ui/button';
|
||||||
@@ -7,7 +7,7 @@ import { AuthPageContainer } from './auth-page-container';
|
|||||||
export const SignInSuccessPage: FC<{
|
export const SignInSuccessPage: FC<{
|
||||||
onOpenAffine: () => void;
|
onOpenAffine: () => void;
|
||||||
}> = ({ onOpenAffine }) => {
|
}> = ({ onOpenAffine }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<AuthPageContainer
|
<AuthPageContainer
|
||||||
title={t['com.affine.auth.signed.success.title']()}
|
title={t['com.affine.auth.signed.success.title']()}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { PasswordLimitsFragment } from '@affine/graphql';
|
import type { PasswordLimitsFragment } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ export const SignUpPage: FC<{
|
|||||||
onOpenAffine,
|
onOpenAffine,
|
||||||
openButtonText,
|
openButtonText,
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [hasSetUp, setHasSetUp] = useState(false);
|
const [hasSetUp, setHasSetUp] = useState(false);
|
||||||
|
|
||||||
const onSetPassword = useCallback(
|
const onSetPassword = useCallback(
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
|
|
||||||
import type { ConfirmModalProps } from '../../ui/modal';
|
import type { ConfirmModalProps } from '../../ui/modal';
|
||||||
import { ConfirmModal } from '../../ui/modal';
|
import { ConfirmModal } from '../../ui/modal';
|
||||||
|
|
||||||
export const PublicLinkDisableModal = (props: ConfirmModalProps) => {
|
export const PublicLinkDisableModal = (props: ConfirmModalProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { AuthPageContainer } from '@affine/component/auth-components';
|
import { AuthPageContainer } from '@affine/component/auth-components';
|
||||||
import type { GetInviteInfoQuery } from '@affine/graphql';
|
import type { GetInviteInfoQuery } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
|
|
||||||
import { Avatar } from '../../ui/avatar';
|
import { Avatar } from '../../ui/avatar';
|
||||||
import { Button } from '../../ui/button';
|
import { Button } from '../../ui/button';
|
||||||
@@ -13,7 +13,7 @@ export const AcceptInvitePage = ({
|
|||||||
onOpenWorkspace: () => void;
|
onOpenWorkspace: () => void;
|
||||||
inviteInfo: GetInviteInfoQuery['getInviteInfo'];
|
inviteInfo: GetInviteInfoQuery['getInviteInfo'];
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<AuthPageContainer
|
<AuthPageContainer
|
||||||
title={t['Successfully joined!']()}
|
title={t['Successfully joined!']()}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Permission } from '@affine/graphql';
|
import { Permission } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { ConfirmModal } from '../../ui/modal';
|
import { ConfirmModal } from '../../ui/modal';
|
||||||
@@ -19,7 +19,7 @@ export const InviteModal = ({
|
|||||||
onConfirm,
|
onConfirm,
|
||||||
isMutating,
|
isMutating,
|
||||||
}: InviteModalProps) => {
|
}: InviteModalProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [inviteEmail, setInviteEmail] = useState('');
|
const [inviteEmail, setInviteEmail] = useState('');
|
||||||
const [permission] = useState(Permission.Write);
|
const [permission] = useState(Permission.Write);
|
||||||
const [isValidEmail, setIsValidEmail] = useState(true);
|
const [isValidEmail, setIsValidEmail] = useState(true);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ConfirmModal } from '@affine/component/ui/modal';
|
import { ConfirmModal } from '@affine/component/ui/modal';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
export interface MemberLimitModalProps {
|
export interface MemberLimitModalProps {
|
||||||
@@ -19,7 +19,7 @@ export const MemberLimitModal = ({
|
|||||||
setOpen,
|
setOpen,
|
||||||
onConfirm,
|
onConfirm,
|
||||||
}: MemberLimitModalProps) => {
|
}: MemberLimitModalProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const handleConfirm = useCallback(() => {
|
const handleConfirm = useCallback(() => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
if (isFreePlan) {
|
if (isFreePlan) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { SignOutIcon } from '@blocksuite/icons/rc';
|
import { SignOutIcon } from '@blocksuite/icons/rc';
|
||||||
|
|
||||||
import { Avatar } from '../../ui/avatar';
|
import { Avatar } from '../../ui/avatar';
|
||||||
@@ -25,7 +25,7 @@ export const NoPermissionOrNotFound = ({
|
|||||||
onSignOut,
|
onSignOut,
|
||||||
signInComponent,
|
signInComponent,
|
||||||
}: NotFoundPageProps) => {
|
}: NotFoundPageProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AffineOtherPageLayout>
|
<AffineOtherPageLayout>
|
||||||
@@ -69,7 +69,7 @@ export const NotFoundPage = ({
|
|||||||
onBack,
|
onBack,
|
||||||
onSignOut,
|
onSignOut,
|
||||||
}: NotFoundPageProps) => {
|
}: NotFoundPageProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AffineOtherPageLayout>
|
<AffineOtherPageLayout>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// License on the MIT
|
// License on the MIT
|
||||||
// https://github.com/emilkowalski/sonner/blob/5cb703edc108a23fd74979235c2f3c4005edd2a7/src/index.tsx
|
// https://github.com/emilkowalski/sonner/blob/5cb703edc108a23fd74979235c2f3c4005edd2a7/src/index.tsx
|
||||||
|
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { CloseIcon, InformationFillDuotoneIcon } from '@blocksuite/icons/rc';
|
import { CloseIcon, InformationFillDuotoneIcon } from '@blocksuite/icons/rc';
|
||||||
import * as Toast from '@radix-ui/react-toast';
|
import * as Toast from '@radix-ui/react-toast';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
@@ -72,7 +72,7 @@ const typeColorMap = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function NotificationCard(props: NotificationCardProps): ReactNode {
|
function NotificationCard(props: NotificationCardProps): ReactNode {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const removeNotification = useSetAtom(removeNotificationAtom);
|
const removeNotification = useSetAtom(removeNotificationAtom);
|
||||||
const { notification, notifications, setHeights, heights, index } = props;
|
const { notification, notifications, setHeights, heights, index } = props;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import type { useI18n } from '@affine/i18n';
|
||||||
import { ImportIcon, PlusIcon } from '@blocksuite/icons/rc';
|
import { ImportIcon, PlusIcon } from '@blocksuite/icons/rc';
|
||||||
import type { createStore } from 'jotai';
|
import type { createStore } from 'jotai';
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ export function registerAffineCreationCommands({
|
|||||||
pageHelper,
|
pageHelper,
|
||||||
t,
|
t,
|
||||||
}: {
|
}: {
|
||||||
t: ReturnType<typeof useAFFiNEI18N>;
|
t: ReturnType<typeof useI18n>;
|
||||||
store: ReturnType<typeof createStore>;
|
store: ReturnType<typeof createStore>;
|
||||||
pageHelper: ReturnType<typeof usePageHelper>;
|
pageHelper: ReturnType<typeof usePageHelper>;
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import type { useI18n } from '@affine/i18n';
|
||||||
import { ContactWithUsIcon, NewIcon } from '@blocksuite/icons/rc';
|
import { ContactWithUsIcon, NewIcon } from '@blocksuite/icons/rc';
|
||||||
import type { createStore } from 'jotai';
|
import type { createStore } from 'jotai';
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ export function registerAffineHelpCommands({
|
|||||||
t,
|
t,
|
||||||
store,
|
store,
|
||||||
}: {
|
}: {
|
||||||
t: ReturnType<typeof useAFFiNEI18N>;
|
t: ReturnType<typeof useI18n>;
|
||||||
store: ReturnType<typeof createStore>;
|
store: ReturnType<typeof createStore>;
|
||||||
}) {
|
}) {
|
||||||
const unsubs: Array<() => void> = [];
|
const unsubs: Array<() => void> = [];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import type { useI18n } from '@affine/i18n';
|
||||||
import { SidebarIcon } from '@blocksuite/icons/rc';
|
import { SidebarIcon } from '@blocksuite/icons/rc';
|
||||||
import type { createStore } from 'jotai';
|
import type { createStore } from 'jotai';
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ export function registerAffineLayoutCommands({
|
|||||||
t,
|
t,
|
||||||
store,
|
store,
|
||||||
}: {
|
}: {
|
||||||
t: ReturnType<typeof useAFFiNEI18N>;
|
t: ReturnType<typeof useI18n>;
|
||||||
store: ReturnType<typeof createStore>;
|
store: ReturnType<typeof createStore>;
|
||||||
}) {
|
}) {
|
||||||
const unsubs: Array<() => void> = [];
|
const unsubs: Array<() => void> = [];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { WorkspaceSubPath } from '@affine/core/shared';
|
import { WorkspaceSubPath } from '@affine/core/shared';
|
||||||
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import type { useI18n } from '@affine/i18n';
|
||||||
import { ArrowRightBigIcon } from '@blocksuite/icons/rc';
|
import { ArrowRightBigIcon } from '@blocksuite/icons/rc';
|
||||||
import type { DocCollection } from '@blocksuite/store';
|
import type { DocCollection } from '@blocksuite/store';
|
||||||
import type { createStore } from 'jotai';
|
import type { createStore } from 'jotai';
|
||||||
@@ -15,7 +15,7 @@ export function registerAffineNavigationCommands({
|
|||||||
docCollection,
|
docCollection,
|
||||||
navigationHelper,
|
navigationHelper,
|
||||||
}: {
|
}: {
|
||||||
t: ReturnType<typeof useAFFiNEI18N>;
|
t: ReturnType<typeof useI18n>;
|
||||||
store: ReturnType<typeof createStore>;
|
store: ReturnType<typeof createStore>;
|
||||||
navigationHelper: ReturnType<typeof useNavigateHelper>;
|
navigationHelper: ReturnType<typeof useNavigateHelper>;
|
||||||
docCollection: DocCollection;
|
docCollection: DocCollection;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import type { useI18n } from '@affine/i18n';
|
||||||
import { SettingsIcon } from '@blocksuite/icons/rc';
|
import { SettingsIcon } from '@blocksuite/icons/rc';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
import type { AffineEditorContainer } from '@blocksuite/presets';
|
||||||
import { appSettingAtom } from '@toeverything/infra';
|
import { appSettingAtom } from '@toeverything/infra';
|
||||||
@@ -14,7 +14,7 @@ export function registerAffineSettingsCommands({
|
|||||||
theme,
|
theme,
|
||||||
languageHelper,
|
languageHelper,
|
||||||
}: {
|
}: {
|
||||||
t: ReturnType<typeof useAFFiNEI18N>;
|
t: ReturnType<typeof useI18n>;
|
||||||
store: ReturnType<typeof createStore>;
|
store: ReturnType<typeof createStore>;
|
||||||
theme: ReturnType<typeof useTheme>;
|
theme: ReturnType<typeof useTheme>;
|
||||||
languageHelper: ReturnType<typeof useLanguageHelper>;
|
languageHelper: ReturnType<typeof useLanguageHelper>;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { updateReadyAtom } from '@affine/core/hooks/use-app-updater';
|
import { updateReadyAtom } from '@affine/core/hooks/use-app-updater';
|
||||||
import { apis } from '@affine/electron-api';
|
import { apis } from '@affine/electron-api';
|
||||||
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import type { useI18n } from '@affine/i18n';
|
||||||
import { ResetIcon } from '@blocksuite/icons/rc';
|
import { ResetIcon } from '@blocksuite/icons/rc';
|
||||||
import type { createStore } from 'jotai';
|
import type { createStore } from 'jotai';
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ export function registerAffineUpdatesCommands({
|
|||||||
t,
|
t,
|
||||||
store,
|
store,
|
||||||
}: {
|
}: {
|
||||||
t: ReturnType<typeof useAFFiNEI18N>;
|
t: ReturnType<typeof useI18n>;
|
||||||
store: ReturnType<typeof createStore>;
|
store: ReturnType<typeof createStore>;
|
||||||
}) {
|
}) {
|
||||||
const unsubs: Array<() => void> = [];
|
const unsubs: Array<() => void> = [];
|
||||||
|
|||||||
+2
-3
@@ -1,7 +1,6 @@
|
|||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { useTheme } from 'next-themes';
|
import { useTheme } from 'next-themes';
|
||||||
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -58,7 +57,7 @@ export const ErrorDetail: FC<ErrorDetailProps> = props => {
|
|||||||
} = props;
|
} = props;
|
||||||
const descriptions = Array.isArray(description) ? description : [description];
|
const descriptions = Array.isArray(description) ? description : [description];
|
||||||
const [isBtnLoading, setBtnLoading] = useState(false);
|
const [isBtnLoading, setBtnLoading] = useState(false);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
|
|
||||||
const onBtnClick = useAsyncCallback(async () => {
|
const onBtnClick = useAsyncCallback(async () => {
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ import type { FallbackProps } from '../error-basic/fallback-creator';
|
|||||||
*/
|
*/
|
||||||
export const AnyErrorFallback: FC<FallbackProps> = props => {
|
export const AnyErrorFallback: FC<FallbackProps> = props => {
|
||||||
const { error } = props;
|
const { error } = props;
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const reloadPage = useCallback(() => {
|
const reloadPage = useCallback(() => {
|
||||||
document.location.reload();
|
document.location.reload();
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { NoPageRootError } from '@affine/core/components/blocksuite/block-suite-editor/no-page-error';
|
import { NoPageRootError } from '@affine/core/components/blocksuite/block-suite-editor/no-page-error';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
|
|
||||||
import { ContactUS, ErrorDetail } from '../error-basic/error-detail';
|
import { ContactUS, ErrorDetail } from '../error-basic/error-detail';
|
||||||
import { createErrorFallback } from '../error-basic/fallback-creator';
|
import { createErrorFallback } from '../error-basic/fallback-creator';
|
||||||
@@ -8,7 +8,7 @@ export const NoPageRootFallback = createErrorFallback(
|
|||||||
NoPageRootError,
|
NoPageRootError,
|
||||||
props => {
|
props => {
|
||||||
const { resetError } = props;
|
const { resetError } = props;
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorDetail
|
<ErrorDetail
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { PageNotFoundError } from '@affine/env/constant';
|
import { PageNotFoundError } from '@affine/env/constant';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -10,7 +10,7 @@ import { ErrorDetail, ErrorStatus } from '../error-basic/error-detail';
|
|||||||
import { createErrorFallback } from '../error-basic/fallback-creator';
|
import { createErrorFallback } from '../error-basic/fallback-creator';
|
||||||
|
|
||||||
export const PageNotFoundDetail = createErrorFallback(PageNotFoundError, () => {
|
export const PageNotFoundDetail = createErrorFallback(PageNotFoundError, () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { jumpToIndex } = useNavigateHelper();
|
const { jumpToIndex } = useNavigateHelper();
|
||||||
|
|
||||||
const onBtnClick = useCallback(
|
const onBtnClick = useCallback(
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { RecoverableError } from '../../../../unexpected-application-state/errors';
|
import { RecoverableError } from '../../../../unexpected-application-state/errors';
|
||||||
@@ -9,7 +9,7 @@ export const RecoverableErrorFallback = createErrorFallback(
|
|||||||
RecoverableError,
|
RecoverableError,
|
||||||
props => {
|
props => {
|
||||||
const { error, resetError } = props;
|
const { error, resetError } = props;
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [count, rerender] = useState(0);
|
const [count, rerender] = useState(0);
|
||||||
|
|
||||||
const canRetry = error.canRetry();
|
const canRetry = error.canRetry();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Button, FlexWrapper, notify } from '@affine/component';
|
|||||||
import { openSettingModalAtom } from '@affine/core/atoms';
|
import { openSettingModalAtom } from '@affine/core/atoms';
|
||||||
import { SubscriptionService } from '@affine/core/modules/cloud';
|
import { SubscriptionService } from '@affine/core/modules/cloud';
|
||||||
import { mixpanel } from '@affine/core/utils';
|
import { mixpanel } from '@affine/core/utils';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { AiIcon } from '@blocksuite/icons/rc';
|
import { AiIcon } from '@blocksuite/icons/rc';
|
||||||
import {
|
import {
|
||||||
DocService,
|
DocService,
|
||||||
@@ -52,7 +52,7 @@ export const AIOnboardingEdgeless = () => {
|
|||||||
SubscriptionService,
|
SubscriptionService,
|
||||||
});
|
});
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const notifyId = useLiveData(edgelessNotifyId$);
|
const notifyId = useLiveData(edgelessNotifyId$);
|
||||||
const generalAIOnboardingOpened = useLiveData(showAIOnboardingGeneral$);
|
const generalAIOnboardingOpened = useLiveData(showAIOnboardingGeneral$);
|
||||||
const aiSubscription = useLiveData(subscriptionService.subscription.ai$);
|
const aiSubscription = useLiveData(subscriptionService.subscription.ai$);
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import { openSettingModalAtom } from '@affine/core/atoms';
|
|||||||
import { useBlurRoot } from '@affine/core/hooks/use-blur-root';
|
import { useBlurRoot } from '@affine/core/hooks/use-blur-root';
|
||||||
import { AuthService, SubscriptionService } from '@affine/core/modules/cloud';
|
import { AuthService, SubscriptionService } from '@affine/core/modules/cloud';
|
||||||
import { mixpanel } from '@affine/core/utils';
|
import { mixpanel } from '@affine/core/utils';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { ArrowLeftSmallIcon } from '@blocksuite/icons/rc';
|
import { ArrowLeftSmallIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useServices } from '@toeverything/infra';
|
import { useLiveData, useServices } from '@toeverything/infra';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
@@ -18,7 +17,7 @@ import { Slider } from './slider';
|
|||||||
import { showAIOnboardingGeneral$ } from './state';
|
import { showAIOnboardingGeneral$ } from './state';
|
||||||
|
|
||||||
type PlayListItem = { video: string; title: ReactNode; desc: ReactNode };
|
type PlayListItem = { video: string; title: ReactNode; desc: ReactNode };
|
||||||
type Translate = ReturnType<typeof useAFFiNEI18N>;
|
type Translate = ReturnType<typeof useI18n>;
|
||||||
|
|
||||||
const getPlayList = (t: Translate): Array<PlayListItem> => [
|
const getPlayList = (t: Translate): Array<PlayListItem> => [
|
||||||
{
|
{
|
||||||
@@ -92,7 +91,7 @@ export const AIOnboardingGeneral = () => {
|
|||||||
const prevVideoRef = useRef<HTMLVideoElement | null>(null);
|
const prevVideoRef = useRef<HTMLVideoElement | null>(null);
|
||||||
const loginStatus = useLiveData(authService.session.status$);
|
const loginStatus = useLiveData(authService.session.status$);
|
||||||
const isLoggedIn = loginStatus === 'authenticated';
|
const isLoggedIn = loginStatus === 'authenticated';
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const open = useLiveData(showAIOnboardingGeneral$);
|
const open = useLiveData(showAIOnboardingGeneral$);
|
||||||
const aiSubscription = useLiveData(subscriptionService.subscription.ai$);
|
const aiSubscription = useLiveData(subscriptionService.subscription.ai$);
|
||||||
const [index, setIndex] = useState(0);
|
const [index, setIndex] = useState(0);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
useNavigateHelper,
|
useNavigateHelper,
|
||||||
} from '@affine/core/hooks/use-navigate-helper';
|
} from '@affine/core/hooks/use-navigate-helper';
|
||||||
import { AuthService } from '@affine/core/modules/cloud';
|
import { AuthService } from '@affine/core/modules/cloud';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { AiIcon } from '@blocksuite/icons/rc';
|
import { AiIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { cssVar } from '@toeverything/theme';
|
import { cssVar } from '@toeverything/theme';
|
||||||
@@ -30,7 +30,7 @@ const LocalOnboardingAnimation = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const FooterActions = ({ onDismiss }: { onDismiss: () => void }) => {
|
const FooterActions = ({ onDismiss }: { onDismiss: () => void }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const authService = useService(AuthService);
|
const authService = useService(AuthService);
|
||||||
const loginStatus = useLiveData(authService.session.status$);
|
const loginStatus = useLiveData(authService.session.status$);
|
||||||
const loggedIn = loginStatus === 'authenticated';
|
const loggedIn = loginStatus === 'authenticated';
|
||||||
@@ -64,7 +64,7 @@ const FooterActions = ({ onDismiss }: { onDismiss: () => void }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const AIOnboardingLocal = () => {
|
export const AIOnboardingLocal = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const authService = useService(AuthService);
|
const authService = useService(AuthService);
|
||||||
const notifyId = useLiveData(localNotifyId$);
|
const notifyId = useLiveData(localNotifyId$);
|
||||||
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
|
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import {
|
|||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { AuthService } from '@affine/core/modules/cloud';
|
import { AuthService } from '@affine/core/modules/cloud';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@ export const AfterSignInSendEmail = ({
|
|||||||
|
|
||||||
const [isSending, setIsSending] = useState(false);
|
const [isSending, setIsSending] = useState(false);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const authService = useService(AuthService);
|
const authService = useService(AuthService);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import {
|
|||||||
} from '@affine/component/auth-components';
|
} from '@affine/component/auth-components';
|
||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
@@ -36,7 +35,7 @@ export const AfterSignUpSendEmail: FC<AuthPanelProps> = ({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const [isSending, setIsSending] = useState(false);
|
const [isSending, setIsSending] = useState(false);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const authService = useService(AuthService);
|
const authService = useService(AuthService);
|
||||||
const loginStatus = useLiveData(authService.session.status$);
|
const loginStatus = useLiveData(authService.session.status$);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { useConfirmModal } from '@affine/component';
|
import { useConfirmModal } from '@affine/component';
|
||||||
import { authAtom } from '@affine/core/atoms';
|
import { authAtom } from '@affine/core/atoms';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { atom, useAtom, useSetAtom } from 'jotai';
|
import { atom, useAtom, useSetAtom } from 'jotai';
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
|
|
||||||
export const showAILoginRequiredAtom = atom(false);
|
export const showAILoginRequiredAtom = atom(false);
|
||||||
|
|
||||||
export const AiLoginRequiredModal = () => {
|
export const AiLoginRequiredModal = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [open, setOpen] = useAtom(showAILoginRequiredAtom);
|
const [open, setOpen] = useAtom(showAILoginRequiredAtom);
|
||||||
const setAuth = useSetAtom(authAtom);
|
const setAuth = useSetAtom(authAtom);
|
||||||
const { openConfirmModal, closeConfirmModal } = useConfirmModal();
|
const { openConfirmModal, closeConfirmModal } = useConfirmModal();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
sendSetPasswordEmailMutation,
|
sendSetPasswordEmailMutation,
|
||||||
sendVerifyEmailMutation,
|
sendVerifyEmailMutation,
|
||||||
} from '@affine/graphql';
|
} from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ import { ServerConfigService } from '../../../modules/cloud';
|
|||||||
import type { AuthPanelProps } from './index';
|
import type { AuthPanelProps } from './index';
|
||||||
|
|
||||||
const useEmailTitle = (emailType: AuthPanelProps['emailType']) => {
|
const useEmailTitle = (emailType: AuthPanelProps['emailType']) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
switch (emailType) {
|
switch (emailType) {
|
||||||
case 'setPassword':
|
case 'setPassword':
|
||||||
@@ -37,7 +37,7 @@ const useEmailTitle = (emailType: AuthPanelProps['emailType']) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const useNotificationHint = (emailType: AuthPanelProps['emailType']) => {
|
const useNotificationHint = (emailType: AuthPanelProps['emailType']) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
switch (emailType) {
|
switch (emailType) {
|
||||||
case 'setPassword':
|
case 'setPassword':
|
||||||
@@ -50,7 +50,7 @@ const useNotificationHint = (emailType: AuthPanelProps['emailType']) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const useButtonContent = (emailType: AuthPanelProps['emailType']) => {
|
const useButtonContent = (emailType: AuthPanelProps['emailType']) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
switch (emailType) {
|
switch (emailType) {
|
||||||
case 'setPassword':
|
case 'setPassword':
|
||||||
@@ -138,7 +138,7 @@ export const SendEmail = ({
|
|||||||
email,
|
email,
|
||||||
emailType,
|
emailType,
|
||||||
}: AuthPanelProps) => {
|
}: AuthPanelProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const serverConfig = useService(ServerConfigService).serverConfig;
|
const serverConfig = useService(ServerConfigService).serverConfig;
|
||||||
|
|
||||||
const passwordLimits = useLiveData(
|
const passwordLimits = useLiveData(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { AuthService } from '@affine/core/modules/cloud';
|
import { AuthService } from '@affine/core/modules/cloud';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useService } from '@toeverything/infra';
|
import { useService } from '@toeverything/infra';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
@@ -22,7 +22,7 @@ export const SignInWithPassword: FC<AuthPanelProps> = ({
|
|||||||
email,
|
email,
|
||||||
onSignedIn,
|
onSignedIn,
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const authService = useService(AuthService);
|
const authService = useService(AuthService);
|
||||||
|
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import { notify } from '@affine/component';
|
|||||||
import { AuthInput, ModalHeader } from '@affine/component/auth-components';
|
import { AuthInput, ModalHeader } from '@affine/component/auth-components';
|
||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { ArrowDownBigIcon } from '@blocksuite/icons/rc';
|
import { ArrowDownBigIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
@@ -28,7 +27,7 @@ export const SignIn: FC<AuthPanelProps> = ({
|
|||||||
email,
|
email,
|
||||||
onSignedIn,
|
onSignedIn,
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const authService = useService(AuthService);
|
const authService = useService(AuthService);
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const [isMutating, setIsMutating] = useState(false);
|
const [isMutating, setIsMutating] = useState(false);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Tooltip } from '@affine/component/ui/tooltip';
|
import { Tooltip } from '@affine/component/ui/tooltip';
|
||||||
import { mixpanel } from '@affine/core/utils';
|
import { mixpanel } from '@affine/core/utils';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useLiveData, useServices } from '@toeverything/infra';
|
import { useLiveData, useServices } from '@toeverything/infra';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
@@ -49,7 +49,7 @@ export const UserPlanButton = () => {
|
|||||||
[setSettingModalAtom]
|
[setSettingModalAtom]
|
||||||
);
|
);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
if (!hasPayment) {
|
if (!hasPayment) {
|
||||||
// no payment feature
|
// no payment feature
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
|||||||
import { DebugLogger } from '@affine/debug';
|
import { DebugLogger } from '@affine/debug';
|
||||||
import { apis } from '@affine/electron-api';
|
import { apis } from '@affine/electron-api';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
initEmptyPage,
|
initEmptyPage,
|
||||||
useLiveData,
|
useLiveData,
|
||||||
@@ -55,7 +55,7 @@ const NameWorkspaceContent = ({
|
|||||||
onConfirmName,
|
onConfirmName,
|
||||||
...props
|
...props
|
||||||
}: NameWorkspaceContentProps) => {
|
}: NameWorkspaceContentProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [workspaceName, setWorkspaceName] = useState('');
|
const [workspaceName, setWorkspaceName] = useState('');
|
||||||
const [enable, setEnable] = useState(shouldEnableCloud);
|
const [enable, setEnable] = useState(shouldEnableCloud);
|
||||||
const session = useService(AuthService).session;
|
const session = useService(AuthService).session;
|
||||||
@@ -182,7 +182,7 @@ export const CreateWorkspaceModal = ({
|
|||||||
onCreate,
|
onCreate,
|
||||||
}: ModalProps) => {
|
}: ModalProps) => {
|
||||||
const [step, setStep] = useState<CreateWorkspaceStep>();
|
const [step, setStep] = useState<CreateWorkspaceStep>();
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const workspacesService = useService(WorkspacesService);
|
const workspacesService = useService(WorkspacesService);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
openHistoryTipsModalAtom,
|
openHistoryTipsModalAtom,
|
||||||
} from '@affine/core/atoms';
|
} from '@affine/core/atoms';
|
||||||
import { useEnableCloud } from '@affine/core/hooks/affine/use-enable-cloud';
|
import { useEnableCloud } from '@affine/core/hooks/affine/use-enable-cloud';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useService, WorkspaceService } from '@toeverything/infra';
|
import { useService, WorkspaceService } from '@toeverything/infra';
|
||||||
import { useAtom, useSetAtom } from 'jotai';
|
import { useAtom, useSetAtom } from 'jotai';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
@@ -12,7 +12,7 @@ import { useCallback } from 'react';
|
|||||||
import TopSvg from './top-svg';
|
import TopSvg from './top-svg';
|
||||||
|
|
||||||
export const HistoryTipsModal = () => {
|
export const HistoryTipsModal = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const currentWorkspace = useService(WorkspaceService).workspace;
|
const currentWorkspace = useService(WorkspaceService).workspace;
|
||||||
const [open, setOpen] = useAtom(openHistoryTipsModalAtom);
|
const [open, setOpen] = useAtom(openHistoryTipsModalAtom);
|
||||||
const setTempDisableCloudOpen = useSetAtom(openDisableCloudAlertModalAtom);
|
const setTempDisableCloudOpen = useSetAtom(openDisableCloudAlertModalAtom);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { OverlayModal } from '@affine/component';
|
import { OverlayModal } from '@affine/component';
|
||||||
import { openIssueFeedbackModalAtom } from '@affine/core/atoms';
|
import { openIssueFeedbackModalAtom } from '@affine/core/atoms';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
|
|
||||||
export const IssueFeedbackModal = () => {
|
export const IssueFeedbackModal = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [open, setOpen] = useAtom(openIssueFeedbackModalAtom);
|
const [open, setOpen] = useAtom(openIssueFeedbackModalAtom);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import { openSettingModalAtom } from '@affine/core/atoms';
|
|||||||
import { useDocCollectionPageTitle } from '@affine/core/hooks/use-block-suite-workspace-page-title';
|
import { useDocCollectionPageTitle } from '@affine/core/hooks/use-block-suite-workspace-page-title';
|
||||||
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
||||||
import { WorkspaceQuotaService } from '@affine/core/modules/quota';
|
import { WorkspaceQuotaService } from '@affine/core/modules/quota';
|
||||||
import { i18nTime, Trans } from '@affine/i18n';
|
import { i18nTime, Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { CloseIcon, ToggleCollapseIcon } from '@blocksuite/icons/rc';
|
import { CloseIcon, ToggleCollapseIcon } from '@blocksuite/icons/rc';
|
||||||
import type { Doc as BlockSuiteDoc, DocCollection } from '@blocksuite/store';
|
import type { Doc as BlockSuiteDoc, DocCollection } from '@blocksuite/store';
|
||||||
import * as Collapsible from '@radix-ui/react-collapsible';
|
import * as Collapsible from '@radix-ui/react-collapsible';
|
||||||
@@ -234,7 +233,7 @@ const PlanPrompt = () => {
|
|||||||
});
|
});
|
||||||
}, [setSettingModalAtom]);
|
}, [setSettingModalAtom]);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const planTitle = useMemo(() => {
|
const planTitle = useMemo(() => {
|
||||||
return (
|
return (
|
||||||
@@ -315,7 +314,7 @@ const PageHistoryList = ({
|
|||||||
onLoadMore: (() => void) | false;
|
onLoadMore: (() => void) | false;
|
||||||
loadingMore: boolean;
|
loadingMore: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const historyListByDay = useMemo(() => {
|
const historyListByDay = useMemo(() => {
|
||||||
return historyListGroupByDay(historyList);
|
return historyListGroupByDay(historyList);
|
||||||
}, [historyList]);
|
}, [historyList]);
|
||||||
@@ -410,7 +409,7 @@ const PageHistoryList = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const EmptyHistoryPrompt = () => {
|
const EmptyHistoryPrompt = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -447,7 +446,7 @@ const PageHistoryManager = ({
|
|||||||
|
|
||||||
const snapshotPage = useSnapshotPage(docCollection, pageDocId, activeVersion);
|
const snapshotPage = useSnapshotPage(docCollection, pageDocId, activeVersion);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const { onRestore, isMutating } = useRestorePage(docCollection, pageId);
|
const { onRestore, isMutating } = useRestorePage(docCollection, pageId);
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
import { ConfirmModal } from '@affine/component';
|
import { ConfirmModal } from '@affine/component';
|
||||||
import { WorkspacePropertiesAdapter } from '@affine/core/modules/properties';
|
import { WorkspacePropertiesAdapter } from '@affine/core/modules/properties';
|
||||||
import type { PageInfoCustomPropertyMeta } from '@affine/core/modules/properties/services/schema';
|
import type { PageInfoCustomPropertyMeta } from '@affine/core/modules/properties/services/schema';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { useService } from '@toeverything/infra';
|
import { useService } from '@toeverything/infra';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ export const ConfirmDeletePropertyModal = ({
|
|||||||
onConfirm: () => void;
|
onConfirm: () => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const adapter = useService(WorkspacePropertiesAdapter);
|
const adapter = useService(WorkspacePropertiesAdapter);
|
||||||
const count = useMemo(() => {
|
const count = useMemo(() => {
|
||||||
const manager = new PagePropertiesMetaManager(adapter);
|
const manager = new PagePropertiesMetaManager(adapter);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Menu, Scrollable } from '@affine/component';
|
import { Menu, Scrollable } from '@affine/component';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { chunk } from 'lodash-es';
|
import { chunk } from 'lodash-es';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ export const IconsSelectorPanel = ({
|
|||||||
iconButton.scrollIntoView({ block: 'center' });
|
iconButton.scrollIntoView({ block: 'center' });
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<Scrollable.Root>
|
<Scrollable.Root>
|
||||||
<div role="heading" className={styles.menuHeader}>
|
<div role="heading" className={styles.menuHeader}>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
Scrollable,
|
Scrollable,
|
||||||
} from '@affine/component';
|
} from '@affine/component';
|
||||||
import type { PageInfoCustomPropertyMeta } from '@affine/core/modules/properties/services/schema';
|
import type { PageInfoCustomPropertyMeta } from '@affine/core/modules/properties/services/schema';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { KeyboardEventHandler, MouseEventHandler } from 'react';
|
import type { KeyboardEventHandler, MouseEventHandler } from 'react';
|
||||||
import { cloneElement, isValidElement, useCallback } from 'react';
|
import { cloneElement, isValidElement, useCallback } from 'react';
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ export const EditPropertyNameMenuItem = ({
|
|||||||
[onBlur]
|
[onBlur]
|
||||||
);
|
);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<div className={styles.propertyRowNamePopupRow}>
|
<div className={styles.propertyRowNamePopupRow}>
|
||||||
<IconsSelectorButton
|
<IconsSelectorButton
|
||||||
@@ -126,7 +126,7 @@ export const PropertyTypeMenuItem = ({
|
|||||||
property: PageInfoCustomPropertyMeta;
|
property: PageInfoCustomPropertyMeta;
|
||||||
}) => {
|
}) => {
|
||||||
const Icon = nameToIcon(getDefaultIconName(property.type), property.type);
|
const Icon = nameToIcon(getDefaultIconName(property.type), property.type);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<div className={styles.propertyRowTypeItem}>
|
<div className={styles.propertyRowTypeItem}>
|
||||||
{t['com.affine.page-properties.create-property.menu.header']()}
|
{t['com.affine.page-properties.create-property.menu.header']()}
|
||||||
|
|||||||
+5
-6
@@ -4,8 +4,7 @@ import type {
|
|||||||
PageInfoCustomPropertyMeta,
|
PageInfoCustomPropertyMeta,
|
||||||
PagePropertyType,
|
PagePropertyType,
|
||||||
} from '@affine/core/modules/properties/services/schema';
|
} from '@affine/core/modules/properties/services/schema';
|
||||||
import { i18nTime } from '@affine/i18n';
|
import { i18nTime, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { DocService, useService } from '@toeverything/infra';
|
import { DocService, useService } from '@toeverything/infra';
|
||||||
import { noop } from 'lodash-es';
|
import { noop } from 'lodash-es';
|
||||||
import type { ChangeEventHandler } from 'react';
|
import type { ChangeEventHandler } from 'react';
|
||||||
@@ -40,7 +39,7 @@ export const DateValue = ({ property }: PropertyRowValueProps) => {
|
|||||||
[manager, property.id]
|
[manager, property.id]
|
||||||
);
|
);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu items={<DatePicker value={property.value} onChange={handleChange} />}>
|
<Menu items={<DatePicker value={property.value} onChange={handleChange} />}>
|
||||||
@@ -102,7 +101,7 @@ export const TextValue = ({ property }: PropertyRowValueProps) => {
|
|||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValue(property.value);
|
setValue(property.value);
|
||||||
}, [property.value]);
|
}, [property.value]);
|
||||||
@@ -148,7 +147,7 @@ export const NumberValue = ({ property }: PropertyRowValueProps) => {
|
|||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValue(property.value);
|
setValue(property.value);
|
||||||
}, [property.value]);
|
}, [property.value]);
|
||||||
@@ -169,7 +168,7 @@ export const NumberValue = ({ property }: PropertyRowValueProps) => {
|
|||||||
export const TagsValue = () => {
|
export const TagsValue = () => {
|
||||||
const doc = useService(DocService).doc;
|
const doc = useService(DocService).doc;
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TagsInlineEditor
|
<TagsInlineEditor
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import type {
|
|||||||
PageInfoCustomPropertyMeta,
|
PageInfoCustomPropertyMeta,
|
||||||
PagePropertyType,
|
PagePropertyType,
|
||||||
} from '@affine/core/modules/properties/services/schema';
|
} from '@affine/core/modules/properties/services/schema';
|
||||||
import { i18nTime } from '@affine/i18n';
|
import { i18nTime, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import {
|
import {
|
||||||
ArrowDownSmallIcon,
|
ArrowDownSmallIcon,
|
||||||
@@ -254,7 +253,7 @@ const VisibilityModeSelector = ({
|
|||||||
property: PageInfoCustomProperty;
|
property: PageInfoCustomProperty;
|
||||||
}) => {
|
}) => {
|
||||||
const manager = useContext(managerContext);
|
const manager = useContext(managerContext);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const meta = manager.getCustomPropertyMeta(property.id);
|
const meta = manager.getCustomPropertyMeta(property.id);
|
||||||
const visibility = property.visibility || 'visible';
|
const visibility = property.visibility || 'visible';
|
||||||
|
|
||||||
@@ -317,7 +316,7 @@ export const PagePropertiesSettingsPopup = ({
|
|||||||
children,
|
children,
|
||||||
}: PagePropertiesSettingsPopupProps) => {
|
}: PagePropertiesSettingsPopupProps) => {
|
||||||
const manager = useContext(managerContext);
|
const manager = useContext(managerContext);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const menuItems = useMemo(() => {
|
const menuItems = useMemo(() => {
|
||||||
const options: MenuItemOption[] = [];
|
const options: MenuItemOption[] = [];
|
||||||
@@ -457,7 +456,7 @@ export const PagePropertyRowNameMenu = ({
|
|||||||
onFinishEditing,
|
onFinishEditing,
|
||||||
property.id,
|
property.id,
|
||||||
]);
|
]);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const handleNameBlur = useCallback(
|
const handleNameBlur = useCallback(
|
||||||
(v: string) => {
|
(v: string) => {
|
||||||
manager.updateCustomPropertyMeta(meta.id, {
|
manager.updateCustomPropertyMeta(meta.id, {
|
||||||
@@ -596,7 +595,7 @@ export const PagePropertiesTableHeader = ({
|
|||||||
}: PagePropertiesTableHeaderProps) => {
|
}: PagePropertiesTableHeaderProps) => {
|
||||||
const manager = useContext(managerContext);
|
const manager = useContext(managerContext);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const backlinks = useBlockSuitePageBacklinks(
|
const backlinks = useBlockSuitePageBacklinks(
|
||||||
manager.workspace.docCollection,
|
manager.workspace.docCollection,
|
||||||
manager.pageId
|
manager.pageId
|
||||||
@@ -788,7 +787,7 @@ const PagePropertyRow = ({ property }: PagePropertyRowProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const PageTagsRow = () => {
|
const PageTagsRow = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={styles.tagsPropertyRow}
|
className={styles.tagsPropertyRow}
|
||||||
@@ -882,7 +881,7 @@ export const PagePropertiesCreatePropertyMenuItems = ({
|
|||||||
onCreated,
|
onCreated,
|
||||||
metaManager,
|
metaManager,
|
||||||
}: PagePropertiesCreatePropertyMenuItemsProps) => {
|
}: PagePropertiesCreatePropertyMenuItemsProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const onAddProperty = useCallback(
|
const onAddProperty = useCallback(
|
||||||
(
|
(
|
||||||
e: React.MouseEvent,
|
e: React.MouseEvent,
|
||||||
@@ -943,7 +942,7 @@ const PagePropertiesAddPropertyMenuItems = ({
|
|||||||
}: PagePropertiesAddPropertyMenuItemsProps) => {
|
}: PagePropertiesAddPropertyMenuItemsProps) => {
|
||||||
const manager = useContext(managerContext);
|
const manager = useContext(managerContext);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const metaList = manager.metaManager.getOrderedPropertiesSchema();
|
const metaList = manager.metaManager.getOrderedPropertiesSchema();
|
||||||
const nonRequiredMetaList = metaList.filter(meta => !meta.required);
|
const nonRequiredMetaList = metaList.filter(meta => !meta.required);
|
||||||
const isChecked = useCallback(
|
const isChecked = useCallback(
|
||||||
@@ -1004,7 +1003,7 @@ const PagePropertiesAddPropertyMenuItems = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const PagePropertiesAddProperty = () => {
|
export const PagePropertiesAddProperty = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [adding, setAdding] = useState(true);
|
const [adding, setAdding] = useState(true);
|
||||||
const manager = useContext(managerContext);
|
const manager = useContext(managerContext);
|
||||||
const toggleAdding: MouseEventHandler = useCallback(e => {
|
const toggleAdding: MouseEventHandler = useCallback(e => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { IconButton, Input, Menu, Scrollable } from '@affine/component';
|
|||||||
import { useNavigateHelper } from '@affine/core/hooks/use-navigate-helper';
|
import { useNavigateHelper } from '@affine/core/hooks/use-navigate-helper';
|
||||||
import { WorkspaceLegacyProperties } from '@affine/core/modules/properties';
|
import { WorkspaceLegacyProperties } from '@affine/core/modules/properties';
|
||||||
import { DeleteTagConfirmModal, TagService } from '@affine/core/modules/tag';
|
import { DeleteTagConfirmModal, TagService } from '@affine/core/modules/tag';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { DeleteIcon, MoreHorizontalIcon, TagsIcon } from '@blocksuite/icons/rc';
|
import { DeleteIcon, MoreHorizontalIcon, TagsIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
@@ -73,7 +73,7 @@ export const EditTagMenu = ({
|
|||||||
tagId: string;
|
tagId: string;
|
||||||
onTagDelete: (tagIds: string[]) => void;
|
onTagDelete: (tagIds: string[]) => void;
|
||||||
}>) => {
|
}>) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const legacyProperties = useService(WorkspaceLegacyProperties);
|
const legacyProperties = useService(WorkspaceLegacyProperties);
|
||||||
const tagList = useService(TagService).tagList;
|
const tagList = useService(TagService).tagList;
|
||||||
const tag = useLiveData(tagList.tagByTagId$(tagId));
|
const tag = useLiveData(tagList.tagByTagId$(tagId));
|
||||||
@@ -172,7 +172,7 @@ export const EditTagMenu = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const TagsEditor = ({ pageId, readonly }: TagsEditorProps) => {
|
export const TagsEditor = ({ pageId, readonly }: TagsEditorProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const tagList = useService(TagService).tagList;
|
const tagList = useService(TagService).tagList;
|
||||||
const tags = useLiveData(tagList.tags$);
|
const tags = useLiveData(tagList.tags$);
|
||||||
const tagIds = useLiveData(tagList.tagIdsByPageId$(pageId));
|
const tagIds = useLiveData(tagList.tagIdsByPageId$(pageId));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ConfirmModal } from '@affine/component/ui/modal';
|
import { ConfirmModal } from '@affine/component/ui/modal';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ import * as styles from './style.css';
|
|||||||
|
|
||||||
export const PaymentDisableModal = () => {
|
export const PaymentDisableModal = () => {
|
||||||
const [open, setOpen] = useAtom(openPaymentDisableAtom);
|
const [open, setOpen] = useAtom(openPaymentDisableAtom);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const onClickCancel = useCallback(() => {
|
const onClickCancel = useCallback(() => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
|||||||
+2
-2
@@ -4,14 +4,14 @@ import { UserQuotaService } from '@affine/core/modules/cloud';
|
|||||||
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
||||||
import { WorkspaceQuotaService } from '@affine/core/modules/quota';
|
import { WorkspaceQuotaService } from '@affine/core/modules/quota';
|
||||||
import { mixpanel } from '@affine/core/utils';
|
import { mixpanel } from '@affine/core/utils';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
|
import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
|
||||||
import bytes from 'bytes';
|
import bytes from 'bytes';
|
||||||
import { useAtom, useSetAtom } from 'jotai';
|
import { useAtom, useSetAtom } from 'jotai';
|
||||||
import { useCallback, useEffect, useMemo } from 'react';
|
import { useCallback, useEffect, useMemo } from 'react';
|
||||||
|
|
||||||
export const CloudQuotaModal = () => {
|
export const CloudQuotaModal = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const currentWorkspace = useService(WorkspaceService).workspace;
|
const currentWorkspace = useService(WorkspaceService).workspace;
|
||||||
const [open, setOpen] = useAtom(openQuotaModalAtom);
|
const [open, setOpen] = useAtom(openQuotaModalAtom);
|
||||||
const workspaceQuotaService = useService(WorkspaceQuotaService);
|
const workspaceQuotaService = useService(WorkspaceQuotaService);
|
||||||
|
|||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
import { ConfirmModal } from '@affine/component/ui/modal';
|
import { ConfirmModal } from '@affine/component/ui/modal';
|
||||||
import { openQuotaModalAtom } from '@affine/core/atoms';
|
import { openQuotaModalAtom } from '@affine/core/atoms';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useService, WorkspaceService } from '@toeverything/infra';
|
import { useService, WorkspaceService } from '@toeverything/infra';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { useCallback, useEffect } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
|
|
||||||
export const LocalQuotaModal = () => {
|
export const LocalQuotaModal = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const currentWorkspace = useService(WorkspaceService).workspace;
|
const currentWorkspace = useService(WorkspaceService).workspace;
|
||||||
const [open, setOpen] = useAtom(openQuotaModalAtom);
|
const [open, setOpen] = useAtom(openQuotaModalAtom);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
useInsidePeekView,
|
useInsidePeekView,
|
||||||
} from '@affine/core/modules/peek-view';
|
} from '@affine/core/modules/peek-view';
|
||||||
import { WorkbenchLink } from '@affine/core/modules/workbench';
|
import { WorkbenchLink } from '@affine/core/modules/workbench';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
LinkedEdgelessIcon,
|
LinkedEdgelessIcon,
|
||||||
LinkedPageIcon,
|
LinkedPageIcon,
|
||||||
@@ -29,7 +29,7 @@ export interface PageReferenceRendererOptions {
|
|||||||
docCollection: DocCollection;
|
docCollection: DocCollection;
|
||||||
pageMetaHelper: ReturnType<typeof useDocMetaHelper>;
|
pageMetaHelper: ReturnType<typeof useDocMetaHelper>;
|
||||||
journalHelper: ReturnType<typeof useJournalHelper>;
|
journalHelper: ReturnType<typeof useJournalHelper>;
|
||||||
t: ReturnType<typeof useAFFiNEI18N>;
|
t: ReturnType<typeof useI18n>;
|
||||||
}
|
}
|
||||||
// use a function to be rendered in the lit renderer
|
// use a function to be rendered in the lit renderer
|
||||||
export function pageReferenceRenderer({
|
export function pageReferenceRenderer({
|
||||||
@@ -77,7 +77,7 @@ export function AffinePageReference({
|
|||||||
}) {
|
}) {
|
||||||
const pageMetaHelper = useDocMetaHelper(docCollection);
|
const pageMetaHelper = useDocMetaHelper(docCollection);
|
||||||
const journalHelper = useJournalHelper(docCollection);
|
const journalHelper = useJournalHelper(docCollection);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const docsService = useService(DocsService);
|
const docsService = useService(DocsService);
|
||||||
const mode$ = LiveData.from(docsService.list.observeMode(pageId), null);
|
const mode$ = LiveData.from(docsService.list.observeMode(pageId), null);
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ import {
|
|||||||
UserCopilotQuotaService,
|
UserCopilotQuotaService,
|
||||||
} from '@affine/core/modules/cloud';
|
} from '@affine/core/modules/cloud';
|
||||||
import { mixpanel } from '@affine/core/utils';
|
import { mixpanel } from '@affine/core/utils';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { cssVar } from '@toeverything/theme';
|
import { cssVar } from '@toeverything/theme';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
@@ -17,7 +17,7 @@ import { AIResume, AISubscribe } from '../general-setting/plans/ai/actions';
|
|||||||
import * as styles from './storage-progress.css';
|
import * as styles from './storage-progress.css';
|
||||||
|
|
||||||
export const AIUsagePanel = () => {
|
export const AIUsagePanel = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const setOpenSettingModal = useSetAtom(openSettingModalAtom);
|
const setOpenSettingModal = useSetAtom(openSettingModalAtom);
|
||||||
const serverConfigService = useService(ServerConfigService);
|
const serverConfigService = useService(ServerConfigService);
|
||||||
const hasPaymentFeature = useLiveData(
|
const hasPaymentFeature = useLiveData(
|
||||||
|
|||||||
+5
-5
@@ -6,7 +6,7 @@ import {
|
|||||||
import { Avatar } from '@affine/component/ui/avatar';
|
import { Avatar } from '@affine/component/ui/avatar';
|
||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { ArrowRightSmallIcon, CameraIcon } from '@blocksuite/icons/rc';
|
import { ArrowRightSmallIcon, CameraIcon } from '@blocksuite/icons/rc';
|
||||||
import {
|
import {
|
||||||
useEnsureLiveData,
|
useEnsureLiveData,
|
||||||
@@ -31,7 +31,7 @@ import { StorageProgress } from './storage-progress';
|
|||||||
import * as styles from './style.css';
|
import * as styles from './style.css';
|
||||||
|
|
||||||
export const UserAvatar = () => {
|
export const UserAvatar = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const session = useService(AuthService).session;
|
const session = useService(AuthService).session;
|
||||||
const account = useEnsureLiveData(session.account$);
|
const account = useEnsureLiveData(session.account$);
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ export const UserAvatar = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const AvatarAndName = () => {
|
export const AvatarAndName = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const session = useService(AuthService).session;
|
const session = useService(AuthService).session;
|
||||||
const account = useEnsureLiveData(session.account$);
|
const account = useEnsureLiveData(session.account$);
|
||||||
const [input, setInput] = useState<string>(account.label);
|
const [input, setInput] = useState<string>(account.label);
|
||||||
@@ -158,7 +158,7 @@ export const AvatarAndName = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const StoragePanel = () => {
|
const StoragePanel = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const setSettingModalAtom = useSetAtom(openSettingModalAtom);
|
const setSettingModalAtom = useSetAtom(openSettingModalAtom);
|
||||||
const onUpgrade = useCallback(() => {
|
const onUpgrade = useCallback(() => {
|
||||||
@@ -193,7 +193,7 @@ export const AccountSetting: FC = () => {
|
|||||||
const serverFeatures = useLiveData(
|
const serverFeatures = useLiveData(
|
||||||
serverConfigService.serverConfig.features$
|
serverConfigService.serverConfig.features$
|
||||||
);
|
);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const session = authService.session;
|
const session = authService.session;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
session.revalidate();
|
session.revalidate();
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { Button, ErrorMessage, Skeleton, Tooltip } from '@affine/component';
|
import { Button, ErrorMessage, Skeleton, Tooltip } from '@affine/component';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { cssVar } from '@toeverything/theme';
|
import { cssVar } from '@toeverything/theme';
|
||||||
import { useEffect, useMemo } from 'react';
|
import { useEffect, useMemo } from 'react';
|
||||||
@@ -22,7 +22,7 @@ enum ButtonType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const StorageProgress = ({ onUpgrade }: StorageProgressProgress) => {
|
export const StorageProgress = ({ onUpgrade }: StorageProgressProgress) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const quota = useService(UserQuotaService).quota;
|
const quota = useService(UserQuotaService).quota;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ import {
|
|||||||
SettingWrapper,
|
SettingWrapper,
|
||||||
} from '@affine/component/setting-components';
|
} from '@affine/component/setting-components';
|
||||||
import { useAppUpdater } from '@affine/core/hooks/use-app-updater';
|
import { useAppUpdater } from '@affine/core/hooks/use-app-updater';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { ArrowRightSmallIcon, OpenInNewIcon } from '@blocksuite/icons/rc';
|
import { ArrowRightSmallIcon, OpenInNewIcon } from '@blocksuite/icons/rc';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import * as styles from './style.css';
|
|||||||
import { UpdateCheckSection } from './update-check-section';
|
import { UpdateCheckSection } from './update-check-section';
|
||||||
|
|
||||||
export const AboutAffine = () => {
|
export const AboutAffine = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { appSettings, updateSettings } = useAppSettingHelper();
|
const { appSettings, updateSettings } = useAppSettingHelper();
|
||||||
const { toggleAutoCheck, toggleAutoDownload } = useAppUpdater();
|
const { toggleAutoCheck, toggleAutoDownload } = useAppUpdater();
|
||||||
const channel = runtimeConfig.appBuildType;
|
const channel = runtimeConfig.appBuildType;
|
||||||
|
|||||||
+3
-3
@@ -3,7 +3,7 @@ import { SettingRow } from '@affine/component/setting-components';
|
|||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { useAppUpdater } from '@affine/core/hooks/use-app-updater';
|
import { useAppUpdater } from '@affine/core/hooks/use-app-updater';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ enum CheckUpdateStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useUpdateStatusLabels = (checkUpdateStatus: CheckUpdateStatus) => {
|
const useUpdateStatusLabels = (checkUpdateStatus: CheckUpdateStatus) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { updateAvailable, downloadProgress, updateReady, checkingForUpdates } =
|
const { updateAvailable, downloadProgress, updateReady, checkingForUpdates } =
|
||||||
useAppUpdater();
|
useAppUpdater();
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ const useUpdateStatusLabels = (checkUpdateStatus: CheckUpdateStatus) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const UpdateCheckSection = () => {
|
export const UpdateCheckSection = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const {
|
const {
|
||||||
checkForUpdates,
|
checkForUpdates,
|
||||||
downloadUpdate,
|
downloadUpdate,
|
||||||
|
|||||||
+4
-4
@@ -4,7 +4,7 @@ import {
|
|||||||
SettingRow,
|
SettingRow,
|
||||||
SettingWrapper,
|
SettingWrapper,
|
||||||
} from '@affine/component/setting-components';
|
} from '@affine/component/setting-components';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { AppSetting } from '@toeverything/infra';
|
import type { AppSetting } from '@toeverything/infra';
|
||||||
import { fontStyleOptions, windowFrameStyleOptions } from '@toeverything/infra';
|
import { fontStyleOptions, windowFrameStyleOptions } from '@toeverything/infra';
|
||||||
import { useTheme } from 'next-themes';
|
import { useTheme } from 'next-themes';
|
||||||
@@ -16,7 +16,7 @@ import { DateFormatSetting } from './date-format-setting';
|
|||||||
import { settingWrapper } from './style.css';
|
import { settingWrapper } from './style.css';
|
||||||
|
|
||||||
export const ThemeSettings = () => {
|
export const ThemeSettings = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { setTheme, theme } = useTheme();
|
const { setTheme, theme } = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -45,7 +45,7 @@ export const ThemeSettings = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const FontFamilySettings = () => {
|
const FontFamilySettings = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { appSettings, updateSettings } = useAppSettingHelper();
|
const { appSettings, updateSettings } = useAppSettingHelper();
|
||||||
return (
|
return (
|
||||||
<RadioButtonGroup
|
<RadioButtonGroup
|
||||||
@@ -92,7 +92,7 @@ const FontFamilySettings = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const AppearanceSettings = () => {
|
export const AppearanceSettings = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const { appSettings, updateSettings } = useAppSettingHelper();
|
const { appSettings, updateSettings } = useAppSettingHelper();
|
||||||
|
|
||||||
|
|||||||
+11
-12
@@ -18,8 +18,7 @@ import {
|
|||||||
SubscriptionRecurring,
|
SubscriptionRecurring,
|
||||||
SubscriptionStatus,
|
SubscriptionStatus,
|
||||||
} from '@affine/graphql';
|
} from '@affine/graphql';
|
||||||
import { i18nTime, Trans } from '@affine/i18n';
|
import { i18nTime, Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
|
import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
@@ -54,7 +53,7 @@ const getMessageKey = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const BillingSettings = () => {
|
export const BillingSettings = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -85,7 +84,7 @@ export const BillingSettings = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const SubscriptionSettings = () => {
|
const SubscriptionSettings = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const subscriptionService = useService(SubscriptionService);
|
const subscriptionService = useService(SubscriptionService);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
subscriptionService.subscription.revalidate();
|
subscriptionService.subscription.revalidate();
|
||||||
@@ -248,7 +247,7 @@ const SubscriptionSettings = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const AIPlanCard = ({ onClick }: { onClick: () => void }) => {
|
const AIPlanCard = ({ onClick }: { onClick: () => void }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const subscriptionService = useService(SubscriptionService);
|
const subscriptionService = useService(SubscriptionService);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
subscriptionService.subscription.revalidate();
|
subscriptionService.subscription.revalidate();
|
||||||
@@ -325,7 +324,7 @@ const PlanAction = ({
|
|||||||
plan: string;
|
plan: string;
|
||||||
gotoPlansSetting: () => void;
|
gotoPlansSetting: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
@@ -345,7 +344,7 @@ const PaymentMethodUpdater = () => {
|
|||||||
const { isMutating, trigger } = useMutation({
|
const { isMutating, trigger } = useMutation({
|
||||||
mutation: createCustomerPortalMutation,
|
mutation: createCustomerPortalMutation,
|
||||||
});
|
});
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const update = useAsyncCallback(async () => {
|
const update = useAsyncCallback(async () => {
|
||||||
await trigger(null, {
|
await trigger(null, {
|
||||||
@@ -368,7 +367,7 @@ const PaymentMethodUpdater = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ResumeSubscription = () => {
|
const ResumeSubscription = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -392,7 +391,7 @@ const CancelSubscription = ({ loading }: { loading?: boolean }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const BillingHistory = () => {
|
const BillingHistory = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { data: invoicesCountQueryResult } = useQuery({
|
const { data: invoicesCountQueryResult } = useQuery({
|
||||||
query: getInvoicesCountQuery,
|
query: getInvoicesCountQuery,
|
||||||
});
|
});
|
||||||
@@ -437,7 +436,7 @@ const InvoiceLine = ({
|
|||||||
}: {
|
}: {
|
||||||
invoice: NonNullable<InvoicesQuery['currentUser']>['invoices'][0];
|
invoice: NonNullable<InvoicesQuery['currentUser']>['invoices'][0];
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const open = useCallback(() => {
|
const open = useCallback(() => {
|
||||||
if (invoice.link) {
|
if (invoice.link) {
|
||||||
@@ -471,7 +470,7 @@ const InvoiceLine = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const SubscriptionSettingSkeleton = () => {
|
const SubscriptionSettingSkeleton = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<SettingWrapper
|
<SettingWrapper
|
||||||
title={t['com.affine.payment.billing-setting.information']()}
|
title={t['com.affine.payment.billing-setting.information']()}
|
||||||
@@ -485,7 +484,7 @@ const SubscriptionSettingSkeleton = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const BillingHistorySkeleton = () => {
|
const BillingHistorySkeleton = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<SettingWrapper title={t['com.affine.payment.billing-setting.history']()}>
|
<SettingWrapper title={t['com.affine.payment.billing-setting.history']()}>
|
||||||
<div className={styles.billingHistorySkeleton}>
|
<div className={styles.billingHistorySkeleton}>
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@ import { Button, Checkbox, Loading, Switch } from '@affine/component';
|
|||||||
import { SettingHeader } from '@affine/component/setting-components';
|
import { SettingHeader } from '@affine/component/setting-components';
|
||||||
import { useAppSettingHelper } from '@affine/core/hooks/affine/use-app-setting-helper';
|
import { useAppSettingHelper } from '@affine/core/hooks/affine/use-app-setting-helper';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { atomWithStorage } from 'jotai/utils';
|
import { atomWithStorage } from 'jotai/utils';
|
||||||
import { Suspense, useCallback, useState } from 'react';
|
import { Suspense, useCallback, useState } from 'react';
|
||||||
@@ -15,7 +15,7 @@ const ExperimentalFeaturesPrompt = ({
|
|||||||
}: {
|
}: {
|
||||||
onConfirm: () => void;
|
onConfirm: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [checked, setChecked] = useState(false);
|
const [checked, setChecked] = useState(false);
|
||||||
|
|
||||||
const onChange: (
|
const onChange: (
|
||||||
@@ -160,7 +160,7 @@ const BlocksuiteFeatureFlagSettings = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ExperimentalFeaturesMain = () => {
|
const ExperimentalFeaturesMain = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { UserFeatureService } from '@affine/core/modules/cloud/services/user-feature';
|
import { UserFeatureService } from '@affine/core/modules/cloud/services/user-feature';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
AppearanceIcon,
|
AppearanceIcon,
|
||||||
ExperimentIcon,
|
ExperimentIcon,
|
||||||
@@ -30,7 +30,7 @@ interface GeneralSettingListItem {
|
|||||||
export type GeneralSettingList = GeneralSettingListItem[];
|
export type GeneralSettingList = GeneralSettingListItem[];
|
||||||
|
|
||||||
export const useGeneralSettingList = (): GeneralSettingList => {
|
export const useGeneralSettingList = (): GeneralSettingList => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { authService, serverConfigService, userFeatureService } = useServices({
|
const { authService, serverConfigService, userFeatureService } = useServices({
|
||||||
AuthService,
|
AuthService,
|
||||||
ServerConfigService,
|
ServerConfigService,
|
||||||
|
|||||||
+2
-2
@@ -2,14 +2,14 @@ import { Button, type ButtonProps, useConfirmModal } from '@affine/component';
|
|||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { SubscriptionService } from '@affine/core/modules/cloud';
|
import { SubscriptionService } from '@affine/core/modules/cloud';
|
||||||
import { SubscriptionPlan } from '@affine/graphql';
|
import { SubscriptionPlan } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useService } from '@toeverything/infra';
|
import { useService } from '@toeverything/infra';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
export interface AICancelProps extends ButtonProps {}
|
export interface AICancelProps extends ButtonProps {}
|
||||||
export const AICancel = ({ ...btnProps }: AICancelProps) => {
|
export const AICancel = ({ ...btnProps }: AICancelProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [isMutating, setMutating] = useState(false);
|
const [isMutating, setMutating] = useState(false);
|
||||||
const [idempotencyKey, setIdempotencyKey] = useState(nanoid());
|
const [idempotencyKey, setIdempotencyKey] = useState(nanoid());
|
||||||
const subscription = useService(SubscriptionService).subscription;
|
const subscription = useService(SubscriptionService).subscription;
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
import { Button, type ButtonProps } from '@affine/component';
|
import { Button, type ButtonProps } from '@affine/component';
|
||||||
import { authAtom } from '@affine/core/atoms';
|
import { authAtom } from '@affine/core/atoms';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
export const AILogin = (btnProps: ButtonProps) => {
|
export const AILogin = (btnProps: ButtonProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const setOpen = useSetAtom(authAtom);
|
const setOpen = useSetAtom(authAtom);
|
||||||
|
|
||||||
const onClickSignIn = useCallback(() => {
|
const onClickSignIn = useCallback(() => {
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@ import {
|
|||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { SubscriptionService } from '@affine/core/modules/cloud';
|
import { SubscriptionService } from '@affine/core/modules/cloud';
|
||||||
import { SubscriptionPlan } from '@affine/graphql';
|
import { SubscriptionPlan } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { SingleSelectSelectSolidIcon } from '@blocksuite/icons/rc';
|
import { SingleSelectSelectSolidIcon } from '@blocksuite/icons/rc';
|
||||||
import { useService } from '@toeverything/infra';
|
import { useService } from '@toeverything/infra';
|
||||||
import { cssVar } from '@toeverything/theme';
|
import { cssVar } from '@toeverything/theme';
|
||||||
@@ -17,7 +17,7 @@ import { useState } from 'react';
|
|||||||
export interface AIResumeProps extends ButtonProps {}
|
export interface AIResumeProps extends ButtonProps {}
|
||||||
|
|
||||||
export const AIResume = ({ ...btnProps }: AIResumeProps) => {
|
export const AIResume = ({ ...btnProps }: AIResumeProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [idempotencyKey, setIdempotencyKey] = useState(nanoid());
|
const [idempotencyKey, setIdempotencyKey] = useState(nanoid());
|
||||||
const subscription = useService(SubscriptionService).subscription;
|
const subscription = useService(SubscriptionService).subscription;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
|||||||
import { SubscriptionService } from '@affine/core/modules/cloud';
|
import { SubscriptionService } from '@affine/core/modules/cloud';
|
||||||
import { mixpanel, popupWindow } from '@affine/core/utils';
|
import { mixpanel, popupWindow } from '@affine/core/utils';
|
||||||
import { SubscriptionPlan, SubscriptionRecurring } from '@affine/graphql';
|
import { SubscriptionPlan, SubscriptionRecurring } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
@@ -21,7 +21,7 @@ export const AISubscribe = ({ ...btnProps }: AISubscribeProps) => {
|
|||||||
subscriptionService.prices.revalidate();
|
subscriptionService.prices.revalidate();
|
||||||
}, [subscriptionService]);
|
}, [subscriptionService]);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpenedExternalWindow) {
|
if (isOpenedExternalWindow) {
|
||||||
|
|||||||
+2
-3
@@ -1,7 +1,6 @@
|
|||||||
import { Button } from '@affine/component';
|
import { Button } from '@affine/component';
|
||||||
import { AuthService, SubscriptionService } from '@affine/core/modules/cloud';
|
import { AuthService, SubscriptionService } from '@affine/core/modules/cloud';
|
||||||
import { i18nTime } from '@affine/i18n';
|
import { i18nTime, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ import * as styles from './ai-plan.css';
|
|||||||
import { AIBenefits } from './benefits';
|
import { AIBenefits } from './benefits';
|
||||||
|
|
||||||
export const AIPlan = () => {
|
export const AIPlan = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const authService = useService(AuthService);
|
const authService = useService(AuthService);
|
||||||
const subscriptionService = useService(SubscriptionService);
|
const subscriptionService = useService(SubscriptionService);
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
CheckBoxCheckLinearIcon,
|
CheckBoxCheckLinearIcon,
|
||||||
PenIcon,
|
PenIcon,
|
||||||
@@ -8,7 +8,7 @@ import { useMemo } from 'react';
|
|||||||
|
|
||||||
import * as styles from './ai-plan.css';
|
import * as styles from './ai-plan.css';
|
||||||
|
|
||||||
const benefitsGetter = (t: ReturnType<typeof useAFFiNEI18N>) => [
|
const benefitsGetter = (t: ReturnType<typeof useI18n>) => [
|
||||||
{
|
{
|
||||||
name: t['com.affine.payment.ai.benefit.g1'](),
|
name: t['com.affine.payment.ai.benefit.g1'](),
|
||||||
icon: <TextIcon />,
|
icon: <TextIcon />,
|
||||||
@@ -39,7 +39,7 @@ const benefitsGetter = (t: ReturnType<typeof useAFFiNEI18N>) => [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const AIBenefits = () => {
|
export const AIBenefits = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const benefits = useMemo(() => benefitsGetter(t), [t]);
|
const benefits = useMemo(() => benefitsGetter(t), [t]);
|
||||||
// TODO: responsive
|
// TODO: responsive
|
||||||
return (
|
return (
|
||||||
|
|||||||
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
// TODO: we don't handle i18n for now
|
// TODO: we don't handle i18n for now
|
||||||
// it's better to manage all equity at server side
|
// it's better to manage all equity at server side
|
||||||
import { SubscriptionPlan, SubscriptionRecurring } from '@affine/graphql';
|
import { SubscriptionPlan, SubscriptionRecurring } from '@affine/graphql';
|
||||||
import type { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import type { useI18n } from '@affine/i18n';
|
||||||
import { AfFiNeIcon } from '@blocksuite/icons/rc';
|
import { AfFiNeIcon } from '@blocksuite/icons/rc';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
import { planTitleTitleCaption } from './style.css';
|
import { planTitleTitleCaption } from './style.css';
|
||||||
|
|
||||||
type T = ReturnType<typeof useAFFiNEI18N>;
|
type T = ReturnType<typeof useI18n>;
|
||||||
|
|
||||||
export type Benefits = Record<
|
export type Benefits = Record<
|
||||||
string,
|
string,
|
||||||
|
|||||||
+4
-5
@@ -1,7 +1,6 @@
|
|||||||
import { Switch } from '@affine/component';
|
import { Switch } from '@affine/component';
|
||||||
import { SubscriptionPlan, SubscriptionRecurring } from '@affine/graphql';
|
import { SubscriptionPlan, SubscriptionRecurring } from '@affine/graphql';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import type { FallbackProps } from 'react-error-boundary';
|
import type { FallbackProps } from 'react-error-boundary';
|
||||||
@@ -20,7 +19,7 @@ const getRecurringLabel = ({
|
|||||||
t,
|
t,
|
||||||
}: {
|
}: {
|
||||||
recurring: SubscriptionRecurring;
|
recurring: SubscriptionRecurring;
|
||||||
t: ReturnType<typeof useAFFiNEI18N>;
|
t: ReturnType<typeof useI18n>;
|
||||||
}) => {
|
}) => {
|
||||||
return recurring === SubscriptionRecurring.Monthly
|
return recurring === SubscriptionRecurring.Monthly
|
||||||
? t['com.affine.payment.recurring-monthly']()
|
? t['com.affine.payment.recurring-monthly']()
|
||||||
@@ -28,7 +27,7 @@ const getRecurringLabel = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Settings = () => {
|
const Settings = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const loggedIn =
|
const loggedIn =
|
||||||
useLiveData(useService(AuthService).session.status$) === 'authenticated';
|
useLiveData(useService(AuthService).session.status$) === 'authenticated';
|
||||||
@@ -214,7 +213,7 @@ export const AFFiNEPricingPlans = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const PlansErrorBoundary = ({ resetErrorBoundary }: FallbackProps) => {
|
const PlansErrorBoundary = ({ resetErrorBoundary }: FallbackProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const scroll = (
|
const scroll = (
|
||||||
<div className={styles.errorTip}>
|
<div className={styles.errorTip}>
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import { Button, Divider, IconButton } from '@affine/component';
|
import { Button, Divider, IconButton } from '@affine/component';
|
||||||
import { SettingHeader } from '@affine/component/setting-components';
|
import { SettingHeader } from '@affine/component/setting-components';
|
||||||
import { openSettingModalAtom } from '@affine/core/atoms';
|
import { openSettingModalAtom } from '@affine/core/atoms';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
ArrowDownBigIcon,
|
ArrowDownBigIcon,
|
||||||
ArrowRightBigIcon,
|
ArrowRightBigIcon,
|
||||||
@@ -27,7 +27,7 @@ import { settingModalScrollContainerAtom } from '../../atoms';
|
|||||||
import * as styles from './layout.css';
|
import * as styles from './layout.css';
|
||||||
|
|
||||||
export const SeeAllLink = () => {
|
export const SeeAllLink = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
@@ -82,7 +82,7 @@ export interface PlanLayoutProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const PlanLayout = ({ cloud, ai, aiTip }: PlanLayoutProps) => {
|
export const PlanLayout = ({ cloud, ai, aiTip }: PlanLayoutProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [{ scrollAnchor }, setOpenSettingModal] = useAtom(openSettingModalAtom);
|
const [{ scrollAnchor }, setOpenSettingModal] = useAtom(openSettingModalAtom);
|
||||||
const aiPricingPlanRef = useRef<HTMLDivElement>(null);
|
const aiPricingPlanRef = useRef<HTMLDivElement>(null);
|
||||||
const aiScrollTipRef = useRef<HTMLDivElement>(null);
|
const aiScrollTipRef = useRef<HTMLDivElement>(null);
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import type { ConfirmModalProps } from '@affine/component/ui/modal';
|
import type { ConfirmModalProps } from '@affine/component/ui/modal';
|
||||||
import { ConfirmModal, Modal } from '@affine/component/ui/modal';
|
import { ConfirmModal, Modal } from '@affine/component/ui/modal';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { DialogTrigger } from '@radix-ui/react-dialog';
|
import { DialogTrigger } from '@radix-ui/react-dialog';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
@@ -26,7 +26,7 @@ export const ConfirmLoadingModal = ({
|
|||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
content?: ReactNode;
|
content?: ReactNode;
|
||||||
} & ConfirmModalProps) => {
|
} & ConfirmModalProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const confirmed = useRef(false);
|
const confirmed = useRef(false);
|
||||||
|
|
||||||
const title = t[`com.affine.payment.modal.${type}.title`]();
|
const title = t[`com.affine.payment.modal.${type}.title`]();
|
||||||
@@ -79,7 +79,7 @@ export const DowngradeModal = ({
|
|||||||
onOpenChange?: (open: boolean) => void;
|
onOpenChange?: (open: boolean) => void;
|
||||||
onCancel?: () => void;
|
onCancel?: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const canceled = useRef(false);
|
const canceled = useRef(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
+8
-9
@@ -5,8 +5,7 @@ import { AuthService, SubscriptionService } from '@affine/core/modules/cloud';
|
|||||||
import { popupWindow } from '@affine/core/utils';
|
import { popupWindow } from '@affine/core/utils';
|
||||||
import type { SubscriptionRecurring } from '@affine/graphql';
|
import type { SubscriptionRecurring } from '@affine/graphql';
|
||||||
import { SubscriptionPlan, SubscriptionStatus } from '@affine/graphql';
|
import { SubscriptionPlan, SubscriptionStatus } from '@affine/graphql';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { DoneIcon } from '@blocksuite/icons/rc';
|
import { DoneIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useAtom, useSetAtom } from 'jotai';
|
import { useAtom, useSetAtom } from 'jotai';
|
||||||
@@ -86,7 +85,7 @@ export const PlanCard = (props: PlanCardProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ActionButton = ({ detail, recurring }: PlanCardProps) => {
|
const ActionButton = ({ detail, recurring }: PlanCardProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const loggedIn =
|
const loggedIn =
|
||||||
useLiveData(useService(AuthService).session.status$) === 'authenticated';
|
useLiveData(useService(AuthService).session.status$) === 'authenticated';
|
||||||
const subscriptionService = useService(SubscriptionService);
|
const subscriptionService = useService(SubscriptionService);
|
||||||
@@ -157,7 +156,7 @@ const ActionButton = ({ detail, recurring }: PlanCardProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const CurrentPlan = () => {
|
const CurrentPlan = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<Button className={styles.planAction}>
|
<Button className={styles.planAction}>
|
||||||
{t['com.affine.payment.current-plan']()}
|
{t['com.affine.payment.current-plan']()}
|
||||||
@@ -166,7 +165,7 @@ const CurrentPlan = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Downgrade = ({ disabled }: { disabled?: boolean }) => {
|
const Downgrade = ({ disabled }: { disabled?: boolean }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const tooltipContent = disabled
|
const tooltipContent = disabled
|
||||||
@@ -192,7 +191,7 @@ const Downgrade = ({ disabled }: { disabled?: boolean }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const BookDemo = ({ plan }: { plan: SubscriptionPlan }) => {
|
const BookDemo = ({ plan }: { plan: SubscriptionPlan }) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const url = useMemo(() => {
|
const url = useMemo(() => {
|
||||||
switch (plan) {
|
switch (plan) {
|
||||||
case SubscriptionPlan.Team:
|
case SubscriptionPlan.Team:
|
||||||
@@ -227,7 +226,7 @@ const BookDemo = ({ plan }: { plan: SubscriptionPlan }) => {
|
|||||||
const Upgrade = ({ recurring }: { recurring: SubscriptionRecurring }) => {
|
const Upgrade = ({ recurring }: { recurring: SubscriptionRecurring }) => {
|
||||||
const [isMutating, setMutating] = useState(false);
|
const [isMutating, setMutating] = useState(false);
|
||||||
const [isOpenedExternalWindow, setOpenedExternalWindow] = useState(false);
|
const [isOpenedExternalWindow, setOpenedExternalWindow] = useState(false);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const subscriptionService = useService(SubscriptionService);
|
const subscriptionService = useService(SubscriptionService);
|
||||||
|
|
||||||
@@ -296,7 +295,7 @@ const ChangeRecurring = ({
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
due: string;
|
due: string;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [isMutating, setIsMutating] = useState(false);
|
const [isMutating, setIsMutating] = useState(false);
|
||||||
// allow replay request on network error until component unmount or success
|
// allow replay request on network error until component unmount or success
|
||||||
@@ -369,7 +368,7 @@ const SignUpAction = ({ children }: PropsWithChildren) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ResumeButton = () => {
|
const ResumeButton = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [hovered, setHovered] = useState(false);
|
const [hovered, setHovered] = useState(false);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ import {
|
|||||||
SettingHeader,
|
SettingHeader,
|
||||||
SettingWrapper,
|
SettingWrapper,
|
||||||
} from '@affine/component/setting-components';
|
} from '@affine/component/setting-components';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
|
|
||||||
import type { ShortcutsInfo } from '../../../../../hooks/affine/use-shortcuts';
|
import type { ShortcutsInfo } from '../../../../../hooks/affine/use-shortcuts';
|
||||||
import {
|
import {
|
||||||
@@ -41,7 +41,7 @@ const ShortcutsPanel = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Shortcuts = () => {
|
export const Shortcuts = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const markdownShortcutsInfo = useMarkdownShortcuts();
|
const markdownShortcutsInfo = useMarkdownShortcuts();
|
||||||
const pageShortcutsInfo = usePageShortcuts();
|
const pageShortcutsInfo = usePageShortcuts();
|
||||||
|
|||||||
+5
-5
@@ -9,7 +9,7 @@ import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
|||||||
import { AuthService } from '@affine/core/modules/cloud';
|
import { AuthService } from '@affine/core/modules/cloud';
|
||||||
import { UserFeatureService } from '@affine/core/modules/cloud/services/user-feature';
|
import { UserFeatureService } from '@affine/core/modules/cloud/services/user-feature';
|
||||||
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { Logo1Icon } from '@blocksuite/icons/rc';
|
import { Logo1Icon } from '@blocksuite/icons/rc';
|
||||||
import type { WorkspaceMetadata } from '@toeverything/infra';
|
import type { WorkspaceMetadata } from '@toeverything/infra';
|
||||||
import {
|
import {
|
||||||
@@ -73,7 +73,7 @@ export const UserInfo = ({ onAccountSettingClick, active }: UserInfoProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const SignInButton = () => {
|
export const SignInButton = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [, setAuthModal] = useAtom(authAtom);
|
const [, setAuthModal] = useAtom(authAtom);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -111,7 +111,7 @@ export const SettingSidebar = ({
|
|||||||
) => void;
|
) => void;
|
||||||
selectedWorkspaceId: string | null;
|
selectedWorkspaceId: string | null;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const loginStatus = useLiveData(useService(AuthService).session.status$);
|
const loginStatus = useLiveData(useService(AuthService).session.status$);
|
||||||
const generalList = useGeneralSettingList();
|
const generalList = useGeneralSettingList();
|
||||||
const onAccountSettingClick = useCallback(() => {
|
const onAccountSettingClick = useCallback(() => {
|
||||||
@@ -259,7 +259,7 @@ const subTabConfigs = [
|
|||||||
},
|
},
|
||||||
] satisfies {
|
] satisfies {
|
||||||
key: WorkspaceSubTab;
|
key: WorkspaceSubTab;
|
||||||
title: keyof ReturnType<typeof useAFFiNEI18N>;
|
title: keyof ReturnType<typeof useI18n>;
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
const avatarImageProps = { style: { borderRadius: 2 } };
|
const avatarImageProps = { style: { borderRadius: 2 } };
|
||||||
@@ -280,7 +280,7 @@ const WorkspaceListItem = ({
|
|||||||
const name = information?.name ?? UNTITLED_WORKSPACE_NAME;
|
const name = information?.name ?? UNTITLED_WORKSPACE_NAME;
|
||||||
const currentWorkspace = workspaceService.workspace;
|
const currentWorkspace = workspaceService.workspace;
|
||||||
const isCurrent = currentWorkspace.id === meta.id;
|
const isCurrent = currentWorkspace.id === meta.id;
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
userFeatureService.userFeature.revalidate();
|
userFeatureService.userFeature.revalidate();
|
||||||
|
|||||||
+2
-3
@@ -4,8 +4,7 @@ import { ConfirmModal } from '@affine/component/ui/modal';
|
|||||||
import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
||||||
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import type { WorkspaceMetadata } from '@toeverything/infra';
|
import type { WorkspaceMetadata } from '@toeverything/infra';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ export const WorkspaceDeleteModal = ({
|
|||||||
const info = useWorkspaceInfo(workspaceMetadata);
|
const info = useWorkspaceInfo(workspaceMetadata);
|
||||||
const workspaceName = info?.name ?? UNTITLED_WORKSPACE_NAME;
|
const workspaceName = info?.name ?? UNTITLED_WORKSPACE_NAME;
|
||||||
const allowDelete = deleteStr === workspaceName;
|
const allowDelete = deleteStr === workspaceName;
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const handleOnEnter = useCallback(() => {
|
const handleOnEnter = useCallback(() => {
|
||||||
if (allowDelete) {
|
if (allowDelete) {
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ import { SettingRow } from '@affine/component/setting-components';
|
|||||||
import { ConfirmModal } from '@affine/component/ui/modal';
|
import { ConfirmModal } from '@affine/component/ui/modal';
|
||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
|
import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
|
||||||
import {
|
import {
|
||||||
GlobalContextService,
|
GlobalContextService,
|
||||||
@@ -35,7 +35,7 @@ export const DeleteLeaveWorkspace = () => {
|
|||||||
WorkspacePermissionService,
|
WorkspacePermissionService,
|
||||||
WorkspacesService,
|
WorkspacesService,
|
||||||
});
|
});
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const workspace = workspaceService.workspace;
|
const workspace = workspaceService.workspace;
|
||||||
const { jumpToSubPath, jumpToIndex } = useNavigateHelper();
|
const { jumpToSubPath, jumpToIndex } = useNavigateHelper();
|
||||||
// fixme: cloud regression
|
// fixme: cloud regression
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ import { Button } from '@affine/component/ui/button';
|
|||||||
import { useEnableCloud } from '@affine/core/hooks/affine/use-enable-cloud';
|
import { useEnableCloud } from '@affine/core/hooks/affine/use-enable-cloud';
|
||||||
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
useLiveData,
|
useLiveData,
|
||||||
useService,
|
useService,
|
||||||
@@ -21,7 +21,7 @@ export interface PublishPanelProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const EnableCloudPanel = () => {
|
export const EnableCloudPanel = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const confirmEnableCloud = useEnableCloud();
|
const confirmEnableCloud = useEnableCloud();
|
||||||
|
|
||||||
const workspace = useService(WorkspaceService).workspace;
|
const workspace = useService(WorkspaceService).workspace;
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ import { Button } from '@affine/component/ui/button';
|
|||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { useSystemOnline } from '@affine/core/hooks/use-system-online';
|
import { useSystemOnline } from '@affine/core/hooks/use-system-online';
|
||||||
import { apis } from '@affine/electron-api';
|
import { apis } from '@affine/electron-api';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { Workspace, WorkspaceMetadata } from '@toeverything/infra';
|
import type { Workspace, WorkspaceMetadata } from '@toeverything/infra';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ export const ExportPanel = ({
|
|||||||
workspace,
|
workspace,
|
||||||
}: ExportPanelProps) => {
|
}: ExportPanelProps) => {
|
||||||
const workspaceId = workspaceMetadata.id;
|
const workspaceId = workspaceMetadata.id;
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
const isOnline = useSystemOnline();
|
const isOnline = useSystemOnline();
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ import {
|
|||||||
import { useWorkspace } from '@affine/core/hooks/use-workspace';
|
import { useWorkspace } from '@affine/core/hooks/use-workspace';
|
||||||
import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
||||||
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
|
import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
|
||||||
import { FrameworkScope } from '@toeverything/infra';
|
import { FrameworkScope } from '@toeverything/infra';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
@@ -22,7 +22,7 @@ import type { WorkspaceSettingDetailProps } from './types';
|
|||||||
export const WorkspaceSettingDetail = ({
|
export const WorkspaceSettingDetail = ({
|
||||||
workspaceMetadata,
|
workspaceMetadata,
|
||||||
}: WorkspaceSettingDetailProps) => {
|
}: WorkspaceSettingDetailProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
// useWorkspace hook is a vary heavy operation here, but we need syncing name and avatar changes here,
|
// useWorkspace hook is a vary heavy operation here, but we need syncing name and avatar changes here,
|
||||||
// we don't have a better way to do this now
|
// we don't have a better way to do this now
|
||||||
|
|||||||
+6
-6
@@ -26,7 +26,7 @@ import { WorkspaceQuotaService } from '@affine/core/modules/quota';
|
|||||||
import { mixpanel } from '@affine/core/utils';
|
import { mixpanel } from '@affine/core/utils';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { Permission } from '@affine/graphql';
|
import { Permission } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { MoreVerticalIcon } from '@blocksuite/icons/rc';
|
import { MoreVerticalIcon } from '@blocksuite/icons/rc';
|
||||||
import {
|
import {
|
||||||
useEnsureLiveData,
|
useEnsureLiveData,
|
||||||
@@ -58,7 +58,7 @@ import * as style from './style.css';
|
|||||||
const COUNT_PER_PAGE = 8;
|
const COUNT_PER_PAGE = 8;
|
||||||
type OnRevoke = (memberId: string) => void;
|
type OnRevoke = (memberId: string) => void;
|
||||||
const MembersPanelLocal = () => {
|
const MembersPanelLocal = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<Tooltip content={t['com.affine.settings.member-tooltip']()}>
|
<Tooltip content={t['com.affine.settings.member-tooltip']()}>
|
||||||
<div className={style.fakeWrapper}>
|
<div className={style.fakeWrapper}>
|
||||||
@@ -105,7 +105,7 @@ export const CloudWorkspaceMembersPanel = () => {
|
|||||||
? checkMemberCountLimit(memberCount, workspaceQuota.memberLimit)
|
? checkMemberCountLimit(memberCount, workspaceQuota.memberLimit)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const { invite, isMutating } = useInviteMember(workspace.id);
|
const { invite, isMutating } = useInviteMember(workspace.id);
|
||||||
const revokeMemberPermission = useRevokeMemberPermission(workspace.id);
|
const revokeMemberPermission = useRevokeMemberPermission(workspace.id);
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ export const CloudWorkspaceMembersPanel = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
export const MembersPanelFallback = () => {
|
export const MembersPanelFallback = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -282,7 +282,7 @@ const MemberListFallback = ({ memberCount }: { memberCount: number }) => {
|
|||||||
}
|
}
|
||||||
return 'auto';
|
return 'auto';
|
||||||
}, [memberCount]);
|
}, [memberCount]);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -338,7 +338,7 @@ const MemberItem = ({
|
|||||||
currentAccount: AuthAccountInfo;
|
currentAccount: AuthAccountInfo;
|
||||||
onRevoke: OnRevoke;
|
onRevoke: OnRevoke;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const handleRevoke = useCallback(() => {
|
const handleRevoke = useCallback(() => {
|
||||||
onRevoke(member.id);
|
onRevoke(member.id);
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
|||||||
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
||||||
import { validateAndReduceImage } from '@affine/core/utils/reduce-image';
|
import { validateAndReduceImage } from '@affine/core/utils/reduce-image';
|
||||||
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { CameraIcon } from '@blocksuite/icons/rc';
|
import { CameraIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
|
import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
|
||||||
import type { KeyboardEvent, MouseEvent } from 'react';
|
import type { KeyboardEvent, MouseEvent } from 'react';
|
||||||
@@ -17,7 +17,7 @@ import * as style from './style.css';
|
|||||||
const avatarImageProps = { style: { borderRadius: 8 } };
|
const avatarImageProps = { style: { borderRadius: 8 } };
|
||||||
|
|
||||||
export const ProfilePanel = () => {
|
export const ProfilePanel = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const workspace = useService(WorkspaceService).workspace;
|
const workspace = useService(WorkspaceService).workspace;
|
||||||
const permissionService = useService(WorkspacePermissionService);
|
const permissionService = useService(WorkspacePermissionService);
|
||||||
|
|||||||
+6
-7
@@ -2,8 +2,7 @@ import { Button, IconButton, Menu } from '@affine/component';
|
|||||||
import { SettingHeader } from '@affine/component/setting-components';
|
import { SettingHeader } from '@affine/component/setting-components';
|
||||||
import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
import { useWorkspaceInfo } from '@affine/core/hooks/use-workspace-info';
|
||||||
import type { PageInfoCustomPropertyMeta } from '@affine/core/modules/properties/services/schema';
|
import type { PageInfoCustomPropertyMeta } from '@affine/core/modules/properties/services/schema';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import {
|
import {
|
||||||
DeleteIcon,
|
DeleteIcon,
|
||||||
FilterIcon,
|
FilterIcon,
|
||||||
@@ -61,7 +60,7 @@ const EditPropertyButton = ({
|
|||||||
}: {
|
}: {
|
||||||
property: PageInfoCustomPropertyMeta;
|
property: PageInfoCustomPropertyMeta;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const manager = useContext(managerContext);
|
const manager = useContext(managerContext);
|
||||||
const [localPropertyMeta, setLocalPropertyMeta] = useState(() => ({
|
const [localPropertyMeta, setLocalPropertyMeta] = useState(() => ({
|
||||||
...property,
|
...property,
|
||||||
@@ -202,7 +201,7 @@ const CustomPropertyRow = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const Icon = nameToIcon(property.icon, property.type);
|
const Icon = nameToIcon(property.icon, property.type);
|
||||||
const required = property.required;
|
const required = property.required;
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={styles.propertyRow}
|
className={styles.propertyRow}
|
||||||
@@ -272,7 +271,7 @@ const CustomPropertyRowsList = ({
|
|||||||
const manager = useContext(managerContext);
|
const manager = useContext(managerContext);
|
||||||
const properties = manager.getOrderedPropertiesSchema();
|
const properties = manager.getOrderedPropertiesSchema();
|
||||||
const statistics = manager.getPropertyStatistics();
|
const statistics = manager.getPropertyStatistics();
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
if (filterMode !== 'all') {
|
if (filterMode !== 'all') {
|
||||||
const filtered = properties.filter(property => {
|
const filtered = properties.filter(property => {
|
||||||
@@ -313,7 +312,7 @@ const CustomPropertyRowsList = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const WorkspaceSettingPropertiesMain = () => {
|
const WorkspaceSettingPropertiesMain = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const manager = useContext(managerContext);
|
const manager = useContext(managerContext);
|
||||||
const [filterMode, setFilterMode] = useState<PropertyFilterMode>('all');
|
const [filterMode, setFilterMode] = useState<PropertyFilterMode>('all');
|
||||||
const properties = manager.getOrderedPropertiesSchema();
|
const properties = manager.getOrderedPropertiesSchema();
|
||||||
@@ -390,7 +389,7 @@ export const WorkspaceSettingProperties = ({
|
|||||||
}: {
|
}: {
|
||||||
workspaceMetadata: WorkspaceMetadata;
|
workspaceMetadata: WorkspaceMetadata;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const workspace = useWorkspace(workspaceMetadata);
|
const workspace = useWorkspace(workspaceMetadata);
|
||||||
const workspaceInfo = useWorkspaceInfo(workspaceMetadata);
|
const workspaceInfo = useWorkspaceInfo(workspaceMetadata);
|
||||||
const title = workspaceInfo?.name || 'untitled';
|
const title = workspaceInfo?.name || 'untitled';
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ import { ExportMenuItems } from '@affine/core/components/page-list';
|
|||||||
import { useExportPage } from '@affine/core/hooks/affine/use-export-page';
|
import { useExportPage } from '@affine/core/hooks/affine/use-export-page';
|
||||||
import { useSharingUrl } from '@affine/core/hooks/affine/use-share-url';
|
import { useSharingUrl } from '@affine/core/hooks/affine/use-share-url';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { CopyIcon } from '@blocksuite/icons/rc';
|
import { CopyIcon } from '@blocksuite/icons/rc';
|
||||||
import { DocService, useLiveData, useService } from '@toeverything/infra';
|
import { DocService, useLiveData, useService } from '@toeverything/infra';
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ export const ShareExport = ({
|
|||||||
workspaceMetadata: workspace,
|
workspaceMetadata: workspace,
|
||||||
currentPage,
|
currentPage,
|
||||||
}: ShareMenuProps) => {
|
}: ShareMenuProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const doc = useService(DocService).doc;
|
const doc = useService(DocService).doc;
|
||||||
const workspaceId = workspace.id;
|
const workspaceId = workspace.id;
|
||||||
const pageId = currentPage.id;
|
const pageId = currentPage.id;
|
||||||
|
|||||||
+4
-4
@@ -4,7 +4,7 @@ import { Menu } from '@affine/component/ui/menu';
|
|||||||
import { useRegisterCopyLinkCommands } from '@affine/core/hooks/affine/use-register-copy-link-commands';
|
import { useRegisterCopyLinkCommands } from '@affine/core/hooks/affine/use-register-copy-link-commands';
|
||||||
import { useIsActiveView } from '@affine/core/modules/workbench';
|
import { useIsActiveView } from '@affine/core/modules/workbench';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { WebIcon } from '@blocksuite/icons/rc';
|
import { WebIcon } from '@blocksuite/icons/rc';
|
||||||
import type { Doc } from '@blocksuite/store';
|
import type { Doc } from '@blocksuite/store';
|
||||||
import type { WorkspaceMetadata } from '@toeverything/infra';
|
import type { WorkspaceMetadata } from '@toeverything/infra';
|
||||||
@@ -22,7 +22,7 @@ export interface ShareMenuProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ShareMenuContent = (props: ShareMenuProps) => {
|
const ShareMenuContent = (props: ShareMenuProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<div className={styles.containerStyle}>
|
<div className={styles.containerStyle}>
|
||||||
<div className={styles.headerStyle}>
|
<div className={styles.headerStyle}>
|
||||||
@@ -41,7 +41,7 @@ const ShareMenuContent = (props: ShareMenuProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const LocalShareMenu = (props: ShareMenuProps) => {
|
const LocalShareMenu = (props: ShareMenuProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
items={<ShareMenuContent {...props} />}
|
items={<ShareMenuContent {...props} />}
|
||||||
@@ -65,7 +65,7 @@ const LocalShareMenu = (props: ShareMenuProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const CloudShareMenu = (props: ShareMenuProps) => {
|
const CloudShareMenu = (props: ShareMenuProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
// only enable copy link commands when the view is active and the workspace is cloud
|
// only enable copy link commands when the view is active and the workspace is cloud
|
||||||
const isActiveView = useIsActiveView();
|
const isActiveView = useIsActiveView();
|
||||||
|
|||||||
+3
-3
@@ -16,7 +16,7 @@ import { ShareService } from '@affine/core/modules/share-doc';
|
|||||||
import { mixpanel } from '@affine/core/utils';
|
import { mixpanel } from '@affine/core/utils';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { PublicPageMode } from '@affine/graphql';
|
import { PublicPageMode } from '@affine/graphql';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
ArrowRightSmallIcon,
|
ArrowRightSmallIcon,
|
||||||
SingleSelectSelectSolidIcon,
|
SingleSelectSelectSolidIcon,
|
||||||
@@ -36,7 +36,7 @@ import * as styles from './index.css';
|
|||||||
import type { ShareMenuProps } from './share-menu';
|
import type { ShareMenuProps } from './share-menu';
|
||||||
|
|
||||||
export const LocalSharePage = (props: ShareMenuProps) => {
|
export const LocalSharePage = (props: ShareMenuProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.localSharePage}>
|
<div className={styles.localSharePage}>
|
||||||
@@ -95,7 +95,7 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
|||||||
urlType: 'share',
|
urlType: 'share',
|
||||||
});
|
});
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const onClickCreateLink = useAsyncCallback(async () => {
|
const onClickCreateLink = useAsyncCallback(async () => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { ConfirmModalProps } from '@affine/component/ui/modal';
|
import type { ConfirmModalProps } from '@affine/component/ui/modal';
|
||||||
import { ConfirmModal } from '@affine/component/ui/modal';
|
import { ConfirmModal } from '@affine/component/ui/modal';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
type SignOutConfirmModalI18NKeys =
|
type SignOutConfirmModalI18NKeys =
|
||||||
@@ -11,7 +11,7 @@ type SignOutConfirmModalI18NKeys =
|
|||||||
|
|
||||||
export const SignOutModal = ({ ...props }: ConfirmModalProps) => {
|
export const SignOutModal = ({ ...props }: ConfirmModalProps) => {
|
||||||
const { title, description, cancelText, confirmButtonOptions = {} } = props;
|
const { title, description, cancelText, confirmButtonOptions = {} } = props;
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const defaultTexts = useMemo(() => {
|
const defaultTexts = useMemo(() => {
|
||||||
const getDefaultText = (key: SignOutConfirmModalI18NKeys) => {
|
const getDefaultText = (key: SignOutConfirmModalI18NKeys) => {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { OverlayModal } from '@affine/component';
|
import { OverlayModal } from '@affine/component';
|
||||||
import { openStarAFFiNEModalAtom } from '@affine/core/atoms';
|
import { openStarAFFiNEModalAtom } from '@affine/core/atoms';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
|
|
||||||
export const StarAFFiNEModal = () => {
|
export const StarAFFiNEModal = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [open, setOpen] = useAtom(openStarAFFiNEModalAtom);
|
const [open, setOpen] = useAtom(openStarAFFiNEModalAtom);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { AuthPageContainer } from '@affine/component/auth-components';
|
import { AuthPageContainer } from '@affine/component/auth-components';
|
||||||
import { Button } from '@affine/component/ui/button';
|
import { Button } from '@affine/component/ui/button';
|
||||||
import { useNavigateHelper } from '@affine/core/hooks/use-navigate-helper';
|
import { useNavigateHelper } from '@affine/core/hooks/use-navigate-helper';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { type ReactNode, useCallback } from 'react';
|
import { type ReactNode, useCallback } from 'react';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
@@ -15,7 +14,7 @@ const UpgradeSuccessLayout = ({
|
|||||||
title?: ReactNode;
|
title?: ReactNode;
|
||||||
description?: ReactNode;
|
description?: ReactNode;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const [params] = useSearchParams();
|
const [params] = useSearchParams();
|
||||||
|
|
||||||
const { jumpToIndex, openInApp } = useNavigateHelper();
|
const { jumpToIndex, openInApp } = useNavigateHelper();
|
||||||
@@ -56,7 +55,7 @@ const UpgradeSuccessLayout = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const CloudUpgradeSuccess = () => {
|
export const CloudUpgradeSuccess = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<UpgradeSuccessLayout
|
<UpgradeSuccessLayout
|
||||||
title={t['com.affine.payment.upgrade-success-page.title']()}
|
title={t['com.affine.payment.upgrade-success-page.title']()}
|
||||||
@@ -66,7 +65,7 @@ export const CloudUpgradeSuccess = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const AIUpgradeSuccess = () => {
|
export const AIUpgradeSuccess = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<UpgradeSuccessLayout
|
<UpgradeSuccessLayout
|
||||||
|
|||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
import { Empty } from '@affine/component';
|
import { Empty } from '@affine/component';
|
||||||
import type { ModalProps } from '@affine/component/ui/modal';
|
import type { ModalProps } from '@affine/component/ui/modal';
|
||||||
import { Modal } from '@affine/component/ui/modal';
|
import { Modal } from '@affine/component/ui/modal';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useI18n } from '@affine/i18n';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -13,7 +12,7 @@ import {
|
|||||||
} from './style';
|
} from './style';
|
||||||
|
|
||||||
export const TmpDisableAffineCloudModal = (props: ModalProps) => {
|
export const TmpDisableAffineCloudModal = (props: ModalProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const onClose = useCallback(() => {
|
const onClose = useCallback(() => {
|
||||||
props.onOpenChange?.(false);
|
props.onOpenChange?.(false);
|
||||||
}, [props]);
|
}, [props]);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { PlusIcon } from '@blocksuite/icons/rc';
|
import { PlusIcon } from '@blocksuite/icons/rc';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
@@ -17,7 +17,7 @@ export function AddPageButton({
|
|||||||
className,
|
className,
|
||||||
style,
|
style,
|
||||||
}: AddPageButtonProps) {
|
}: AddPageButtonProps) {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Tooltip } from '@affine/component';
|
import { Tooltip } from '@affine/component';
|
||||||
import { popupWindow } from '@affine/core/utils';
|
import { popupWindow } from '@affine/core/utils';
|
||||||
import { Unreachable } from '@affine/env/constant';
|
import { Unreachable } from '@affine/env/constant';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { CloseIcon, NewIcon, ResetIcon } from '@blocksuite/icons/rc';
|
import { CloseIcon, NewIcon, ResetIcon } from '@blocksuite/icons/rc';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
@@ -40,7 +40,7 @@ interface ButtonContentProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function DownloadUpdate({ updateAvailable }: ButtonContentProps) {
|
function DownloadUpdate({ updateAvailable }: ButtonContentProps) {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<div className={styles.installLabel}>
|
<div className={styles.installLabel}>
|
||||||
<span className={styles.ellipsisTextOverflow}>
|
<span className={styles.ellipsisTextOverflow}>
|
||||||
@@ -52,7 +52,7 @@ function DownloadUpdate({ updateAvailable }: ButtonContentProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function UpdateReady({ updateAvailable, appQuitting }: ButtonContentProps) {
|
function UpdateReady({ updateAvailable, appQuitting }: ButtonContentProps) {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<div className={styles.updateAvailableWrapper}>
|
<div className={styles.updateAvailableWrapper}>
|
||||||
<div className={styles.installLabelNormal}>
|
<div className={styles.installLabelNormal}>
|
||||||
@@ -76,7 +76,7 @@ function DownloadingUpdate({
|
|||||||
updateAvailable,
|
updateAvailable,
|
||||||
downloadProgress,
|
downloadProgress,
|
||||||
}: ButtonContentProps) {
|
}: ButtonContentProps) {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<div className={clsx([styles.updateAvailableWrapper])}>
|
<div className={clsx([styles.updateAvailableWrapper])}>
|
||||||
<div className={clsx([styles.installLabelNormal])}>
|
<div className={clsx([styles.installLabelNormal])}>
|
||||||
@@ -97,7 +97,7 @@ function DownloadingUpdate({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function OpenDownloadPage({ updateAvailable }: ButtonContentProps) {
|
function OpenDownloadPage({ updateAvailable }: ButtonContentProps) {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.installLabelNormal}>
|
<div className={styles.installLabelNormal}>
|
||||||
@@ -117,7 +117,7 @@ function OpenDownloadPage({ updateAvailable }: ButtonContentProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function WhatsNew({ onDismissChangelog }: ButtonContentProps) {
|
function WhatsNew({ onDismissChangelog }: ButtonContentProps) {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const onClickClose: React.MouseEventHandler = useCallback(
|
const onClickClose: React.MouseEventHandler = useCallback(
|
||||||
e => {
|
e => {
|
||||||
onDismissChangelog();
|
onDismissChangelog();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { SearchIcon } from '@blocksuite/icons/rc';
|
import { SearchIcon } from '@blocksuite/icons/rc';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import type { HTMLAttributes } from 'react';
|
import type { HTMLAttributes } from 'react';
|
||||||
@@ -12,7 +12,7 @@ interface QuickSearchInputProps extends HTMLAttributes<HTMLDivElement> {
|
|||||||
|
|
||||||
// Although it is called an input, it is actually a button.
|
// Although it is called an input, it is actually a button.
|
||||||
export function QuickSearchInput({ onClick, ...props }: QuickSearchInputProps) {
|
export function QuickSearchInput({ onClick, ...props }: QuickSearchInputProps) {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const isMac = environment.isBrowser && environment.isMacOs;
|
const isMac = environment.isBrowser && environment.isMacOs;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { IconButton, Tooltip } from '@affine/component';
|
import { IconButton, Tooltip } from '@affine/component';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { SidebarIcon } from '@blocksuite/icons/rc';
|
import { SidebarIcon } from '@blocksuite/icons/rc';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
@@ -15,7 +15,7 @@ export const SidebarSwitch = ({
|
|||||||
className?: string;
|
className?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const [open, setOpen] = useAtom(appSidebarOpenAtom);
|
const [open, setOpen] = useAtom(appSidebarOpenAtom);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const tooltipContent = open
|
const tooltipContent = open
|
||||||
? t['com.affine.sidebarSwitch.collapse']()
|
? t['com.affine.sidebarSwitch.collapse']()
|
||||||
: t['com.affine.sidebarSwitch.expand']();
|
: t['com.affine.sidebarSwitch.expand']();
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { useJournalInfoHelper } from '@affine/core/hooks/use-journal';
|
import { useJournalInfoHelper } from '@affine/core/hooks/use-journal';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import type { Doc } from '@blocksuite/store';
|
import type { Doc } from '@blocksuite/store';
|
||||||
|
|
||||||
import * as styles from './styles.css';
|
import * as styles from './styles.css';
|
||||||
@@ -7,7 +7,7 @@ import * as styles from './styles.css';
|
|||||||
export const BlocksuiteEditorJournalDocTitle = ({ page }: { page: Doc }) => {
|
export const BlocksuiteEditorJournalDocTitle = ({ page }: { page: Doc }) => {
|
||||||
const { localizedJournalDate, isTodayJournal, journalDate } =
|
const { localizedJournalDate, isTodayJournal, journalDate } =
|
||||||
useJournalInfoHelper(page.collection, page.id);
|
useJournalInfoHelper(page.collection, page.id);
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
// TODO: i18n
|
// TODO: i18n
|
||||||
const day = journalDate?.format('dddd') ?? null;
|
const day = journalDate?.format('dddd') ?? null;
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { FavoriteTag } from '@affine/core/components/page-list';
|
import { FavoriteTag } from '@affine/core/components/page-list';
|
||||||
import { FavoriteItemsAdapter } from '@affine/core/modules/properties';
|
import { FavoriteItemsAdapter } from '@affine/core/modules/properties';
|
||||||
import { toast } from '@affine/core/utils';
|
import { toast } from '@affine/core/utils';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
|
import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
@@ -11,7 +11,7 @@ export interface FavoriteButtonProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useFavorite = (pageId: string) => {
|
export const useFavorite = (pageId: string) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const workspace = useService(WorkspaceService).workspace;
|
const workspace = useService(WorkspaceService).workspace;
|
||||||
const docCollection = workspace.docCollection;
|
const docCollection = workspace.docCollection;
|
||||||
const currentPage = docCollection.getDoc(pageId);
|
const currentPage = docCollection.getDoc(pageId);
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { Button } from '@affine/component';
|
import { Button } from '@affine/component';
|
||||||
import { useJournalRouteHelper } from '@affine/core/hooks/use-journal';
|
import { useJournalRouteHelper } from '@affine/core/hooks/use-journal';
|
||||||
import type { DocCollection } from '@affine/core/shared';
|
import type { DocCollection } from '@affine/core/shared';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
export interface JournalTodayButtonProps {
|
export interface JournalTodayButtonProps {
|
||||||
@@ -11,7 +11,7 @@ export interface JournalTodayButtonProps {
|
|||||||
export const JournalTodayButton = ({
|
export const JournalTodayButton = ({
|
||||||
docCollection,
|
docCollection,
|
||||||
}: JournalTodayButtonProps) => {
|
}: JournalTodayButtonProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const journalHelper = useJournalRouteHelper(docCollection);
|
const journalHelper = useJournalRouteHelper(docCollection);
|
||||||
|
|
||||||
const onToday = useCallback(() => {
|
const onToday = useCallback(() => {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { useTrashModalHelper } from '@affine/core/hooks/affine/use-trash-modal-h
|
|||||||
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
|
||||||
import { mixpanel } from '@affine/core/utils';
|
import { mixpanel } from '@affine/core/utils';
|
||||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
DuplicateIcon,
|
DuplicateIcon,
|
||||||
EdgelessIcon,
|
EdgelessIcon,
|
||||||
@@ -49,7 +49,7 @@ export const PageHeaderMenuButton = ({
|
|||||||
pageId,
|
pageId,
|
||||||
isJournal,
|
isJournal,
|
||||||
}: PageMenuProps) => {
|
}: PageMenuProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
|
|
||||||
const workspace = useService(WorkspaceService).workspace;
|
const workspace = useService(WorkspaceService).workspace;
|
||||||
const docCollection = workspace.docCollection;
|
const docCollection = workspace.docCollection;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Tooltip } from '@affine/component/ui/tooltip';
|
import { Tooltip } from '@affine/component/ui/tooltip';
|
||||||
import { useBlockSuiteDocMeta } from '@affine/core/hooks/use-block-suite-page-meta';
|
import { useBlockSuiteDocMeta } from '@affine/core/hooks/use-block-suite-page-meta';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useI18n } from '@affine/i18n';
|
||||||
import {
|
import {
|
||||||
type DocMode,
|
type DocMode,
|
||||||
DocService,
|
DocService,
|
||||||
@@ -24,7 +24,7 @@ export type EditorModeSwitchProps = {
|
|||||||
publicMode?: DocMode;
|
publicMode?: DocMode;
|
||||||
};
|
};
|
||||||
const TooltipContent = () => {
|
const TooltipContent = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{t['Switch']()}
|
{t['Switch']()}
|
||||||
@@ -41,7 +41,7 @@ export const EditorModeSwitch = ({
|
|||||||
isPublic,
|
isPublic,
|
||||||
publicMode,
|
publicMode,
|
||||||
}: EditorModeSwitchProps) => {
|
}: EditorModeSwitchProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useI18n();
|
||||||
const pageMeta = useBlockSuiteDocMeta(docCollection).find(
|
const pageMeta = useBlockSuiteDocMeta(docCollection).find(
|
||||||
meta => meta.id === pageId
|
meta => meta.id === pageId
|
||||||
);
|
);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user