-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* The EntityTimer UI was integrated into the Survey Header * The ProcessingScreen UI * Provide the respondentMeta to SurveyContext * Improve the navigateTo handler for the processingAnswers routes * EN/FR translations for the processing screen * Provide custom title to the SurveyHeader * Add the ability to complete the flow by force * Update the survey header styles * CheckCircle icon * The main screen for the Processing screen done * Loader added to the ProcessingScreen * Change the SurveyHeader template * ProgressBar style fixes after code review --------- Co-authored-by: Viktor Riabkov <[email protected]>
- Loading branch information
1 parent
05da2a9
commit ab107b0
Showing
15 changed files
with
234 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import Box from '../Box'; | ||
|
||
type Props = { | ||
color?: string; | ||
strokeWidth?: number; | ||
|
||
width?: string; | ||
height?: string; | ||
}; | ||
|
||
const CheckCircle = (props: Props) => { | ||
return ( | ||
<Box | ||
display="flex" | ||
sx={{ | ||
'& path': { | ||
strokeDasharray: 56, | ||
strokeDashoffset: 56, | ||
animation: 'draw 2s ease forwards', | ||
}, | ||
'@keyframes draw': { | ||
to: { | ||
strokeDashoffset: 0, | ||
}, | ||
}, | ||
}} | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
strokeWidth={props.strokeWidth || 1.5} | ||
stroke={props.color || 'currentColor'} | ||
width={props.width || '24px'} | ||
height={props.height || '24px'} | ||
className="checkmark-circle" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" | ||
/> | ||
</svg> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default CheckCircle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default as ClockIcon } from './ClockIcon'; | ||
export { default as CheckCircle } from './CheckCircle'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as SurveyAnswerProcessingWidget } from './ui'; |
84 changes: 84 additions & 0 deletions
84
src/widgets/SurveyAnswerProcessing/ui/ProcessingScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { useCallback, useContext } from 'react'; | ||
|
||
import { ProgressBar } from './ProgressBar'; | ||
|
||
import { appletModel } from '~/entities/applet'; | ||
import { useBanners } from '~/entities/banner/model'; | ||
import { SurveyContext, SurveyLayout, SurveyManageButtons } from '~/features/PassSurvey'; | ||
import { Theme } from '~/shared/constants'; | ||
import Box from '~/shared/ui/Box'; | ||
import Text from '~/shared/ui/Text'; | ||
import { useCustomTranslation } from '~/shared/utils'; | ||
|
||
export const ProcessingScreen = () => { | ||
const { t } = useCustomTranslation(); | ||
|
||
const context = useContext(SurveyContext); | ||
|
||
const { addWarningBanner } = useBanners(); | ||
|
||
const { completeActivity, completeFlow } = appletModel.hooks.useEntityComplete({ | ||
activityId: context.activityId, | ||
eventId: context.eventId, | ||
appletId: context.appletId, | ||
flow: context.flow, | ||
flowId: context.flow?.id ?? null, | ||
publicAppletKey: context.publicAppletKey, | ||
}); | ||
|
||
const onFinish = useCallback(() => { | ||
const canBeClosed = true; // TODO: Change on real one when the store will be ready | ||
|
||
if (!canBeClosed) { | ||
return addWarningBanner(t('answerProcessingScreen.processInProgress')); | ||
} | ||
|
||
return context.flow ? completeFlow({ forceComplete: true }) : completeActivity(); | ||
}, [addWarningBanner, completeActivity, completeFlow, context.flow, t]); | ||
|
||
return ( | ||
<SurveyLayout | ||
isSaveAndExitButtonShown={false} | ||
title="Test Activity Or Flow Title" // TODO: Change on real one when the store will be ready | ||
footerActions={ | ||
<SurveyManageButtons | ||
isLoading={false} | ||
isBackShown={false} | ||
onNextButtonClick={onFinish} | ||
nextButtonText={t('Consent.close')} | ||
/> | ||
} | ||
> | ||
<Box display="flex" flex={1} justifyContent="center" alignItems="center" paddingX="24px"> | ||
<Box> | ||
<Box | ||
display="flex" | ||
justifyContent="center" | ||
alignItems="center" | ||
flexDirection="column" | ||
gap="12px" | ||
> | ||
<Text variant="h4">{t('answerProcessingScreen.title')}</Text> | ||
<Text variant="body1">{t('answerProcessingScreen.description')}</Text> | ||
</Box> | ||
|
||
<Box | ||
padding="16px 8px" | ||
marginTop="16px" | ||
bgcolor={Theme.colors.light.primary012} | ||
borderRadius="12px" | ||
> | ||
<ProgressBar | ||
activityName={context.activity.name} | ||
currentActivityIndex={0} | ||
activitiesCount={10} | ||
isCompleted={false} // TODO: Change on real one when the store will be ready | ||
isNotStarted={true} // TODO: Change on real one when the store will be ready | ||
isInProgress={false} // TODO: Change on real one when the store will be ready | ||
/> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</SurveyLayout> | ||
); | ||
}; |
Oops, something went wrong.