Skip to content

Commit

Permalink
Merge pull request #151 from AppQuality/UTT-33-turnoff-ct-insights
Browse files Browse the repository at this point in the history
feat: Remove InsightSection from UxDashboardForm
  • Loading branch information
cannarocks authored Aug 2, 2024
2 parents 7cc63df + c221004 commit 7041dbe
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 1,565 deletions.
96 changes: 0 additions & 96 deletions src/pages/UxDashboard/UxForm/FormProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,6 @@ export interface FormQuestion {
name: GetCampaignsByCampaignUxApiResponse["questions"][number]["name"];
id?: GetCampaignsByCampaignUxApiResponse["questions"][number]["id"];
}
export interface FormVideoPart {
id?: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["videoParts"][number]["id"];
internalId: string;
end: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["videoParts"][number]["end"];
description: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["videoParts"][number]["description"];
start: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["videoParts"][number]["start"];
mediaId: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["videoParts"][number]["mediaId"];
streamUrl: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["videoParts"][number]["streamUrl"];
url: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["videoParts"][number]["url"];
}
export interface FormInsight {
id?: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["id"];
internalId: string;
title: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["title"];
description: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["description"];
severity: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["severity"];
cluster: NonNullable<
GetCampaignsByCampaignUxApiResponse["insights"]
>[number]["clusters"];
videoParts: FormVideoPart[];
}

export interface FormSentiment {
clusterId: NonNullable<
Expand All @@ -75,7 +32,6 @@ export interface FormValuesInterface {
methodology: GetCampaignsByCampaignUxApiResponse["methodology"];
questions: FormQuestion[];
usersNumber?: GetCampaignsByCampaignUxApiResponse["usersNumber"];
insights: FormInsight[];
sentiments?: FormSentiment[];
}

Expand Down Expand Up @@ -110,32 +66,6 @@ const FormProvider = ({ children }: { children: ReactNode }) => {
};
}, []) || [],
usersNumber: currentData?.usersNumber,
insights:
currentData?.insights?.map((insight) => {
return {
id: insight.id,
internalId: uuidv4(),
title: insight.title,
description: insight.description,
severity: {
id: insight.severity.id,
name: insight.severity.name,
},
cluster: insight.clusters,
videoParts: insight.videoParts.map((video) => {
return {
id: video.id,
internalId: uuidv4(),
start: video.start,
end: video.end - video.start,
description: video.description,
mediaId: video.mediaId,
streamUrl: video.streamUrl,
url: video.url,
};
}),
};
}) || [],
sentiments:
currentData?.sentiments && currentData.sentiments.length
? currentData.sentiments.map((sentiment) => {
Expand Down Expand Up @@ -229,31 +159,6 @@ const FormProvider = ({ children }: { children: ReactNode }) => {
),
});

const mapFormInsightsForPatch = (insights: FormValuesInterface["insights"]) =>
insights?.map((insight, index) => {
return {
id: insight.id,
title: insight.title,
description: insight.description,
order: index,
severityId: insight.severity.id,
clusterIds: Array.isArray(insight.cluster)
? insight.cluster.map((cluster) => cluster.id)
: insight.cluster,
videoParts: !insight.videoParts
? []
: insight.videoParts.map((video, videoIndex) => {
return {
id: video.id,
order: videoIndex,
start: video.start,
end: Math.round(video.end) + video.start,
mediaId: video.mediaId,
description: video.description,
};
}),
};
});
return (
<Formik
initialValues={initialValues}
Expand All @@ -273,7 +178,6 @@ const FormProvider = ({ children }: { children: ReactNode }) => {
})),
methodology: values.methodology,
usersNumber: values.usersNumber,
insights: mapFormInsightsForPatch(values.insights) || [],
sentiments: values.sentiments || [],
},
});
Expand Down
144 changes: 0 additions & 144 deletions src/pages/UxDashboard/UxForm/Insights/InsightCard.tsx

This file was deleted.

Loading

0 comments on commit 7041dbe

Please sign in to comment.