Skip to content

Commit

Permalink
feature: skip response for node
Browse files Browse the repository at this point in the history
  • Loading branch information
buckhalt committed Dec 18, 2024
1 parent a5d8711 commit edbf769
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
39 changes: 25 additions & 14 deletions lib/interviewer/containers/Interfaces/Geospatial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ type GeospatialInterfaceProps = {
registerBeforeNext: (
beforeNext: (direction: NavDirection) => boolean,
) => void;
getNavigationHelpers: () => {
moveForward: () => void;
};
};

export default function GeospatialInterface({
stage,
registerBeforeNext,
getNavigationHelpers,
}: GeospatialInterfaceProps) {
const dispatch = useDispatch<ThunkDispatch<RootState, unknown, AnyAction>>();
const dragSafeRef = useRef(null);
Expand Down Expand Up @@ -138,6 +142,8 @@ export default function GeospatialInterface({

const { updateReady: setIsReadyForNext } = useReadyForNextStage();

const { moveForward } = getNavigationHelpers();

const previousNode = useCallback(() => {
setNavState({
activeIndex: getNodeIndex(),
Expand Down Expand Up @@ -211,22 +217,27 @@ export default function GeospatialInterface({
currentPromptIndex={currentPrompt ? prompts.indexOf(currentPrompt) : -1}
dragConstraints={dragSafeRef}
>
<AnimatePresence
mode="wait"
key={currentPrompt?.id}
custom={navState.direction}
>
<motion.div
key={stageNodes[navState.activeIndex]?.[entityPrimaryKeyProperty]}
variants={NodeAnimationVariants}
<div className="flex flex-col items-center gap-2 pb-4">
<AnimatePresence
mode="wait"
key={currentPrompt?.id}
custom={navState.direction}
initial="initial"
animate="animate"
exit="exit"
>
<Node {...stageNodes[navState.activeIndex]} />
</motion.div>
</AnimatePresence>
<motion.div
key={stageNodes[navState.activeIndex]?.[entityPrimaryKeyProperty]}
variants={NodeAnimationVariants}
custom={navState.direction}
initial="initial"
animate="animate"
exit="exit"
>
<Node {...stageNodes[navState.activeIndex]} />
</motion.div>
</AnimatePresence>
<Button size="small" onClick={moveForward}>
Skip
</Button>
</div>
</CollapsablePrompts>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion lib/interviewer/containers/Stage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import StageErrorBoundary from '../components/StageErrorBoundary';
import getInterface from './Interfaces';
import { type BeforeNextFunction } from './ProtocolScreen';

export type StageProps = {
type StageProps = {
stage: {
id: string;
type: string;
Expand Down

0 comments on commit edbf769

Please sign in to comment.