mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-27 04:42:14 +03:00
fix: only owner can set workspace avatar (#882)
Co-authored-by: Qi <474021214@qq.com>
This commit is contained in:
parent
8297259f7e
commit
5323f659c8
@ -33,7 +33,6 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
|
||||
currentWorkspace &&
|
||||
(await updateWorkspace({ avatarBlob: blob }, currentWorkspace));
|
||||
};
|
||||
|
||||
if (!workspace) {
|
||||
return null;
|
||||
}
|
||||
@ -42,7 +41,8 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
|
||||
<>
|
||||
<StyledRow>
|
||||
<StyledSettingKey>{t('Workspace Avatar')}</StyledSettingKey>
|
||||
<StyledAvatar>
|
||||
<StyledAvatar disabled={!isOwner}>
|
||||
{isOwner ? (
|
||||
<Upload
|
||||
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
|
||||
fileChange={fileChange}
|
||||
@ -58,6 +58,13 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
|
||||
/>
|
||||
</>
|
||||
</Upload>
|
||||
) : (
|
||||
<WorkspaceUnitAvatar
|
||||
size={72}
|
||||
name={workspace.name}
|
||||
workspaceUnit={workspace}
|
||||
/>
|
||||
)}
|
||||
</StyledAvatar>
|
||||
</StyledRow>
|
||||
|
||||
|
@ -19,10 +19,12 @@ export const StyledProviderInfo = styled('p')(({ theme }) => {
|
||||
};
|
||||
});
|
||||
|
||||
export const StyledAvatar = styled('div')(() => {
|
||||
export const StyledAvatar = styled('div')(
|
||||
({ disabled }: { disabled: boolean }) => {
|
||||
return {
|
||||
position: 'relative',
|
||||
cursor: 'pointer',
|
||||
marginRight: '20px',
|
||||
cursor: disabled ? 'default' : 'pointer',
|
||||
':hover': {
|
||||
'.camera-icon': {
|
||||
display: 'block',
|
||||
@ -41,4 +43,5 @@ export const StyledAvatar = styled('div')(() => {
|
||||
lineHeight: '72px',
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user