mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
refactor(core): remove the unused compareDate field from DocDisplayIconOptions (#10095)
This commit is contained in:
@@ -15,11 +15,7 @@ export const AppSidebarJournalButton = () => {
|
||||
const maybeDocId = location.pathname.split('/')[1];
|
||||
const isJournal = !!useLiveData(journalService.journalDate$(maybeDocId));
|
||||
|
||||
const JournalIcon = useLiveData(
|
||||
docDisplayMetaService.icon$(maybeDocId, {
|
||||
compareDate: new Date(),
|
||||
})
|
||||
);
|
||||
const JournalIcon = useLiveData(docDisplayMetaService.icon$(maybeDocId));
|
||||
const Icon = isJournal ? JournalIcon : TodayIcon;
|
||||
|
||||
return (
|
||||
|
||||
@@ -61,9 +61,7 @@ const PageItem = ({
|
||||
}: PageItemProps) => {
|
||||
const i18n = useI18n();
|
||||
const docDisplayMetaService = useService(DocDisplayMetaService);
|
||||
const Icon = useLiveData(
|
||||
docDisplayMetaService.icon$(docId, { compareDate: new Date() })
|
||||
);
|
||||
const Icon = useLiveData(docDisplayMetaService.icon$(docId));
|
||||
const title = useLiveData(docDisplayMetaService.title$(docId));
|
||||
|
||||
return (
|
||||
|
||||
@@ -16,9 +16,7 @@ export const AppTabJournal = ({ tab }: AppTabCustomFCProps) => {
|
||||
|
||||
const maybeDocId = location.pathname.split('/')[1];
|
||||
const journalDate = useLiveData(journalService.journalDate$(maybeDocId));
|
||||
const JournalIcon = useLiveData(
|
||||
docDisplayMetaService.icon$(maybeDocId, { compareDate: new Date() })
|
||||
);
|
||||
const JournalIcon = useLiveData(docDisplayMetaService.icon$(maybeDocId));
|
||||
|
||||
const handleOpenToday = useCallback(() => {
|
||||
const docId = journalService.ensureJournalByDate(new Date()).id;
|
||||
|
||||
@@ -94,9 +94,7 @@ const DocItem = ({ docRecord }: { docRecord: DocRecord }) => {
|
||||
const docId = docRecord.id;
|
||||
const i18n = useI18n();
|
||||
const docDisplayMetaService = useService(DocDisplayMetaService);
|
||||
const Icon = useLiveData(
|
||||
docDisplayMetaService.icon$(docId, { compareDate: new Date() })
|
||||
);
|
||||
const Icon = useLiveData(docDisplayMetaService.icon$(docId));
|
||||
const title = useLiveData(docDisplayMetaService.title$(docId));
|
||||
return (
|
||||
<WorkbenchLink aria-label={title} to={`/${docId}`}>
|
||||
|
||||
@@ -24,9 +24,7 @@ type Category = 'created' | 'updated';
|
||||
|
||||
const DocItem = ({ docId }: { docId: string }) => {
|
||||
const docDisplayMetaService = useService(DocDisplayMetaService);
|
||||
const Icon = useLiveData(
|
||||
docDisplayMetaService.icon$(docId, { compareDate: new Date() })
|
||||
);
|
||||
const Icon = useLiveData(docDisplayMetaService.icon$(docId));
|
||||
const title = useLiveData(docDisplayMetaService.title$(docId));
|
||||
return (
|
||||
<WorkbenchLink aria-label={title} to={`/${docId}`}>
|
||||
|
||||
@@ -34,7 +34,6 @@ import type { JournalService } from '../../journal';
|
||||
type IconType = 'rc' | 'lit';
|
||||
interface DocDisplayIconOptions<T extends IconType> {
|
||||
type?: T;
|
||||
compareDate?: Date | Dayjs;
|
||||
/**
|
||||
* Override the mode detected inside the hook:
|
||||
* by default, it will use the `primaryMode$` of the doc.
|
||||
|
||||
Reference in New Issue
Block a user