import { CollectionList, FilterList, SaveCollectionButton, useCollectionManager, } from '@affine/component/page-list'; import type { Collection } from '@affine/env/filter'; import type { WorkspaceHeaderProps } from '@affine/env/workspace'; import { WorkspaceFlavour, WorkspaceSubPath } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { SettingsIcon } from '@blocksuite/icons'; import { uuidv4 } from '@blocksuite/store'; import type { ReactElement } from 'react'; import { useCallback } from 'react'; import { useGetPageInfoById } from '../hooks/use-get-page-info'; import { BlockSuiteEditorHeader } from './blocksuite/workspace-header'; import { filterContainerStyle } from './filter-container.css'; import { WorkspaceModeFilterTab, WorkspaceTitle } from './pure/workspace-title'; export function WorkspaceHeader({ currentWorkspace, currentEntry, }: WorkspaceHeaderProps): ReactElement { const setting = useCollectionManager(); const t = useAFFiNEI18N(); const saveToCollection = useCallback( async (collection: Collection) => { await setting.saveCollection(collection); setting.selectCollection(collection.id); }, [setting] ); const getPageInfoById = useGetPageInfoById(); if ('subPath' in currentEntry) { if (currentEntry.subPath === WorkspaceSubPath.ALL) { const leftSlot = ( ); const filterContainer = setting.isDefault && setting.currentCollection.filterList.length > 0 ? (
{ return setting.updateCollection({ ...setting.currentCollection, filterList, }); }} />
{setting.currentCollection.filterList.length > 0 ? ( ) : null}
) : null; return ( <> {filterContainer} ); } else if (currentEntry.subPath === WorkspaceSubPath.SETTING) { return ( } > {t['Workspace Settings']()} ); } else if ( currentEntry.subPath === WorkspaceSubPath.SHARED || currentEntry.subPath === WorkspaceSubPath.TRASH ) { return ( ); } } else if ('pageId' in currentEntry) { const pageId = currentEntry.pageId; const isPublic = currentWorkspace.flavour === WorkspaceFlavour.PUBLIC; return ( ); } return <>; }