refactor(core): remove the unused compareDate field from DocDisplayIconOptions (#10095)

This commit is contained in:
L-Sun
2025-02-11 13:26:43 +00:00
parent ba52abe50f
commit 401ce70153
6 changed files with 5 additions and 18 deletions

View File

@@ -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 (

View File

@@ -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 (

View File

@@ -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;

View File

@@ -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}`}>

View File

@@ -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}`}>

View File

@@ -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.