feat(store): add OpenAI edit draft state management

This commit is contained in:
LTbinglingfeng
2026-02-01 00:48:28 +08:00
parent c6fabcb6bc
commit f0735dbc1e
5 changed files with 260 additions and 41 deletions

View File

@@ -83,20 +83,28 @@ export function PageTransition({
};
const fromIndex = resolveOrderIndex(currentLayerPathname);
const toIndex = resolveOrderIndex(location.pathname);
const nextDirection: TransitionDirection =
const nextVariant: TransitionVariant = getTransitionVariant
? getTransitionVariant(currentLayerPathname ?? '', location.pathname)
: 'vertical';
let nextDirection: TransitionDirection =
fromIndex === null || toIndex === null || fromIndex === toIndex
? 'forward'
: toIndex > fromIndex
? 'forward'
: 'backward';
// When using iOS-style stacking, history POP within the same "section" can have equal route order.
// In that case, prefer treating navigation to an existing layer as a backward (pop) transition.
if (nextVariant === 'ios' && layers.some((layer) => layer.key === location.key)) {
nextDirection = 'backward';
}
transitionDirectionRef.current = nextDirection;
transitionVariantRef.current = getTransitionVariant
? getTransitionVariant(currentLayerPathname ?? '', location.pathname)
: 'vertical';
transitionVariantRef.current = nextVariant;
const shouldSkipExitLayer = (() => {
if (transitionVariantRef.current !== 'ios' || nextDirection !== 'backward') return false;
if (nextVariant !== 'ios' || nextDirection !== 'backward') return false;
const normalizeSegments = (pathname: string) =>
pathname
.split('/')
@@ -178,6 +186,7 @@ export function PageTransition({
getRouteOrder,
getTransitionVariant,
resolveScrollContainer,
layers,
]);
// Run GSAP animation when animating starts