mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-23 05:25:53 +08:00
refactor(core): refactor collection to use new filter system (#12228)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new Collection entity and store with reactive management and real-time updates. - Added reactive favorite and shared filters with expanded filtering options. - **Refactor** - Overhauled collection and filtering logic for better performance and maintainability. - Replaced legacy filtering UI and logic with a streamlined, service-driven rules system. - Updated collection components to use reactive data streams and simplified props. - Simplified collection creation by delegating ID generation and instantiation to the service layer. - Removed deprecated hooks and replaced state-based filtering with observable-driven filtering. - **Bug Fixes** - Improved accuracy and consistency of tag and favorite filtering in collections. - **Chores** - Removed deprecated and unused filter-related files, types, components, and styles to reduce complexity. - Cleaned up imports and removed unused code across multiple components. - **Documentation** - Corrected inline documentation for improved clarity. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { toast } from '@affine/component';
|
||||
import type {
|
||||
CollectionMeta,
|
||||
TagMeta,
|
||||
} from '@affine/core/components/page-list';
|
||||
import type { TagMeta } from '@affine/core/components/page-list';
|
||||
import type { CollectionMeta } from '@affine/core/modules/collection';
|
||||
import track from '@affine/track';
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/lit';
|
||||
import { scrollbarStyle } from '@blocksuite/affine/shared/styles';
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
import type { TagMeta } from '@affine/core/components/page-list';
|
||||
import type { Collection } from '@affine/env/filter';
|
||||
import { createLitPortal } from '@blocksuite/affine/components/portal';
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/lit';
|
||||
import { unsafeCSSVarV2 } from '@blocksuite/affine/shared/theme';
|
||||
@@ -128,7 +127,7 @@ export class ChatPanelChips extends SignalWatcher(
|
||||
|
||||
private _tags: Signal<TagMeta[]> = signal([]);
|
||||
|
||||
private _collections: Signal<Collection[]> = signal([]);
|
||||
private _collections: Signal<{ id: string; name: string }[]> = signal([]);
|
||||
|
||||
private _cleanup: (() => void) | null = null;
|
||||
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
import type { Collection } from '@affine/env/filter';
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/lit';
|
||||
import { ShadowlessElement } from '@blocksuite/affine/std';
|
||||
import { CollectionsIcon } from '@blocksuite/icons/lit';
|
||||
@@ -18,7 +17,7 @@ export class ChatPanelCollectionChip extends SignalWatcher(
|
||||
accessor removeChip!: (chip: CollectionChip) => void;
|
||||
|
||||
@property({ attribute: false })
|
||||
accessor collection!: Collection;
|
||||
accessor collection!: { id: string; name: string };
|
||||
|
||||
override render() {
|
||||
const { state } = this.chip;
|
||||
|
||||
@@ -4,7 +4,6 @@ import type {
|
||||
SearchDocMenuAction,
|
||||
SearchTagMenuAction,
|
||||
} from '@affine/core/modules/search-menu/services';
|
||||
import type { Collection } from '@affine/env/filter';
|
||||
import type { DocMeta, Store } from '@blocksuite/affine/store';
|
||||
import type { LinkedMenuGroup } from '@blocksuite/affine/widgets/linked-doc';
|
||||
import type { Signal } from '@preact/signals-core';
|
||||
@@ -71,7 +70,7 @@ export interface DocDisplayConfig {
|
||||
getTagTitle: (tagId: string) => string;
|
||||
getTagPageIds: (tagId: string) => string[];
|
||||
getCollections: () => {
|
||||
signal: Signal<Collection[]>;
|
||||
signal: Signal<{ id: string; name: string }[]>;
|
||||
cleanup: () => void;
|
||||
};
|
||||
getCollectionPageIds: (collectionId: string) => string[];
|
||||
|
||||
Reference in New Issue
Block a user