mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-01 06:10:16 +08:00
feat(core): tag groups sorted alphabetically (#6865)
feat(core): tag groups sorted alphabetically feat(core): add display group to collection page and tag page <img width="755" alt="image" src="https://github.com/toeverything/AFFiNE/assets/102217452/17a5abbe-cd1a-4ce2-8adc-f9aa5b6d6e77">
This commit is contained in:
@@ -4,7 +4,7 @@ import { TagService } from '@affine/core/modules/tag';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { FavoritedIcon, FavoriteIcon } from '@blocksuite/icons';
|
||||
import type { DocMeta } from '@blocksuite/store';
|
||||
import { useLiveData, useService } from '@toeverything/infra';
|
||||
import { LiveData, useLiveData, useService } from '@toeverything/infra';
|
||||
import { type ReactNode, useMemo } from 'react';
|
||||
|
||||
import * as styles from './group-definitions.css';
|
||||
@@ -128,7 +128,17 @@ const GroupTagLabel = ({ tag, count }: { tag: Tag; count: number }) => {
|
||||
};
|
||||
export const useTagGroupDefinitions = (): ItemGroupDefinition<ListItem>[] => {
|
||||
const tagList = useService(TagService).tagList;
|
||||
const tags = useLiveData(tagList.tags$);
|
||||
const sortedTagsLiveData$ = useMemo(
|
||||
() =>
|
||||
LiveData.computed(get =>
|
||||
get(tagList.tags$).sort((a, b) =>
|
||||
get(a.value$).localeCompare(get(b.value$))
|
||||
)
|
||||
),
|
||||
[tagList.tags$]
|
||||
);
|
||||
const tags = useLiveData(sortedTagsLiveData$);
|
||||
|
||||
const t = useAFFiNEI18N();
|
||||
|
||||
const untagged = useMemo(
|
||||
|
||||
Reference in New Issue
Block a user