diff --git a/client/src/app/components/questionnaire-summary/questionnaire-summary.tsx b/client/src/app/components/questionnaire-summary/questionnaire-summary.tsx index 186687f97f..b7418bcfc9 100644 --- a/client/src/app/components/questionnaire-summary/questionnaire-summary.tsx +++ b/client/src/app/components/questionnaire-summary/questionnaire-summary.tsx @@ -36,7 +36,6 @@ interface QuestionnaireSummaryProps { fetchError?: AxiosError | null; summaryData: Assessment | Questionnaire | undefined; summaryType: SummaryType; - isArchetype?: boolean; } const QuestionnaireSummary: React.FC = ({ @@ -44,10 +43,9 @@ const QuestionnaireSummary: React.FC = ({ summaryType, isFetching = false, fetchError = null, - isArchetype, }) => { const { t } = useTranslation(); - + const isArchetype = location.pathname.includes("/archetypes/"); const [activeSectionIndex, setActiveSectionIndex] = useState<"all" | number>( "all" ); @@ -90,13 +88,23 @@ const QuestionnaireSummary: React.FC = ({ summaryType === SummaryType.Assessment ? ( - - Assessment - + {isArchetype ? ( + + Assessment + + ) : ( + + Assessment + + )} {summaryData?.name} diff --git a/client/src/app/pages/assessment/assessment-page.tsx b/client/src/app/pages/assessment/assessment-page.tsx index e9718ee0e1..cbfb5652ae 100644 --- a/client/src/app/pages/assessment/assessment-page.tsx +++ b/client/src/app/pages/assessment/assessment-page.tsx @@ -21,7 +21,6 @@ import { AssessmentWizard } from "./components/assessment-wizard/assessment-wiza const AssessmentPage: React.FC = () => { const { t } = useTranslation(); - const isArchetype = location.pathname.includes("/archetypes/"); const { assessmentId } = useParams(); @@ -34,10 +33,7 @@ const AssessmentPage: React.FC = () => { return ( <> - + @@ -68,11 +64,7 @@ const AssessmentPage: React.FC = () => { /> )} }> - + diff --git a/client/src/app/pages/assessment/components/assessment-actions/components/dynamic-assessment-actions-row.tsx b/client/src/app/pages/assessment/components/assessment-actions/components/dynamic-assessment-actions-row.tsx index cc1aa8d3b5..416edbc6b2 100644 --- a/client/src/app/pages/assessment/components/assessment-actions/components/dynamic-assessment-actions-row.tsx +++ b/client/src/app/pages/assessment/components/assessment-actions/components/dynamic-assessment-actions-row.tsx @@ -31,7 +31,6 @@ enum AssessmentAction { interface DynamicAssessmentActionsRowProps { questionnaire: Questionnaire; - isArchetype: boolean; application?: Application; archetype?: Archetype; assessment?: Assessment; @@ -39,7 +38,8 @@ interface DynamicAssessmentActionsRowProps { const DynamicAssessmentActionsRow: FunctionComponent< DynamicAssessmentActionsRowProps -> = ({ questionnaire, application, archetype, assessment, isArchetype }) => { +> = ({ questionnaire, application, archetype, assessment }) => { + const isArchetype = location.pathname.includes("/archetypes/"); const history = useHistory(); const { t } = useTranslation(); const queryClient = useQueryClient(); diff --git a/client/src/app/pages/assessment/components/assessment-actions/components/questionnaires-table.tsx b/client/src/app/pages/assessment/components/assessment-actions/components/questionnaires-table.tsx index 9eaaa5f221..5210a60929 100644 --- a/client/src/app/pages/assessment/components/assessment-actions/components/questionnaires-table.tsx +++ b/client/src/app/pages/assessment/components/assessment-actions/components/questionnaires-table.tsx @@ -95,7 +95,6 @@ const QuestionnairesTable: React.FC = ({ diff --git a/client/src/app/pages/assessment/components/assessment-page-header.tsx b/client/src/app/pages/assessment/components/assessment-page-header.tsx index bd2dee7405..96c01f4f08 100644 --- a/client/src/app/pages/assessment/components/assessment-page-header.tsx +++ b/client/src/app/pages/assessment/components/assessment-page-header.tsx @@ -12,16 +12,14 @@ import { useFetchArchetypeOrApplicationByAssessment } from "@app/hooks/useFetchA export interface AssessmentPageHeaderProps { assessment?: Assessment; - isArchetype?: boolean; } export const AssessmentPageHeader: React.FC = ({ assessment, - isArchetype, }) => { const { t } = useTranslation(); const history = useHistory(); - + const isArchetype = location.pathname.includes("/archetypes/"); const { data } = useFetchArchetypeOrApplicationByAssessment( isArchetype, isArchetype ? assessment?.archetype?.id : assessment?.archetype?.id @@ -93,7 +91,9 @@ export const AssessmentPageHeader: React.FC = ({ cancelBtnLabel={t("actions.cancel")} onCancel={() => setIsConfirmDialogOpen(false)} onClose={() => setIsConfirmDialogOpen(false)} - onConfirm={() => history.push(Paths.applications)} + onConfirm={() => + history.push(isArchetype ? Paths.archetypes : Paths.applications) + } /> )} diff --git a/client/src/app/pages/assessment/components/assessment-wizard/assessment-wizard.tsx b/client/src/app/pages/assessment/components/assessment-wizard/assessment-wizard.tsx index 053a92c16a..5f2dddc75d 100644 --- a/client/src/app/pages/assessment/components/assessment-wizard/assessment-wizard.tsx +++ b/client/src/app/pages/assessment/components/assessment-wizard/assessment-wizard.tsx @@ -58,14 +58,13 @@ export interface AssessmentWizardValues { export interface AssessmentWizardProps { assessment?: Assessment; isOpen: boolean; - isArchetype?: boolean; } export const AssessmentWizard: React.FC = ({ assessment, isOpen, - isArchetype, }) => { + const isArchetype = location.pathname.includes("/archetypes/"); const queryClient = useQueryClient(); const { questionnaires } = useFetchQuestionnaires(); const onHandleUpdateAssessmentSuccess = () => {