Skip to content

Commit 5104ce8

Browse files
authored
feat: stepper to navigate response collection (#45)
1 parent 7908ea6 commit 5104ce8

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

src/interfaces/interactionProcess.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ export type Phase = {
2929

3030
export const InputPhase: Phase = {
3131
phase: IdeationPhases.Input,
32-
label: t('SUBMIT_NEW_IDEA_STEP_TITLE'),
32+
label: t('RESPONSE_COLLECTION.STEPPER.INPUT_STEP_LABEL'),
3333
};
3434

3535
export const ChoosePhase: Phase = {
3636
phase: IdeationPhases.Choose,
37-
label: t('READ_IDEAS_STEP_TITLE'),
37+
label: t('RESPONSE_COLLECTION.STEPPER.CHOOSE_STEP_LABEL'),
3838
};
3939

4040
export enum ResponseVisibilityMode {

src/langs/en.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
"BUILD_ON_THIS_IDEA": "Build on this idea",
99
"IDEA_TOO_LONG_ALERT": "Your idea is too long. Please, try to be more concise.",
1010
"IDEA_SUBMITTED_SUCCESS": "Your idea was successfully submitted.",
11-
"SUBMIT_NEW_IDEA_STEP_TITLE": "Submit a new idea",
12-
"READ_IDEAS_STEP_TITLE": "Find inspiration",
1311
"EDIT": "Edit",
1412
"DELETE": "Delete",
1513
"COMING_SOON": "Coming soon!",
@@ -61,6 +59,12 @@
6159
}
6260
}
6361
},
62+
"RESPONSE_COLLECTION": {
63+
"STEPPER": {
64+
"INPUT_STEP_LABEL": "Submit your response",
65+
"CHOOSE_STEP_LABEL": "Read the responses of other participants"
66+
}
67+
},
6468
"SAVE": "Save",
6569
"CHOOSE_RESPONSE_HEADER_TEXT": "Read these responses that have been proposed by other participants. Choose one to build upon or propose a new response.",
6670
"NO_IDEAS_TO_SHOW_TEXT": "The other participants have not submitted enough ideas yet. Once they have, these ideas will appear here.",

src/modules/responseCollection/PhaseStepper.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { StepLabel } from '@mui/material';
1+
import { StepButton } from '@mui/material';
22
import Step from '@mui/material/Step';
33
import Stepper from '@mui/material/Stepper';
44

@@ -14,14 +14,14 @@ const PhasesStepper = (props: {
1414
const { activeStep, steps, selectStep } = props;
1515
const sortedSteps = steps.sort((a, b) => a.phase - b.phase);
1616
return (
17-
<Stepper activeStep={activeStep}>
17+
<Stepper nonLinear activeStep={activeStep}>
1818
{sortedSteps.map((step) => (
1919
<Step key={step.label}>
20-
<StepLabel>{step.label}</StepLabel>
21-
{/* TODO: Add interactivity to the stepper.
20+
{/* <StepLabel>{step.label}</StepLabel> */}
21+
{/* TODO: Add interactivity to the stepper. */}
2222
<StepButton onClick={() => selectStep && selectStep(step.phase)}>
2323
{step.label}
24-
</StepButton> */}
24+
</StepButton>
2525
</Step>
2626
))}
2727
</Stepper>

src/modules/responseCollection/ResponseCollection.tsx

+11-7
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ const ResponseCollection: FC = () => {
5353
setOpenSnackbar(false);
5454
};
5555

56+
useEffect(() => {
57+
if (phase === IdeationPhases.Choose) {
58+
setChosenIdea(undefined);
59+
}
60+
}, [phase]);
61+
5662
useEffect(() => {
5763
if (isSuccess) {
5864
const currentIdeaSet = myResponsesSets.find(
@@ -113,13 +119,11 @@ const ResponseCollection: FC = () => {
113119
height="100%"
114120
spacing={4}
115121
>
116-
{ideas && ideas.length > 1 && (
117-
<PhasesStepper
118-
activeStep={phase}
119-
steps={[InputPhase, ChoosePhase]}
120-
// selectStep={(newPhase: number) => setPhase(newPhase)}
121-
/>
122-
)}
122+
<PhasesStepper
123+
activeStep={phase}
124+
steps={[InputPhase, ChoosePhase]}
125+
selectStep={(newPhase: number) => setPhase(newPhase)}
126+
/>
123127
<Instructions />
124128
{renderPhaseOfIdeation()}
125129
<MyResponses />

0 commit comments

Comments
 (0)