Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNTOR-1809 Returning user dashboard chart #3259

Merged
merged 6 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions locales-pending/premium.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ exposure-chart-legend-heading-nr = Number
# $nr (number) - Number of a particular type of exposure found for the user
exposure-chart-legend-value-nr = { $nr }×
exposure-chart-caption = This chart shows how many times your info is actively exposed.
exposure-chart-returning-user-upgrade-prompt = Home address, family members and more are not yet included.
exposure-chart-returning-user-upgrade-prompt-cta = Start a free scan

modal-active-number-of-exposures-title = About your number of active exposures
# Variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const BreachMockItem1: HibpLikeDbBreach = {
Domain: "",
Id: 0,
IsFabricated: false,
IsResolved: false,
IsMalware: false,
IsRetired: false,
IsSensitive: false,
Expand All @@ -44,6 +45,7 @@ const BreachMockItem2: HibpLikeDbBreach = {
BreachDate: "11/09/23",
DataClasses: [],
Description: "",
IsResolved: false,
Domain: "",
Id: 0,
IsFabricated: false,
Expand All @@ -64,6 +66,7 @@ const BreachMockItem3: HibpLikeDbBreach = {
BreachDate: "11/09/23",
DataClasses: [],
Description: "",
IsResolved: false,
Domain: "",
Id: 0,
IsFabricated: false,
Expand All @@ -84,6 +87,7 @@ const BreachMockItem4: HibpLikeDbBreach = {
BreachDate: "11/09/23",
DataClasses: [],
Description: "",
IsResolved: false,
Domain: "",
Id: 0,
IsFabricated: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type DashboardTopBannerProps = {
| "ResumeBreachResolutionContent"
| "YourDataIsProtectedContent";
bannerData: DashboardSummary;
hasRunScan: boolean;
};

export const DashboardTopBanner = (props: DashboardTopBannerProps) => {
Expand Down Expand Up @@ -61,7 +62,7 @@ export const DashboardTopBanner = (props: DashboardTopBannerProps) => {
"dashboard-top-banner-monitor-protects-your-even-more-cta"
),
onClick: () => {
// do something
window.location.href = "/redesign/user/welcome";
},
},
},
Expand Down Expand Up @@ -140,7 +141,7 @@ export const DashboardTopBanner = (props: DashboardTopBannerProps) => {
)}
</div>
<div className={styles.chart}>
<Chart data={chartData} />
<Chart hasRunScan={props.hasRunScan} data={chartData} />
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export const View = (props: Props) => {
? "DataBrokerScanUpsellContent"
: "LetsFixDataContent"
}
hasRunScan={!isScanResultItemsEmpty}
/>
<section className={styles.exposuresArea}>
<h2 className={styles.exposuresAreaHeadline}>
Expand Down
17 changes: 16 additions & 1 deletion src/app/components/client/Chart.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
flex: 1;
width: 100%;
max-width: 250px;
align-self: center;

// Font size set in Chart.tsx
.headingNr {
Expand All @@ -74,11 +75,25 @@

.legend {
align-self: center;
flex-direction: column;
display: flex;
gap: $spacing-sm;

@media screen and (min-width: $screen-lg) {
height: auto;
display: flex;
align-items: center;
max-width: 200px; // width of legend and prompt
}

.prompt {
font: $text-body-xs;
display: flex;
text-align: start;
flex-direction: column;
gap: $spacing-xs;
border: 1px solid $color-purple-70;
padding: $spacing-sm;
align-items: flex-start;
}

thead {
Expand Down
12 changes: 12 additions & 0 deletions src/app/components/client/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import { ModalOverlay } from "./dialog/ModalOverlay";
import { Dialog } from "./dialog/Dialog";
import ModalImage from "../client/assets/modal-default-img.svg";
import Image from "next/image";
import Link from "next/link";

export type Props = {
data: Array<[string, number]>;
hasRunScan: boolean;
};

export const DoughnutChart = (props: Props) => {
Expand Down Expand Up @@ -95,6 +97,15 @@ export const DoughnutChart = (props: Props) => {
</div>
);

const prompt = (
<div className={styles.prompt}>
<p>{l10n.getString("exposure-chart-returning-user-upgrade-prompt")}</p>
<Link href="/redesign/user/welcome">
{l10n.getString("exposure-chart-returning-user-upgrade-prompt-cta")}
</Link>
</div>
);

return (
<>
<figure className={styles.chartContainer}>
Expand Down Expand Up @@ -177,6 +188,7 @@ export const DoughnutChart = (props: Props) => {
))}
</tbody>
</table>
{!props.hasRunScan ? prompt : null}
</div>
</div>
<figcaption>
Expand Down
1 change: 1 addition & 0 deletions src/app/components/client/stories/ExposureCard.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const BreachMockItem: HibpLikeDbBreach = {
Id: 0,
IsFabricated: false,
IsMalware: false,
IsResolved: false,
IsRetired: false,
IsSensitive: false,
IsSpamList: false,
Expand Down
Loading