mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
chore: fix most warnings and ignore a few warnings, because the code quality is too bad
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { ResetIcon } from '@blocksuite/icons';
|
||||
import { styled } from '@/styles';
|
||||
import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
|
||||
import { Button } from '@/ui/button';
|
||||
|
||||
@@ -12,14 +12,17 @@ interface LoginModalProps {
|
||||
workspaceId: string;
|
||||
onInviteSuccess: () => void;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const debounce = <T extends (...args: any) => any>(
|
||||
fn: T,
|
||||
time?: number,
|
||||
immediate?: boolean
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): ((...args: any) => any) => {
|
||||
let timeoutId: null | number;
|
||||
let defaultImmediate = immediate || false;
|
||||
const delay = time || 300;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (...args: any) => {
|
||||
if (defaultImmediate) {
|
||||
fn.apply(this, args); // 确保引用函数的指向正确,并且函数的参数也不变
|
||||
@@ -45,10 +48,10 @@ export const InviteMembers = ({
|
||||
workspaceId,
|
||||
onInviteSuccess,
|
||||
}: LoginModalProps) => {
|
||||
const [canInvite, setCanInvite] = useState<boolean>(true);
|
||||
const [email, setEmail] = useState<string>('');
|
||||
const [showMember, setShowMember] = useState<boolean>(false);
|
||||
const [showTip, setShowTip] = useState<boolean>(false);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const [userData, setUserData] = useState<any>({});
|
||||
const inputChange = (value: string) => {
|
||||
setEmail(value);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { styled } from '@/styles';
|
||||
import Loading from './loading';
|
||||
|
||||
// Used for the full page loading
|
||||
const StyledLoadingContainer = styled('div')(({ theme }) => {
|
||||
const StyledLoadingContainer = styled('div')(() => {
|
||||
return {
|
||||
height: '100vh',
|
||||
display: 'flex',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ResetIcon } from '@blocksuite/icons';
|
||||
import { styled } from '@/styles';
|
||||
import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
|
||||
import { TextButton, Button } from '@/ui/button';
|
||||
import { TextButton } from '@/ui/button';
|
||||
import { GoogleLoginButton, StayLogOutButton } from './LoginOptionButton';
|
||||
|
||||
interface LoginModalProps {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { displayFlex, styled, textEllipsis } from '@/styles';
|
||||
import { displayFlex, styled } from '@/styles';
|
||||
import { TableRow } from '@/ui/table';
|
||||
import Link from 'next/link';
|
||||
|
||||
export const StyledTableContainer = styled.div(() => {
|
||||
return {
|
||||
@@ -37,7 +36,7 @@ export const StyledTitleLink = styled.div(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledTableRow = styled(TableRow)(({ theme }) => {
|
||||
export const StyledTableRow = styled(TableRow)(() => {
|
||||
return {
|
||||
cursor: 'pointer',
|
||||
'&:hover': {
|
||||
|
||||
@@ -2,10 +2,12 @@ import { cloneElement, FC, PropsWithChildren, ReactNode } from 'react';
|
||||
|
||||
export const ProviderComposer: FC<
|
||||
PropsWithChildren<{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
contexts: any;
|
||||
}>
|
||||
> = ({ contexts, children }) =>
|
||||
contexts.reduceRight(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(kids: ReactNode, parent: any) =>
|
||||
cloneElement(parent, {
|
||||
children: kids,
|
||||
|
||||
@@ -38,7 +38,7 @@ export const StyledSubTitle = styled.div(({ theme }) => ({
|
||||
marginTop: '28px',
|
||||
padding: '0 16px',
|
||||
}));
|
||||
export const StyledModalHeader = styled.div(({ theme }) => ({
|
||||
export const StyledModalHeader = styled.div(() => ({
|
||||
...displayFlex('space-between', 'center'),
|
||||
paddingTop: '8px 4px 0 4px',
|
||||
width: '100%',
|
||||
|
||||
@@ -50,10 +50,10 @@ export class Counter extends LitElement {
|
||||
</div>`;
|
||||
}
|
||||
|
||||
private _increment(e: Event) {
|
||||
private _increment() {
|
||||
this.count++;
|
||||
}
|
||||
private _subtract(e: Event) {
|
||||
private _subtract() {
|
||||
this.count--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export const StyledPage = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledWrapper = styled('div')(({ theme }) => {
|
||||
export const StyledWrapper = styled('div')(() => {
|
||||
return {
|
||||
flexGrow: 1,
|
||||
position: 'relative',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { styled } from '@/styles';
|
||||
import { Button } from '@/ui/button';
|
||||
|
||||
export const StyledModalWrapper = styled('div')(({ theme }) => {
|
||||
return {
|
||||
@@ -24,7 +23,7 @@ export const StyledModalHeader = styled('div')(({ theme }) => {
|
||||
|
||||
// export const StyledModalContent = styled('div')(({ theme }) => {});
|
||||
|
||||
export const StyledTextContent = styled('div')(({ theme }) => {
|
||||
export const StyledTextContent = styled('div')(() => {
|
||||
return {
|
||||
margin: 'auto',
|
||||
width: '425px',
|
||||
@@ -37,7 +36,7 @@ export const StyledTextContent = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledInputContent = styled('div')(({ theme }) => {
|
||||
export const StyledInputContent = styled('div')(() => {
|
||||
return {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
@@ -46,7 +45,7 @@ export const StyledInputContent = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledButtonContent = styled('div')(({ theme }) => {
|
||||
export const StyledButtonContent = styled('div')(() => {
|
||||
return {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
@@ -55,7 +54,7 @@ export const StyledButtonContent = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledWorkspaceName = styled('span')(({ theme }) => {
|
||||
export const StyledWorkspaceName = styled('span')(() => {
|
||||
return {
|
||||
color: '#E8178A',
|
||||
};
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import Modal from '@/ui/modal';
|
||||
import Input from '@/ui/input';
|
||||
import {
|
||||
StyledModalHeader,
|
||||
StyledTextContent,
|
||||
StyledModalWrapper,
|
||||
StyledButtonContent,
|
||||
} from './style';
|
||||
import { useState } from 'react';
|
||||
import { ModalCloseButton } from '@/ui/modal';
|
||||
import { Button } from '@/ui/button';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useAppState } from '@/providers/app-state-provider';
|
||||
|
||||
interface WorkspaceDeleteProps {
|
||||
open: boolean;
|
||||
@@ -20,17 +16,7 @@ interface WorkspaceDeleteProps {
|
||||
nextWorkSpaceId: string;
|
||||
}
|
||||
|
||||
export const WorkspaceDelete = ({
|
||||
open,
|
||||
onClose,
|
||||
workspaceId,
|
||||
workspaceName,
|
||||
nextWorkSpaceId,
|
||||
}: WorkspaceDeleteProps) => {
|
||||
const [deleteStr, setDeleteStr] = useState<string>('');
|
||||
const router = useRouter();
|
||||
// const { refreshWorkspacesMeta } = useAppState();
|
||||
|
||||
export const WorkspaceDelete = ({ open, onClose }: WorkspaceDeleteProps) => {
|
||||
const handleLeave = async () => {
|
||||
// TODO
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { styled } from '@/styles';
|
||||
import { Button } from '@/ui/button';
|
||||
|
||||
export const StyledModalWrapper = styled('div')(({ theme }) => {
|
||||
return {
|
||||
@@ -24,7 +23,7 @@ export const StyledModalHeader = styled('div')(({ theme }) => {
|
||||
|
||||
// export const StyledModalContent = styled('div')(({ theme }) => {});
|
||||
|
||||
export const StyledTextContent = styled('div')(({ theme }) => {
|
||||
export const StyledTextContent = styled('div')(() => {
|
||||
return {
|
||||
margin: 'auto',
|
||||
width: '425px',
|
||||
@@ -37,7 +36,7 @@ export const StyledTextContent = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledButtonContent = styled('div')(({ theme }) => {
|
||||
export const StyledButtonContent = styled('div')(() => {
|
||||
return {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { styled } from '@/styles';
|
||||
import MuiAvatar from '@mui/material/Avatar';
|
||||
|
||||
export const StyledSettingInputContainer = styled('div')(({ theme }) => {
|
||||
export const StyledSettingInputContainer = styled('div')(() => {
|
||||
return {
|
||||
marginTop: '12px',
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledDeleteButtonContainer = styled('div')(({ theme }) => {
|
||||
export const StyledDeleteButtonContainer = styled('div')(() => {
|
||||
return {
|
||||
marginTop: '154px',
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledSettingAvatarContent = styled('div')(({ theme }) => {
|
||||
export const StyledSettingAvatarContent = styled('div')(() => {
|
||||
return {
|
||||
marginTop: '12px',
|
||||
display: 'flex',
|
||||
@@ -23,6 +23,6 @@ export const StyledSettingAvatarContent = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledSettingAvatar = styled(MuiAvatar)(({ theme }) => {
|
||||
export const StyledSettingAvatar = styled(MuiAvatar)(() => {
|
||||
return { height: '72px', width: '72px' };
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import Modal, { ModalCloseButton } from '@/ui/modal';
|
||||
import {
|
||||
StyledAvatarUploadBtn,
|
||||
StyledCopyButtonContainer,
|
||||
StyledMemberAvatar,
|
||||
StyledMemberButtonContainer,
|
||||
@@ -33,7 +32,7 @@ import {
|
||||
EmailIcon,
|
||||
TrashIcon,
|
||||
} from '@blocksuite/icons';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Button, IconButton } from '@/ui/button';
|
||||
import Input from '@/ui/input';
|
||||
import { InviteMembers } from '../invite-members/index';
|
||||
@@ -51,7 +50,6 @@ import { Empty } from '@/ui/empty';
|
||||
import { useAppState } from '@/providers/app-state-provider';
|
||||
import { WorkspaceDetails } from '../workspace-slider-bar/WorkspaceSelector/SelectorPopperContent';
|
||||
import { GeneralPage } from './general';
|
||||
import { Workspace as StoreWorkspaces } from '@blocksuite/store';
|
||||
|
||||
enum ActiveTab {
|
||||
'general' = 'general',
|
||||
@@ -170,7 +168,7 @@ export const WorkspaceSetting = ({
|
||||
const MembersPage = ({ workspace }: { workspace: Workspace }) => {
|
||||
const [isInviteModalShow, setIsInviteModalShow] = useState(false);
|
||||
const [members, setMembers] = useState<Member[]>([]);
|
||||
const refreshMembers = () => {
|
||||
const refreshMembers = useCallback(() => {
|
||||
getWorkspaceMembers({
|
||||
id: workspace.id,
|
||||
})
|
||||
@@ -180,10 +178,10 @@ const MembersPage = ({ workspace }: { workspace: Workspace }) => {
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
}, [workspace.id]);
|
||||
useEffect(() => {
|
||||
refreshMembers();
|
||||
}, [workspace.id]);
|
||||
}, [refreshMembers]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -240,7 +238,7 @@ const MembersPage = ({ workspace }: { workspace: Workspace }) => {
|
||||
// }).then(confirm => {
|
||||
removeMember({
|
||||
permissionId: member.id,
|
||||
}).then(data => {
|
||||
}).then(() => {
|
||||
// console.log('data: ', data);
|
||||
toast('Moved to Trash');
|
||||
refreshMembers();
|
||||
@@ -300,7 +298,7 @@ const PublishPage = ({ workspace }: { workspace: Workspace }) => {
|
||||
updateWorkspace({
|
||||
id: workspace.id,
|
||||
public: flag,
|
||||
}).then(data => {
|
||||
}).then(() => {
|
||||
setPublicStatus(!publicStatus);
|
||||
toast('Updated');
|
||||
});
|
||||
|
||||
+3
-3
@@ -47,7 +47,7 @@ export const SelectorPopperContent = ({
|
||||
|
||||
const refreshDetails = useCallback(async () => {
|
||||
const workspaceDetailList = await Promise.all(
|
||||
workspacesMeta?.map(async ({ id, type }) => {
|
||||
workspacesMeta.map(async ({ id, type }) => {
|
||||
if (user) {
|
||||
if (type === WorkspaceType.Private) {
|
||||
return { id, member_count: 1, owner: user };
|
||||
@@ -81,7 +81,7 @@ export const SelectorPopperContent = ({
|
||||
refreshWorkspacesMeta();
|
||||
refreshDetails();
|
||||
}
|
||||
}, [isShow]);
|
||||
}, [isShow, refreshDetails, refreshWorkspacesMeta]);
|
||||
|
||||
return !user ? (
|
||||
<SelectorPopperContainer placement="bottom-start">
|
||||
@@ -168,7 +168,7 @@ const WorkspaceGroupTitle = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
const WorkspaceWrapper = styled('div')(({ theme }) => {
|
||||
const WorkspaceWrapper = styled('div')(() => {
|
||||
return {
|
||||
maxHeight: '200px',
|
||||
overflow: 'auto',
|
||||
|
||||
+4
-4
@@ -24,7 +24,7 @@ export const StyledModalHeader = styled('div')(({ theme }) => {
|
||||
|
||||
// export const StyledModalContent = styled('div')(({ theme }) => {});
|
||||
|
||||
export const StyledTextContent = styled('div')(({ theme }) => {
|
||||
export const StyledTextContent = styled('div')(() => {
|
||||
return {
|
||||
margin: 'auto',
|
||||
width: '425px',
|
||||
@@ -37,7 +37,7 @@ export const StyledTextContent = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledInputContent = styled('div')(({ theme }) => {
|
||||
export const StyledInputContent = styled('div')(() => {
|
||||
return {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
@@ -46,7 +46,7 @@ export const StyledInputContent = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledButtonContent = styled('div')(({ theme }) => {
|
||||
export const StyledButtonContent = styled('div')(() => {
|
||||
return {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
@@ -55,7 +55,7 @@ export const StyledButtonContent = styled('div')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledButton = styled(Button)(({ theme }) => {
|
||||
export const StyledButton = styled(Button)(() => {
|
||||
return {
|
||||
width: '260px',
|
||||
justifyContent: 'center',
|
||||
|
||||
+1
-5
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
createWorkspace,
|
||||
getBlob,
|
||||
uploadBlob,
|
||||
} from '@pathfinder/data-services';
|
||||
import { createWorkspace, uploadBlob } from '@pathfinder/data-services';
|
||||
import Modal from '@/ui/modal';
|
||||
import Input from '@/ui/input';
|
||||
import {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ export const FooterSetting = ({ onClick }: SettingProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
const Wrapper = styled(IconButton)(({ theme }) => {
|
||||
const Wrapper = styled(IconButton)(() => {
|
||||
return {
|
||||
fontSize: '20px',
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
ImportIcon,
|
||||
TrashIcon,
|
||||
AddIcon,
|
||||
FavouritedIcon,
|
||||
} from '@blocksuite/icons';
|
||||
import Link from 'next/link';
|
||||
import { Tooltip } from '@/ui/tooltip';
|
||||
@@ -29,7 +28,6 @@ import { useAppState } from '@/providers/app-state-provider/context';
|
||||
import { IconButton } from '@/ui/button';
|
||||
import { WorkspaceSelector } from './WorkspaceSelector';
|
||||
import useLocalStorage from '@/hooks/use-local-storage';
|
||||
import { useTranslation } from '@/libs/i18n';
|
||||
import usePageMetaList from '@/hooks/use-page-meta-list';
|
||||
import { usePageHelper } from '@/hooks/use-page-helper';
|
||||
|
||||
@@ -73,7 +71,6 @@ export const WorkSpaceSliderBar = () => {
|
||||
|
||||
const [showTip, setShowTip] = useState(false);
|
||||
const [show, setShow] = useLocalStorage('AFFINE_SLIDE_BAR', false, true);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const paths = {
|
||||
all: currentWorkspaceId ? `/workspace/${currentWorkspaceId}/all` : '',
|
||||
|
||||
@@ -78,7 +78,7 @@ export const StyledListItemForWorkspace = styled(StyledListItem)({
|
||||
height: '52px',
|
||||
});
|
||||
|
||||
export const StyledLink = styled(Link)(({ theme }) => {
|
||||
export const StyledLink = styled(Link)(() => {
|
||||
return {
|
||||
flexGrow: 1,
|
||||
textAlign: 'left',
|
||||
@@ -93,7 +93,7 @@ export const StyledLink = styled(Link)(({ theme }) => {
|
||||
},
|
||||
};
|
||||
});
|
||||
export const StyledNewPageButton = styled(StyledListItem)(({ theme }) => {
|
||||
export const StyledNewPageButton = styled(StyledListItem)(() => {
|
||||
return {
|
||||
position: 'absolute',
|
||||
bottom: '24px',
|
||||
|
||||
@@ -9,7 +9,7 @@ export const useCurrentPageMeta = (): PageMeta | null => {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
(currentWorkspace?.meta.pageMetas.find(
|
||||
(currentWorkspace.meta.pageMetas.find(
|
||||
p => p.id === currentPage.pageId
|
||||
) as PageMeta) ?? null
|
||||
);
|
||||
@@ -22,7 +22,7 @@ export const useCurrentPageMeta = (): PageMeta | null => {
|
||||
useEffect(() => {
|
||||
setCurrentPageMeta(pageMetaHandler);
|
||||
|
||||
const dispose = currentWorkspace?.meta.pagesUpdated.on(res => {
|
||||
const dispose = currentWorkspace?.meta.pagesUpdated.on(() => {
|
||||
setCurrentPageMeta(pageMetaHandler);
|
||||
}).dispose;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export const useInitWorkspace = (disabled?: boolean) => {
|
||||
loadWorkspace(workspaceId).finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}, [workspaceId, disabled]);
|
||||
}, [workspaceId, disabled, loadWorkspace]);
|
||||
|
||||
return {
|
||||
workspaceId,
|
||||
|
||||
@@ -59,6 +59,7 @@ export const usePageHelper = (): EditorHandlers => {
|
||||
return trash;
|
||||
},
|
||||
search: (query: QueryContent) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
return currentWorkspace!.search(query);
|
||||
},
|
||||
changePageMode: async (pageId, mode) => {
|
||||
@@ -76,6 +77,7 @@ export const usePageHelper = (): EditorHandlers => {
|
||||
},
|
||||
permanentlyDeletePage: pageId => {
|
||||
// TODO: workspace.meta.removePage or workspace.removePage?
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
currentWorkspace!.meta.removePage(pageId);
|
||||
},
|
||||
openPage: (pageId, query = {}, newTab = false) => {
|
||||
|
||||
@@ -103,6 +103,7 @@ export const getRemoteTranslations = async (languages: string) => {
|
||||
return {};
|
||||
}
|
||||
// The assert is safe because we checked above
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
return translations[languages]!;
|
||||
};
|
||||
|
||||
@@ -162,11 +163,11 @@ export const removeTag = async (keyId: string, tagId: number) => {
|
||||
return json;
|
||||
};
|
||||
|
||||
export const addTagByKey = async (key: string, tag: string) => {
|
||||
// TODO get key id by key name
|
||||
// const keyId =
|
||||
// addTag(keyId, tag);
|
||||
};
|
||||
// export const addTagByKey = async (key: string, tag: string) => {
|
||||
// // TODO get key id by key name
|
||||
// // const keyId =
|
||||
// // addTag(keyId, tag);
|
||||
// };
|
||||
|
||||
/**
|
||||
* Exports data
|
||||
|
||||
@@ -9,7 +9,8 @@ const RES_DIR = path.resolve(process.cwd(), 'src', 'resources');
|
||||
|
||||
const countKeys = (obj: TranslationRes) => {
|
||||
let count = 0;
|
||||
Object.entries(obj).forEach(([key, value]) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
Object.entries(obj).forEach(([_, value]) => {
|
||||
if (typeof value === 'string') {
|
||||
count++;
|
||||
} else {
|
||||
@@ -101,6 +102,7 @@ const main = async () => {
|
||||
|
||||
export const LOCALES = [
|
||||
${availableLanguages
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
.map(({ translations, ...language }) =>
|
||||
JSON.stringify({
|
||||
...language,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// cSpell:ignore Tolgee
|
||||
import { readFile } from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { addTagByKey, createsNewKey, getRemoteTranslations } from './api';
|
||||
import { createsNewKey, getRemoteTranslations } from './api';
|
||||
import type { TranslationRes } from './utils';
|
||||
|
||||
const BASE_JSON_PATH = path.resolve(
|
||||
@@ -12,8 +12,6 @@ const BASE_JSON_PATH = path.resolve(
|
||||
);
|
||||
const BASE_LANGUAGES = 'en' as const;
|
||||
|
||||
const DEPRECATED_TAG_NAME = 'unused' as const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @example
|
||||
@@ -140,15 +138,15 @@ const main = async () => {
|
||||
|
||||
// TODO remove unused tags from used keys
|
||||
|
||||
diff.remove.forEach(key => {
|
||||
// TODO set unused tag
|
||||
// console.log(`Add ${DEPRECATED_TAG_NAME} to ${key}`);
|
||||
addTagByKey(key, DEPRECATED_TAG_NAME);
|
||||
});
|
||||
// diff.remove.forEach(key => {
|
||||
// // TODO set unused tag
|
||||
// // console.log(`Add ${DEPRECATED_TAG_NAME} to ${key}`);
|
||||
// addTagByKey(key, DEPRECATED_TAG_NAME);
|
||||
// });
|
||||
|
||||
diff.modify.forEach(key => {
|
||||
// TODO warn different between local and remote base translations
|
||||
});
|
||||
// diff.modify.forEach(key => {
|
||||
// // TODO warn different between local and remote base translations
|
||||
// });
|
||||
|
||||
// TODO send notification
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@ const User = ({ name, avatar }: { name: string; avatar?: string }) => {
|
||||
export default function DevPage() {
|
||||
const router = useRouter();
|
||||
const [successInvited, setSuccessInvited] = useState<boolean>(false);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const [inviteData, setInviteData] = useState<any>(null);
|
||||
useEffect(() => {
|
||||
acceptInviting({ invitingCode: router.query.invite_code as string })
|
||||
@@ -55,8 +56,8 @@ export default function DevPage() {
|
||||
>
|
||||
<circle opacity="0.14" cx="12" cy="12" r="9" fill="#6880FF" />
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM16.6783 8.2652C17.0841 8.6398 17.1094 9.27246 16.7348 9.67828L11.1963 15.6783C11.007 15.8834 10.7406 16 10.4615 16C10.1824 16 9.91604 15.8834 9.72674 15.6783L7.2652 13.0116C6.89059 12.6058 6.9159 11.9731 7.32172 11.5985C7.72754 11.2239 8.3602 11.2492 8.7348 11.6551L10.4615 13.5257L15.2652 8.32172C15.6398 7.9159 16.2725 7.89059 16.6783 8.2652Z"
|
||||
fill="#6880FF"
|
||||
/>
|
||||
@@ -82,8 +83,8 @@ export default function DevPage() {
|
||||
fill="#6880FF"
|
||||
/>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M2.29289 2.29289C2.68342 1.90237 3.31658 1.90237 3.70711 2.29289L7.70678 6.29256C7.707 6.29278 7.70655 6.29234 7.70678 6.29256L21.7071 20.2929C22.0976 20.6834 22.0976 21.3166 21.7071 21.7071C21.3166 22.0976 20.6834 22.0976 20.2929 21.7071L16.5858 18H16.5C15.9477 18 15.5 17.5523 15.5 17C15.5 16.9722 15.5011 16.9447 15.5033 16.9176L13.961 15.3752C12.8815 16.959 11.0631 18 9 18H7C3.68629 18 1 15.3137 1 12C1 9.40763 2.64407 7.19925 4.94642 6.36064L2.29289 3.70711C1.90237 3.31658 1.90237 2.68342 2.29289 2.29289ZM6.60504 8.01925C4.5813 8.21761 3 9.92414 3 12C3 14.2091 4.79086 16 7 16H9C10.511 16 11.8282 15.1618 12.5087 13.9229L10.9367 12.3509C10.7946 12.7301 10.4288 13 10 13C9.44772 13 9 12.5523 9 12C9 11.5127 9.0583 11.0379 9.16858 10.5828L6.60504 8.01925ZM15 8C14.4436 8 13.9162 8.11302 13.4375 8.31642C12.9291 8.53238 12.342 8.29538 12.1261 7.78707C11.9101 7.27876 12.1471 6.69162 12.6554 6.47566C13.377 6.1691 14.17 6 15 6H17C20.3137 6 23 8.68629 23 12C23 13.4573 22.4792 14.7955 21.6146 15.8349C21.2615 16.2595 20.6309 16.3174 20.2063 15.9642C19.7817 15.6111 19.7239 14.9806 20.077 14.556C20.6539 13.8624 21 12.973 21 12C21 9.79086 19.2091 8 17 8H15Z"
|
||||
fill="#6880FF"
|
||||
/>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import {
|
||||
useRef,
|
||||
useEffect,
|
||||
@@ -15,7 +16,7 @@ import type { NextPageWithLayout } from '../..//_app';
|
||||
import WorkspaceLayout from '@/components/workspace-layout';
|
||||
import { useRouter } from 'next/router';
|
||||
|
||||
const StyledEditorContainer = styled('div')(({ theme }) => {
|
||||
const StyledEditorContainer = styled('div')(() => {
|
||||
return {
|
||||
height: 'calc(100vh - 60px)',
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ const WorkspaceIndex = () => {
|
||||
if (!workspace) {
|
||||
return;
|
||||
}
|
||||
const savedPageId = workspace!.meta.pageMetas[0]?.id;
|
||||
const savedPageId = workspace.meta.pageMetas[0]?.id;
|
||||
if (savedPageId) {
|
||||
router.replace(`/workspace/${currentWorkspaceId}/${savedPageId}`);
|
||||
return;
|
||||
|
||||
@@ -10,7 +10,7 @@ export const WorkspaceIndex = () => {
|
||||
if (workspace) {
|
||||
router.push(`/workspace/${workspaceId}`);
|
||||
}
|
||||
}, [workspace, workspaceId]);
|
||||
}, [router, workspace, workspaceId]);
|
||||
|
||||
return <></>;
|
||||
};
|
||||
|
||||
@@ -8,11 +8,7 @@ import {
|
||||
import '@blocksuite/blocks';
|
||||
import '@blocksuite/blocks/style';
|
||||
import { BlockSchema, createEditor } from '@blocksuite/editor';
|
||||
import type {
|
||||
AppStateContext,
|
||||
LoadWorkspaceHandler,
|
||||
CreateEditorHandler,
|
||||
} from './context';
|
||||
import type { LoadWorkspaceHandler, CreateEditorHandler } from './context';
|
||||
import {
|
||||
downloadWorkspace,
|
||||
token,
|
||||
|
||||
@@ -75,6 +75,7 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
|
||||
workspaces,
|
||||
}));
|
||||
})();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [state.workspacesMeta]);
|
||||
|
||||
const [loadWorkspaceHandler, _setLoadWorkspaceHandler] =
|
||||
|
||||
@@ -22,8 +22,8 @@ export const ConfirmProvider = ({
|
||||
return (
|
||||
<ConfirmContext.Provider
|
||||
value={{
|
||||
confirm: ({ onClose, onCancel, onConfirm, ...props }: ConfirmProps) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm: ({ onCancel, onConfirm, ...props }: ConfirmProps) => {
|
||||
return new Promise(resolve => {
|
||||
const confirmId = String(Date.now());
|
||||
const closeHandler = () => {
|
||||
delete confirmRecord[confirmId];
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { createContext, useContext, useEffect, useState } from 'react';
|
||||
import {
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import ShortcutsModal from '@/components/shortcuts-modal';
|
||||
import ContactModal from '@/components/contact-modal';
|
||||
@@ -26,7 +32,7 @@ type ModalMap = {
|
||||
export const ModalContext = createContext<ModalContextValue>({
|
||||
triggerShortcutsModal: () => {},
|
||||
triggerContactModal: () => {},
|
||||
triggerQuickSearchModal: (visible?) => {},
|
||||
triggerQuickSearchModal: () => {},
|
||||
triggerImportModal: () => {},
|
||||
triggerLoginModal: () => {},
|
||||
});
|
||||
@@ -44,12 +50,15 @@ export const ModalProvider = ({
|
||||
login: false,
|
||||
});
|
||||
|
||||
const triggerHandler = (key: keyof ModalMap, visible?: boolean) => {
|
||||
setModalMap({
|
||||
...modalMap,
|
||||
[key]: visible ?? !modalMap[key],
|
||||
});
|
||||
};
|
||||
const triggerHandler = useCallback(
|
||||
(key: keyof ModalMap, visible?: boolean) => {
|
||||
setModalMap({
|
||||
...modalMap,
|
||||
[key]: visible ?? !modalMap[key],
|
||||
});
|
||||
},
|
||||
[modalMap]
|
||||
);
|
||||
useEffect(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
|
||||
@@ -99,7 +99,10 @@ export const ThemeProvider = ({
|
||||
<Global
|
||||
styles={css`
|
||||
:root {
|
||||
${globalThemeVariables(mode, themeStyle) as any}
|
||||
${
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
globalThemeVariables(mode, themeStyle) as any
|
||||
}
|
||||
}
|
||||
`}
|
||||
/>
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
import {
|
||||
HTMLAttributes,
|
||||
cloneElement,
|
||||
ReactElement,
|
||||
Children,
|
||||
CSSProperties,
|
||||
forwardRef,
|
||||
PropsWithChildren,
|
||||
} from 'react';
|
||||
import { cloneElement, Children, forwardRef } from 'react';
|
||||
import { StyledButton } from './styles';
|
||||
|
||||
import { ButtonProps } from './interface';
|
||||
|
||||
@@ -113,6 +113,7 @@ export const StyledTextButton = styled('button', {
|
||||
bold = false,
|
||||
shape = 'default',
|
||||
// TODO: Implement type
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
type = 'default',
|
||||
}) => {
|
||||
const { fontSize, borderRadius, padding, height } = getSize(size);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { displayFlex, styled } from '@/styles';
|
||||
import { ModalWrapper } from '@/ui/modal';
|
||||
|
||||
export const StyledModalWrapper = styled(ModalWrapper)(({ theme }) => {
|
||||
export const StyledModalWrapper = styled(ModalWrapper)(() => {
|
||||
return {
|
||||
width: '460px',
|
||||
padding: '46px 60px 32px',
|
||||
|
||||
@@ -9,6 +9,7 @@ type inputProps = {
|
||||
maxLength?: number;
|
||||
minLength?: number;
|
||||
onChange?: (value: string) => void;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
onBlur?: (e: any) => void;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { CSSProperties } from 'react';
|
||||
import { CSSProperties } from 'react';
|
||||
import { styled, textEllipsis } from '@/styles';
|
||||
|
||||
// This component should be just used to be contained the text content
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CSSProperties, HTMLAttributes, PropsWithChildren } from 'react';
|
||||
import type { CSSProperties } from 'react';
|
||||
import { styled } from '@/styles';
|
||||
|
||||
export type WrapperProps = {
|
||||
|
||||
@@ -13,14 +13,12 @@ export const StyledMenuWrapper = styled(StyledPopperContainer)(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledArrow = styled(ArrowRightIcon)(({ theme }) => {
|
||||
return {
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
margin: 'auto',
|
||||
};
|
||||
export const StyledArrow = styled(ArrowRightIcon)({
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
margin: 'auto',
|
||||
});
|
||||
|
||||
export const StyledMenuItem = styled.button<{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { CSSProperties, HTMLAttributes, PropsWithChildren } from 'react';
|
||||
import { CSSProperties } from 'react';
|
||||
import { styled } from '@/styles';
|
||||
|
||||
export const ModalWrapper = styled.div<{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Fade from '@mui/material/Fade';
|
||||
import { StyledModal, StyledBackdrop, StyledWrapper } from './styles';
|
||||
import { StyledModal, StyledBackdrop } from './styles';
|
||||
import { ModalUnstyledOwnProps } from '@mui/base/ModalUnstyled';
|
||||
|
||||
const Backdrop = ({
|
||||
@@ -11,7 +11,7 @@ const Backdrop = ({
|
||||
}) => {
|
||||
return (
|
||||
<Fade in={open}>
|
||||
<StyledBackdrop open={open} {...other} />
|
||||
<StyledBackdrop {...other} />
|
||||
</Fade>
|
||||
);
|
||||
};
|
||||
@@ -31,7 +31,6 @@ const transformConfig = {
|
||||
export const Modal = (props: ModalProps) => {
|
||||
const {
|
||||
wrapperPosition = ['center', 'center'],
|
||||
components,
|
||||
open,
|
||||
children,
|
||||
...otherProps
|
||||
|
||||
@@ -3,16 +3,14 @@ import ModalUnstyled from '@mui/base/ModalUnstyled';
|
||||
import { Wrapper } from '@/ui/layout';
|
||||
import { CSSProperties } from 'react';
|
||||
|
||||
export const StyledBackdrop = styled.div<{ open?: boolean }>(({ open }) => {
|
||||
return {
|
||||
zIndex: '-1',
|
||||
position: 'fixed',
|
||||
right: '0',
|
||||
bottom: '0',
|
||||
top: '0',
|
||||
left: '0',
|
||||
backgroundColor: 'rgba(58, 76, 92, 0.2)',
|
||||
};
|
||||
export const StyledBackdrop = styled.div({
|
||||
zIndex: '-1',
|
||||
position: 'fixed',
|
||||
right: '0',
|
||||
bottom: '0',
|
||||
top: '0',
|
||||
left: '0',
|
||||
backgroundColor: 'rgba(58, 76, 92, 0.2)',
|
||||
});
|
||||
|
||||
export const StyledModal = styled(ModalUnstyled, {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// import Table from '@mui/material/Table';
|
||||
// import TableBody from '@mui/material/TableBody';
|
||||
import TableCell from '@mui/material/TableCell';
|
||||
// import TableCell from '@mui/material/TableCell';
|
||||
// import TableHead from '@mui/material/TableHead';
|
||||
// import TableRow from '@mui/material/TableRow';
|
||||
//
|
||||
|
||||
@@ -14,7 +14,7 @@ export const StyledTable = styled.table<{ tableLayout: 'auto' | 'fixed' }>(
|
||||
}
|
||||
);
|
||||
|
||||
export const StyledTableBody = styled.tbody(({ theme }) => {
|
||||
export const StyledTableBody = styled.tbody(() => {
|
||||
return {
|
||||
fontWeight: 400,
|
||||
};
|
||||
@@ -22,7 +22,7 @@ export const StyledTableBody = styled.tbody(({ theme }) => {
|
||||
|
||||
export const StyledTableCell = styled.td<
|
||||
Pick<TableCellProps, 'ellipsis' | 'align' | 'proportion'>
|
||||
>(({ theme, align = 'left', ellipsis = false, proportion }) => {
|
||||
>(({ align = 'left', ellipsis = false, proportion }) => {
|
||||
const width = proportion ? `${proportion * 100}%` : 'auto';
|
||||
return {
|
||||
width,
|
||||
@@ -37,7 +37,7 @@ export const StyledTableCell = styled.td<
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledTableHead = styled.thead(({ theme }) => {
|
||||
export const StyledTableHead = styled.thead(() => {
|
||||
return {
|
||||
fontWeight: 500,
|
||||
tr: {
|
||||
|
||||
@@ -13,6 +13,7 @@ export function isMobile(userAgent: string) {
|
||||
|
||||
export const getIsMobile = function () {
|
||||
return isMobile(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
navigator?.userAgent || navigator?.vendor || (window as any)?.opera
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function debounce(fn: Function, timeout: number) {
|
||||
let timeoutId: any;
|
||||
|
||||
Reference in New Issue
Block a user