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 maybeDocId = location.pathname.split('/')[1];
|
||||||
const isJournal = !!useLiveData(journalService.journalDate$(maybeDocId));
|
const isJournal = !!useLiveData(journalService.journalDate$(maybeDocId));
|
||||||
|
|
||||||
const JournalIcon = useLiveData(
|
const JournalIcon = useLiveData(docDisplayMetaService.icon$(maybeDocId));
|
||||||
docDisplayMetaService.icon$(maybeDocId, {
|
|
||||||
compareDate: new Date(),
|
|
||||||
})
|
|
||||||
);
|
|
||||||
const Icon = isJournal ? JournalIcon : TodayIcon;
|
const Icon = isJournal ? JournalIcon : TodayIcon;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ const PageItem = ({
|
|||||||
}: PageItemProps) => {
|
}: PageItemProps) => {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
const docDisplayMetaService = useService(DocDisplayMetaService);
|
const docDisplayMetaService = useService(DocDisplayMetaService);
|
||||||
const Icon = useLiveData(
|
const Icon = useLiveData(docDisplayMetaService.icon$(docId));
|
||||||
docDisplayMetaService.icon$(docId, { compareDate: new Date() })
|
|
||||||
);
|
|
||||||
const title = useLiveData(docDisplayMetaService.title$(docId));
|
const title = useLiveData(docDisplayMetaService.title$(docId));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ export const AppTabJournal = ({ tab }: AppTabCustomFCProps) => {
|
|||||||
|
|
||||||
const maybeDocId = location.pathname.split('/')[1];
|
const maybeDocId = location.pathname.split('/')[1];
|
||||||
const journalDate = useLiveData(journalService.journalDate$(maybeDocId));
|
const journalDate = useLiveData(journalService.journalDate$(maybeDocId));
|
||||||
const JournalIcon = useLiveData(
|
const JournalIcon = useLiveData(docDisplayMetaService.icon$(maybeDocId));
|
||||||
docDisplayMetaService.icon$(maybeDocId, { compareDate: new Date() })
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleOpenToday = useCallback(() => {
|
const handleOpenToday = useCallback(() => {
|
||||||
const docId = journalService.ensureJournalByDate(new Date()).id;
|
const docId = journalService.ensureJournalByDate(new Date()).id;
|
||||||
|
|||||||
@@ -94,9 +94,7 @@ const DocItem = ({ docRecord }: { docRecord: DocRecord }) => {
|
|||||||
const docId = docRecord.id;
|
const docId = docRecord.id;
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
const docDisplayMetaService = useService(DocDisplayMetaService);
|
const docDisplayMetaService = useService(DocDisplayMetaService);
|
||||||
const Icon = useLiveData(
|
const Icon = useLiveData(docDisplayMetaService.icon$(docId));
|
||||||
docDisplayMetaService.icon$(docId, { compareDate: new Date() })
|
|
||||||
);
|
|
||||||
const title = useLiveData(docDisplayMetaService.title$(docId));
|
const title = useLiveData(docDisplayMetaService.title$(docId));
|
||||||
return (
|
return (
|
||||||
<WorkbenchLink aria-label={title} to={`/${docId}`}>
|
<WorkbenchLink aria-label={title} to={`/${docId}`}>
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ type Category = 'created' | 'updated';
|
|||||||
|
|
||||||
const DocItem = ({ docId }: { docId: string }) => {
|
const DocItem = ({ docId }: { docId: string }) => {
|
||||||
const docDisplayMetaService = useService(DocDisplayMetaService);
|
const docDisplayMetaService = useService(DocDisplayMetaService);
|
||||||
const Icon = useLiveData(
|
const Icon = useLiveData(docDisplayMetaService.icon$(docId));
|
||||||
docDisplayMetaService.icon$(docId, { compareDate: new Date() })
|
|
||||||
);
|
|
||||||
const title = useLiveData(docDisplayMetaService.title$(docId));
|
const title = useLiveData(docDisplayMetaService.title$(docId));
|
||||||
return (
|
return (
|
||||||
<WorkbenchLink aria-label={title} to={`/${docId}`}>
|
<WorkbenchLink aria-label={title} to={`/${docId}`}>
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import type { JournalService } from '../../journal';
|
|||||||
type IconType = 'rc' | 'lit';
|
type IconType = 'rc' | 'lit';
|
||||||
interface DocDisplayIconOptions<T extends IconType> {
|
interface DocDisplayIconOptions<T extends IconType> {
|
||||||
type?: T;
|
type?: T;
|
||||||
compareDate?: Date | Dayjs;
|
|
||||||
/**
|
/**
|
||||||
* Override the mode detected inside the hook:
|
* Override the mode detected inside the hook:
|
||||||
* by default, it will use the `primaryMode$` of the doc.
|
* by default, it will use the `primaryMode$` of the doc.
|
||||||
|
|||||||
Reference in New Issue
Block a user