mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
chore: enable no-unused vars (#2181)
This commit is contained in:
@@ -45,7 +45,14 @@ const config = {
|
|||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
'@typescript-eslint/no-empty-function': 'off',
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
'@typescript-eslint/no-unused-vars': 'off',
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
},
|
||||||
|
],
|
||||||
'unused-imports/no-unused-imports': 'error',
|
'unused-imports/no-unused-imports': 'error',
|
||||||
'simple-import-sort/imports': 'error',
|
'simple-import-sort/imports': 'error',
|
||||||
'simple-import-sort/exports': 'error',
|
'simple-import-sort/exports': 'error',
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ const browserWindow = {
|
|||||||
isDestroyed: () => {
|
isDestroyed: () => {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
setWindowButtonVisibility: (v: boolean) => {
|
setWindowButtonVisibility: (_v: boolean) => {
|
||||||
// will be stubbed later
|
// will be stubbed later
|
||||||
},
|
},
|
||||||
webContents: {
|
webContents: {
|
||||||
send: (type: string, ...args: any[]) => {
|
send: (_type: string, ..._args: any[]) => {
|
||||||
// ...
|
// ...
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ if (!isSingleInstance) {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('second-instance', (event, argv) => {
|
app.on('second-instance', () => {
|
||||||
restoreOrCreateWindow();
|
restoreOrCreateWindow();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('open-url', async (_, url) => {
|
app.on('open-url', async (_, _url) => {
|
||||||
// todo: handle `affine://...` urls
|
// todo: handle `affine://...` urls
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { UnauthorizedException } from '@nestjs/common';
|
|||||||
import { Test } from '@nestjs/testing';
|
import { Test } from '@nestjs/testing';
|
||||||
import { PrismaClient } from '@prisma/client';
|
import { PrismaClient } from '@prisma/client';
|
||||||
|
|
||||||
import { Config, ConfigModule } from '../config';
|
import { ConfigModule } from '../config';
|
||||||
import { getDefaultAFFiNEConfig } from '../config/default';
|
import { getDefaultAFFiNEConfig } from '../config/default';
|
||||||
import { GqlModule } from '../graphql.module';
|
import { GqlModule } from '../graphql.module';
|
||||||
import { AuthModule } from '../modules/auth';
|
import { AuthModule } from '../modules/auth';
|
||||||
@@ -15,7 +15,6 @@ import { PrismaModule } from '../prisma';
|
|||||||
globalThis.AFFiNE = getDefaultAFFiNEConfig();
|
globalThis.AFFiNE = getDefaultAFFiNEConfig();
|
||||||
|
|
||||||
let auth: AuthService;
|
let auth: AuthService;
|
||||||
let config: Config;
|
|
||||||
|
|
||||||
// cleanup database before each test
|
// cleanup database before each test
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -38,7 +37,6 @@ beforeEach(async () => {
|
|||||||
AuthModule,
|
AuthModule,
|
||||||
],
|
],
|
||||||
}).compile();
|
}).compile();
|
||||||
config = module.get(Config);
|
|
||||||
auth = module.get(AuthService);
|
auth = module.get(AuthService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ beforeEach(async () => {
|
|||||||
config = module.get(Config);
|
config = module.get(Config);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should be able to get config', t => {
|
test('should be able to get config', () => {
|
||||||
ok(typeof config.host === 'string');
|
ok(typeof config.host === 'string');
|
||||||
equal(config.env, 'test');
|
equal(config.env, 'test');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should be able to override config', async t => {
|
test('should be able to override config', async () => {
|
||||||
const module = await Test.createTestingModule({
|
const module = await Test.createTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export const Content = styled('div')({
|
|||||||
padding: '0 40px',
|
padding: '0 40px',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ContentTitle = styled('h1')(({ theme }) => {
|
export const ContentTitle = styled('h1')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'var(--affine-font-h6)',
|
fontSize: 'var(--affine-font-h6)',
|
||||||
lineHeight: '28px',
|
lineHeight: '28px',
|
||||||
@@ -21,7 +21,7 @@ export const ContentTitle = styled('h1')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleTips = styled('div')(({ theme }) => {
|
export const StyleTips = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
userSelect: 'none',
|
userSelect: 'none',
|
||||||
margin: '20px 0',
|
margin: '20px 0',
|
||||||
@@ -31,7 +31,7 @@ export const StyleTips = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleButton = styled(Button)(({ theme }) => {
|
export const StyleButton = styled(Button)(() => {
|
||||||
return {
|
return {
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
margin: '20px 0',
|
margin: '20px 0',
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ const InviteBox = styled('div')({
|
|||||||
position: 'relative',
|
position: 'relative',
|
||||||
});
|
});
|
||||||
|
|
||||||
const Members = styled('div')(({ theme }) => {
|
const Members = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
@@ -178,7 +178,7 @@ const Members = styled('div')(({ theme }) => {
|
|||||||
// };
|
// };
|
||||||
// });
|
// });
|
||||||
|
|
||||||
const Member = styled('div')(({ theme }) => {
|
const Member = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-icon-color)',
|
color: 'var(--affine-icon-color)',
|
||||||
fontSize: 'var(--affine-font-sm)',
|
fontSize: 'var(--affine-font-sm)',
|
||||||
@@ -188,7 +188,7 @@ const Member = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const MemberIcon = styled('div')(({ theme }) => {
|
const MemberIcon = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '40px',
|
width: '40px',
|
||||||
height: '40px',
|
height: '40px',
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export const StyledMemberInfo = styled('div')(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledMemberName = styled('div')(({ theme }) => {
|
export const StyledMemberName = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontWeight: '400',
|
fontWeight: '400',
|
||||||
fontSize: '18px',
|
fontSize: '18px',
|
||||||
@@ -70,7 +70,7 @@ export const StyledMemberName = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledMemberEmail = styled('div')(({ theme }) => {
|
export const StyledMemberEmail = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontWeight: '400',
|
fontWeight: '400',
|
||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
|
|
||||||
export const StyledModalWrapper = styled('div')(({ theme }) => {
|
export const StyledModalWrapper = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
padding: '0px',
|
padding: '0px',
|
||||||
@@ -36,7 +36,7 @@ export const StyledTextContent = styled('div')(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledInputContent = styled('div')(({ theme }) => {
|
export const StyledInputContent = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
|
|
||||||
export const StyledModalWrapper = styled('div')(({ theme }) => {
|
export const StyledModalWrapper = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
padding: '0px',
|
padding: '0px',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { displayFlex, styled } from '@affine/component';
|
import { displayFlex, styled } from '@affine/component';
|
||||||
import { Input } from '@affine/component';
|
import { Input } from '@affine/component';
|
||||||
|
|
||||||
export const StyledInput = styled(Input)(({ theme }) => {
|
export const StyledInput = styled(Input)(() => {
|
||||||
return {
|
return {
|
||||||
border: '1px solid var(--affine-border-color)',
|
border: '1px solid var(--affine-border-color)',
|
||||||
borderRadius: '10px',
|
borderRadius: '10px',
|
||||||
@@ -9,7 +9,7 @@ export const StyledInput = styled(Input)(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledWorkspaceInfo = styled('div')(({ theme }) => {
|
export const StyledWorkspaceInfo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
...displayFlex('flex-start', 'center'),
|
...displayFlex('flex-start', 'center'),
|
||||||
fontSize: '20px',
|
fontSize: '20px',
|
||||||
@@ -48,7 +48,7 @@ export const StyledAvatar = styled('div')(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const StyledEditButton = styled('div')(({ theme }) => {
|
export const StyledEditButton = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-primary-color)',
|
color: 'var(--affine-primary-color)',
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { useCurrentUser } from '../../../../../hooks/current/use-current-user';
|
|||||||
import { WorkspaceAvatar } from '../../../../pure/footer';
|
import { WorkspaceAvatar } from '../../../../pure/footer';
|
||||||
import type { PanelProps } from '../../index';
|
import type { PanelProps } from '../../index';
|
||||||
|
|
||||||
export const StyledWorkspaceName = styled('span')(({ theme }) => {
|
export const StyledWorkspaceName = styled('span')(() => {
|
||||||
return {
|
return {
|
||||||
fontWeight: '400',
|
fontWeight: '400',
|
||||||
fontSize: 'var(--affine-font-h6)',
|
fontSize: 'var(--affine-font-h6)',
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const StyledSettingContent = styled('div')(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const WorkspaceSettingTagItem = styled('li')<{ isActive?: boolean }>(
|
export const WorkspaceSettingTagItem = styled('li')<{ isActive?: boolean }>(
|
||||||
({ theme, isActive }) => {
|
({ isActive }) => {
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -45,7 +45,7 @@ export const WorkspaceSettingTagItem = styled('li')<{ isActive?: boolean }>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const StyledSettingKey = styled('div')(({ theme }) => {
|
export const StyledSettingKey = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '140px',
|
width: '140px',
|
||||||
fontSize: 'var(--affine-font-base)',
|
fontSize: 'var(--affine-font-base)',
|
||||||
@@ -60,14 +60,14 @@ export const StyledRow = styled(FlexWrapper)(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledWorkspaceName = styled('span')(({ theme }) => {
|
export const StyledWorkspaceName = styled('span')(() => {
|
||||||
return {
|
return {
|
||||||
fontWeight: '400',
|
fontWeight: '400',
|
||||||
fontSize: 'var(--affine-font-h6)',
|
fontSize: 'var(--affine-font-h6)',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledIndicator = styled('div')(({ theme }) => {
|
export const StyledIndicator = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
height: '2px',
|
height: '2px',
|
||||||
background: 'var(--affine-primary-color)',
|
background: 'var(--affine-primary-color)',
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ export type OperationCellProps = {
|
|||||||
|
|
||||||
export const OperationCell: React.FC<OperationCellProps> = ({
|
export const OperationCell: React.FC<OperationCellProps> = ({
|
||||||
pageMeta,
|
pageMeta,
|
||||||
metas,
|
|
||||||
blockSuiteWorkspace,
|
blockSuiteWorkspace,
|
||||||
onOpenPageInNewTab,
|
onOpenPageInNewTab,
|
||||||
onToggleFavoritePage,
|
onToggleFavoritePage,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const StyledTableContainer = styled('div')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledTitleWrapper = styled('div')(({ theme }) => {
|
export const StyledTitleWrapper = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
...displayFlex('flex-start', 'center'),
|
...displayFlex('flex-start', 'center'),
|
||||||
a: {
|
a: {
|
||||||
@@ -26,7 +26,7 @@ export const StyledTitleWrapper = styled('div')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledTitleLink = styled('div')(({ theme }) => {
|
export const StyledTitleLink = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
maxWidth: '80%',
|
maxWidth: '80%',
|
||||||
marginRight: '18px',
|
marginRight: '18px',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { displayFlex, styled } from '@affine/component';
|
|||||||
export const StyledEditorModeSwitch = styled('div')<{
|
export const StyledEditorModeSwitch = styled('div')<{
|
||||||
switchLeft: boolean;
|
switchLeft: boolean;
|
||||||
showAlone?: boolean;
|
showAlone?: boolean;
|
||||||
}>(({ theme, switchLeft, showAlone }) => {
|
}>(({ switchLeft, showAlone }) => {
|
||||||
return {
|
return {
|
||||||
width: showAlone ? '40px' : '78px',
|
width: showAlone ? '40px' : '78px',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default EditPage;
|
|||||||
const StyledEditPageButton = styled(
|
const StyledEditPageButton = styled(
|
||||||
TextButton,
|
TextButton,
|
||||||
{}
|
{}
|
||||||
)(({ theme }) => {
|
)(() => {
|
||||||
return {
|
return {
|
||||||
border: '1px solid var(--affine-primary-color)',
|
border: '1px solid var(--affine-primary-color)',
|
||||||
color: 'var(--affine-primary-color)',
|
color: 'var(--affine-primary-color)',
|
||||||
|
|||||||
@@ -76,12 +76,12 @@ const LocalHeaderShareMenu: React.FC<BaseHeaderProps> = props => {
|
|||||||
},
|
},
|
||||||
[helper]
|
[helper]
|
||||||
)}
|
)}
|
||||||
togglePagePublic={useCallback(async (page, isPublic) => {
|
togglePagePublic={useCallback(async () => {
|
||||||
// local workspace should not have public page
|
// local workspace should not have public page
|
||||||
throw new Error('unreachable');
|
throw new Error('unreachable');
|
||||||
}, [])}
|
}, [])}
|
||||||
toggleWorkspacePublish={useCallback(
|
toggleWorkspacePublish={useCallback(
|
||||||
async (workspace, publish) => {
|
async workspace => {
|
||||||
assertEquals(workspace.flavour, WorkspaceFlavour.LOCAL);
|
assertEquals(workspace.flavour, WorkspaceFlavour.LOCAL);
|
||||||
assertEquals(workspace.id, props.workspace.id);
|
assertEquals(workspace.id, props.workspace.id);
|
||||||
await helper.jumpToSubPath(workspace.id, WorkspaceSubPath.SETTING);
|
await helper.jumpToSubPath(workspace.id, WorkspaceSubPath.SETTING);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import { affineAuth } from '../../../../plugins/affine';
|
|||||||
import type { AffineOfficialWorkspace } from '../../../../shared';
|
import type { AffineOfficialWorkspace } from '../../../../shared';
|
||||||
import { TransformWorkspaceToAffineModal } from '../../../affine/transform-workspace-to-affine-modal';
|
import { TransformWorkspaceToAffineModal } from '../../../affine/transform-workspace-to-affine-modal';
|
||||||
|
|
||||||
const IconWrapper = styled('div')(({ theme }) => {
|
const IconWrapper = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '32px',
|
width: '32px',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import spring, { toString } from 'css-spring';
|
|||||||
|
|
||||||
const ANIMATE_DURATION = 400;
|
const ANIMATE_DURATION = 400;
|
||||||
|
|
||||||
export const StyledThemeModeSwitch = styled('button')(({ theme }) => {
|
export const StyledThemeModeSwitch = styled('button')(() => {
|
||||||
return {
|
return {
|
||||||
width: '32px',
|
width: '32px',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
@@ -20,7 +20,7 @@ export const StyledThemeModeSwitch = styled('button')(({ theme }) => {
|
|||||||
export const StyledSwitchItem = styled('div')<{
|
export const StyledSwitchItem = styled('div')<{
|
||||||
active: boolean;
|
active: boolean;
|
||||||
isHover: boolean;
|
isHover: boolean;
|
||||||
}>(({ active, isHover, theme }) => {
|
}>(({ active, isHover }) => {
|
||||||
const activeRaiseAnimate = toString(
|
const activeRaiseAnimate = toString(
|
||||||
spring({ top: '0' }, { top: '-100%' }, { preset: 'gentle' })
|
spring({ top: '0' }, { top: '-100%' }, { preset: 'gentle' })
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -106,19 +106,19 @@ const HeaderRightItems: Record<HeaderRightItemName, HeaderItem> = {
|
|||||||
},
|
},
|
||||||
[HeaderRightItemName.ShareMenu]: {
|
[HeaderRightItemName.ShareMenu]: {
|
||||||
Component: HeaderShareMenu,
|
Component: HeaderShareMenu,
|
||||||
availableWhen: (workspace, currentPage, { isPublic, isPreview }) => {
|
availableWhen: (workspace, currentPage) => {
|
||||||
return workspace.flavour !== WorkspaceFlavour.PUBLIC && !!currentPage;
|
return workspace.flavour !== WorkspaceFlavour.PUBLIC && !!currentPage;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[HeaderRightItemName.EditPage]: {
|
[HeaderRightItemName.EditPage]: {
|
||||||
Component: EditPage,
|
Component: EditPage,
|
||||||
availableWhen: (workspace, currentPage, { isPublic, isPreview }) => {
|
availableWhen: (workspace, currentPage, { isPublic }) => {
|
||||||
return isPublic;
|
return isPublic;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[HeaderRightItemName.UserAvatar]: {
|
[HeaderRightItemName.UserAvatar]: {
|
||||||
Component: UserAvatar,
|
Component: UserAvatar,
|
||||||
availableWhen: (workspace, currentPage, { isPublic, isPreview }) => {
|
availableWhen: (workspace, currentPage, { isPublic }) => {
|
||||||
return isPublic;
|
return isPublic;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,22 +23,20 @@ export const StyledHeaderContainer = styled('div')<{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledHeader = styled('div')<{ hasWarning: boolean }>(
|
export const StyledHeader = styled('div')<{ hasWarning: boolean }>(() => {
|
||||||
({ theme }) => {
|
return {
|
||||||
return {
|
flexShrink: 0,
|
||||||
flexShrink: 0,
|
height: '52px',
|
||||||
height: '52px',
|
width: '100%',
|
||||||
width: '100%',
|
padding: '0 20px',
|
||||||
padding: '0 20px',
|
...displayFlex('space-between', 'center'),
|
||||||
...displayFlex('space-between', 'center'),
|
background: 'var(--affine-background-primary-color)',
|
||||||
background: 'var(--affine-background-primary-color)',
|
zIndex: 99,
|
||||||
zIndex: 99,
|
position: 'relative',
|
||||||
position: 'relative',
|
};
|
||||||
};
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
export const StyledTitleContainer = styled('div')(({ theme }) => ({
|
export const StyledTitleContainer = styled('div')(() => ({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
|
|
||||||
@@ -82,7 +80,7 @@ export const StyledHeaderRightSide = styled('div')({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const StyledBrowserWarning = styled('div')<{ show: boolean }>(
|
export const StyledBrowserWarning = styled('div')<{ show: boolean }>(
|
||||||
({ theme, show }) => {
|
({ show }) => {
|
||||||
return {
|
return {
|
||||||
backgroundColor: 'var(--affine-background-warning-color)',
|
backgroundColor: 'var(--affine-background-warning-color)',
|
||||||
color: 'var(--affine-background-warning-color)',
|
color: 'var(--affine-background-warning-color)',
|
||||||
@@ -95,7 +93,7 @@ export const StyledBrowserWarning = styled('div')<{ show: boolean }>(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const StyledCloseButton = styled('div')(({ theme }) => {
|
export const StyledCloseButton = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '36px',
|
width: '36px',
|
||||||
height: '36px',
|
height: '36px',
|
||||||
@@ -137,7 +135,7 @@ export const StyledSearchArrowWrapper = styled('div')(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledPageListTittleWrapper = styled(StyledTitle)(({ theme }) => {
|
export const StyledPageListTittleWrapper = styled(StyledTitle)(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'var(--affine-font-base)',
|
fontSize: 'var(--affine-font-base)',
|
||||||
color: 'var(--affine-text-primary-color)',
|
color: 'var(--affine-text-primary-color)',
|
||||||
@@ -148,7 +146,7 @@ export const StyledPageListTittleWrapper = styled(StyledTitle)(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledQuickSearchTipButton = styled('div')(({ theme }) => {
|
export const StyledQuickSearchTipButton = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
...displayFlex('center', 'center'),
|
...displayFlex('center', 'center'),
|
||||||
marginTop: '12px',
|
marginTop: '12px',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
} from '@affine/component';
|
} from '@affine/component';
|
||||||
import { Button } from '@affine/component';
|
import { Button } from '@affine/component';
|
||||||
|
|
||||||
export const StyledSplitLine = styled('div')(({ theme }) => {
|
export const StyledSplitLine = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '1px',
|
width: '1px',
|
||||||
height: '20px',
|
height: '20px',
|
||||||
@@ -15,7 +15,7 @@ export const StyledSplitLine = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleWorkspaceInfo = styled('div')(({ theme }) => {
|
export const StyleWorkspaceInfo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
marginLeft: '15px',
|
marginLeft: '15px',
|
||||||
width: '202px',
|
width: '202px',
|
||||||
@@ -36,7 +36,7 @@ export const StyleWorkspaceInfo = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleWorkspaceTitle = styled('div')(({ theme }) => {
|
export const StyleWorkspaceTitle = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'var(--affine-font-base)',
|
fontSize: 'var(--affine-font-base)',
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
@@ -54,7 +54,7 @@ export const StyledFooter = styled('div')({
|
|||||||
...displayFlex('space-between', 'center'),
|
...displayFlex('space-between', 'center'),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleUserInfo = styled('div')(({ theme }) => {
|
export const StyleUserInfo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
textAlign: 'left',
|
textAlign: 'left',
|
||||||
marginLeft: '16px',
|
marginLeft: '16px',
|
||||||
@@ -73,14 +73,14 @@ export const StyleUserInfo = styled('div')(({ theme }) => {
|
|||||||
export const StyledModalHeaderLeft = styled('div')(() => {
|
export const StyledModalHeaderLeft = styled('div')(() => {
|
||||||
return { ...displayFlex('flex-start', 'center') };
|
return { ...displayFlex('flex-start', 'center') };
|
||||||
});
|
});
|
||||||
export const StyledModalTitle = styled('div')(({ theme }) => {
|
export const StyledModalTitle = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: 'var(--affine-font-h6)',
|
fontSize: 'var(--affine-font-h6)',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledHelperContainer = styled('div')(({ theme }) => {
|
export const StyledHelperContainer = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-icon-color)',
|
color: 'var(--affine-icon-color)',
|
||||||
marginLeft: '15px',
|
marginLeft: '15px',
|
||||||
@@ -128,7 +128,7 @@ export const StyledModalHeader = styled('div')(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledSignInButton = styled(Button)(({ theme }) => {
|
export const StyledSignInButton = styled(Button)(() => {
|
||||||
return {
|
return {
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
paddingLeft: 0,
|
paddingLeft: 0,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { displayFlex, positionAbsolute, styled } from '@affine/component';
|
|||||||
|
|
||||||
export const StyledIsland = styled('div')<{
|
export const StyledIsland = styled('div')<{
|
||||||
spread: boolean;
|
spread: boolean;
|
||||||
}>(({ theme, spread }) => {
|
}>(({ spread }) => {
|
||||||
return {
|
return {
|
||||||
transition: 'box-shadow 0.2s',
|
transition: 'box-shadow 0.2s',
|
||||||
width: '44px',
|
width: '44px',
|
||||||
@@ -31,7 +31,7 @@ export const StyledIsland = styled('div')<{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledIconWrapper = styled('div')(({ theme }) => {
|
export const StyledIconWrapper = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-icon-color)',
|
color: 'var(--affine-icon-color)',
|
||||||
...displayFlex('center', 'center'),
|
...displayFlex('center', 'center'),
|
||||||
@@ -57,7 +57,7 @@ export const StyledAnimateWrapper = styled('div')(() => ({
|
|||||||
|
|
||||||
export const StyledTriggerWrapper = styled('div')<{
|
export const StyledTriggerWrapper = styled('div')<{
|
||||||
spread?: boolean;
|
spread?: boolean;
|
||||||
}>(({ theme, spread }) => {
|
}>(({ spread }) => {
|
||||||
return {
|
return {
|
||||||
width: '36px',
|
width: '36px',
|
||||||
height: '36px',
|
height: '36px',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { IconButton } from '@affine/component';
|
|||||||
import { styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
import { ArrowDownSmallIcon } from '@blocksuite/icons';
|
||||||
|
|
||||||
const StyledIconButtonWithAnimate = styled(IconButton)(({ theme }) => {
|
const StyledIconButtonWithAnimate = styled(IconButton)(() => {
|
||||||
return {
|
return {
|
||||||
svg: {
|
svg: {
|
||||||
transition: 'transform 0.15s ease-in-out',
|
transition: 'transform 0.15s ease-in-out',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { displayFlex, styled, textEllipsis } from '@affine/component';
|
import { displayFlex, styled, textEllipsis } from '@affine/component';
|
||||||
|
|
||||||
export const StyledNavigationPathContainer = styled('div')(({ theme }) => {
|
export const StyledNavigationPathContainer = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
height: '46px',
|
height: '46px',
|
||||||
...displayFlex('flex-start', 'center'),
|
...displayFlex('flex-start', 'center'),
|
||||||
@@ -24,7 +24,7 @@ export const StyledNavigationPathContainer = styled('div')(({ theme }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const StyledNavPathLink = styled('div')<{ active?: boolean }>(
|
export const StyledNavPathLink = styled('div')<{ active?: boolean }>(
|
||||||
({ theme, active }) => {
|
({ active }) => {
|
||||||
return {
|
return {
|
||||||
color: active
|
color: active
|
||||||
? 'var(--affine-text-primary-color)'
|
? 'var(--affine-text-primary-color)'
|
||||||
@@ -45,7 +45,7 @@ export const StyledNavPathLink = styled('div')<{ active?: boolean }>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const StyledNavPathExtendContainer = styled('div')<{ show: boolean }>(
|
export const StyledNavPathExtendContainer = styled('div')<{ show: boolean }>(
|
||||||
({ show, theme }) => {
|
({ show }) => {
|
||||||
return {
|
return {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: '0',
|
left: '0',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { displayFlex, styled, textEllipsis } from '@affine/component';
|
import { displayFlex, styled, textEllipsis } from '@affine/component';
|
||||||
|
|
||||||
export const StyledContent = styled('div')(({ theme }) => {
|
export const StyledContent = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
minHeight: '290px',
|
minHeight: '290px',
|
||||||
maxHeight: '70vh',
|
maxHeight: '70vh',
|
||||||
@@ -35,7 +35,7 @@ export const StyledContent = styled('div')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledJumpTo = styled('div')(({ theme }) => {
|
export const StyledJumpTo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
...displayFlex('center', 'start'),
|
...displayFlex('center', 'start'),
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
@@ -47,7 +47,7 @@ export const StyledJumpTo = styled('div')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledNotFound = styled('div')(({ theme }) => {
|
export const StyledNotFound = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '612px',
|
width: '612px',
|
||||||
...displayFlex('center', 'center'),
|
...displayFlex('center', 'center'),
|
||||||
@@ -68,7 +68,7 @@ export const StyledNotFound = styled('div')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledInputContent = styled('div')(({ theme }) => {
|
export const StyledInputContent = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
...displayFlex('space-between', 'center'),
|
...displayFlex('space-between', 'center'),
|
||||||
input: {
|
input: {
|
||||||
@@ -85,7 +85,7 @@ export const StyledInputContent = styled('div')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledShortcut = styled('div')(({ theme }) => {
|
export const StyledShortcut = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-placeholder-color)',
|
color: 'var(--affine-placeholder-color)',
|
||||||
fontSize: 'var(--affine-font-sm)',
|
fontSize: 'var(--affine-font-sm)',
|
||||||
@@ -93,7 +93,7 @@ export const StyledShortcut = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledLabel = styled('label')(({ theme }) => {
|
export const StyledLabel = styled('label')(() => {
|
||||||
return {
|
return {
|
||||||
width: '20px',
|
width: '20px',
|
||||||
height: '20px',
|
height: '20px',
|
||||||
@@ -109,7 +109,7 @@ export const StyledModalHeader = styled('div')(() => {
|
|||||||
...displayFlex('space-between', 'center'),
|
...displayFlex('space-between', 'center'),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledModalDivider = styled('div')(({ theme }) => {
|
export const StyledModalDivider = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
height: '0',
|
height: '0',
|
||||||
@@ -118,7 +118,7 @@ export const StyledModalDivider = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledModalFooter = styled('div')(({ theme }) => {
|
export const StyledModalFooter = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'inherit',
|
fontSize: 'inherit',
|
||||||
lineHeight: '22px',
|
lineHeight: '22px',
|
||||||
@@ -142,7 +142,7 @@ export const StyledModalFooter = styled('div')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledModalFooterContent = styled('button')(({ theme }) => {
|
export const StyledModalFooterContent = styled('button')(() => {
|
||||||
return {
|
return {
|
||||||
width: '600px',
|
width: '600px',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { displayFlex, styled } from '@affine/component';
|
import { displayFlex, styled } from '@affine/component';
|
||||||
|
|
||||||
export const StyledShortcutsModal = styled('div')(({ theme }) => ({
|
export const StyledShortcutsModal = styled('div')(() => ({
|
||||||
width: '288px',
|
width: '288px',
|
||||||
height: '74vh',
|
height: '74vh',
|
||||||
paddingBottom: '28px',
|
paddingBottom: '28px',
|
||||||
@@ -16,7 +16,7 @@ export const StyledShortcutsModal = styled('div')(({ theme }) => ({
|
|||||||
margin: 'auto',
|
margin: 'auto',
|
||||||
zIndex: 'var(--affine-z-index-modal)',
|
zIndex: 'var(--affine-z-index-modal)',
|
||||||
}));
|
}));
|
||||||
export const StyledTitle = styled('div')(({ theme }) => ({
|
export const StyledTitle = styled('div')(() => ({
|
||||||
color: 'var(--affine-text-primary-color)',
|
color: 'var(--affine-text-primary-color)',
|
||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
fontSize: 'var(--affine-font-sm)',
|
fontSize: 'var(--affine-font-sm)',
|
||||||
@@ -28,7 +28,7 @@ export const StyledTitle = styled('div')(({ theme }) => ({
|
|||||||
color: 'var(--affine-primary-color)',
|
color: 'var(--affine-primary-color)',
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
export const StyledSubTitle = styled('div')(({ theme }) => ({
|
export const StyledSubTitle = styled('div')(() => ({
|
||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
fontSize: 'var(--affine-font-sm)',
|
fontSize: 'var(--affine-font-sm)',
|
||||||
height: '34px',
|
height: '34px',
|
||||||
@@ -49,7 +49,7 @@ export const StyledModalHeader = styled('div')(() => ({
|
|||||||
transition: 'background-color 0.5s',
|
transition: 'background-color 0.5s',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const StyledListItem = styled('div')(({ theme }) => ({
|
export const StyledListItem = styled('div')(() => ({
|
||||||
height: '34px',
|
height: '34px',
|
||||||
...displayFlex('space-between', 'center'),
|
...displayFlex('space-between', 'center'),
|
||||||
fontSize: 'var(--affine-font-sm)',
|
fontSize: 'var(--affine-font-sm)',
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export const LanguageMenu: React.FC = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const ListItem = styled(MenuItem)(({ theme }) => ({
|
const ListItem = styled(MenuItem)(() => ({
|
||||||
height: '38px',
|
height: '38px',
|
||||||
fontSize: 'var(--affine-font-base)',
|
fontSize: 'var(--affine-font-base)',
|
||||||
textTransform: 'capitalize',
|
textTransform: 'capitalize',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { displayFlex, styled, textEllipsis } from '@affine/component';
|
import { displayFlex, styled, textEllipsis } from '@affine/component';
|
||||||
|
|
||||||
export const StyledSplitLine = styled('div')(({ theme }) => {
|
export const StyledSplitLine = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '1px',
|
width: '1px',
|
||||||
height: '20px',
|
height: '20px',
|
||||||
@@ -9,7 +9,7 @@ export const StyledSplitLine = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleWorkspaceInfo = styled('div')(({ theme }) => {
|
export const StyleWorkspaceInfo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
marginLeft: '15px',
|
marginLeft: '15px',
|
||||||
width: '202px',
|
width: '202px',
|
||||||
@@ -30,7 +30,7 @@ export const StyleWorkspaceInfo = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleWorkspaceTitle = styled('div')(({ theme }) => {
|
export const StyleWorkspaceTitle = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'var(--affine-font-base)',
|
fontSize: 'var(--affine-font-base)',
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
@@ -41,7 +41,7 @@ export const StyleWorkspaceTitle = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledCreateWorkspaceCard = styled('div')(({ theme }) => {
|
export const StyledCreateWorkspaceCard = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '310px',
|
width: '310px',
|
||||||
height: '124px',
|
height: '124px',
|
||||||
@@ -68,14 +68,14 @@ export const StyledCreateWorkspaceCard = styled('div')(({ theme }) => {
|
|||||||
export const StyledModalHeaderLeft = styled('div')(() => {
|
export const StyledModalHeaderLeft = styled('div')(() => {
|
||||||
return { ...displayFlex('flex-start', 'center') };
|
return { ...displayFlex('flex-start', 'center') };
|
||||||
});
|
});
|
||||||
export const StyledModalTitle = styled('div')(({ theme }) => {
|
export const StyledModalTitle = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: 'var(--affine-font-h6)',
|
fontSize: 'var(--affine-font-h6)',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledHelperContainer = styled('div')(({ theme }) => {
|
export const StyledHelperContainer = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-icon-color)',
|
color: 'var(--affine-icon-color)',
|
||||||
marginLeft: '15px',
|
marginLeft: '15px',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { displayFlex, textEllipsis } from '@affine/component';
|
import { displayFlex, textEllipsis } from '@affine/component';
|
||||||
import { styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
export const StyledSelectorContainer = styled('div')(({ theme }) => {
|
export const StyledSelectorContainer = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
height: '58px',
|
height: '58px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -32,7 +32,7 @@ export const StyledWorkspaceName = styled('div')(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledWorkspaceStatus = styled('div')(({ theme }) => {
|
export const StyledWorkspaceStatus = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
height: '22px',
|
height: '22px',
|
||||||
...displayFlex('flex-start', 'center'),
|
...displayFlex('flex-start', 'center'),
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const StyledLink = styled(Link)(() => {
|
|||||||
'-webkit-app-region': 'no-drag',
|
'-webkit-app-region': 'no-drag',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledNewPageButton = styled('button')(({ theme }) => {
|
export const StyledNewPageButton = styled('button')(() => {
|
||||||
return {
|
return {
|
||||||
height: '52px',
|
height: '52px',
|
||||||
...displayFlex('flex-start', 'center'),
|
...displayFlex('flex-start', 'center'),
|
||||||
@@ -56,7 +56,7 @@ export const StyledNewPageButton = styled('button')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledSliderModalBackground = styled('div')<{ active: boolean }>(
|
export const StyledSliderModalBackground = styled('div')<{ active: boolean }>(
|
||||||
({ theme, active }) => {
|
({ active }) => {
|
||||||
return {
|
return {
|
||||||
transition: 'opacity .15s',
|
transition: 'opacity .15s',
|
||||||
pointerEvents: active ? 'auto' : 'none',
|
pointerEvents: active ? 'auto' : 'none',
|
||||||
@@ -74,7 +74,7 @@ export const StyledSliderModalBackground = styled('div')<{ active: boolean }>(
|
|||||||
|
|
||||||
export const StyledScrollWrapper = styled('div')<{
|
export const StyledScrollWrapper = styled('div')<{
|
||||||
showTopBorder: boolean;
|
showTopBorder: boolean;
|
||||||
}>(({ showTopBorder, theme }) => {
|
}>(({ showTopBorder }) => {
|
||||||
return {
|
return {
|
||||||
maxHeight: '50%',
|
maxHeight: '50%',
|
||||||
overflowY: 'auto',
|
overflowY: 'auto',
|
||||||
|
|||||||
@@ -310,7 +310,6 @@ describe('useIsFirstLoad', () => {
|
|||||||
});
|
});
|
||||||
test('useTipsDisplayStatus', async () => {
|
test('useTipsDisplayStatus', async () => {
|
||||||
const tipsDisplayStatus = renderHook(() => useTipsDisplayStatus());
|
const tipsDisplayStatus = renderHook(() => useTipsDisplayStatus());
|
||||||
const setTipsDisplayStatus = tipsDisplayStatus.result.current;
|
|
||||||
expect(tipsDisplayStatus.result.current).toEqual({
|
expect(tipsDisplayStatus.result.current).toEqual({
|
||||||
quickSearchTips: {
|
quickSearchTips: {
|
||||||
permanentlyHidden: true,
|
permanentlyHidden: true,
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
import type { AffineWorkspace } from '@affine/workspace/type';
|
|
||||||
|
|
||||||
export function useAffinePublicPage(workspace: AffineWorkspace) {}
|
|
||||||
@@ -86,14 +86,14 @@ export const useElementResizeEffect = (
|
|||||||
element: Element | null,
|
element: Element | null,
|
||||||
fn: () => void | (() => () => void),
|
fn: () => void | (() => () => void),
|
||||||
// TODO: add throttle
|
// TODO: add throttle
|
||||||
throttle = 0
|
_throttle = 0
|
||||||
) => {
|
) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!element) {
|
if (!element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let dispose: void | (() => void);
|
let dispose: void | (() => void);
|
||||||
const resizeObserver = new ResizeObserver(entries => {
|
const resizeObserver = new ResizeObserver(() => {
|
||||||
dispose = fn();
|
dispose = fn();
|
||||||
});
|
});
|
||||||
resizeObserver.observe(element);
|
resizeObserver.observe(element);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export const StyledToolWrapper = styled('div')(({ theme }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const StyledSliderResizer = styled('div')<{ isResizing: boolean }>(
|
export const StyledSliderResizer = styled('div')<{ isResizing: boolean }>(
|
||||||
({ theme }) => {
|
() => {
|
||||||
return {
|
return {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 0,
|
top: 0,
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ InvitePage.getLayout = page => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const StyledContainer = styled('div')(({ theme }) => {
|
const StyledContainer = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
height: '100vh',
|
height: '100vh',
|
||||||
...displayFlex('center', 'center'),
|
...displayFlex('center', 'center'),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import {
|
|||||||
} from '../../../layouts/public-workspace-layout';
|
} from '../../../layouts/public-workspace-layout';
|
||||||
import type { NextPageWithLayout } from '../../../shared';
|
import type { NextPageWithLayout } from '../../../shared';
|
||||||
|
|
||||||
export const NavContainer = styled('div')(({ theme }) => {
|
export const NavContainer = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
width: '100vw',
|
width: '100vw',
|
||||||
height: '52px',
|
height: '52px',
|
||||||
@@ -36,7 +36,7 @@ export const NavContainer = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledBreadcrumbs = styled(Link)(({ theme }) => {
|
export const StyledBreadcrumbs = styled(Link)(() => {
|
||||||
return {
|
return {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
...displayFlex('center', 'center'),
|
...displayFlex('center', 'center'),
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const affineApis = {} as ReturnType<typeof createUserApis> &
|
|||||||
Object.assign(affineApis, createUserApis(prefixUrl));
|
Object.assign(affineApis, createUserApis(prefixUrl));
|
||||||
Object.assign(affineApis, createWorkspaceApis(prefixUrl));
|
Object.assign(affineApis, createWorkspaceApis(prefixUrl));
|
||||||
|
|
||||||
const debugLogger = new DebugLogger('affine-debug-apis');
|
const _debugLogger = new DebugLogger('affine-debug-apis');
|
||||||
|
|
||||||
if (!globalThis.AFFINE_APIS) {
|
if (!globalThis.AFFINE_APIS) {
|
||||||
globalThis.AFFINE_APIS = affineApis;
|
globalThis.AFFINE_APIS = affineApis;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default {
|
|||||||
|
|
||||||
const Footer = () => <div>Add Page</div>;
|
const Footer = () => <div>Add Page</div>;
|
||||||
|
|
||||||
export const Default: StoryFn = props => {
|
export const Default: StoryFn = () => {
|
||||||
const [open, setOpen] = useAtom(appSidebarOpenAtom);
|
const [open, setOpen] = useAtom(appSidebarOpenAtom);
|
||||||
const ref = useRef<HTMLElement>(null);
|
const ref = useRef<HTMLElement>(null);
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { absoluteCenter, displayFlex, styled } from '@affine/component';
|
import { absoluteCenter, displayFlex, styled } from '@affine/component';
|
||||||
|
|
||||||
export const StyledBigLink = styled('a')(({ theme }) => {
|
export const StyledBigLink = styled('a')(() => {
|
||||||
return {
|
return {
|
||||||
width: '268px',
|
width: '268px',
|
||||||
height: '76px',
|
height: '76px',
|
||||||
@@ -57,7 +57,7 @@ export const StyledBigLink = styled('a')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledSmallLink = styled('a')(({ theme }) => {
|
export const StyledSmallLink = styled('a')(() => {
|
||||||
return {
|
return {
|
||||||
width: '124px',
|
width: '124px',
|
||||||
height: '76px',
|
height: '76px',
|
||||||
@@ -86,7 +86,7 @@ export const StyledSmallLink = styled('a')(({ theme }) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledSubTitle = styled('div')(({ theme }) => {
|
export const StyledSubTitle = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: '18px',
|
fontSize: '18px',
|
||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
@@ -111,7 +111,7 @@ export const StyledModalHeader = styled('div')(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledModalFooter = styled('div')(({ theme }) => {
|
export const StyledModalFooter = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
lineHeight: '20px',
|
lineHeight: '20px',
|
||||||
@@ -121,7 +121,7 @@ export const StyledModalFooter = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledPrivacyContainer = styled('div')(({ theme }) => {
|
export const StyledPrivacyContainer = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
marginTop: '4px',
|
marginTop: '4px',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { styled, TextButton } from '@affine/component';
|
import { styled, TextButton } from '@affine/component';
|
||||||
|
|
||||||
export const StyledModalWrapper = styled('div')(({ theme }) => {
|
export const StyledModalWrapper = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
padding: '0px',
|
padding: '0px',
|
||||||
@@ -11,7 +11,7 @@ export const StyledModalWrapper = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledModalHeader = styled('div')(({ theme }) => {
|
export const StyledModalHeader = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
margin: '44px 0px 12px 0px',
|
margin: '44px 0px 12px 0px',
|
||||||
width: '560px',
|
width: '560px',
|
||||||
@@ -21,7 +21,7 @@ export const StyledModalHeader = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledTextContent = styled('div')(({ theme }) => {
|
export const StyledTextContent = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
margin: 'auto',
|
margin: 'auto',
|
||||||
width: '560px',
|
width: '560px',
|
||||||
@@ -40,7 +40,7 @@ export const StyledButtonContent = styled('div')(() => {
|
|||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledButton = styled(TextButton)(({ theme }) => {
|
export const StyledButton = styled(TextButton)(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-primary-color)',
|
color: 'var(--affine-primary-color)',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
@@ -50,7 +50,7 @@ export const StyledButton = styled(TextButton)(({ theme }) => {
|
|||||||
padding: '4px 20px',
|
padding: '4px 20px',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledDangerButton = styled(TextButton)(({ theme }) => {
|
export const StyledDangerButton = styled(TextButton)(() => {
|
||||||
return {
|
return {
|
||||||
color: '#FF631F',
|
color: '#FF631F',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Button, displayFlex, styled, TextButton } from '../..';
|
|||||||
|
|
||||||
export const StyledShareButton = styled(TextButton, {
|
export const StyledShareButton = styled(TextButton, {
|
||||||
shouldForwardProp: (prop: string) => prop !== 'isShared',
|
shouldForwardProp: (prop: string) => prop !== 'isShared',
|
||||||
})<{ isShared?: boolean }>(({ theme, isShared }) => {
|
})<{ isShared?: boolean }>(({ isShared }) => {
|
||||||
return {
|
return {
|
||||||
padding: '4px 8px',
|
padding: '4px 8px',
|
||||||
marginLeft: '4px',
|
marginLeft: '4px',
|
||||||
@@ -30,55 +30,53 @@ export const StyledTabsWrapper = styled('div')(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const TabItem = styled('li')<{ isActive?: boolean }>(
|
export const TabItem = styled('li')<{ isActive?: boolean }>(({ isActive }) => {
|
||||||
({ theme, isActive }) => {
|
{
|
||||||
{
|
return {
|
||||||
return {
|
...displayFlex('center', 'center'),
|
||||||
...displayFlex('center', 'center'),
|
flex: '1',
|
||||||
flex: '1',
|
height: '30px',
|
||||||
height: '30px',
|
color: 'var(--affine-text-primary-color)',
|
||||||
color: 'var(--affine-text-primary-color)',
|
opacity: isActive ? 1 : 0.2,
|
||||||
opacity: isActive ? 1 : 0.2,
|
fontWeight: '500',
|
||||||
fontWeight: '500',
|
fontSize: 'var(--affine-font-base)',
|
||||||
fontSize: 'var(--affine-font-base)',
|
lineHeight: 'var(--affine-line-height)',
|
||||||
lineHeight: 'var(--affine-line-height)',
|
cursor: 'pointer',
|
||||||
cursor: 'pointer',
|
transition: 'all 0.15s ease',
|
||||||
transition: 'all 0.15s ease',
|
padding: '0 10px',
|
||||||
padding: '0 10px',
|
marginBottom: '4px',
|
||||||
marginBottom: '4px',
|
borderRadius: '4px',
|
||||||
borderRadius: '4px',
|
position: 'relative',
|
||||||
position: 'relative',
|
':hover': {
|
||||||
':hover': {
|
background: 'var(--affine-hover-color)',
|
||||||
background: 'var(--affine-hover-color)',
|
opacity: 1,
|
||||||
opacity: 1,
|
color: isActive
|
||||||
color: isActive
|
? 'var(--affine-text-primary-color)'
|
||||||
|
: 'var(--affine-text-secondary-color)',
|
||||||
|
svg: {
|
||||||
|
fill: isActive
|
||||||
? 'var(--affine-text-primary-color)'
|
? 'var(--affine-text-primary-color)'
|
||||||
: 'var(--affine-text-secondary-color)',
|
: 'var(--affine-text-secondary-color)',
|
||||||
svg: {
|
|
||||||
fill: isActive
|
|
||||||
? 'var(--affine-text-primary-color)'
|
|
||||||
: 'var(--affine-text-secondary-color)',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
svg: {
|
},
|
||||||
fontSize: '20px',
|
svg: {
|
||||||
marginRight: '12px',
|
fontSize: '20px',
|
||||||
},
|
marginRight: '12px',
|
||||||
':after': {
|
},
|
||||||
content: '""',
|
':after': {
|
||||||
position: 'absolute',
|
content: '""',
|
||||||
bottom: '-6px',
|
position: 'absolute',
|
||||||
left: '0',
|
bottom: '-6px',
|
||||||
width: '100%',
|
left: '0',
|
||||||
height: '2px',
|
width: '100%',
|
||||||
background: 'var(--affine-text-primary-color)',
|
height: '2px',
|
||||||
opacity: 0.2,
|
background: 'var(--affine-text-primary-color)',
|
||||||
},
|
opacity: 0.2,
|
||||||
};
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
export const StyledIndicator = styled('div')(({ theme }) => {
|
export const StyledIndicator = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
height: '2px',
|
height: '2px',
|
||||||
background: 'var(--affine-text-primary-color)',
|
background: 'var(--affine-text-primary-color)',
|
||||||
@@ -87,7 +85,7 @@ export const StyledIndicator = styled('div')(({ theme }) => {
|
|||||||
transition: 'left .3s, width .3s',
|
transition: 'left .3s, width .3s',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledInput = styled('input')(({ theme }) => {
|
export const StyledInput = styled('input')(() => {
|
||||||
return {
|
return {
|
||||||
padding: '4px 8px',
|
padding: '4px 8px',
|
||||||
height: '28px',
|
height: '28px',
|
||||||
@@ -101,7 +99,7 @@ export const StyledInput = styled('input')(({ theme }) => {
|
|||||||
marginRight: '10px',
|
marginRight: '10px',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledButton = styled(TextButton)(({ theme }) => {
|
export const StyledButton = styled(TextButton)(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-primary-color)',
|
color: 'var(--affine-primary-color)',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
@@ -121,7 +119,7 @@ export const StyledDisableButton = styled(Button)(() => {
|
|||||||
padding: '0',
|
padding: '0',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledLinkSpan = styled('span')(({ theme }) => {
|
export const StyledLinkSpan = styled('span')(() => {
|
||||||
return {
|
return {
|
||||||
marginLeft: '4px',
|
marginLeft: '4px',
|
||||||
color: 'var(--affine-primary-color)',
|
color: 'var(--affine-primary-color)',
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { AffineWorkspace, LocalWorkspace } from '@affine/workspace/type';
|
|||||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||||
import { SettingsIcon } from '@blocksuite/icons';
|
import { SettingsIcon } from '@blocksuite/icons';
|
||||||
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
||||||
import type { FC, MouseEvent } from 'react';
|
import type { FC } from 'react';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
import { WorkspaceAvatar } from '../workspace-avatar';
|
import { WorkspaceAvatar } from '../workspace-avatar';
|
||||||
@@ -95,12 +95,9 @@ export const WorkspaceCard: FC<WorkspaceCardProps> = ({
|
|||||||
return (
|
return (
|
||||||
<StyledCard
|
<StyledCard
|
||||||
data-testid="workspace-card"
|
data-testid="workspace-card"
|
||||||
onClick={useCallback(
|
onClick={useCallback(() => {
|
||||||
(event: MouseEvent) => {
|
onClick(workspace);
|
||||||
onClick(workspace);
|
}, [onClick, workspace])}
|
||||||
},
|
|
||||||
[onClick, workspace]
|
|
||||||
)}
|
|
||||||
active={workspace.id === currentWorkspaceId}
|
active={workspace.id === currentWorkspaceId}
|
||||||
>
|
>
|
||||||
<WorkspaceAvatar size={58} workspace={workspace} />
|
<WorkspaceAvatar size={58} workspace={workspace} />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { displayFlex, styled, textEllipsis } from '../..';
|
import { displayFlex, styled, textEllipsis } from '../..';
|
||||||
import { IconButton } from '../..';
|
import { IconButton } from '../..';
|
||||||
|
|
||||||
export const StyleWorkspaceInfo = styled('div')(({ theme }) => {
|
export const StyleWorkspaceInfo = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
marginLeft: '15px',
|
marginLeft: '15px',
|
||||||
width: '202px',
|
width: '202px',
|
||||||
@@ -22,7 +22,7 @@ export const StyleWorkspaceInfo = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyleWorkspaceTitle = styled('div')(({ theme }) => {
|
export const StyleWorkspaceTitle = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'var(--affine-font-base)',
|
fontSize: 'var(--affine-font-base)',
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
@@ -35,7 +35,7 @@ export const StyleWorkspaceTitle = styled('div')(({ theme }) => {
|
|||||||
|
|
||||||
export const StyledCard = styled('div')<{
|
export const StyledCard = styled('div')<{
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
}>(({ theme, active }) => {
|
}>(({ active }) => {
|
||||||
const borderColor = active ? 'var(--affine-primary-color)' : 'transparent';
|
const borderColor = active ? 'var(--affine-primary-color)' : 'transparent';
|
||||||
return {
|
return {
|
||||||
width: '310px',
|
width: '310px',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import MuiBreadcrumbs from '@mui/material/Breadcrumbs';
|
|||||||
|
|
||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
|
|
||||||
export const Breadcrumbs = styled(MuiBreadcrumbs)(({ theme }) => {
|
export const Breadcrumbs = styled(MuiBreadcrumbs)(() => {
|
||||||
return {
|
return {
|
||||||
color: 'var(--affine-text-primary-color)',
|
color: 'var(--affine-text-primary-color)',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ export const StyledTextButton = styled('button', {
|
|||||||
>
|
>
|
||||||
>(
|
>(
|
||||||
({
|
({
|
||||||
theme,
|
|
||||||
size = 'default',
|
size = 'default',
|
||||||
disabled,
|
disabled,
|
||||||
hoverBackground,
|
hoverBackground,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const StyledModalWrapper = styled(ModalWrapper)(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledConfirmTitle = styled('div')(({ theme }) => {
|
export const StyledConfirmTitle = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'var(--affine-font-h6)',
|
fontSize: 'var(--affine-font-h6)',
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
@@ -20,7 +20,7 @@ export const StyledConfirmTitle = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledConfirmContent = styled('div')(({ theme }) => {
|
export const StyledConfirmContent = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'var(--affine-font-base)',
|
fontSize: 'var(--affine-font-base)',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import MuiDivider from '@mui/material/Divider';
|
|||||||
|
|
||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
|
|
||||||
export const Divider = styled(MuiDivider)(({ theme }) => {
|
export const Divider = styled(MuiDivider)(() => {
|
||||||
return {
|
return {
|
||||||
borderColor: 'var(--affine-border-color)',
|
borderColor: 'var(--affine-border-color)',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { SvgIconProps } from '@mui/material/SvgIcon';
|
import type { SvgIconProps } from '@mui/material/SvgIcon';
|
||||||
import SvgIcon from '@mui/material/SvgIcon';
|
import SvgIcon from '@mui/material/SvgIcon';
|
||||||
|
|
||||||
export const EmptySVG = (props: SvgIconProps) => {
|
export const EmptySVG = (_props: SvgIconProps) => {
|
||||||
return (
|
return (
|
||||||
<SvgIcon
|
<SvgIcon
|
||||||
width="200"
|
width="200"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export const StyledInput = styled('input')<{
|
|||||||
width?: CSSProperties['width'];
|
width?: CSSProperties['width'];
|
||||||
height?: CSSProperties['height'];
|
height?: CSSProperties['height'];
|
||||||
noBorder?: boolean;
|
noBorder?: boolean;
|
||||||
}>(({ theme, width, disabled, height, noBorder }) => {
|
}>(({ width, disabled, height, noBorder }) => {
|
||||||
return {
|
return {
|
||||||
width: width || '100%',
|
width: width || '100%',
|
||||||
height,
|
height,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ export const Content = styled('div', {
|
|||||||
},
|
},
|
||||||
})<ContentProps>(
|
})<ContentProps>(
|
||||||
({
|
({
|
||||||
theme,
|
|
||||||
color,
|
color,
|
||||||
fontSize,
|
fontSize,
|
||||||
weight,
|
weight,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export type IconMenuProps = PropsWithChildren<{
|
|||||||
HTMLAttributes<HTMLButtonElement>;
|
HTMLAttributes<HTMLButtonElement>;
|
||||||
|
|
||||||
export const MenuItem = forwardRef<HTMLButtonElement, IconMenuProps>(
|
export const MenuItem = forwardRef<HTMLButtonElement, IconMenuProps>(
|
||||||
({ endIcon, icon, iconSize, children, ...props }, ref) => {
|
({ endIcon, icon, children, ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<StyledMenuItem ref={ref} {...props}>
|
<StyledMenuItem ref={ref} {...props}>
|
||||||
{icon && <StyledStartIconWrapper>{icon}</StyledStartIconWrapper>}
|
{icon && <StyledStartIconWrapper>{icon}</StyledStartIconWrapper>}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ export const PureMenu = ({
|
|||||||
children,
|
children,
|
||||||
placement,
|
placement,
|
||||||
width,
|
width,
|
||||||
height,
|
|
||||||
...otherProps
|
...otherProps
|
||||||
}: PureMenuProps) => {
|
}: PureMenuProps) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import StyledPopperContainer from '../shared/Container';
|
|||||||
export const StyledMenuWrapper = styled(StyledPopperContainer)<{
|
export const StyledMenuWrapper = styled(StyledPopperContainer)<{
|
||||||
width?: CSSProperties['width'];
|
width?: CSSProperties['width'];
|
||||||
height?: CSSProperties['height'];
|
height?: CSSProperties['height'];
|
||||||
}>(({ theme, width, height }) => {
|
}>(({ width, height }) => {
|
||||||
return {
|
return {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
@@ -18,14 +18,14 @@ export const StyledMenuWrapper = styled(StyledPopperContainer)<{
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledStartIconWrapper = styled('div')(({ theme }) => {
|
export const StyledStartIconWrapper = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
marginRight: '12px',
|
marginRight: '12px',
|
||||||
fontSize: '20px',
|
fontSize: '20px',
|
||||||
color: 'var(--affine-icon-color)',
|
color: 'var(--affine-icon-color)',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export const StyledEndIconWrapper = styled('div')(({ theme }) => {
|
export const StyledEndIconWrapper = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
marginLeft: '12px',
|
marginLeft: '12px',
|
||||||
fontSize: '20px',
|
fontSize: '20px',
|
||||||
@@ -33,7 +33,7 @@ export const StyledEndIconWrapper = styled('div')(({ theme }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledContent = styled('div')(({ theme }) => {
|
export const StyledContent = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
textAlign: 'left',
|
textAlign: 'left',
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
@@ -45,7 +45,7 @@ export const StyledContent = styled('div')(({ theme }) => {
|
|||||||
export const StyledMenuItem = styled('button')<{
|
export const StyledMenuItem = styled('button')<{
|
||||||
isDir?: boolean;
|
isDir?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}>(({ theme, isDir = false, disabled = false }) => {
|
}>(({ isDir = false, disabled = false }) => {
|
||||||
return {
|
return {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
borderRadius: '5px',
|
borderRadius: '5px',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const ModalWrapper = styled('div')<{
|
|||||||
width?: CSSProperties['width'];
|
width?: CSSProperties['width'];
|
||||||
height?: CSSProperties['height'];
|
height?: CSSProperties['height'];
|
||||||
minHeight?: CSSProperties['minHeight'];
|
minHeight?: CSSProperties['minHeight'];
|
||||||
}>(({ theme, width, height, minHeight }) => {
|
}>(({ width, height, minHeight }) => {
|
||||||
return {
|
return {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { CSSProperties } from 'react';
|
|||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
import { Wrapper } from '../layout';
|
import { Wrapper } from '../layout';
|
||||||
|
|
||||||
export const StyledBackdrop = styled('div')(({ theme }) => {
|
export const StyledBackdrop = styled('div')(() => {
|
||||||
return {
|
return {
|
||||||
zIndex: '-1',
|
zIndex: '-1',
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
@@ -23,7 +23,7 @@ export const StyledModal = styled(ModalUnstyled, {
|
|||||||
})<{
|
})<{
|
||||||
alignItems: CSSProperties['alignItems'];
|
alignItems: CSSProperties['alignItems'];
|
||||||
justifyContent: CSSProperties['justifyContent'];
|
justifyContent: CSSProperties['justifyContent'];
|
||||||
}>(({ theme, alignItems, justifyContent }) => {
|
}>(({ alignItems, justifyContent }) => {
|
||||||
return {
|
return {
|
||||||
width: '100vw',
|
width: '100vw',
|
||||||
height: '100vh',
|
height: '100vh',
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ const getArrowStyle = (
|
|||||||
|
|
||||||
const StyledArrow = styled('span')<{
|
const StyledArrow = styled('span')<{
|
||||||
placement?: PopperArrowProps['placement'];
|
placement?: PopperArrowProps['placement'];
|
||||||
}>(({ placement, theme }) => {
|
}>(({ placement }) => {
|
||||||
return {
|
return {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
fontSize: '7px',
|
fontSize: '7px',
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ export const BasicStyledPopper = styled(PopperUnstyled, {
|
|||||||
!['zIndex'].some(name => name === propName),
|
!['zIndex'].some(name => name === propName),
|
||||||
})<{
|
})<{
|
||||||
zIndex?: CSSProperties['zIndex'];
|
zIndex?: CSSProperties['zIndex'];
|
||||||
}>(({ zIndex, theme }) => {
|
}>(({ zIndex }) => {
|
||||||
return {
|
return {
|
||||||
zIndex: zIndex ?? 'var(--affine-z-index-popover)',
|
zIndex: zIndex ?? 'var(--affine-z-index-popover)',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const placementToContainerDirection: Record<
|
|||||||
|
|
||||||
export const StyledPopperContainer = styled('div')<{
|
export const StyledPopperContainer = styled('div')<{
|
||||||
placement?: PopperPlacementType;
|
placement?: PopperPlacementType;
|
||||||
}>(({ theme, placement = 'top' }) => {
|
}>(({ placement = 'top' }) => {
|
||||||
const direction = placementToContainerDirection[placement];
|
const direction = placementToContainerDirection[placement];
|
||||||
const borderRadius = getBorderRadius(
|
const borderRadius = getBorderRadius(
|
||||||
direction,
|
direction,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { styled } from '@affine/component';
|
import { styled } from '@affine/component';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
const StyledLabel = styled('label')(({ theme }) => {
|
const StyledLabel = styled('label')(() => {
|
||||||
return {
|
return {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@@ -10,7 +10,7 @@ const StyledLabel = styled('label')(({ theme }) => {
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const StyledInput = styled('input')(({ theme }) => {
|
const StyledInput = styled('input')(() => {
|
||||||
return {
|
return {
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { styled, textEllipsis } from '../../styles';
|
|||||||
import type { TableCellProps } from './interface';
|
import type { TableCellProps } from './interface';
|
||||||
|
|
||||||
export const StyledTable = styled('table')<{ tableLayout: 'auto' | 'fixed' }>(
|
export const StyledTable = styled('table')<{ tableLayout: 'auto' | 'fixed' }>(
|
||||||
({ theme, tableLayout }) => {
|
({ tableLayout }) => {
|
||||||
return {
|
return {
|
||||||
fontSize: 'var(--affine-font-base)',
|
fontSize: 'var(--affine-font-base)',
|
||||||
color: 'var(--affine-text-primary-color)',
|
color: 'var(--affine-text-primary-color)',
|
||||||
@@ -53,7 +53,7 @@ export const StyledTableHead = styled('thead')(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StyledTableRow = styled('tr')(({ theme }) => {
|
export const StyledTableRow = styled('tr')(() => {
|
||||||
return {
|
return {
|
||||||
td: {
|
td: {
|
||||||
transition: 'background .15s',
|
transition: 'background .15s',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { TooltipProps } from '@mui/material';
|
|||||||
import { styled } from '../../styles';
|
import { styled } from '../../styles';
|
||||||
import { Popper, type PopperProps } from '../popper';
|
import { Popper, type PopperProps } from '../popper';
|
||||||
import StyledPopperContainer from '../shared/Container';
|
import StyledPopperContainer from '../shared/Container';
|
||||||
const StyledTooltip = styled(StyledPopperContainer)(({ theme }) => {
|
const StyledTooltip = styled(StyledPopperContainer)(() => {
|
||||||
return {
|
return {
|
||||||
maxWidth: '320px',
|
maxWidth: '320px',
|
||||||
boxShadow: 'var(--affine-float-button-shadow)',
|
boxShadow: 'var(--affine-float-button-shadow)',
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export const TreeView = <RenderProps,>({
|
|||||||
enableKeyboardSelection,
|
enableKeyboardSelection,
|
||||||
onSelect,
|
onSelect,
|
||||||
enableDnd = true,
|
enableDnd = true,
|
||||||
initialCollapsedIds = [],
|
|
||||||
disableCollapse,
|
disableCollapse,
|
||||||
onDrop,
|
onDrop,
|
||||||
...otherProps
|
...otherProps
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
import type { TreeNodeProps } from '../types';
|
import type { TreeNodeProps } from '../types';
|
||||||
export const useCollapsed = <RenderProps>({
|
export const useCollapsed = ({
|
||||||
initialCollapsedIds = [],
|
initialCollapsedIds = [],
|
||||||
disableCollapse = false,
|
disableCollapse = false,
|
||||||
}: {
|
}: {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export type Node<RenderProps = unknown> = {
|
|||||||
renderBottomLine?: boolean;
|
renderBottomLine?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type CommonProps<RenderProps = unknown> = {
|
type CommonProps = {
|
||||||
enableDnd?: boolean;
|
enableDnd?: boolean;
|
||||||
enableKeyboardSelection?: boolean;
|
enableKeyboardSelection?: boolean;
|
||||||
indent?: CSSProperties['paddingLeft'];
|
indent?: CSSProperties['paddingLeft'];
|
||||||
@@ -51,7 +51,7 @@ export type TreeNodeProps<RenderProps = unknown> = {
|
|||||||
allowDrop?: boolean;
|
allowDrop?: boolean;
|
||||||
selectedId?: string;
|
selectedId?: string;
|
||||||
draggingId?: string;
|
draggingId?: string;
|
||||||
} & CommonProps<RenderProps>;
|
} & CommonProps;
|
||||||
|
|
||||||
export type TreeNodeItemProps<RenderProps = unknown> = {
|
export type TreeNodeItemProps<RenderProps = unknown> = {
|
||||||
collapsed: boolean;
|
collapsed: boolean;
|
||||||
@@ -64,7 +64,7 @@ export type TreeViewProps<RenderProps = unknown> = {
|
|||||||
data: Node<RenderProps>[];
|
data: Node<RenderProps>[];
|
||||||
initialCollapsedIds?: string[];
|
initialCollapsedIds?: string[];
|
||||||
disableCollapse?: boolean;
|
disableCollapse?: boolean;
|
||||||
} & CommonProps<RenderProps>;
|
} & CommonProps;
|
||||||
|
|
||||||
export type NodeLIneProps<RenderProps = unknown> = {
|
export type NodeLIneProps<RenderProps = unknown> = {
|
||||||
allowDrop: boolean;
|
allowDrop: boolean;
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ const mockedAddBlob = vi.fn();
|
|||||||
vi.stubGlobal('window', {
|
vi.stubGlobal('window', {
|
||||||
apis: {
|
apis: {
|
||||||
db: {
|
db: {
|
||||||
getDoc: async (id: string) => {
|
getDoc: async () => {
|
||||||
return Y.encodeStateAsUpdate(offlineYdoc);
|
return Y.encodeStateAsUpdate(offlineYdoc);
|
||||||
},
|
},
|
||||||
applyDocUpdate: async (id: string, update: Uint8Array) => {
|
applyDocUpdate: async (id: string, update: Uint8Array) => {
|
||||||
Y.applyUpdate(offlineYdoc, update, 'sqlite');
|
Y.applyUpdate(offlineYdoc, update, 'sqlite');
|
||||||
},
|
},
|
||||||
getPersistedBlobs: async (id: string) => {
|
getPersistedBlobs: async () => {
|
||||||
// todo: may need to hack the way to get hash keys of blobs
|
// todo: may need to hack the way to get hash keys of blobs
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
@@ -88,7 +88,7 @@ describe('SQLite provider', () => {
|
|||||||
const bin = new Uint8Array([1, 2, 3]);
|
const bin = new Uint8Array([1, 2, 3]);
|
||||||
const blob = new Blob([bin]);
|
const blob = new Blob([bin]);
|
||||||
workspace.blobs.list = vi.fn(async () => ['blob1']);
|
workspace.blobs.list = vi.fn(async () => ['blob1']);
|
||||||
workspace.blobs.get = vi.fn(async (key: string) => {
|
workspace.blobs.get = vi.fn(async () => {
|
||||||
return blob;
|
return blob;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -131,16 +131,11 @@ type PageDetailProps<Flavour extends keyof WorkspaceRegistry> =
|
|||||||
currentPageId: string;
|
currentPageId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PageListProps<Flavour extends keyof WorkspaceRegistry> = {
|
type PageListProps<_Flavour extends keyof WorkspaceRegistry> = {
|
||||||
blockSuiteWorkspace: BlockSuiteWorkspace;
|
blockSuiteWorkspace: BlockSuiteWorkspace;
|
||||||
onOpenPage: (pageId: string, newTab?: boolean) => void;
|
onOpenPage: (pageId: string, newTab?: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type SideBarMenuProps<Flavour extends keyof WorkspaceRegistry> =
|
|
||||||
UIBaseProps<Flavour> & {
|
|
||||||
setSideBarOpen: (open: boolean) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface WorkspaceUISchema<Flavour extends keyof WorkspaceRegistry> {
|
export interface WorkspaceUISchema<Flavour extends keyof WorkspaceRegistry> {
|
||||||
PageDetail: FC<PageDetailProps<Flavour>>;
|
PageDetail: FC<PageDetailProps<Flavour>>;
|
||||||
PageList: FC<PageListProps<Flavour>>;
|
PageList: FC<PageListProps<Flavour>>;
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ export const createIndexedDBProvider = (
|
|||||||
let reject: (reason?: unknown) => void;
|
let reject: (reason?: unknown) => void;
|
||||||
let early = true;
|
let early = true;
|
||||||
let connect = false;
|
let connect = false;
|
||||||
let destroy = false;
|
|
||||||
|
|
||||||
async function handleUpdate(update: Uint8Array, origin: unknown) {
|
async function handleUpdate(update: Uint8Array, origin: unknown) {
|
||||||
const db = await dbPromise;
|
const db = await dbPromise;
|
||||||
@@ -199,7 +198,6 @@ export const createIndexedDBProvider = (
|
|||||||
});
|
});
|
||||||
const handleDestroy = async () => {
|
const handleDestroy = async () => {
|
||||||
connect = true;
|
connect = true;
|
||||||
destroy = true;
|
|
||||||
const db = await dbPromise;
|
const db = await dbPromise;
|
||||||
db.close();
|
db.close();
|
||||||
};
|
};
|
||||||
@@ -277,7 +275,6 @@ export const createIndexedDBProvider = (
|
|||||||
doc.off('destroy', handleDestroy);
|
doc.off('destroy', handleDestroy);
|
||||||
},
|
},
|
||||||
cleanup() {
|
cleanup() {
|
||||||
destroy = true;
|
|
||||||
// todo
|
// todo
|
||||||
},
|
},
|
||||||
whenSynced: Promise.resolve(),
|
whenSynced: Promise.resolve(),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
|
|||||||
import type { Page } from '@playwright/test';
|
import type { Page } from '@playwright/test';
|
||||||
import { expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
|
||||||
async function openStorybook(page: Page, storyName?: string) {
|
async function openStorybook(page: Page) {
|
||||||
return page.goto(`http://localhost:6006`);
|
return page.goto(`http://localhost:6006`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user