From 2ee6e7edc433c98834c21d36259a7f9416174173 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 6 Nov 2024 10:17:37 +0530 Subject: [PATCH] Inline --- .../contentOverlay/family/index.tsx | 102 +++++++++++++++++- .../family/usageSection/index.tsx | 93 ---------------- .../contentOverlay/individual/index.tsx | 0 3 files changed, 99 insertions(+), 96 deletions(-) delete mode 100644 web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/family/usageSection/index.tsx delete mode 100644 web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/individual/index.tsx diff --git a/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/family/index.tsx b/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/family/index.tsx index 77776745dc..ea437ef4b6 100644 --- a/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/family/index.tsx +++ b/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/family/index.tsx @@ -1,13 +1,23 @@ +import { + FlexWrapper, + SpaceBetweenFlex, +} from "@ente/shared/components/Container"; +import { Box, Stack, Typography } from "@mui/material"; +import { t } from "i18next"; +import type React from "react"; import { useMemo } from "react"; import { UserDetails } from "types/user"; import { isPartOfFamily } from "utils/user/family"; +import { LegendIndicator, Progressbar } from "../../styledComponents"; import StorageSection from "../storageSection"; -import { FamilyUsageSection } from "./usageSection"; -interface Iprops { +interface FamilySubscriptionCardContentProps { userDetails: UserDetails; } -export function FamilySubscriptionCardContent({ userDetails }: Iprops) { + +export const FamilySubscriptionCardContent: React.FC< + FamilySubscriptionCardContentProps +> = ({ userDetails }) => { const totalUsage = useMemo(() => { if (isPartOfFamily(userDetails.familyData)) { return userDetails.familyData.members.reduce( @@ -32,4 +42,90 @@ export function FamilySubscriptionCardContent({ userDetails }: Iprops) { /> ); +}; + +interface FamilyUsageSectionProps { + userUsage: number; + totalUsage: number; + fileCount: number; + totalStorage: number; } + +const FamilyUsageSection: React.FC = ({ + userUsage, + totalUsage, + fileCount, + totalStorage, +}) => { + return ( + + + + + + + + + {t("photos_count", { count: fileCount ?? 0 })} + + + + ); +}; + +interface FamilyUsageProgressBarProps { + userUsage: number; + totalUsage: number; + totalStorage: number; +} + +const FamilyUsageProgressBar: React.FC = ({ + userUsage, + totalUsage, + totalStorage, +}) => { + return ( + + + + + ); +}; + +interface LegendProps { + label: string; + color: string; +} + +const Legend: React.FC = ({ label, color }) => { + return ( + + + + {label} + + + ); +}; diff --git a/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/family/usageSection/index.tsx b/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/family/usageSection/index.tsx deleted file mode 100644 index 84ee5b0f69..0000000000 --- a/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/family/usageSection/index.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import { - FlexWrapper, - SpaceBetweenFlex, -} from "@ente/shared/components/Container"; -import { Box, Stack, Typography } from "@mui/material"; -import { t } from "i18next"; -import { LegendIndicator, Progressbar } from "../../../styledComponents"; - -interface Iprops { - userUsage: number; - totalUsage: number; - fileCount: number; - totalStorage: number; -} - -export function FamilyUsageSection({ - userUsage, - totalUsage, - fileCount, - totalStorage, -}: Iprops) { - return ( - - - - - - - - - {t("photos_count", { count: fileCount ?? 0 })} - - - - ); -} - -interface FamilyUsageProgressBarProps { - userUsage: number; - totalUsage: number; - totalStorage: number; -} - -function FamilyUsageProgressBar({ - userUsage, - totalUsage, - totalStorage, -}: FamilyUsageProgressBarProps) { - return ( - - - - - ); -} - -interface LegendProps { - label: string; - color: string; -} - -function Legend({ label, color }: LegendProps) { - return ( - - - - {label} - - - ); -} diff --git a/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/individual/index.tsx b/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/individual/index.tsx deleted file mode 100644 index e69de29bb2..0000000000