feat: avatar

This commit is contained in:
tzhangchi
2023-01-06 01:25:38 +08:00
parent 67ef5099dd
commit 57067b43b3
2 changed files with 23 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import { import {
StyledDeleteButtonContainer, StyledDeleteButtonContainer,
StyledSettingAvatar, // StyledSettingAvatar,
StyledSettingAvatarContent, StyledSettingAvatarContent,
StyledSettingInputContainer, StyledSettingInputContainer,
} from './style'; } from './style';
@@ -21,7 +21,7 @@ import {
User, User,
Workspace, Workspace,
} from '@/hooks/mock-data/mock'; } from '@/hooks/mock-data/mock';
import { stringToColour } from '@/utils';
export const GeneralPage = ({ workspace }: { workspace: Workspace }) => { export const GeneralPage = ({ workspace }: { workspace: Workspace }) => {
const { currentWorkspace, refreshWorkspacesMeta } = useAppState(); const { currentWorkspace, refreshWorkspacesMeta } = useAppState();
useEffect(() => { useEffect(() => {
@@ -79,9 +79,27 @@ export const GeneralPage = ({ workspace }: { workspace: Workspace }) => {
<div> <div>
<StyledSettingH2 marginTop={56}>Workspace Avatar</StyledSettingH2> <StyledSettingH2 marginTop={56}>Workspace Avatar</StyledSettingH2>
<StyledSettingAvatarContent> <StyledSettingAvatarContent>
<StyledSettingAvatar alt="workspace avatar" src={''}> {/* <StyledSettingAvatar alt="workspace avatar" src={''}>
AFFiNE AFFiNE
</StyledSettingAvatar> </StyledSettingAvatar> */}
<div
style={{
float: 'left',
width: '60px',
height: '60px',
border: '1px solid #fff',
color: '#fff',
fontSize: '26px',
padding: '5px 0 0 5px;',
background: stringToColour(workspace?.name ?? 'AFFiNE'),
borderRadius: '50%',
textAlign: 'center',
lineHeight: '60px',
marginRight: '5px',
}}
>
{(workspace?.name ?? 'AFFiNE').substring(0, 1)}
</div>
<Upload <Upload
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
fileChange={fileChange} fileChange={fileChange}

View File

@@ -438,7 +438,7 @@ const SyncPage = ({ workspace }: { workspace: Workspace }) => {
<Button <Button
onClick={() => { onClick={() => {
updateWorkspaceMeta(workspace.id, { updateWorkspaceMeta(workspace.id, {
workspaceType: 'cloud', type: 'cloud',
}); });
setType(); setType();
}} }}