diff --git a/src/features/PassSurvey/ui/SurveyLayout.tsx b/src/features/PassSurvey/ui/SurveyLayout.tsx
index ed0388d0a..1227b6e77 100644
--- a/src/features/PassSurvey/ui/SurveyLayout.tsx
+++ b/src/features/PassSurvey/ui/SurveyLayout.tsx
@@ -32,6 +32,8 @@ const SurveyLayout = (props: Props) => {
title={props.title}
/>
+
+
{
flexDirection="column"
overflow="scroll"
>
-
{props.children}
diff --git a/src/i18n/en/translation.json b/src/i18n/en/translation.json
index 0fa7061b8..214250605 100644
--- a/src/i18n/en/translation.json
+++ b/src/i18n/en/translation.json
@@ -310,6 +310,7 @@
},
"charactersCount": "{{numCharacters}}/{{maxCharacters}} characters",
"targetSubjectLabel": "About {{name}}",
- "targetSubjectBanner": "Please ensure all your responses are about {{name}}"
+ "targetSubjectBanner": "Please ensure all your responses are about {{name}}",
+ "loading": "Loading…"
}
}
diff --git a/src/i18n/fr/translation.json b/src/i18n/fr/translation.json
index ae36e8942..2879a7ae1 100644
--- a/src/i18n/fr/translation.json
+++ b/src/i18n/fr/translation.json
@@ -329,6 +329,7 @@
},
"charactersCount": "{{numCharacters}}/{{maxCharacters}} caractères",
"targetSubjectLabel": "À propos de {{name}}",
- "targetSubjectBanner": "Assurez-vous que toutes vos réponses concernent {{name}}"
+ "targetSubjectBanner": "Assurez-vous que toutes vos réponses concernent {{name}}",
+ "loading": "Chargement en cours..."
}
}
diff --git a/src/shared/ui/CardItem/TargetSubjectLine.tsx b/src/shared/ui/CardItem/TargetSubjectLine.tsx
new file mode 100644
index 000000000..b34192d88
--- /dev/null
+++ b/src/shared/ui/CardItem/TargetSubjectLine.tsx
@@ -0,0 +1,22 @@
+import { SubjectDTO } from '~/shared/api/types/subject';
+import { Box } from '~/shared/ui';
+import { TargetSubjectLabel } from '~/widgets/TargetSubjectLabel';
+
+type Props = {
+ subject: SubjectDTO | null;
+};
+
+export const TargetSubjectLine = ({ subject }: Props) => {
+ if (!subject) return null;
+
+ return (
+
+
+
+ );
+};
diff --git a/src/shared/ui/CardItem/index.tsx b/src/shared/ui/CardItem/index.tsx
index bb3433255..0581825fe 100644
--- a/src/shared/ui/CardItem/index.tsx
+++ b/src/shared/ui/CardItem/index.tsx
@@ -1,11 +1,11 @@
-import { PropsWithChildren } from 'react';
+import { PropsWithChildren, useContext, useMemo } from 'react';
-import { Theme } from '../../constants';
-import { useCustomMediaQuery, useCustomTranslation } from '../../utils';
+import { TargetSubjectLine } from './TargetSubjectLine';
-import { Markdown } from '~/shared/ui';
-import Box from '~/shared/ui/Box';
-import Text from '~/shared/ui/Text';
+import { SurveyContext } from '~/features/PassSurvey';
+import { Theme } from '~/shared/constants';
+import { Box, Markdown, Text } from '~/shared/ui';
+import { insertAfterMedia, useCustomMediaQuery, useCustomTranslation } from '~/shared/utils';
interface CardItemProps extends PropsWithChildren {
watermark?: string;
@@ -20,6 +20,14 @@ export const CardItem = ({ children, markdown, isOptional, testId }: CardItemPro
const { t } = useCustomTranslation();
+ const context = useContext(SurveyContext);
+
+ const processedMarkdown = useMemo(() => {
+ if (!context.targetSubject) return markdown;
+
+ return insertAfterMedia(markdown, '');
+ }, [markdown, context.targetSubject]);
+
return (
-
+
+ props.id === 'target-subject' ? (
+
+ ) : (
+
+ ),
+ }}
+ />
{isOptional && (
& {
markdown: string;
-}
+};
-export const Markdown = (props: MarkdownProps) => {
- const { isLoading, markdown } = useMarkdownExtender(props.markdown);
+export const Markdown = ({ markdown: markdownProp, ...rest }: MarkdownProps) => {
+ const { t } = useCustomTranslation();
+ const { isLoading, markdown } = useMarkdownExtender(markdownProp);
if (isLoading) {
- return
Loading...
;
+ return
{t('loading')}
;
}
return (
- {markdown}
+
+ {markdown}
+
);
};
diff --git a/src/shared/utils/helpers/index.ts b/src/shared/utils/helpers/index.ts
index 5027f16d8..5511c0113 100644
--- a/src/shared/utils/helpers/index.ts
+++ b/src/shared/utils/helpers/index.ts
@@ -7,3 +7,4 @@ export * from './getInitials';
export * from './delay';
export * from './cutString';
export * from './getSubjectName';
+export * from './insertAfterMedia';
diff --git a/src/shared/utils/helpers/insertAfterMedia.ts b/src/shared/utils/helpers/insertAfterMedia.ts
new file mode 100644
index 000000000..1c76b3c35
--- /dev/null
+++ b/src/shared/utils/helpers/insertAfterMedia.ts
@@ -0,0 +1,31 @@
+/**
+ * Inserts the given string into the given markdown after the first line containing content
+ * that does not contain solely media.
+ *
+ * @param markdown Markdown content to parse
+ * @param inserted Inserted string
+ * @returns Processed markdown with string inserted
+ */
+export const insertAfterMedia = (markdown: string, inserted: string) => {
+ const lines = markdown.split('\n');
+ // Stop at first line containing content that is not:
+ // - solely a media element (/