fix(core): remove plugins settings (#5337)
depend on https://github.com/toeverything/AFFiNE/pull/5324
This commit is contained in:
@@ -12,7 +12,6 @@ export const loading = style({
|
|||||||
[speedVar]: '1.5s',
|
[speedVar]: '1.5s',
|
||||||
},
|
},
|
||||||
textRendering: 'optimizeLegibility',
|
textRendering: 'optimizeLegibility',
|
||||||
WebkitFontSmoothing: 'antialiased',
|
|
||||||
transform: 'rotate(-90deg)',
|
transform: 'rotate(-90deg)',
|
||||||
animation: `${rotate} ${speedVar} infinite linear`,
|
animation: `${rotate} ${speedVar} infinite linear`,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {
|
|||||||
AppearanceIcon,
|
AppearanceIcon,
|
||||||
InformationIcon,
|
InformationIcon,
|
||||||
KeyboardIcon,
|
KeyboardIcon,
|
||||||
PluginIcon,
|
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
import type { ReactElement, SVGProps } from 'react';
|
import type { ReactElement, SVGProps } from 'react';
|
||||||
|
|
||||||
@@ -14,13 +13,11 @@ import { AppearanceSettings } from './appearance';
|
|||||||
import { BillingSettings } from './billing';
|
import { BillingSettings } from './billing';
|
||||||
import { PaymentIcon, UpgradeIcon } from './icons';
|
import { PaymentIcon, UpgradeIcon } from './icons';
|
||||||
import { AFFiNECloudPlans } from './plans';
|
import { AFFiNECloudPlans } from './plans';
|
||||||
import { Plugins } from './plugins';
|
|
||||||
import { Shortcuts } from './shortcuts';
|
import { Shortcuts } from './shortcuts';
|
||||||
|
|
||||||
export type GeneralSettingKeys =
|
export type GeneralSettingKeys =
|
||||||
| 'shortcuts'
|
| 'shortcuts'
|
||||||
| 'appearance'
|
| 'appearance'
|
||||||
| 'plugins'
|
|
||||||
| 'about'
|
| 'about'
|
||||||
| 'plans'
|
| 'plans'
|
||||||
| 'billing';
|
| 'billing';
|
||||||
@@ -52,12 +49,6 @@ export const useGeneralSettingList = (): GeneralSettingList => {
|
|||||||
icon: KeyboardIcon,
|
icon: KeyboardIcon,
|
||||||
testId: 'shortcuts-panel-trigger',
|
testId: 'shortcuts-panel-trigger',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'plugins',
|
|
||||||
title: 'Plugins',
|
|
||||||
icon: PluginIcon,
|
|
||||||
testId: 'plugins-panel-trigger',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'about',
|
key: 'about',
|
||||||
title: t['com.affine.aboutAFFiNE.title'](),
|
title: t['com.affine.aboutAFFiNE.title'](),
|
||||||
@@ -96,8 +87,6 @@ export const GeneralSetting = ({ generalKey }: GeneralSettingProps) => {
|
|||||||
return <Shortcuts />;
|
return <Shortcuts />;
|
||||||
case 'appearance':
|
case 'appearance':
|
||||||
return <AppearanceSettings />;
|
return <AppearanceSettings />;
|
||||||
case 'plugins':
|
|
||||||
return <Plugins />;
|
|
||||||
case 'about':
|
case 'about':
|
||||||
return <AboutAffine />;
|
return <AboutAffine />;
|
||||||
case 'plans':
|
case 'plans':
|
||||||
|
|||||||
@@ -127,9 +127,6 @@ export const SettingSidebar = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className={sidebarItemsWrapper}>
|
<div className={sidebarItemsWrapper}>
|
||||||
{generalSettingList.map(({ title, icon, key, testId }) => {
|
{generalSettingList.map(({ title, icon, key, testId }) => {
|
||||||
if (!runtimeConfig.enablePlugin && key === 'plugins') {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx(sidebarSelectItem, {
|
className={clsx(sidebarSelectItem, {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { WorkspaceMetadata } from '@affine/workspace/metadata';
|
import type { WorkspaceMetadata } from '@affine/workspace/metadata';
|
||||||
|
|
||||||
import { useIsWorkspaceOwner } from '../../../../hooks/affine/use-is-workspace-owner';
|
import { useIsWorkspaceOwner } from '../../../../hooks/affine/use-is-workspace-owner';
|
||||||
import { WorkspaceSettingDetail } from '../../new-workspace-setting-detail';
|
import { WorkspaceSettingDetail } from './new-workspace-setting-detail';
|
||||||
|
|
||||||
export const WorkspaceSetting = ({
|
export const WorkspaceSetting = ({
|
||||||
workspaceMetadata,
|
workspaceMetadata,
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks';
|
|||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
import { openSettingModalAtom } from '../../../../atoms';
|
import { openSettingModalAtom } from '../../../../../../atoms';
|
||||||
import {
|
import {
|
||||||
RouteLogic,
|
RouteLogic,
|
||||||
useNavigateHelper,
|
useNavigateHelper,
|
||||||
} from '../../../../hooks/use-navigate-helper';
|
} from '../../../../../../hooks/use-navigate-helper';
|
||||||
import type { WorkspaceSettingDetailProps } from '../types';
|
import type { WorkspaceSettingDetailProps } from '../types';
|
||||||
import { WorkspaceDeleteModal } from './delete';
|
import { WorkspaceDeleteModal } from './delete';
|
||||||
|
|
||||||
@@ -10,10 +10,10 @@ import { useWorkspaceInfo } from '@toeverything/hooks/use-workspace-info';
|
|||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
import { openSettingModalAtom } from '../../../atoms';
|
import { openSettingModalAtom } from '../../../../../atoms';
|
||||||
import { useNavigateHelper } from '../../../hooks/use-navigate-helper';
|
import { useNavigateHelper } from '../../../../../hooks/use-navigate-helper';
|
||||||
import { EnableAffineCloudModal } from '../enable-affine-cloud-modal';
|
import { EnableAffineCloudModal } from '../../../enable-affine-cloud-modal';
|
||||||
import { TmpDisableAffineCloudModal } from '../tmp-disable-affine-cloud-modal';
|
import { TmpDisableAffineCloudModal } from '../../../tmp-disable-affine-cloud-modal';
|
||||||
import type { WorkspaceSettingDetailProps } from './types';
|
import type { WorkspaceSettingDetailProps } from './types';
|
||||||
|
|
||||||
export interface PublishPanelProps extends WorkspaceSettingDetailProps {
|
export interface PublishPanelProps extends WorkspaceSettingDetailProps {
|
||||||
@@ -3,12 +3,12 @@ import {
|
|||||||
SettingRow,
|
SettingRow,
|
||||||
SettingWrapper,
|
SettingWrapper,
|
||||||
} from '@affine/component/setting-components';
|
} from '@affine/component/setting-components';
|
||||||
|
import { useSelfHosted } from '@affine/core/hooks/affine/use-server-config';
|
||||||
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
import { UNTITLED_WORKSPACE_NAME } from '@affine/env/constant';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { useWorkspace } from '@toeverything/hooks/use-workspace';
|
import { useWorkspace } from '@toeverything/hooks/use-workspace';
|
||||||
import { useWorkspaceInfo } from '@toeverything/hooks/use-workspace-info';
|
import { useWorkspaceInfo } from '@toeverything/hooks/use-workspace-info';
|
||||||
|
|
||||||
import { useSelfHosted } from '../../../hooks/affine/use-server-config';
|
|
||||||
import { DeleteLeaveWorkspace } from './delete-leave-workspace';
|
import { DeleteLeaveWorkspace } from './delete-leave-workspace';
|
||||||
import { EnableCloudPanel } from './enable-cloud';
|
import { EnableCloudPanel } from './enable-cloud';
|
||||||
import { ExportPanel } from './export';
|
import { ExportPanel } from './export';
|
||||||
@@ -29,15 +29,18 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
import { openSettingModalAtom } from '../../../atoms';
|
import { openSettingModalAtom } from '../../../../../atoms';
|
||||||
import type { CheckedUser } from '../../../hooks/affine/use-current-user';
|
import type { CheckedUser } from '../../../../../hooks/affine/use-current-user';
|
||||||
import { useCurrentUser } from '../../../hooks/affine/use-current-user';
|
import { useCurrentUser } from '../../../../../hooks/affine/use-current-user';
|
||||||
import { useInviteMember } from '../../../hooks/affine/use-invite-member';
|
import { useInviteMember } from '../../../../../hooks/affine/use-invite-member';
|
||||||
import { useMemberCount } from '../../../hooks/affine/use-member-count';
|
import { useMemberCount } from '../../../../../hooks/affine/use-member-count';
|
||||||
import { type Member, useMembers } from '../../../hooks/affine/use-members';
|
import {
|
||||||
import { useRevokeMemberPermission } from '../../../hooks/affine/use-revoke-member-permission';
|
type Member,
|
||||||
import { useUserQuota } from '../../../hooks/use-quota';
|
useMembers,
|
||||||
import { AffineErrorBoundary } from '../affine-error-boundary';
|
} from '../../../../../hooks/affine/use-members';
|
||||||
|
import { useRevokeMemberPermission } from '../../../../../hooks/affine/use-revoke-member-permission';
|
||||||
|
import { useUserQuota } from '../../../../../hooks/use-quota';
|
||||||
|
import { AffineErrorBoundary } from '../../../affine-error-boundary';
|
||||||
import * as style from './style.css';
|
import * as style from './style.css';
|
||||||
import type { WorkspaceSettingDetailProps } from './types';
|
import type { WorkspaceSettingDetailProps } from './types';
|
||||||
|
|
||||||
@@ -2,6 +2,8 @@ import { FlexWrapper, Input, Wrapper } from '@affine/component';
|
|||||||
import { pushNotificationAtom } from '@affine/component/notification-center';
|
import { pushNotificationAtom } from '@affine/component/notification-center';
|
||||||
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 { Upload } from '@affine/core/components/pure/file-upload';
|
||||||
|
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 { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import type { Workspace } from '@affine/workspace';
|
import type { Workspace } from '@affine/workspace';
|
||||||
@@ -19,9 +21,7 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
import { validateAndReduceImage } from '../../../utils/reduce-image';
|
import * as style from './style.css';
|
||||||
import { Upload } from '../../pure/file-upload';
|
|
||||||
import * as styles from './style.css';
|
|
||||||
import type { WorkspaceSettingDetailProps } from './types';
|
import type { WorkspaceSettingDetailProps } from './types';
|
||||||
|
|
||||||
export interface ProfilePanelProps extends WorkspaceSettingDetailProps {
|
export interface ProfilePanelProps extends WorkspaceSettingDetailProps {
|
||||||
@@ -165,7 +165,7 @@ export const ProfilePanel = ({ isOwner, workspace }: ProfilePanelProps) => {
|
|||||||
const canAdjustAvatar = !workspaceIsLoading && avatarUrl && isOwner;
|
const canAdjustAvatar = !workspaceIsLoading && avatarUrl && isOwner;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.profileWrapper}>
|
<div className={style.profileWrapper}>
|
||||||
<Upload
|
<Upload
|
||||||
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
|
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
|
||||||
fileChange={handleUploadAvatar}
|
fileChange={handleUploadAvatar}
|
||||||
@@ -195,7 +195,7 @@ export const ProfilePanel = ({ isOwner, workspace }: ProfilePanelProps) => {
|
|||||||
</Upload>
|
</Upload>
|
||||||
|
|
||||||
<Wrapper marginLeft={20}>
|
<Wrapper marginLeft={20}>
|
||||||
<div className={styles.label}>{t['Workspace Name']()}</div>
|
<div className={style.label}>{t['Workspace Name']()}</div>
|
||||||
<FlexWrapper alignItems="center" flexGrow="1">
|
<FlexWrapper alignItems="center" flexGrow="1">
|
||||||
<Input
|
<Input
|
||||||
disabled={workspaceIsLoading || !isOwner}
|
disabled={workspaceIsLoading || !isOwner}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import { Avatar } from '@affine/component/ui/avatar';
|
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|
||||||
import { CloudWorkspaceIcon } from '@blocksuite/icons';
|
|
||||||
import { useAsyncCallback } from '@toeverything/hooks/affine-async-hooks';
|
|
||||||
|
|
||||||
import { useCurrentLoginStatus } from '../../hooks/affine/use-current-login-status';
|
|
||||||
import { useCurrentUser } from '../../hooks/affine/use-current-user';
|
|
||||||
import { signInCloud } from '../../utils/cloud-utils';
|
|
||||||
import { StyledSignInButton } from '../pure/footer/styles';
|
|
||||||
|
|
||||||
export const LoginCard = () => {
|
|
||||||
const t = useAFFiNEI18N();
|
|
||||||
const loginStatus = useCurrentLoginStatus();
|
|
||||||
|
|
||||||
const onSignInClick = useAsyncCallback(async () => {
|
|
||||||
await signInCloud();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (loginStatus === 'authenticated') {
|
|
||||||
return <UserCard />;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<StyledSignInButton data-testid="sign-in-button" onClick={onSignInClick}>
|
|
||||||
<div className="circle">
|
|
||||||
<CloudWorkspaceIcon />
|
|
||||||
</div>{' '}
|
|
||||||
{t['Sign in']()}
|
|
||||||
</StyledSignInButton>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const UserCard = () => {
|
|
||||||
const user = useCurrentUser();
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Avatar size={28} name={user.name} url={user.image} />
|
|
||||||
<div style={{ marginLeft: '15px' }}>
|
|
||||||
<div>{user.name}</div>
|
|
||||||
<div>{user.email}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -4,7 +4,6 @@ import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
|||||||
import {
|
import {
|
||||||
openAboutPanel,
|
openAboutPanel,
|
||||||
openAppearancePanel,
|
openAppearancePanel,
|
||||||
openPluginsPanel,
|
|
||||||
openSettingModal,
|
openSettingModal,
|
||||||
openShortcutsPanel,
|
openShortcutsPanel,
|
||||||
} from '@affine-test/kit/utils/setting';
|
} from '@affine-test/kit/utils/setting';
|
||||||
@@ -79,15 +78,6 @@ test('Open shortcuts panel', async ({ page }) => {
|
|||||||
await expect(title).toBeVisible();
|
await expect(title).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Open plugins panel', async ({ page }) => {
|
|
||||||
await openHomePage(page);
|
|
||||||
await waitForEditorLoad(page);
|
|
||||||
await openSettingModal(page);
|
|
||||||
await openPluginsPanel(page);
|
|
||||||
const title = page.getByTestId('plugins-title');
|
|
||||||
await expect(title).toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Open about panel', async ({ page }) => {
|
test('Open about panel', async ({ page }) => {
|
||||||
await openHomePage(page);
|
await openHomePage(page);
|
||||||
await waitForEditorLoad(page);
|
await waitForEditorLoad(page);
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ export async function openAppearancePanel(page: Page) {
|
|||||||
export async function openShortcutsPanel(page: Page) {
|
export async function openShortcutsPanel(page: Page) {
|
||||||
await page.getByTestId('shortcuts-panel-trigger').click();
|
await page.getByTestId('shortcuts-panel-trigger').click();
|
||||||
}
|
}
|
||||||
export async function openPluginsPanel(page: Page) {
|
|
||||||
await page.getByTestId('plugins-panel-trigger').click();
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function openAboutPanel(page: Page) {
|
export async function openAboutPanel(page: Page) {
|
||||||
await page.getByTestId('about-panel-trigger').click();
|
await page.getByTestId('about-panel-trigger').click();
|
||||||
|
|||||||
Reference in New Issue
Block a user