mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 04:51:49 +08:00
Merge branch 'feat/filesystem_and_search' of https://github.com/toeverything/AFFiNE into feat/filesystem_and_search
This commit is contained in:
@@ -9,7 +9,11 @@ import { StyledSettingH2 } from '../style';
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Button } from '@/ui/button';
|
import { Button } from '@/ui/button';
|
||||||
import Input from '@/ui/input';
|
import Input from '@/ui/input';
|
||||||
import { Workspace, WorkspaceType } from '@pathfinder/data-services';
|
import {
|
||||||
|
uploadBlob,
|
||||||
|
Workspace,
|
||||||
|
WorkspaceType,
|
||||||
|
} from '@pathfinder/data-services';
|
||||||
import { useAppState } from '@/providers/app-state-provider';
|
import { useAppState } from '@/providers/app-state-provider';
|
||||||
import { WorkspaceDetails } from '@/components/workspace-slider-bar/WorkspaceSelector/SelectorPopperContent';
|
import { WorkspaceDetails } from '@/components/workspace-slider-bar/WorkspaceSelector/SelectorPopperContent';
|
||||||
import { WorkspaceDelete } from './delete';
|
import { WorkspaceDelete } from './delete';
|
||||||
@@ -70,16 +74,18 @@ export const GeneralPage = ({
|
|||||||
setShowLeave(false);
|
setShowLeave(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fileChange = async (file: File) => {
|
||||||
|
const blob = new Blob([file], { type: file.type });
|
||||||
|
const blobId = await uploadBlob({ blob });
|
||||||
|
const newAvatar = `/api/blob/${blobId}`;
|
||||||
|
currentWorkspace?.meta.setAvatar(newAvatar);
|
||||||
|
workspaces[workspace.id]?.meta.setAvatar(newAvatar);
|
||||||
|
debouncedRefreshWorkspacesMeta();
|
||||||
|
};
|
||||||
|
|
||||||
return workspace ? (
|
return workspace ? (
|
||||||
<div>
|
<div>
|
||||||
<StyledSettingH2 marginTop={56}>
|
<StyledSettingH2 marginTop={56}>Workspace Avatar</StyledSettingH2>
|
||||||
Workspace Avatar
|
|
||||||
<Upload
|
|
||||||
fileChange={file => {
|
|
||||||
console.log(file);
|
|
||||||
}}
|
|
||||||
></Upload>
|
|
||||||
</StyledSettingH2>
|
|
||||||
<StyledSettingAvatarContent>
|
<StyledSettingAvatarContent>
|
||||||
<StyledSettingAvatar
|
<StyledSettingAvatar
|
||||||
alt="workspace avatar"
|
alt="workspace avatar"
|
||||||
@@ -87,6 +93,10 @@ export const GeneralPage = ({
|
|||||||
>
|
>
|
||||||
{workspaces[workspace.id]?.meta.name[0]}
|
{workspaces[workspace.id]?.meta.name[0]}
|
||||||
</StyledSettingAvatar>
|
</StyledSettingAvatar>
|
||||||
|
<Upload
|
||||||
|
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
|
||||||
|
fileChange={fileChange}
|
||||||
|
></Upload>
|
||||||
{/* TODO: add upload logic */}
|
{/* TODO: add upload logic */}
|
||||||
{/* {isOwner ? (
|
{/* {isOwner ? (
|
||||||
<StyledAvatarUploadBtn shape="round">upload</StyledAvatarUploadBtn>
|
<StyledAvatarUploadBtn shape="round">upload</StyledAvatarUploadBtn>
|
||||||
|
|||||||
@@ -24,5 +24,5 @@ export const StyledSettingAvatarContent = styled('div')(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const StyledSettingAvatar = styled(MuiAvatar)(() => {
|
export const StyledSettingAvatar = styled(MuiAvatar)(() => {
|
||||||
return { height: '72px', width: '72px' };
|
return { height: '72px', width: '72px', marginRight: '24px' };
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user