Fix/UI issue (#946)

Co-authored-by: JimmFly <yangjinfei001@gmail.com>
This commit is contained in:
Qi
2023-02-11 00:19:21 +08:00
committed by GitHub
parent 8a7393a961
commit d5f4c4210d
52 changed files with 610 additions and 659 deletions

View File

@@ -1,12 +1,13 @@
import { styled } from '@affine/component';
import { Modal, ModalWrapper } from '@affine/component';
import { Button, IconButton } from '@affine/component';
import { IconButton } from '@affine/component';
import { useTranslation } from '@affine/i18n';
import { useAppState } from '@/providers/app-state-provider';
import { useState } from 'react';
import router from 'next/router';
import { toast } from '@affine/component';
import { CloseIcon } from '@blocksuite/icons';
import { Header, Content, ContentTitle, StyleTips, StyleButton } from './style';
interface EnableWorkspaceModalProps {
open: boolean;
onClose: () => void;
@@ -71,41 +72,3 @@ export const EnableWorkspaceModal = ({
</Modal>
);
};
const Header = styled('div')({
height: '44px',
display: 'flex',
flexDirection: 'row-reverse',
paddingRight: '10px',
paddingTop: '10px',
});
const Content = styled('div')({
textAlign: 'center',
});
const ContentTitle = styled('h1')({
fontSize: '20px',
lineHeight: '28px',
fontWeight: 600,
textAlign: 'center',
});
const StyleTips = styled('div')(() => {
return {
userSelect: 'none',
width: '400px',
margin: 'auto',
marginBottom: '32px',
marginTop: '12px',
};
});
const StyleButton = styled(Button)(() => {
return {
width: '284px',
display: 'block',
margin: 'auto',
marginTop: '16px',
};
});

View File

@@ -0,0 +1,39 @@
import { Button, styled } from '@affine/component';
export const Header = styled('div')({
height: '44px',
display: 'flex',
flexDirection: 'row-reverse',
paddingRight: '10px',
paddingTop: '10px',
});
export const Content = styled('div')({
textAlign: 'center',
});
export const ContentTitle = styled('h1')({
fontSize: '20px',
lineHeight: '28px',
fontWeight: 600,
textAlign: 'center',
});
export const StyleTips = styled('div')(() => {
return {
userSelect: 'none',
width: '400px',
margin: 'auto',
marginBottom: '32px',
marginTop: '12px',
};
});
export const StyleButton = styled(Button)(() => {
return {
width: '284px',
display: 'block',
margin: 'auto',
marginTop: '16px',
};
});

View File

@@ -1,28 +0,0 @@
import { Button } from '@affine/component';
import { useTranslation } from '@affine/i18n';
import { useState } from 'react';
import { EnableWorkspaceModal } from './EnableWorkspaceModal';
export const EnableWorkspaceButton = () => {
const { t } = useTranslation();
const [enableModalOpen, setEnableModalOpen] = useState(false);
return (
<>
<Button
type="light"
shape="circle"
onClick={async () => {
setEnableModalOpen(true);
}}
>
{t('Enable AFFiNE Cloud')}
</Button>
<EnableWorkspaceModal
open={enableModalOpen}
onClose={() => {
setEnableModalOpen(false);
}}
></EnableWorkspaceModal>
</>
);
};

View File

@@ -1,50 +1,47 @@
import { CloudUnsyncedIcon } from '@blocksuite/icons';
import { useModal } from '@/store/globalModal';
import { LocalWorkspaceIcon, CloudWorkspaceIcon } from '@blocksuite/icons';
import { useAppState } from '@/providers/app-state-provider';
import { IconButton } from '@affine/component';
import { styled, Tooltip } from '@affine/component';
import { useTranslation } from '@affine/i18n';
import { useModal } from '@/store/globalModal';
// Temporary solution to use this component, since the @blocksuite/icons has not been published yet
const DefaultSyncIcon = () => {
return (
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M3 13.6493C3 16.6044 5.41766 19 8.4 19L16.5 19C18.9853 19 21 16.9839 21 14.4969C21 12.6503 19.8893 10.9449 18.3 10.25C18.1317 7.32251 15.684 5 12.6893 5C10.3514 5 8.34694 6.48637 7.5 8.5C4.8 8.9375 3 11.2001 3 13.6493Z"
stroke="#888A9E"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M11.4571 9L9 16H10.4392L12.0021 11.1586L13.5657 16H15L12.5425 9H11.4571Z"
fill="#888A9E"
/>
</svg>
);
};
const IconWrapper = styled.div(() => {
return {
width: '20px',
height: '20px',
marginRight: '12px',
fontSize: '20px',
};
});
export const SyncUser = () => {
const { triggerLoginModal } = useModal();
const appState = useAppState();
const { currentWorkspace } = useAppState();
const { triggerEnableWorkspaceModal } = useModal();
return appState.user ? (
<IconButton iconSize="middle" disabled>
<DefaultSyncIcon />
</IconButton>
) : (
<IconButton
iconSize="middle"
data-testid="cloud-unsync-icon"
onClick={triggerLoginModal}
>
<CloudUnsyncedIcon />
</IconButton>
const { t } = useTranslation();
if (currentWorkspace?.provider === 'local') {
return (
<Tooltip
content={t('Saved then enable AFFiNE Cloud')}
placement="bottom-end"
>
<IconWrapper
onClick={() => {
triggerEnableWorkspaceModal();
}}
style={{ cursor: 'pointer' }}
>
<LocalWorkspaceIcon />
</IconWrapper>
</Tooltip>
);
}
return (
<Tooltip content={t('AFFiNE Cloud')} placement="bottom-end">
<IconWrapper>
<CloudWorkspaceIcon />
</IconWrapper>
</Tooltip>
);
};

View File

@@ -4,6 +4,7 @@ export const StyledHeaderContainer = styled.div<{ hasWarning: boolean }>(
({ hasWarning }) => {
return {
height: hasWarning ? '96px' : '60px',
padding: '0 28px',
};
}
);
@@ -39,6 +40,9 @@ export const StyledHeaderRightSide = styled('div')({
height: '100%',
display: 'flex',
alignItems: 'center',
'>*:not(:last-child)': {
marginRight: '12px',
},
});
export const StyledBrowserWarning = styled.div<{ show: boolean }>(

View File

@@ -27,7 +27,9 @@ export const HelpIsland = ({
setShowSpread(!spread);
}}
>
<StyledAnimateWrapper spread={spread}>
<StyledAnimateWrapper
style={{ height: spread ? `${showList.length * 44}px` : 0 }}
>
{showList.includes('contact') && (
<Tooltip content={t('Contact Us')} placement="left-end">
<StyledIconWrapper

View File

@@ -51,10 +51,7 @@ export const StyledIconWrapper = styled('div')(({ theme }) => {
};
});
export const StyledAnimateWrapper = styled('div', {
shouldForwardProp: prop => prop !== 'spread',
})<{ spread: boolean }>(({ spread }) => ({
height: spread ? '88px' : '0',
export const StyledAnimateWrapper = styled('div')(() => ({
transition: 'height 0.2s cubic-bezier(0, 0, 0.55, 1.6)',
overflow: 'hidden',
}));

View File

@@ -0,0 +1,28 @@
import {
JoinedWorkspaceIcon as DefaultJoinedWorkspaceIcon,
LocalWorkspaceIcon as DefaultLocalWorkspaceIcon,
CloudWorkspaceIcon as DefaultCloudWorkspaceIcon,
LocalDataIcon as DefaultLocalDataIcon,
PublishIcon as DefaultPublishIcon,
} from '@blocksuite/icons';
// Here are some icons with special color or size
export const JoinedWorkspaceIcon = () => {
return <DefaultJoinedWorkspaceIcon style={{ color: '#FF646B' }} />;
};
export const LocalWorkspaceIcon = () => {
return <DefaultLocalWorkspaceIcon style={{ color: '#FDBD32' }} />;
};
export const CloudWorkspaceIcon = () => {
return <DefaultCloudWorkspaceIcon style={{ color: '##60A5FA' }} />;
};
export const LocalDataIcon = () => {
return <DefaultLocalDataIcon style={{ color: '#62CD80' }} />;
};
export const PublishIcon = () => {
return <DefaultPublishIcon style={{ color: '##8699FF' }} />;
};

View File

@@ -14,6 +14,7 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
const [localCache, setLocalCache] = useState(true);
const { blobDataSynced } = useAppState();
const { t } = useTranslation();
return (
<Modal open={open} onClose={onClose} data-testid="logout-modal">
<ModalWrapper width={560} height={292}>
@@ -28,8 +29,8 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
<ContentTitle>{t('Sign out')}?</ContentTitle>
<SignDes>
{blobDataSynced
? t('Set up an AFFiNE account to sync data')
: 'All data has been stored in the cloud'}
? t('Sign out description')
: t('All data has been stored in the cloud')}
</SignDes>
<StyleTips>
{localCache ? (

View File

@@ -6,10 +6,10 @@ import { IconButton } from '@affine/component';
import {
MoreVerticalIcon,
RestoreIcon,
DeleteIcon,
FavouritesIcon,
FavouritedIcon,
OpenInNewIcon,
DeleteForeverIcon,
TrashIcon,
} from '@blocksuite/icons';
import { toast } from '@affine/component';
@@ -53,7 +53,7 @@ export const OperationCell = ({ pageMeta }: { pageMeta: PageMeta }) => {
confirmType: 'danger',
}).then(confirm => {
confirm && toggleDeletePage(id);
toast(t('Moved to Trash'));
confirm && toast(t('Moved to Trash'));
});
}}
icon={<TrashIcon />}
@@ -106,7 +106,7 @@ export const TrashOperationCell = ({ pageMeta }: { pageMeta: PageMeta }) => {
});
}}
>
<DeleteIcon />
<DeleteForeverIcon />
</IconButton>
</FlexWrapper>
);

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { AddIcon } from '@blocksuite/icons';
import { PlusIcon } from '@blocksuite/icons';
import { StyledModalFooterContent } from './style';
import { Command } from 'cmdk';
import { usePageHelper } from '@/hooks/use-page-helper';
@@ -21,7 +21,7 @@ export const Footer = (props: { query: string; onClose: () => void }) => {
}}
>
<StyledModalFooterContent>
<AddIcon />
<PlusIcon />
{query ? (
<span>{t('New Keyword Page', { query: query })}</span>
) : (

View File

@@ -18,7 +18,6 @@ export const WorkspaceAvatar = (props: IWorkspaceAvatar) => {
...props.style,
width: sizeStr,
height: sizeStr,
border: '1px solid #fff',
color: '#fff',
borderRadius: '50%',
overflow: 'hidden',

View File

@@ -4,11 +4,10 @@ import { useRouter } from 'next/router';
import { StyledPage, StyledToolWrapper, StyledWrapper } from './styles';
import { PropsWithChildren } from 'react';
import useEnsureWorkspace from '@/hooks/use-ensure-workspace';
import { PageLoading } from '@/components/loading';
export const WorkspaceDefender = ({ children }: PropsWithChildren) => {
const { workspaceLoaded } = useEnsureWorkspace();
return <>{workspaceLoaded ? children : <PageLoading />}</>;
return <>{workspaceLoaded ? children : null}</>;
};
export const WorkspaceLayout = ({ children }: PropsWithChildren) => {

View File

@@ -1,4 +1,4 @@
import { CloudInsyncIcon, LogOutIcon } from '@blocksuite/icons';
import { CloudWorkspaceIcon, SignOutIcon } from '@blocksuite/icons';
import { FlexWrapper } from '@affine/component';
import { WorkspaceAvatar } from '@/components/workspace-avatar';
import { IconButton } from '@affine/component';
@@ -37,7 +37,7 @@ export const Footer = ({
onLogout();
}}
>
<LogOutIcon />
<SignOutIcon />
</IconButton>
</Tooltip>
</>
@@ -49,7 +49,7 @@ export const Footer = ({
bold
icon={
<div className="circle">
<CloudInsyncIcon fontSize={16} />
<CloudWorkspaceIcon fontSize={16} />
</div>
}
onClick={async () => {

View File

@@ -56,7 +56,7 @@ export const LanguageMenu = () => {
const ListItem = styled(MenuItem)(({ theme }) => ({
height: '38px',
color: theme.colors.popoverColor,
fontSize: theme.font.sm,
fontSize: theme.font.base,
textTransform: 'capitalize',
padding: '0 24px',
}));

View File

@@ -1,16 +1,15 @@
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar';
import {
CloudIcon,
LocalIcon,
OfflineIcon,
PublishedIcon,
} from '@/components/workspace-modal/icons';
import { UsersIcon } from '@blocksuite/icons';
JoinedWorkspaceIcon,
LocalWorkspaceIcon,
CloudWorkspaceIcon,
LocalDataIcon,
PublishIcon,
} from '@/components/icons';
import { WorkspaceUnit } from '@affine/datacenter';
import { useAppState } from '@/providers/app-state-provider';
import { StyleWorkspaceInfo, StyleWorkspaceTitle, StyledCard } from './styles';
import { useTranslation } from '@affine/i18n';
import { FlexWrapper } from '@affine/component';
const WorkspaceType = ({ workspaceData }: { workspaceData: WorkspaceUnit }) => {
const { user } = useAppState();
@@ -20,7 +19,7 @@ const WorkspaceType = ({ workspaceData }: { workspaceData: WorkspaceUnit }) => {
if (workspaceData.provider === 'local') {
return (
<p>
<LocalIcon />
<LocalWorkspaceIcon />
{t('Local Workspace')}
</p>
);
@@ -28,12 +27,12 @@ const WorkspaceType = ({ workspaceData }: { workspaceData: WorkspaceUnit }) => {
return isOwner ? (
<p>
<CloudIcon />
<CloudWorkspaceIcon />
{t('Cloud Workspace')}
</p>
) : (
<p>
<UsersIcon fontSize={20} color={'#FF646B'} />
<JoinedWorkspaceIcon />
{t('Joined Workspace')}
</p>
);
@@ -56,9 +55,7 @@ export const WorkspaceCard = ({
}}
active={workspaceData.id === currentWorkspace?.id}
>
<FlexWrapper>
<WorkspaceUnitAvatar size={58} workspaceUnit={workspaceData} />
</FlexWrapper>
<WorkspaceUnitAvatar size={58} workspaceUnit={workspaceData} />
<StyleWorkspaceInfo>
<StyleWorkspaceTitle>
@@ -67,13 +64,13 @@ export const WorkspaceCard = ({
<WorkspaceType workspaceData={workspaceData} />
{workspaceData.provider === 'local' && (
<p>
<OfflineIcon />
<LocalDataIcon />
{t('Available Offline')}
</p>
)}
{workspaceData.published && (
<p>
<PublishedIcon />
<PublishIcon />
{t('Published to Web')}
</p>
)}

View File

@@ -1,99 +0,0 @@
export const LocalIcon = () => {
return (
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M6.86315 3.54163H13.1382C13.738 3.54162 14.2261 3.54161 14.6222 3.57398C15.0314 3.60741 15.3972 3.67848 15.7377 3.85196C16.2734 4.12493 16.709 4.5605 16.982 5.09624C17.1555 5.43671 17.2265 5.80252 17.26 6.21174C17.2923 6.60785 17.2923 7.09591 17.2923 7.69577V10.9153C17.2923 11.5151 17.2923 12.0032 17.26 12.3993C17.2265 12.8085 17.1555 13.1743 16.982 13.5148C16.709 14.0505 16.2734 14.4861 15.7377 14.7591C15.3972 14.9326 15.0314 15.0036 14.6222 15.0371C14.2261 15.0694 13.738 15.0694 13.1382 15.0694H12.8479V16.0416H13.7044C14.0495 16.0416 14.3294 16.3214 14.3294 16.6666C14.3294 17.0118 14.0495 17.2916 13.7044 17.2916H6.29695C5.95177 17.2916 5.67195 17.0118 5.67195 16.6666C5.67195 16.3214 5.95177 16.0416 6.29695 16.0416H7.15343V15.0694H6.86313C6.26327 15.0694 5.77521 15.0694 5.37909 15.0371C4.96988 15.0036 4.60407 14.9326 4.2636 14.7591C3.72786 14.4861 3.29229 14.0505 3.01931 13.5148C2.84583 13.1743 2.77477 12.8085 2.74134 12.3993C2.70897 12.0032 2.70898 11.5151 2.70898 10.9152V7.69579C2.70898 7.09592 2.70897 6.60786 2.74134 6.21174C2.77477 5.80252 2.84583 5.43671 3.01931 5.09624C3.29229 4.5605 3.72786 4.12493 4.2636 3.85196C4.60407 3.67848 4.96988 3.60741 5.37909 3.57398C5.77521 3.54161 6.26328 3.54162 6.86315 3.54163ZM3.96013 11.4583C3.96232 11.801 3.96868 12.071 3.98719 12.2975C4.0143 12.6294 4.06434 12.8124 4.13307 12.9473C4.2862 13.2478 4.53055 13.4922 4.83108 13.6453C4.96597 13.714 5.14897 13.7641 5.48088 13.7912C5.82009 13.8189 6.25695 13.8194 6.88954 13.8194H13.1118C13.7444 13.8194 14.1812 13.8189 14.5204 13.7912C14.8523 13.7641 15.0353 13.714 15.1702 13.6453C15.4708 13.4922 15.7151 13.2478 15.8682 12.9473C15.937 12.8124 15.987 12.6294 16.0141 12.2975C16.0326 12.071 16.039 11.801 16.0412 11.4583H3.96013ZM16.0423 10.2083H3.95898V7.72218C3.95898 7.08959 3.95947 6.65273 3.98719 6.31353C4.0143 5.98162 4.06434 5.79861 4.13307 5.66372C4.2862 5.36319 4.53055 5.11884 4.83108 4.96571C4.96597 4.89698 5.14897 4.84694 5.48088 4.81983C5.82009 4.79211 6.25695 4.79163 6.88954 4.79163H13.1118C13.7444 4.79163 14.1812 4.79211 14.5204 4.81983C14.8523 4.84694 15.0353 4.89698 15.1702 4.96571C15.4708 5.11884 15.7151 5.36319 15.8682 5.66372C15.937 5.79861 15.987 5.98162 16.0141 6.31353C16.0418 6.65273 16.0423 7.08959 16.0423 7.72218V10.2083ZM11.5979 15.0694H8.40343V16.0416H11.5979V15.0694ZM10.0007 11.9583C10.3458 11.9583 10.6257 12.2381 10.6257 12.5833V12.5916C10.6257 12.9368 10.3458 13.2166 10.0007 13.2166C9.65547 13.2166 9.37565 12.9368 9.37565 12.5916V12.5833C9.37565 12.2381 9.65547 11.9583 10.0007 11.9583Z"
fill="#FDBD32"
/>
</svg>
);
};
export const OfflineIcon = () => {
return (
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M8.12249 3.54165C8.47134 3.54145 8.74594 3.54129 9.01129 3.60499C9.24512 3.66113 9.46866 3.75372 9.6737 3.87937C9.90638 4.02195 10.1004 4.21624 10.347 4.46306L10.4942 4.61035C10.8035 4.91964 10.889 4.99941 10.9794 5.05484C11.0726 5.11195 11.1742 5.15404 11.2805 5.17956C11.3837 5.20432 11.5005 5.20834 11.9379 5.20834L14.8587 5.20834C15.3038 5.20833 15.6754 5.20832 15.9789 5.23312C16.2955 5.25899 16.5927 5.31491 16.8737 5.45812C17.3049 5.67783 17.6555 6.02841 17.8752 6.45961C18.0184 6.74066 18.0744 7.03788 18.1002 7.35445C18.125 7.65797 18.125 8.02951 18.125 8.47463V13.192C18.125 13.6372 18.125 14.0087 18.1002 14.3122C18.0744 14.6288 18.0184 14.926 17.8752 15.2071C17.6555 15.6383 17.3049 15.9889 16.8737 16.2086C16.5927 16.3518 16.2955 16.4077 15.9789 16.4336C15.6754 16.4584 15.3039 16.4583 14.8587 16.4583H5.14129C4.69618 16.4583 4.32463 16.4584 4.02111 16.4336C3.70454 16.4077 3.40732 16.3518 3.12627 16.2086C2.69507 15.9889 2.34449 15.6383 2.12478 15.2071C1.98157 14.926 1.92565 14.6288 1.89978 14.3122C1.87498 14.0087 1.87499 13.6372 1.875 13.192V6.80798C1.87499 6.36285 1.87498 5.99131 1.89978 5.68778C1.92565 5.37121 1.98157 5.074 2.12478 4.79294C2.34449 4.36174 2.69507 4.01116 3.12627 3.79145C3.40732 3.64825 3.70454 3.59232 4.02111 3.56645C4.32464 3.54166 4.69618 3.54166 5.14131 3.54167L8.12249 3.54165ZM3.125 13.1667V6.83334C3.125 6.69601 3.12504 6.57168 3.12558 6.45836L14.8333 6.45834C15.3104 6.45834 15.6305 6.45882 15.8771 6.47897C16.1164 6.49852 16.2308 6.53342 16.3062 6.57187C16.5022 6.67174 16.6616 6.8311 16.7615 7.0271C16.7999 7.10257 16.8348 7.21697 16.8544 7.45624C16.8745 7.7028 16.875 8.02298 16.875 8.50001V13.1667C16.875 13.6437 16.8745 13.9639 16.8544 14.2104C16.8348 14.4497 16.7999 14.5641 16.7615 14.6396C16.6616 14.8356 16.5022 14.9949 16.3062 15.0948C16.2308 15.1333 16.1164 15.1682 15.8771 15.1877C15.6305 15.2079 15.3104 15.2083 14.8333 15.2083H5.16667C4.68964 15.2083 4.36946 15.2079 4.1229 15.1877C3.88363 15.1682 3.76923 15.1333 3.69376 15.0948C3.49776 14.9949 3.3384 14.8356 3.23854 14.6396C3.20008 14.5641 3.16518 14.4497 3.14563 14.2104C3.12549 13.9639 3.125 13.6437 3.125 13.1667ZM9.20211 7.49996C9.01802 7.49996 8.86878 7.6492 8.86878 7.83329V10.867H7.47722C7.17943 10.867 7.03108 11.2277 7.24271 11.4372L10 14.1666L12.7573 11.4372C12.9689 11.2277 12.8206 10.867 12.5228 10.867H11.1312V7.83329C11.1312 7.6492 10.982 7.49996 10.7979 7.49996H9.20211Z"
fill="#62CD80"
/>
</svg>
);
};
export const PublishedIcon = () => {
return (
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M10 18.125C14.4873 18.125 18.125 14.4873 18.125 10C18.125 5.51269 14.4873 1.875 10 1.875C5.51269 1.875 1.875 5.51269 1.875 10C1.875 14.4873 5.51269 18.125 10 18.125ZM9.99992 16.523C13.6024 16.523 16.5228 13.6026 16.5228 10.0001C16.5228 6.39761 13.6024 3.47722 9.99992 3.47722C6.39742 3.47722 3.47703 6.39761 3.47703 10.0001C3.47703 13.6026 6.39742 16.523 9.99992 16.523Z"
fill="#8699FF"
/>
<path
d="M7.13957 8.05468C8.34659 8.05468 9.33537 7.12035 9.42212 5.93548C9.57023 5.97414 9.72565 5.99472 9.88588 5.99472H10.8014C11.8126 5.99472 12.6324 5.17496 12.6324 4.16374C12.6324 3.15251 11.8126 2.33275 10.8014 2.33275H9.88588C9.03665 2.33275 8.32245 2.91091 8.11542 3.69509C7.81941 3.55535 7.48862 3.47722 7.13957 3.47722C5.8756 3.47722 4.85094 4.50182 4.85084 5.76577H3.70524V8.39782L7.59609 12.2887V12.9753C7.59609 13.8601 8.31338 14.5774 9.1982 14.5774V16.4084L10.457 17.4383L14.6912 15.264C14.6912 14.1264 13.7689 13.2042 12.6313 13.2042H12.288C12.288 11.3713 10.8022 9.88549 8.96932 9.88549H6.79503V8.02892C6.90741 8.04589 7.02246 8.05468 7.13957 8.05468Z"
fill="#8699FF"
/>
</svg>
);
};
export const CloudIcon = () => {
return (
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M2.5 11.3744C2.5 13.837 4.51472 15.8333 7 15.8333L13.75 15.8333C15.8211 15.8333 17.5 14.1532 17.5 12.0807C17.5 10.5419 16.5744 9.12069 15.25 8.54163C15.1098 6.10205 13.07 4.16663 10.5744 4.16663C8.62616 4.16663 6.95578 5.40527 6.25 7.08329C4 7.44788 2.5 9.33336 2.5 11.3744Z"
stroke="#60A5FA"
strokeWidth="1.25"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M9.54757 7.5L7.5 13.3333H8.6993L10.0017 9.29884L11.3048 13.3333H12.5L10.4521 7.5H9.54757Z"
fill="#60A5FA"
/>
</svg>
);
};
export const LineIcon = () => {
return (
<svg
width="2"
height="20"
viewBox="0 0 2 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M1 0V20" stroke="black" strokeOpacity="0.15" />
</svg>
);
};

View File

@@ -1,11 +1,10 @@
import { Modal, ModalWrapper, ModalCloseButton } from '@affine/component';
import { FlexWrapper } from '@affine/component';
import { useState } from 'react';
import { CreateWorkspaceModal } from '../create-workspace';
import { Tooltip } from '@affine/component';
import { AddIcon, HelpCenterIcon } from '@blocksuite/icons';
import { PlusIcon, HelpIcon } from '@blocksuite/icons';
import { useAppState } from '@/providers/app-state-provider';
import { useRouter } from 'next/router';
@@ -62,7 +61,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
disablePortal={true}
>
<StyledHelperContainer>
<HelpCenterIcon />
<HelpIcon />
</StyledHelperContainer>
</Tooltip>
</StyledModalHeaderLeft>
@@ -98,11 +97,9 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
setCreateWorkspaceOpen(true);
}}
>
<FlexWrapper>
<StyleWorkspaceAdd className="add-icon">
<AddIcon fontSize={18} />
</StyleWorkspaceAdd>
</FlexWrapper>
<StyleWorkspaceAdd className="add-icon">
<PlusIcon />
</StyleWorkspaceAdd>
<StyleWorkspaceInfo>
<StyleWorkspaceTitle>{t('New Workspace')}</StyleWorkspaceTitle>

View File

@@ -19,12 +19,14 @@ export const StyleWorkspaceInfo = styled.div(({ theme }) => {
return {
marginLeft: '15px',
p: {
color: theme.colors.popoverColor,
height: '20px',
fontSize: theme.font.xs,
fontSize: theme.font.sm,
...displayFlex('flex-start', 'center'),
},
svg: {
marginRight: '10px',
fontSize: '16px',
},
};
});
@@ -54,13 +56,12 @@ export const StyledCard = styled.div<{
border: `1px solid ${borderColor}`,
...displayFlex('flex-start', 'flex-start'),
marginBottom: '24px',
transition: 'background .2s',
':hover': {
background: theme.colors.hoverBackground,
'.add-icon': {
border: `1.5px dashed ${theme.colors.primaryColor}`,
svg: {
fill: theme.colors.primaryColor,
},
borderColor: theme.colors.primaryColor,
color: theme.colors.primaryColor,
},
},
};
@@ -103,6 +104,7 @@ export const StyledHelperContainer = styled.div(({ theme }) => {
color: theme.colors.iconColor,
marginLeft: '15px',
fontWeight: 400,
fontSize: theme.font.h6,
...displayFlex('center', 'center'),
};
});
@@ -126,11 +128,10 @@ export const StyleWorkspaceAdd = styled.div(() => {
width: '58px',
height: '58px',
borderRadius: '100%',
textAlign: 'center',
background: '#f4f5fa',
border: '1.5px dashed #f4f5fa',
lineHeight: '58px',
marginTop: '2px',
transition: 'background .2s',
...displayFlex('center', 'center'),
};
});
export const StyledModalHeader = styled('div')(({ theme }) => {

View File

@@ -9,7 +9,7 @@ export const ExportPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
<>
<Wrapper marginBottom="32px"> {t('Export Description')}</Wrapper>
<Button type="light" shape="circle" disabled>
{t('Export AFFINE backup file')}
{t('Export AFFiNE backup file')}
</Button>
</>
);

View File

@@ -5,11 +5,12 @@ import { toast } from '@affine/component';
import { WorkspaceUnit } from '@affine/datacenter';
import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
import { useTranslation } from '@affine/i18n';
import { EnableWorkspaceButton } from '../enable-workspace';
import { Wrapper, Content, FlexWrapper } from '@affine/component';
import { useModal } from '@/store/globalModal';
export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const shareUrl = window.location.host + '/public-workspace/' + workspace.id;
const { publishWorkspace } = useWorkspaceHelper();
const { triggerEnableWorkspaceModal } = useModal();
const { t } = useTranslation();
const [loaded, setLoaded] = useState(false);
const togglePublic = async (flag: boolean) => {
@@ -83,7 +84,15 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
return (
<>
<Wrapper marginBottom="32px">{t('Publishing')}</Wrapper>
<EnableWorkspaceButton />
<Button
type="light"
shape="circle"
onClick={async () => {
triggerEnableWorkspaceModal();
}}
>
{t('Enable AFFiNE Cloud')}
</Button>
</>
);
};

View File

@@ -1,15 +1,10 @@
import {
StyledWorkspaceName,
StyledEmail,
// StyledDownloadCard,
// StyledDownloadCardDes,
} from './style';
import { StyledWorkspaceName } from './style';
import { WorkspaceUnit } from '@affine/datacenter';
import { useTranslation, Trans } from '@affine/i18n';
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar';
import { EnableWorkspaceButton } from '../enable-workspace';
import { useAppState } from '@/providers/app-state-provider';
import { FlexWrapper, Content, Wrapper } from '@affine/component';
import { FlexWrapper, Content, Wrapper, Button } from '@affine/component';
import { useModal } from '@/store/globalModal';
// // FIXME: Temporary solution, since the @blocksuite/icons is broken
// const ActiveIcon = () => {
@@ -40,6 +35,8 @@ import { FlexWrapper, Content, Wrapper } from '@affine/component';
export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const { t } = useTranslation();
const { user } = useAppState();
const { triggerEnableWorkspaceModal } = useModal();
if (workspace.provider === 'local') {
return (
<>
@@ -55,7 +52,15 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
</FlexWrapper>
<p>{t('Local Workspace Description')}</p>
<Wrapper marginTop="32px">
<EnableWorkspaceButton />
<Button
type="light"
shape="circle"
onClick={async () => {
triggerEnableWorkspaceModal();
}}
>
{t('Enable AFFiNE Cloud')}
</Button>
</Wrapper>
</>
);
@@ -74,11 +79,9 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
</FlexWrapper>
<Trans i18nKey="Cloud Workspace Description">
All data will be synchronised and saved to the AFFiNE account
<StyledEmail>
{{
email: '{' + user?.email + '}.',
}}
</StyledEmail>
{{
email: user?.email,
}}
</Trans>
{/*<Wrapper marginBottom="12px" marginTop="32px">*/}

View File

@@ -1,24 +1,34 @@
import { StyledInput, StyledProviderInfo, StyledAvatar } from './style';
import {
StyledInput,
StyledWorkspaceInfo,
StyledAvatar,
StyledEditButton,
} from './style';
import { StyledSettingKey, StyledRow } from '../style';
import { FlexWrapper, Content } from '@affine/component';
import { FlexWrapper } from '@affine/component';
import { useState } from 'react';
import { Button } from '@affine/component';
import { useAppState } from '@/providers/app-state-provider';
import { WorkspaceDelete } from './delete';
import { WorkspaceLeave } from './leave';
import { UsersIcon } from '@blocksuite/icons';
import {
JoinedWorkspaceIcon,
CloudWorkspaceIcon,
LocalWorkspaceIcon,
} from '@/components/icons';
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar';
import { WorkspaceUnit } from '@affine/datacenter';
import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
import { useTranslation } from '@affine/i18n';
import { CloudIcon, LocalIcon } from '@/components/workspace-modal/icons';
import { CameraIcon } from './icons';
import { Upload } from '@/components/file-upload';
import { MuiFade } from '@affine/component';
export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const [showDelete, setShowDelete] = useState<boolean>(false);
const [showLeave, setShowLeave] = useState<boolean>(false);
const [workspaceName, setWorkspaceName] = useState<string>(workspace?.name);
const [showEditInput, setShowEditInput] = useState(false);
const { currentWorkspace, isOwner } = useAppState();
const { updateWorkspace } = useWorkspaceHelper();
const { t } = useTranslation();
@@ -70,72 +80,86 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
<StyledRow>
<StyledSettingKey>{t('Workspace Name')}</StyledSettingKey>
<FlexWrapper>
<StyledInput
width={284}
height={38}
value={workspaceName}
placeholder={t('Workspace Name')}
maxLength={15}
minLength={0}
disabled={!isOwner}
onChange={newName => {
setWorkspaceName(newName);
}}
></StyledInput>
<div style={{ position: 'relative' }}>
<MuiFade in={!showEditInput}>
<FlexWrapper>
{workspace.name}
{isOwner && (
<StyledEditButton
onClick={() => {
setShowEditInput(true);
}}
>
Edit
</StyledEditButton>
)}
</FlexWrapper>
</MuiFade>
{isOwner && (
<>
<Button
type="default"
shape="circle"
style={{ marginLeft: '24px' }}
onClick={() => {
setWorkspaceName(workspace.name);
}}
>
{t('Cancel')}
</Button>
<Button
type="light"
shape="circle"
style={{ marginLeft: '24px' }}
onClick={() => {
handleUpdateWorkspaceName();
}}
>
{t('Confirm')}
</Button>
</>
<MuiFade in={showEditInput}>
<FlexWrapper style={{ position: 'absolute', top: 0, left: 0 }}>
<StyledInput
width={284}
height={38}
value={workspaceName}
placeholder={t('Workspace Name')}
maxLength={15}
minLength={0}
onChange={newName => {
setWorkspaceName(newName);
}}
></StyledInput>
<Button
type="light"
shape="circle"
style={{ marginLeft: '24px' }}
disabled={workspaceName === workspace.name}
onClick={() => {
handleUpdateWorkspaceName();
setShowEditInput(false);
}}
>
{t('Confirm')}
</Button>
<Button
type="default"
shape="circle"
style={{ marginLeft: '24px' }}
onClick={() => {
setWorkspaceName(workspace.name);
setShowEditInput(false);
}}
>
{t('Cancel')}
</Button>
</FlexWrapper>
</MuiFade>
)}
</FlexWrapper>
</div>
</StyledRow>
<StyledRow>
<StyledSettingKey>{t('Workspace Type')}</StyledSettingKey>
<FlexWrapper>
{isOwner ? (
currentWorkspace?.provider === 'local' ? (
<FlexWrapper alignItems="center">
<LocalIcon />
<Content style={{ marginLeft: '15px' }}>
{t('Local Workspace')}
</Content>
</FlexWrapper>
) : (
<FlexWrapper alignItems="center">
<CloudIcon />
<Content style={{ marginLeft: '15px' }}>
{t('Available Offline')}
</Content>
</FlexWrapper>
)
{isOwner ? (
currentWorkspace?.provider === 'local' ? (
<StyledWorkspaceInfo>
<LocalWorkspaceIcon />
<span>{t('Local Workspace')}</span>
</StyledWorkspaceInfo>
) : (
<StyledProviderInfo>
<UsersIcon fontSize={20} color={'#FF646B'} />
{t('Joined Workspace')}
</StyledProviderInfo>
)}
</FlexWrapper>
<StyledWorkspaceInfo>
<CloudWorkspaceIcon />
<span>{t('Available Offline')}</span>
</StyledWorkspaceInfo>
)
) : (
<StyledWorkspaceInfo>
<JoinedWorkspaceIcon />
<span>{t('Joined Workspace')}</span>
</StyledWorkspaceInfo>
)}
</StyledRow>
<StyledRow>

View File

@@ -1,20 +1,18 @@
export const CameraIcon = () => {
return (
<span>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M10.6236 4.25001C10.635 4.25001 10.6467 4.25002 10.6584 4.25002H13.3416C13.3533 4.25002 13.365 4.25001 13.3764 4.25001C13.5609 4.24995 13.7105 4.2499 13.8543 4.26611C14.5981 4.34997 15.2693 4.75627 15.6826 5.38026C15.7624 5.50084 15.83 5.63398 15.9121 5.79586C15.9173 5.80613 15.9226 5.81652 15.9279 5.82703C15.9538 5.87792 15.9679 5.90562 15.9789 5.9261C15.9832 5.9341 15.9857 5.93861 15.9869 5.94065C16.0076 5.97069 16.0435 5.99406 16.0878 5.99905L16.0849 5.99877C16.0849 5.99877 16.0907 5.99918 16.1047 5.99947C16.1286 5.99998 16.1604 6.00002 16.2181 6.00002L17.185 6.00001C17.6577 6 18.0566 5.99999 18.3833 6.02627C18.7252 6.05377 19.0531 6.11364 19.3656 6.27035C19.8402 6.50842 20.2283 6.88944 20.4723 7.36077C20.6336 7.67233 20.6951 7.99944 20.7232 8.33858C20.75 8.66166 20.75 9.05554 20.75 9.51992V16.2301C20.75 16.6945 20.75 17.0884 20.7232 17.4114C20.6951 17.7506 20.6336 18.0777 20.4723 18.3893C20.2283 18.8606 19.8402 19.2416 19.3656 19.4797C19.0531 19.6364 18.7252 19.6963 18.3833 19.7238C18.0566 19.75 17.6578 19.75 17.185 19.75H6.81497C6.34225 19.75 5.9434 19.75 5.61668 19.7238C5.27477 19.6963 4.94688 19.6364 4.63444 19.4797C4.15978 19.2416 3.77167 18.8606 3.52771 18.3893C3.36644 18.0777 3.30494 17.7506 3.27679 17.4114C3.24998 17.0884 3.24999 16.6945 3.25 16.2302V9.51987C3.24999 9.05551 3.24998 8.66164 3.27679 8.33858C3.30494 7.99944 3.36644 7.67233 3.52771 7.36077C3.77167 6.88944 4.15978 6.50842 4.63444 6.27035C4.94688 6.11364 5.27477 6.05377 5.61668 6.02627C5.9434 5.99999 6.34225 6 6.81498 6.00001L7.78191 6.00002C7.83959 6.00002 7.87142 5.99998 7.8953 5.99947C7.90607 5.99924 7.91176 5.99897 7.91398 5.99884C7.95747 5.99343 7.99267 5.9703 8.01312 5.94066C8.01429 5.93863 8.01684 5.93412 8.02113 5.9261C8.0321 5.90561 8.04622 5.87791 8.07206 5.82703C8.07739 5.81653 8.08266 5.80615 8.08787 5.79588C8.17004 5.63397 8.23759 5.50086 8.31745 5.38026C8.73067 4.75627 9.40192 4.34997 10.1457 4.26611C10.2895 4.2499 10.4391 4.24995 10.6236 4.25001ZM10.6584 5.75002C10.422 5.75002 10.3627 5.75114 10.3138 5.75666C10.0055 5.79142 9.73316 5.95919 9.56809 6.20845C9.54218 6.24758 9.51544 6.29761 9.40943 6.50633C9.40611 6.51287 9.40274 6.5195 9.39934 6.52622C9.36115 6.60161 9.31758 6.68761 9.26505 6.76694C8.9964 7.17261 8.56105 7.4354 8.08026 7.48961C7.98625 7.50021 7.89021 7.50011 7.80434 7.50003C7.79678 7.50002 7.7893 7.50002 7.78191 7.50002H6.84445C6.33444 7.50002 5.99634 7.50058 5.73693 7.52144C5.48594 7.54163 5.37478 7.57713 5.30693 7.61115C5.11257 7.70864 4.95675 7.86306 4.85983 8.05029C4.82733 8.11308 4.79194 8.21816 4.77165 8.46266C4.7506 8.71626 4.75 9.0474 4.75 9.55001V16.2C4.75 16.7026 4.7506 17.0338 4.77165 17.2874C4.79194 17.5319 4.82733 17.6369 4.85983 17.6997C4.95675 17.887 5.11257 18.0414 5.30693 18.1389C5.37478 18.1729 5.48594 18.2084 5.73693 18.2286C5.99634 18.2494 6.33444 18.25 6.84445 18.25H17.1556C17.6656 18.25 18.0037 18.2494 18.2631 18.2286C18.5141 18.2084 18.6252 18.1729 18.6931 18.1389C18.8874 18.0414 19.0433 17.887 19.1402 17.6997C19.1727 17.6369 19.2081 17.5319 19.2283 17.2874C19.2494 17.0338 19.25 16.7026 19.25 16.2V9.55001C19.25 9.0474 19.2494 8.71626 19.2283 8.46266C19.2081 8.21816 19.1727 8.11308 19.1402 8.05029C19.0433 7.86306 18.8874 7.70864 18.6931 7.61115C18.6252 7.57713 18.5141 7.54163 18.2631 7.52144C18.0037 7.50058 17.6656 7.50002 17.1556 7.50002H16.2181C16.2107 7.50002 16.2032 7.50002 16.1957 7.50003C16.1098 7.50011 16.0138 7.50021 15.9197 7.48961C15.4389 7.4354 15.0036 7.17261 14.735 6.76694C14.6824 6.68761 14.6389 6.60163 14.6007 6.52622C14.5973 6.5195 14.5939 6.51287 14.5906 6.50633C14.4846 6.29763 14.4578 6.24758 14.4319 6.20846C14.2668 5.95919 13.9945 5.79142 13.6862 5.75666C13.6373 5.75114 13.578 5.75002 13.3416 5.75002H10.6584ZM12 11C10.9303 11 10.0833 11.8506 10.0833 12.875C10.0833 13.8995 10.9303 14.75 12 14.75C13.0697 14.75 13.9167 13.8995 13.9167 12.875C13.9167 11.8506 13.0697 11 12 11ZM8.58333 12.875C8.58333 11 10.1242 9.50002 12 9.50002C13.8758 9.50002 15.4167 11 15.4167 12.875C15.4167 14.7501 13.8758 16.25 12 16.25C10.1242 16.25 8.58333 14.7501 8.58333 12.875Z"
fill="white"
/>
</svg>
</span>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M10.6236 4.25001C10.635 4.25001 10.6467 4.25002 10.6584 4.25002H13.3416C13.3533 4.25002 13.365 4.25001 13.3764 4.25001C13.5609 4.24995 13.7105 4.2499 13.8543 4.26611C14.5981 4.34997 15.2693 4.75627 15.6826 5.38026C15.7624 5.50084 15.83 5.63398 15.9121 5.79586C15.9173 5.80613 15.9226 5.81652 15.9279 5.82703C15.9538 5.87792 15.9679 5.90562 15.9789 5.9261C15.9832 5.9341 15.9857 5.93861 15.9869 5.94065C16.0076 5.97069 16.0435 5.99406 16.0878 5.99905L16.0849 5.99877C16.0849 5.99877 16.0907 5.99918 16.1047 5.99947C16.1286 5.99998 16.1604 6.00002 16.2181 6.00002L17.185 6.00001C17.6577 6 18.0566 5.99999 18.3833 6.02627C18.7252 6.05377 19.0531 6.11364 19.3656 6.27035C19.8402 6.50842 20.2283 6.88944 20.4723 7.36077C20.6336 7.67233 20.6951 7.99944 20.7232 8.33858C20.75 8.66166 20.75 9.05554 20.75 9.51992V16.2301C20.75 16.6945 20.75 17.0884 20.7232 17.4114C20.6951 17.7506 20.6336 18.0777 20.4723 18.3893C20.2283 18.8606 19.8402 19.2416 19.3656 19.4797C19.0531 19.6364 18.7252 19.6963 18.3833 19.7238C18.0566 19.75 17.6578 19.75 17.185 19.75H6.81497C6.34225 19.75 5.9434 19.75 5.61668 19.7238C5.27477 19.6963 4.94688 19.6364 4.63444 19.4797C4.15978 19.2416 3.77167 18.8606 3.52771 18.3893C3.36644 18.0777 3.30494 17.7506 3.27679 17.4114C3.24998 17.0884 3.24999 16.6945 3.25 16.2302V9.51987C3.24999 9.05551 3.24998 8.66164 3.27679 8.33858C3.30494 7.99944 3.36644 7.67233 3.52771 7.36077C3.77167 6.88944 4.15978 6.50842 4.63444 6.27035C4.94688 6.11364 5.27477 6.05377 5.61668 6.02627C5.9434 5.99999 6.34225 6 6.81498 6.00001L7.78191 6.00002C7.83959 6.00002 7.87142 5.99998 7.8953 5.99947C7.90607 5.99924 7.91176 5.99897 7.91398 5.99884C7.95747 5.99343 7.99267 5.9703 8.01312 5.94066C8.01429 5.93863 8.01684 5.93412 8.02113 5.9261C8.0321 5.90561 8.04622 5.87791 8.07206 5.82703C8.07739 5.81653 8.08266 5.80615 8.08787 5.79588C8.17004 5.63397 8.23759 5.50086 8.31745 5.38026C8.73067 4.75627 9.40192 4.34997 10.1457 4.26611C10.2895 4.2499 10.4391 4.24995 10.6236 4.25001ZM10.6584 5.75002C10.422 5.75002 10.3627 5.75114 10.3138 5.75666C10.0055 5.79142 9.73316 5.95919 9.56809 6.20845C9.54218 6.24758 9.51544 6.29761 9.40943 6.50633C9.40611 6.51287 9.40274 6.5195 9.39934 6.52622C9.36115 6.60161 9.31758 6.68761 9.26505 6.76694C8.9964 7.17261 8.56105 7.4354 8.08026 7.48961C7.98625 7.50021 7.89021 7.50011 7.80434 7.50003C7.79678 7.50002 7.7893 7.50002 7.78191 7.50002H6.84445C6.33444 7.50002 5.99634 7.50058 5.73693 7.52144C5.48594 7.54163 5.37478 7.57713 5.30693 7.61115C5.11257 7.70864 4.95675 7.86306 4.85983 8.05029C4.82733 8.11308 4.79194 8.21816 4.77165 8.46266C4.7506 8.71626 4.75 9.0474 4.75 9.55001V16.2C4.75 16.7026 4.7506 17.0338 4.77165 17.2874C4.79194 17.5319 4.82733 17.6369 4.85983 17.6997C4.95675 17.887 5.11257 18.0414 5.30693 18.1389C5.37478 18.1729 5.48594 18.2084 5.73693 18.2286C5.99634 18.2494 6.33444 18.25 6.84445 18.25H17.1556C17.6656 18.25 18.0037 18.2494 18.2631 18.2286C18.5141 18.2084 18.6252 18.1729 18.6931 18.1389C18.8874 18.0414 19.0433 17.887 19.1402 17.6997C19.1727 17.6369 19.2081 17.5319 19.2283 17.2874C19.2494 17.0338 19.25 16.7026 19.25 16.2V9.55001C19.25 9.0474 19.2494 8.71626 19.2283 8.46266C19.2081 8.21816 19.1727 8.11308 19.1402 8.05029C19.0433 7.86306 18.8874 7.70864 18.6931 7.61115C18.6252 7.57713 18.5141 7.54163 18.2631 7.52144C18.0037 7.50058 17.6656 7.50002 17.1556 7.50002H16.2181C16.2107 7.50002 16.2032 7.50002 16.1957 7.50003C16.1098 7.50011 16.0138 7.50021 15.9197 7.48961C15.4389 7.4354 15.0036 7.17261 14.735 6.76694C14.6824 6.68761 14.6389 6.60163 14.6007 6.52622C14.5973 6.5195 14.5939 6.51287 14.5906 6.50633C14.4846 6.29763 14.4578 6.24758 14.4319 6.20846C14.2668 5.95919 13.9945 5.79142 13.6862 5.75666C13.6373 5.75114 13.578 5.75002 13.3416 5.75002H10.6584ZM12 11C10.9303 11 10.0833 11.8506 10.0833 12.875C10.0833 13.8995 10.9303 14.75 12 14.75C13.0697 14.75 13.9167 13.8995 13.9167 12.875C13.9167 11.8506 13.0697 11 12 11ZM8.58333 12.875C8.58333 11 10.1242 9.50002 12 9.50002C13.8758 9.50002 15.4167 11 15.4167 12.875C15.4167 14.7501 13.8758 16.25 12 16.25C10.1242 16.25 8.58333 14.7501 8.58333 12.875Z"
fill="white"
/>
</svg>
);
};

View File

@@ -1,4 +1,4 @@
import { styled } from '@affine/component';
import { displayFlex, styled } from '@affine/component';
import { Input } from '@affine/component';
export const StyledInput = styled(Input)(({ theme }) => {
@@ -8,17 +8,16 @@ export const StyledInput = styled(Input)(({ theme }) => {
fontSize: theme.font.sm,
};
});
export const StyledProviderInfo = styled('p')(({ theme }) => {
export const StyledWorkspaceInfo = styled.div(({ theme }) => {
return {
color: theme.colors.iconColor,
svg: {
verticalAlign: 'sub',
marginRight: '10px',
...displayFlex('flex-start', 'center'),
fontSize: '20px',
span: {
fontSize: theme.font.base,
marginLeft: '15px',
},
};
});
export const StyledAvatar = styled('div')(
({ disabled }: { disabled: boolean }) => {
return {
@@ -27,21 +26,29 @@ export const StyledAvatar = styled('div')(
cursor: disabled ? 'default' : 'pointer',
':hover': {
'.camera-icon': {
display: 'block',
display: 'flex',
},
},
'.camera-icon': {
position: 'absolute',
top: 0,
left: 0,
display: 'none',
width: '100%',
height: '100%',
borderRadius: '50%',
backgroundColor: 'rgba(60, 61, 63, 0.5)',
top: 0,
left: 0,
textAlign: 'center',
lineHeight: '72px',
justifyContent: 'center',
alignItems: 'center',
},
};
}
);
export const StyledEditButton = styled('div')(({ theme }) => {
return {
color: theme.colors.primaryColor,
cursor: 'pointer',
marginLeft: '36px',
};
});

View File

@@ -26,11 +26,12 @@ import useMembers from '@/hooks/use-members';
import Loading from '@/components/loading';
import { FlexWrapper } from '@affine/component';
import { useTranslation } from '@affine/i18n';
import { EnableWorkspaceButton } from '@/components/enable-workspace';
import { useModal } from '@/store/globalModal';
export const MembersPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const [isInviteModalShow, setIsInviteModalShow] = useState(false);
const { members, removeMember, loaded } = useMembers();
const { triggerEnableWorkspaceModal } = useModal();
const { t } = useTranslation();
const { confirm } = useConfirm();
@@ -165,14 +166,17 @@ export const MembersPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
}
return (
<Wrapper
style={{
fontWeight: '500',
fontSize: '18px',
}}
>
<>
<Wrapper marginBottom="32px">{t('Collaboration Description')}</Wrapper>
<EnableWorkspaceButton />
</Wrapper>
<Button
type="light"
shape="circle"
onClick={async () => {
triggerEnableWorkspaceModal();
}}
>
{t('Enable AFFiNE Cloud')}
</Button>
</>
);
};

View File

@@ -4,8 +4,7 @@ export const StyledSettingContainer = styled('div')(() => {
return {
display: 'flex',
flexDirection: 'column',
padding: '0 34px 20px 48px',
padding: '0 0 20px 48px',
height: '100vh',
};
});
@@ -79,12 +78,6 @@ export const StyledWorkspaceName = styled('span')(({ theme }) => {
};
});
export const StyledEmail = styled('span')(() => {
return {
color: '#E8178A',
};
});
// export const StyledDownloadCard = styled.div<{ active?: boolean }>(
// ({ theme, active }) => {
// return {

View File

@@ -1,4 +1,4 @@
import { Avatar, WorkspaceName, SelectorWrapper } from './styles';
import { WorkspaceName, SelectorWrapper } from './styles';
import { useEffect, useState } from 'react';
import { WorkspaceModal } from '@/components/workspace-modal';
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar';
@@ -20,23 +20,16 @@ export const WorkspaceSelector = () => {
}}
data-testid="current-workspace"
>
<Avatar
alt="Affine"
data-testid="workspace-avatar"
// src={currentWorkspace?.avatar}
>
<div
<div data-testid="workspace-avatar">
<WorkspaceUnitAvatar
style={{
float: 'left',
flexShrink: 0,
}}
>
<WorkspaceUnitAvatar
size={28}
name={currentWorkspace?.name ?? 'AFFiNE Test'}
workspaceUnit={currentWorkspace}
/>
</div>
</Avatar>
size={32}
name={currentWorkspace?.name ?? 'AFFiNE Test'}
workspaceUnit={currentWorkspace}
/>
</div>
<WorkspaceName data-testid="workspace-name">
{currentWorkspace?.name ?? 'AFFiNE Test'}
</WorkspaceName>

View File

@@ -1,12 +1,8 @@
import { MuiAvatar } from '@affine/component';
import { MuiAvatar, textEllipsis } from '@affine/component';
import { styled } from '@affine/component';
import { StyledPopperContainer } from '@affine/component';
export const SelectorWrapper = styled('div')({
width: '100%',
height: '100%',
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
':hover': {
cursor: 'pointer',
@@ -21,21 +17,11 @@ export const Avatar = styled(MuiAvatar)({
export const WorkspaceName = styled('span')(({ theme }) => {
return {
marginLeft: '12px',
lineHeight: 1,
fontSize: '18px',
fontSize: theme.font.h6,
fontWeight: 500,
color: theme.colors.iconColor,
marginTop: '4px',
flexGrow: 1,
...textEllipsis(1),
};
});
export const SelectorPopperContainer = styled(StyledPopperContainer)(
({ theme }) => {
return {
width: '334px',
boxShadow: theme.shadow.tooltip,
padding: '24px 12px',
backgroundColor: theme.colors.pageBackground,
fontSize: theme.font.xs,
};
}
);

View File

@@ -17,7 +17,7 @@ import {
AllPagesIcon,
FavouritesIcon,
TrashIcon,
AddIcon,
PlusIcon,
SettingsIcon,
} from '@blocksuite/icons';
import Link from 'next/link';
@@ -183,7 +183,7 @@ export const WorkSpaceSliderBar = () => {
}
}}
>
<AddIcon /> {t('New Page')}
<PlusIcon /> {t('New Page')}
</StyledNewPageButton>
</StyledSliderBarWrapper>
</StyledSliderBar>

View File

@@ -6,6 +6,7 @@ export const StyledSliderBar = styled.div<{ show: boolean }>(
return {
width: show ? '256px' : '0',
height: '100vh',
minHeight: '450px',
background: theme.mode === 'dark' ? '#272727' : '#F9F9FB',
boxShadow: theme.shadow.modal,
transition: 'width .15s, padding .15s',
@@ -81,8 +82,9 @@ export const StyledListItem = styled.div<{
};
});
export const StyledListItemForWorkspace = styled(StyledListItem)({
height: '52px',
export const StyledListItemForWorkspace = styled.div({
height: '42px',
padding: '0 12px',
});
export const StyledLink = styled(Link)(() => {

View File

@@ -6,6 +6,9 @@
.affine-default-page-block-container {
width: 686px !important;
}
.affine-default-page-block-container > .affine-block-children-container {
margin-left: -26px !important;
}
affine-block-hub {
position: unset !important;

View File

@@ -83,8 +83,9 @@ const WorkspaceSetting = () => {
<Head>
<title>{t('Settings')} - AFFiNE</title>
</Head>
<PageListHeader icon={<SettingsIcon />}>{t('Settings')}</PageListHeader>
<StyledSettingContainer>
<PageListHeader icon={<SettingsIcon />}>{t('Settings')}</PageListHeader>
<StyledSettingSidebar>
<StyledSettingTabContainer>
{tableArr.map(({ name }) => {

View File

@@ -8,6 +8,7 @@ import ShortcutsModal from '@/components/shortcuts-modal';
import QuickSearch from '@/components/quick-search';
import { LoginModal } from '@/components/login-modal';
import ImportModal from '@/components/import';
import { EnableWorkspaceModal } from '@/components/enable-workspace-modal';
export type ModalState = {
contact: boolean;
@@ -15,6 +16,7 @@ export type ModalState = {
quickSearch: boolean;
import: boolean;
login: boolean;
enableWorkspace: boolean;
};
export type ModalActions = {
@@ -23,6 +25,7 @@ export type ModalActions = {
triggerQuickSearchModal: (visible?: boolean) => void;
triggerImportModal: () => void;
triggerLoginModal: () => void;
triggerEnableWorkspaceModal: () => void;
};
const create = () =>
@@ -35,6 +38,7 @@ const create = () =>
quickSearch: false,
import: false,
login: false,
enableWorkspace: false,
},
set => ({
triggerShortcutsModal: () => {
@@ -62,6 +66,11 @@ const create = () =>
login: !login,
}));
},
triggerEnableWorkspaceModal: () => {
set(({ enableWorkspace }) => ({
enableWorkspace: !enableWorkspace,
}));
},
})
)
)
@@ -131,6 +140,14 @@ const Modals: React.FC = function Modal() {
});
}, [api])}
/>
<EnableWorkspaceModal
open={useModal(state => state.enableWorkspace)}
onClose={useCallback(() => {
api.setState({
enableWorkspace: false,
});
}, [api])}
/>
</>
);
};