Skip to content

Commit 777f87c

Browse files
committed
feat: added extra screen to complement question with more statements
1 parent 40723cc commit 777f87c

File tree

3 files changed

+44
-29
lines changed

3 files changed

+44
-29
lines changed

src/components/statementWizard/PrivacySelector.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ export const PrivacySelector: React.FC<PrivacySelectorProps> = ({
1515
}) => {
1616
return (
1717
<div className='space-y-6'>
18-
<h2 className='text-2xl font-semibold text-center'>
19-
Who can see this statement?
20-
</h2>
2118
<div className='space-y-4'>
2219
<Button
2320
variant='outline'

src/components/statementWizard/StatementWizard.tsx

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
4848

4949
// Define steps; skip 'category' if using a preset question.
5050
const steps: Step[] = isPreset
51-
? ['subject', 'verb', 'object', 'privacy']
51+
? ['subject', 'verb', 'object', 'privacy', 'complement']
5252
: ['subject', 'verb', 'object', 'category', 'privacy'];
5353

5454
const stepBorderColors: Record<Exclude<Step, 'closed'>, string> = {
@@ -57,6 +57,7 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
5757
object: 'border-objectInput',
5858
category: 'border-black',
5959
privacy: 'border-privacySelector',
60+
complement: 'border-gray-400',
6061
};
6162

6263
const [step, setStep] = useState<Step>('subject');
@@ -83,9 +84,15 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
8384
}, [presetQuestion, username]);
8485

8586
// Get the sub-question for each step.
86-
const getSubQuestion = (currentStep: Exclude<Step, 'closed'>) =>
87-
presetQuestion?.steps?.[currentStep]?.question ||
88-
defaultQuestions(username, selection)[currentStep];
87+
const getSubQuestion = (currentStep: Exclude<Step, 'closed'>) => {
88+
if (currentStep === 'complement') {
89+
return 'Add additional statement if needed';
90+
}
91+
return (
92+
presetQuestion?.steps?.[currentStep]?.question ||
93+
defaultQuestions(username, selection)[currentStep]
94+
);
95+
};
8996

9097
const handleBack = () => {
9198
const currentIndex = steps.indexOf(step);
@@ -295,12 +302,40 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
295302
onChange={(isPublic) =>
296303
setSelection((prev) => ({ ...prev, isPublic }))
297304
}
298-
onComplete={handleComplete}
305+
onComplete={() => {
306+
console.log('Privacy complete triggered');
307+
if (isPreset) {
308+
handleNext('complement');
309+
} else {
310+
handleComplete();
311+
}
312+
}}
299313
/>
300314
</StepContainer>
301315
);
302316
};
303317

318+
const renderComplementStep = () => {
319+
const subQuestion = 'Add Extra Detail?';
320+
return (
321+
<StepContainer subQuestion={subQuestion} showBack onBack={handleBack}>
322+
<div className='text-center p-4'>
323+
<p className='text-lg'>
324+
If you feel your statement didn't fully answer the question, you can
325+
later add custom statements to complement it.
326+
</p>
327+
</div>
328+
<Button
329+
onClick={handleComplete}
330+
variant='pink'
331+
className='mx-auto mt-4'
332+
>
333+
Finish
334+
</Button>
335+
</StepContainer>
336+
);
337+
};
338+
304339
const renderCurrentStep = () => {
305340
switch (step) {
306341
case 'subject':
@@ -313,6 +348,8 @@ const StatementWizard: React.FC<StatementWizardProps> = ({
313348
return renderCategoryStep();
314349
case 'privacy':
315350
return renderPrivacyStep();
351+
case 'complement':
352+
return renderComplementStep();
316353
default:
317354
return null;
318355
}

types/entries.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,6 @@ export interface Entry {
2424
isResolved?: boolean;
2525
}
2626

27-
// export interface Action {
28-
// id: string;
29-
// creationDate: string;
30-
// dueDate?: string;
31-
// text: string;
32-
// isResolved?: boolean;
33-
// }
34-
// export interface Statement {
35-
// id: string;
36-
// subject: string;
37-
// verb: string;
38-
// object: string;
39-
// adverbial?: string;
40-
// isPublic: boolean;
41-
// actions?: Action[];
42-
// category: string;
43-
// presetId?: string;
44-
// isResolved?: boolean;
45-
// }
46-
4727
export interface Category {
4828
id: string;
4929
name: string;
@@ -107,4 +87,5 @@ export type Step =
10787
| 'verb'
10888
| 'object'
10989
| 'category'
110-
| 'privacy';
90+
| 'privacy'
91+
| 'complement';

0 commit comments

Comments
 (0)