Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Inline

Manav Rathie7b7b3c1cc5b
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
index 9bdc3292c1..6e8f1e354d 100644
--- a/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/individual/index.tsx
+++ b/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/individual/index.tsx
@@ -1,12 +1,19 @@
+import { formattedStorageByteSize } from "@/new/photos/utils/units";
+import { SpaceBetweenFlex } from "@ente/shared/components/Container";
+import { Box, Typography } from "@mui/material";
+import { t } from "i18next";
import { UserDetails } from "types/user";
import StorageSection from "../storageSection";
-import { IndividualUsageSection } from "./usageSection";
-interface Iprops {
+import { Progressbar } from "../../styledComponents";
+
+interface IndividualSubscriptionCardContentProps {
userDetails: UserDetails;
}
-export function IndividualSubscriptionCardContent({ userDetails }: Iprops) {
+export const IndividualSubscriptionCardContent: React.FC<
+ IndividualSubscriptionCardContentProps
+> = ({ userDetails }) => {
const totalStorage =
userDetails.subscription.storage + (userDetails.storageBonus ?? 0);
return (
@@ -19,4 +26,44 @@ export function IndividualSubscriptionCardContent({ userDetails }: Iprops) {
/>
</>
);
+};
+
+interface IndividualUsageSectionProps {
+ usage: number;
+ fileCount: number;
+ storage: number;
}
+const IndividualUsageSection: React.FC<IndividualUsageSectionProps> = ({
+ usage,
+ storage,
+ fileCount,
+}) => {
+ // [Note: Fallback translation for languages with multiple plurals]
+ //
+ // Languages like Polish and Arabian have multiple plural forms, and
+ // currently i18n falls back to the base language translation instead of the
+ // "_other" form if all the plural forms are not listed out.
+ //
+ // As a workaround, name the _other form as the unprefixed name. That is,
+ // instead of calling the most general plural form as foo_count_other, call
+ // it foo_count (To keep our heads straight, we adopt the convention that
+ // all such pluralizable strings use the _count suffix, but that's not a
+ // requirement from the library).
+ return (
+ <Box width="100%">
+ <Progressbar value={Math.min((usage * 100) / storage, 100)} />
+ <SpaceBetweenFlex
+ sx={{
+ marginTop: 1.5,
+ }}
+ >
+ <Typography variant="mini">{`${formattedStorageByteSize(
+ storage - usage,
+ )} ${t("FREE")}`}</Typography>
+ <Typography variant="mini" fontWeight={"bold"}>
+ {t("photos_count", { count: fileCount ?? 0 })}
+ </Typography>
+ </SpaceBetweenFlex>
+ </Box>
+ );
+};
diff --git a/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/individual/usageSection.tsx b/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/individual/usageSection.tsx
deleted file mode 100644
index 857ac9c633..0000000000
--- a/web/apps/photos/src/components/Sidebar/SubscriptionCard/contentOverlay/individual/usageSection.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { formattedStorageByteSize } from "@/new/photos/utils/units";
-import { SpaceBetweenFlex } from "@ente/shared/components/Container";
-import { Box, Typography } from "@mui/material";
-import { t } from "i18next";
-
-import { Progressbar } from "../../styledComponents";
-
-interface Iprops {
- usage: number;
- fileCount: number;
- storage: number;
-}
-export function IndividualUsageSection({ usage, storage, fileCount }: Iprops) {
- // [Note: Fallback translation for languages with multiple plurals]
- //
- // Languages like Polish and Arabian have multiple plural forms, and
- // currently i18n falls back to the base language translation instead of the
- // "_other" form if all the plural forms are not listed out.
- //
- // As a workaround, name the _other form as the unprefixed name. That is,
- // instead of calling the most general plural form as foo_count_other, call
- // it foo_count (To keep our heads straight, we adopt the convention that
- // all such pluralizable strings use the _count suffix, but that's not a
- // requirement from the library).
- return (
- <Box width="100%">
- <Progressbar value={Math.min((usage * 100) / storage, 100)} />
- <SpaceBetweenFlex
- sx={{
- marginTop: 1.5,
- }}
- >
- <Typography variant="mini">{`${formattedStorageByteSize(
- storage - usage,
- )} ${t("FREE")}`}</Typography>
- <Typography variant="mini" fontWeight={"bold"}>
- {t("photos_count", { count: fileCount ?? 0 })}
- </Typography>
- </SpaceBetweenFlex>
- </Box>
- );
-}