Skip to content

Commit ce63ca0

Browse files
authored
Merge pull request #926 from AppQuality/fixes
Fixes
2 parents dd33a55 + e945fb5 commit ce63ca0

File tree

7 files changed

+50
-12
lines changed

7 files changed

+50
-12
lines changed

src/common/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ export interface components {
775775
deviceType: string;
776776
};
777777
uploaderId: number;
778+
usecaseTitle: string;
778779
})[];
779780
};
780781
/** Observation */

src/features/api/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,7 @@ export type Insight = {
18831883
deviceType: string;
18841884
};
18851885
uploaderId: number;
1886+
usecaseTitle: string;
18861887
})[];
18871888
};
18881889
export type Grape = {

src/locales/en/translation.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,15 @@
778778
"__INSIGHTS_PAGE_CLOSE_DRAWER_BUTTON": "Close",
779779
"__INSIGHTS_PAGE_COLLECTION_GROUP_BY_USECASE": "Group by Use Case",
780780
"__INSIGHTS_PAGE_COLLECTION_UNGROUP": "Show all",
781-
"__INSIGHTS_PAGE_DRAWER_PUBLISH": "Publish",
782-
"__INSIGHTS_PAGE_DRAWER_UNPUBLISH": "Unpublish",
783-
"__INSIGHTS_PAGE_INSIGHTS_DRAWER_PUBLISHED_INSIGHTS": "Published insights",
784781
"__INSIGHTS_PAGE_DELETE_MODAL_BODY_TEXT": "Are you sure to delete this insight?",
785782
"__INSIGHTS_PAGE_DELETE_MODAL_CONTINUE_BUTTON": "Delete",
786783
"__INSIGHTS_PAGE_DELETE_MODAL_HEADER_TITLE": "Delete insight",
787784
"__INSIGHTS_PAGE_DELETE_MODAL_QUIT_BUTTON": "Cancel",
785+
"__INSIGHTS_PAGE_DRAWER_PUBLISH": "Publish",
786+
"__INSIGHTS_PAGE_DRAWER_UNPUBLISH": "Unpublish",
787+
"__INSIGHTS_PAGE_INSIGHT_ACCORDION_DESCRIPTION_LABEL": "Description",
788+
"__INSIGHTS_PAGE_INSIGHT_ACCORDION_OBSERVATIONS_DESCRIPTION": "<0>Observations in this insight: {{count}}</0>",
789+
"__INSIGHTS_PAGE_INSIGHT_ACCORDION_OBSERVATIONS_LABEL": "Observations",
788790
"__INSIGHTS_PAGE_INSIGHT_FORM_BUTTON_CREATE": "Create insight",
789791
"__INSIGHTS_PAGE_INSIGHT_FORM_BUTTON_DELETE": "Delete",
790792
"__INSIGHTS_PAGE_INSIGHT_FORM_BUTTON_EDIT": "Edit",
@@ -804,6 +806,8 @@
804806
"__INSIGHTS_PAGE_INSIGHT_FORM_FIELD_TITLE_LABEL": "Title Insight",
805807
"__INSIGHTS_PAGE_INSIGHT_FORM_FIELD_TITLE_PLACEHOLDER": "Insert a title",
806808
"__INSIGHTS_PAGE_INSIGHT_FORM_FIELD_USECASE_LABEL": "Use Case",
809+
"__INSIGHTS_PAGE_INSIGHT_FORM_TITLE": "Insight build",
810+
"__INSIGHTS_PAGE_INSIGHTS_DRAWER_PUBLISHED_INSIGHTS": "Published insights",
807811
"__INSIGHTS_PAGE_INSIGHTS_DRAWER_TITLE": "Insight",
808812
"__INSIGHTS_PAGE_NAVIGATION_LABEL": "Navigate to:",
809813
"__INSIGHTS_PAGE_OPEN_DRAWER_BUTTON": "Here you will find your insights",

src/locales/it/translation.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,13 +807,15 @@
807807
"__INSIGHTS_PAGE_CLOSE_DRAWER_BUTTON": "Close drawer",
808808
"__INSIGHTS_PAGE_COLLECTION_GROUP_BY_USECASE": "Organizza per Use Case",
809809
"__INSIGHTS_PAGE_COLLECTION_UNGROUP": "",
810-
"__INSIGHTS_PAGE_DRAWER_PUBLISH": "Non pubblicato! Clicca per rendere visibile l'insight in dashboard.",
811-
"__INSIGHTS_PAGE_DRAWER_UNPUBLISH": "Pubblicato in dashboard! Clicca per nascondere l'insight.",
812-
"__INSIGHTS_PAGE_INSIGHTS_DRAWER_PUBLISHED_INSIGHTS": "Published insights",
813810
"__INSIGHTS_PAGE_DELETE_MODAL_BODY_TEXT": "Sei sicuro di voler eliminare questo insight",
814811
"__INSIGHTS_PAGE_DELETE_MODAL_CONTINUE_BUTTON": "Elimina",
815812
"__INSIGHTS_PAGE_DELETE_MODAL_HEADER_TITLE": "Elimina insight",
816813
"__INSIGHTS_PAGE_DELETE_MODAL_QUIT_BUTTON": "Annulla",
814+
"__INSIGHTS_PAGE_DRAWER_PUBLISH": "Non pubblicato! Clicca per rendere visibile l'insight in dashboard.",
815+
"__INSIGHTS_PAGE_DRAWER_UNPUBLISH": "Pubblicato in dashboard! Clicca per nascondere l'insight.",
816+
"__INSIGHTS_PAGE_INSIGHT_ACCORDION_DESCRIPTION_LABEL": "",
817+
"__INSIGHTS_PAGE_INSIGHT_ACCORDION_OBSERVATIONS_DESCRIPTION": "<0>Observations in this insight: {{count}}</0>",
818+
"__INSIGHTS_PAGE_INSIGHT_ACCORDION_OBSERVATIONS_LABEL": "",
817819
"__INSIGHTS_PAGE_INSIGHT_FORM_BUTTON_CREATE": "",
818820
"__INSIGHTS_PAGE_INSIGHT_FORM_BUTTON_DELETE": "",
819821
"__INSIGHTS_PAGE_INSIGHT_FORM_BUTTON_EDIT": "",
@@ -834,6 +836,8 @@
834836
"__INSIGHTS_PAGE_INSIGHT_FORM_FIELD_TITLE_LABEL": "",
835837
"__INSIGHTS_PAGE_INSIGHT_FORM_FIELD_TITLE_PLACEHOLDER": "",
836838
"__INSIGHTS_PAGE_INSIGHT_FORM_FIELD_USECASE_LABEL": "",
839+
"__INSIGHTS_PAGE_INSIGHT_FORM_TITLE": "",
840+
"__INSIGHTS_PAGE_INSIGHTS_DRAWER_PUBLISHED_INSIGHTS": "Published insights",
837841
"__INSIGHTS_PAGE_INSIGHTS_DRAWER_TITLE": "",
838842
"__INSIGHTS_PAGE_NAVIGATION_LABEL": "Naviga in:",
839843
"__INSIGHTS_PAGE_OPEN_DRAWER_BUTTON": "",

src/pages/Insights/Collection/ObservationCard.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
IconButton,
66
Label,
77
SM,
8+
Span,
89
SpecialCard,
910
Tag,
1011
} from '@appquality/unguess-design-system';
@@ -67,6 +68,7 @@ export const ObservationCard = ({
6768
const { t } = useTranslation();
6869
const [isLightboxOpen, setIsLightboxOpen] = useState(false);
6970
const { values, setFieldValue } = useFormikContext<InsightFormValues>();
71+
const quotesMaxChars = 50;
7072

7173
const severity = observation.tags.find(
7274
(tag) => tag.group.name === 'severity'
@@ -110,6 +112,13 @@ export const ObservationCard = ({
110112
}
111113
};
112114

115+
const getQuotesWithEllipsis = (quotes: string, maxChars: number = 50) => {
116+
if (quotes.length > maxChars) {
117+
return `${quotes.slice(0, maxChars)}...`;
118+
}
119+
return quotes;
120+
};
121+
113122
return (
114123
<FieldArray name="observations">
115124
{(arrayHelpers) => (
@@ -168,7 +177,19 @@ export const ObservationCard = ({
168177
}}
169178
>
170179
<Quotes isChecked={isChecked}>
171-
&quot;{observation.quotes}&quot;
180+
&quot;
181+
{observation.quotes &&
182+
observation.quotes.length > quotesMaxChars ? (
183+
<Span title={observation.quotes}>
184+
{getQuotesWithEllipsis(
185+
observation.quotes,
186+
quotesMaxChars
187+
)}
188+
</Span>
189+
) : (
190+
observation.quotes
191+
)}
192+
&quot;
172193
</Quotes>
173194
</SpecialCard.Header.Title>
174195
<SpecialCard.Header.Text style={{ marginTop: 'auto' }}>

src/pages/Insights/InsightsDrawer/InsightAccordion.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Accordion, MD, Tag, SM, LG } from '@appquality/unguess-design-system';
1+
import { Accordion, MD, Tag, LG } from '@appquality/unguess-design-system';
22
import { useFormikContext } from 'formik';
33
import { appTheme } from 'src/app/theme';
44
import { Divider } from 'src/common/components/divider';
55
import { GetCampaignsByCidInsightsApiResponse } from 'src/features/api';
66
import { ReactComponent as ObservationIcon } from '@zendeskgarden/svg-icons/src/16/speech-bubble-conversation-stroke.svg';
7+
import { Trans, useTranslation } from 'react-i18next';
78
import { InsightFormValues } from '../FormProvider';
89
import { AccordionLabel } from './components/AccordionLabel';
910
import { ButtonsFooter } from './components/ButtonsFooter';
@@ -13,6 +14,7 @@ const Insight = ({
1314
}: {
1415
insight: GetCampaignsByCidInsightsApiResponse[number];
1516
}) => {
17+
const { t } = useTranslation();
1618
const { values } = useFormikContext<InsightFormValues>();
1719
const isCurrent = values.id === insight.id;
1820
return (
@@ -39,7 +41,7 @@ const Insight = ({
3941
marginBottom: appTheme.space.xs,
4042
}}
4143
>
42-
Description
44+
{t('__INSIGHTS_PAGE_INSIGHT_ACCORDION_DESCRIPTION_LABEL')}
4345
</MD>
4446
<MD style={{ paddingBottom: appTheme.space.xs }}>
4547
{insight.description}
@@ -54,9 +56,14 @@ const Insight = ({
5456
}}
5557
>
5658
<ObservationIcon color={appTheme.palette.grey[600]} />{' '}
57-
Observations
59+
{t('__INSIGHTS_PAGE_INSIGHT_ACCORDION_OBSERVATIONS_LABEL')}
5860
</LG>
59-
<MD>Observations in this insight: {insight.observations.length}</MD>
61+
<Trans i18nKey="__INSIGHTS_PAGE_INSIGHT_ACCORDION_OBSERVATIONS_DESCRIPTION">
62+
<MD>
63+
Observations in this insight:{' '}
64+
{{ count: insight.observations.length }}
65+
</MD>
66+
</Trans>
6067
<div style={{ marginBottom: appTheme.space.md }}>
6168
{insight.observations.map((o) => (
6269
<div

src/pages/Insights/InsightsDrawer/components/ButtonsFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const ButtonsFooter = ({
8989
uploaderId: o.uploaderId,
9090
mediaId: o.video.id,
9191
deviceType: o.video.deviceType,
92-
usecaseTitle: '', // TODO: @sinatragianpaolo add usecaseTitle to API GET /campaigns/{cid}/insights observations
92+
usecaseTitle: o.usecaseTitle,
9393
})),
9494
})
9595
}

0 commit comments

Comments
 (0)