From d1c9a4070576a0143e51b9b7c7f2e111c7a85dbd Mon Sep 17 00:00:00 2001 From: DiamondThree <857159145@qq.com> Date: Fri, 13 Jan 2023 14:11:29 +0800 Subject: [PATCH] fix: lint error --- .../workspace-avatar/WorkspaceUnitAvatar.tsx | 7 ++-- .../app/src/pages/invite/[invite_code].tsx | 33 +++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/packages/app/src/components/workspace-avatar/WorkspaceUnitAvatar.tsx b/packages/app/src/components/workspace-avatar/WorkspaceUnitAvatar.tsx index 8a390bddda..4144d9645d 100644 --- a/packages/app/src/components/workspace-avatar/WorkspaceUnitAvatar.tsx +++ b/packages/app/src/components/workspace-avatar/WorkspaceUnitAvatar.tsx @@ -6,15 +6,16 @@ const useAvatar = (workspaceUnit?: WorkspaceUnit) => { const [avatarUrl, setAvatarUrl] = useState(''); const avatarId = workspaceUnit?.avatar || workspaceUnit?.blocksuiteWorkspace?.meta.avatar; + const blobs = workspaceUnit?.blocksuiteWorkspace?.blobs; useEffect(() => { - if (avatarId && workspaceUnit?.blocksuiteWorkspace?.blobs) { - workspaceUnit.blocksuiteWorkspace.blobs.then(blobs => { + if (avatarId && blobs) { + blobs.then(blobs => { blobs?.get(avatarId).then(url => setAvatarUrl(url || '')); }); } else { setAvatarUrl(''); } - }, [avatarId]); + }, [avatarId, blobs]); return avatarUrl; }; diff --git a/packages/app/src/pages/invite/[invite_code].tsx b/packages/app/src/pages/invite/[invite_code].tsx index 342fa7c481..872b3f927a 100644 --- a/packages/app/src/pages/invite/[invite_code].tsx +++ b/packages/app/src/pages/invite/[invite_code].tsx @@ -1,5 +1,4 @@ import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; -import { useAppState } from '@/providers/app-state-provider'; import { styled } from '@/styles'; import { Empty } from '@/ui/empty'; // import { Avatar } from '@mui/material'; @@ -23,16 +22,14 @@ export default function DevPage() { const router = useRouter(); const [successInvited, setSuccessInvited] = useState(false); const { acceptInvite } = useWorkspaceHelper(); - const { user } = useAppState(); useEffect(() => { router.query.invite_code && acceptInvite(router.query.invite_code as string).then(data => { if (data && data.accepted) { setSuccessInvited(true); - user && router.push(`/workspace/${data.workspace_id}`); } }); - }, [router.query.invite_code]); + }, [router, acceptInvite]); return ( @@ -98,16 +95,16 @@ export default function DevPage() { ); } -const UserIcon = styled('div')({ - display: 'inline-block', - width: '28px', - height: '28px', - borderRadius: '50%', - backgroundColor: '#FFF5AB', - textAlign: 'center', - color: '#896406', - lineHeight: '28px', -}); +// const UserIcon = styled('div')({ +// display: 'inline-block', +// width: '28px', +// height: '28px', +// borderRadius: '50%', +// backgroundColor: '#FFF5AB', +// textAlign: 'center', +// color: '#896406', +// lineHeight: '28px', +// }); const Invited = styled('div')(({ theme }) => { return { @@ -126,14 +123,6 @@ const Content = styled('div')({ marginTop: '35px', }); -const UserContent = styled('span')({ - fontSize: '18px', - marginLeft: '12px', - span: { - padding: '0 12px', - }, -}); - const Status = styled('div')(() => { return { marginTop: '16px',