mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat(core): draft filter skip method step if there is only one method (#12457)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Filter options can now start from a specified step, improving flexibility when multiple filtering methods are available. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -39,6 +39,7 @@ export const Condition = ({
|
||||
<FilterOptionsGroup
|
||||
isDraft={isDraft}
|
||||
onDraftCompleted={onDraftCompleted}
|
||||
initialStep={methods && methods.length > 1 ? 0 : 1}
|
||||
items={[
|
||||
methods &&
|
||||
(({ onDraftCompleted, menuRef }) => {
|
||||
|
||||
@@ -13,10 +13,12 @@ export const FilterOptionsGroup = ({
|
||||
isDraft,
|
||||
onDraftCompleted,
|
||||
items,
|
||||
initialStep = 0,
|
||||
}: {
|
||||
isDraft?: boolean;
|
||||
onDraftCompleted?: () => void;
|
||||
items?: FilterOptionsGroupChildren[];
|
||||
initialStep?: number;
|
||||
}) => {
|
||||
const stepCount =
|
||||
items?.filter(v => {
|
||||
@@ -27,7 +29,7 @@ export const FilterOptionsGroup = ({
|
||||
}).length ?? 0;
|
||||
|
||||
const childRefs = useRef<(MenuRef | null)[]>([]);
|
||||
const [currentStep, setCurrentStep] = useState(0);
|
||||
const [currentStep, setCurrentStep] = useState(initialStep);
|
||||
|
||||
const handleNextStep = useCallback(() => {
|
||||
// Add a small delay between steps to prevent the next menu from automatically closing due to the previous menu's close event
|
||||
|
||||
Reference in New Issue
Block a user