mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 13:15:51 +08:00
feat(core): enable two step journal by default (#13283)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * The journal confirmation flow is now always enabled when creating or opening journals across all platforms. * **Refactor** * Removed the two-step journal confirmation feature flag and all related conditional logic. * Simplified journal navigation and creation flows for a more consistent user experience. * **Chores** * Cleaned up unused components and imports related to the removed feature flag. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
+5
-16
@@ -16,7 +16,6 @@ import {
|
||||
DocsService,
|
||||
} from '@affine/core/modules/doc';
|
||||
import { DocDisplayMetaService } from '@affine/core/modules/doc-display-meta';
|
||||
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
||||
import { JournalService } from '@affine/core/modules/journal';
|
||||
import {
|
||||
WorkbenchLink,
|
||||
@@ -114,26 +113,16 @@ export const EditorJournalPanel = () => {
|
||||
const journalDate = journalDateStr ? dayjs(journalDateStr) : null;
|
||||
const isJournal = !!journalDate;
|
||||
|
||||
const featureFlagService = useService(FeatureFlagService);
|
||||
const isTwoStepJournalConfirmationEnabled = useLiveData(
|
||||
featureFlagService.flags.enable_two_step_journal_confirmation.$
|
||||
);
|
||||
|
||||
const openJournal = useCallback(
|
||||
(date: string) => {
|
||||
if (isTwoStepJournalConfirmationEnabled) {
|
||||
const docs = journalService.journalsByDate$(date).value;
|
||||
if (docs.length > 0) {
|
||||
workbench.openDoc(docs[0].id, { at: 'active' });
|
||||
} else {
|
||||
workbench.open(`/journals?date=${date}`, { at: 'active' });
|
||||
}
|
||||
const docs = journalService.journalsByDate$(date).value;
|
||||
if (docs.length > 0) {
|
||||
workbench.openDoc(docs[0].id, { at: 'active' });
|
||||
} else {
|
||||
const doc = journalService.ensureJournalByDate(date);
|
||||
workbench.openDoc(doc.id, { at: 'active' });
|
||||
workbench.open(`/journals?date=${date}`, { at: 'active' });
|
||||
}
|
||||
},
|
||||
[isTwoStepJournalConfirmationEnabled, journalService, workbench]
|
||||
[journalService, workbench]
|
||||
);
|
||||
|
||||
const onDateSelect = useCallback(
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
type WeekDatePickerHandle,
|
||||
} from '@affine/component';
|
||||
import { BlocksuiteEditorJournalDocTitleUI } from '@affine/core/blocksuite/block-suite-editor/journal-doc-title';
|
||||
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
||||
import {
|
||||
JOURNAL_DATE_FORMAT,
|
||||
JournalService,
|
||||
@@ -22,13 +21,7 @@ import { TodayIcon } from '@blocksuite/icons/rc';
|
||||
import { useLiveData, useService } from '@toeverything/infra';
|
||||
import dayjs from 'dayjs';
|
||||
import type { Location } from 'history';
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
||||
|
||||
import { AllDocSidebarTabs } from '../layouts/all-doc-sidebar-tabs';
|
||||
import * as styles from './index.css';
|
||||
@@ -157,31 +150,6 @@ export const JournalsPageWithConfirmation = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const JournalsPageWithoutConfirmation = () => {
|
||||
const journalService = useService(JournalService);
|
||||
const workbench = useService(WorkbenchService).workbench;
|
||||
|
||||
useEffect(() => {
|
||||
const today = dayjs().format(JOURNAL_DATE_FORMAT);
|
||||
const doc = journalService.ensureJournalByDate(today);
|
||||
workbench.openDoc(doc.id, {
|
||||
replaceHistory: true,
|
||||
at: 'active',
|
||||
});
|
||||
}, [journalService, workbench]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const Component = () => {
|
||||
const featureFlagService = useService(FeatureFlagService);
|
||||
const isTwoStepJournalConfirmationEnabled = useLiveData(
|
||||
featureFlagService.flags.enable_two_step_journal_confirmation.$
|
||||
);
|
||||
|
||||
if (isTwoStepJournalConfirmationEnabled) {
|
||||
return <JournalsPageWithConfirmation />;
|
||||
}
|
||||
|
||||
return <JournalsPageWithoutConfirmation />;
|
||||
return <JournalsPageWithConfirmation />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user