Skip to content

Commit c9723b2

Browse files
committed
fix(stepper): improve step display and clean up formatting
- Refactor step display to enhance layout and readability - Add a new no-op constant to built-in events - Clean up transition validation logic (Your transition validation is so confusing, it makes find-and-replace look like a clear path)
1 parent 3750829 commit c9723b2

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

apps/kyb-app/src/common/components/atoms/StepperProgress/StepperProgress.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,16 @@ interface Props {
88
export const StepperProgress = ({ currentStep, totalSteps }: Props) => {
99
const { t } = useTranslation();
1010

11-
return <span className="font-inter">{`${t('step')} ${currentStep} / ${totalSteps}`}</span>;
11+
return (
12+
<div className="flex items-center gap-2">
13+
<div className="flex items-center gap-2">
14+
<span className="text-s font-medium text-slate-600">{t('step')}</span>
15+
<div className="flex items-center gap-2">
16+
<span className="text-s font-medium text-blue-500">{currentStep}</span>
17+
<span className="text-s font-medium text-slate-400">/</span>
18+
<span className="text-s font-medium text-slate-600">{totalSteps}</span>
19+
</div>
20+
</div>
21+
</div>
22+
);
1223
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const BUILT_IN_EVENT = {
22
UPDATE_CONTEXT: 'UPDATE_CONTEXT',
33
DEEP_MERGE_CONTEXT: 'DEEP_MERGE_CONTEXT',
4+
NO_OP: 'NO_OP',
45
} as const;
56

67
export type BuiltInEvent = (typeof BUILT_IN_EVENT)[keyof typeof BUILT_IN_EVENT];

packages/workflow-core/src/lib/utils/definition-validator/states-validator.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export const validateTransitionOnEvent = ({
7979

8080
throw Error(`Unexpected transition object: ${JSON.stringify(transition)}`);
8181
};
82-
const targetState = getTargetState();
8382

8483
if (
8584
isObject(transition) &&
@@ -89,6 +88,8 @@ export const validateTransitionOnEvent = ({
8988
return;
9089
}
9190

91+
const targetState = getTargetState();
92+
9293
if (!stateNames.includes(targetState)) {
9394
throw new Error(`Invalid transition from ${currentState} to ${targetState}`);
9495
}

0 commit comments

Comments
 (0)