Skip to content

armgit / ente

Public Imported from GitHub
0

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

Tweak API

Manav Rathi131cf43f73f5
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index 9f5f04b714..0a82510551 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -1567,7 +1567,7 @@ const ManageLinkExpiry: React.FC<ManageLinkExpiryProps> = ({
? "critical"
: "primary"
}
- subText={
+ caption={
isLinkExpired(publicShareProp?.validTill)
? t("link_expired")
: publicShareProp?.validTill
@@ -1691,7 +1691,7 @@ const ManageDeviceLimit: React.FC<ManageDeviceLimitProps> = ({
<EnteMenuItem
label={t("LINK_DEVICE_LIMIT")}
variant="captioned"
- subText={
+ caption={
publicShareProp.deviceLimit === 0
? t("NO_DEVICE_LIMIT")
: publicShareProp.deviceLimit.toString()
diff --git a/web/apps/photos/src/components/Sidebar/index.tsx b/web/apps/photos/src/components/Sidebar/index.tsx
index 2a735e7f01..e9d6b3446b 100644
--- a/web/apps/photos/src/components/Sidebar/index.tsx
+++ b/web/apps/photos/src/components/Sidebar/index.tsx
@@ -436,7 +436,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
onClick={openUncategorizedSection}
variant="captioned"
label={t("section_uncategorized")}
- subText={collectionSummaries
+ caption={collectionSummaries
.get(uncategorizedCollectionId)
?.fileCount.toString()}
/>
@@ -445,7 +445,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
onClick={openArchiveSection}
variant="captioned"
label={t("section_archive")}
- subText={collectionSummaries
+ caption={collectionSummaries
.get(ARCHIVE_SECTION)
?.fileCount.toString()}
/>
@@ -454,7 +454,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
onClick={openHiddenSection}
variant="captioned"
label={t("section_hidden")}
- subIcon={
+ caption={
<LockOutlinedIcon
sx={{
verticalAlign: "middle",
@@ -468,7 +468,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
onClick={openTrashSection}
variant="captioned"
label={t("section_trash")}
- subText={collectionSummaries
+ caption={collectionSummaries
.get(TRASH_SECTION)
?.fileCount.toString()}
/>
diff --git a/web/packages/shared/components/Menu/EnteMenuItem.tsx b/web/packages/shared/components/Menu/EnteMenuItem.tsx
index 8c50a8e9cc..95e1cb0df8 100644
--- a/web/packages/shared/components/Menu/EnteMenuItem.tsx
+++ b/web/packages/shared/components/Menu/EnteMenuItem.tsx
@@ -16,6 +16,10 @@ import React from "react";
interface EnteMenuItemProps {
onClick: () => void;
color?: ButtonProps["color"];
+ /**
+ * - Variant "captioned": The {@link caption}) is shown alongside the main
+ * {@link label}, separated from it by a bullet.
+ */
variant?: "primary" | "captioned" | "toggle" | "secondary" | "mini";
fontWeight?: TypographyProps["fontWeight"];
startIcon?: React.ReactNode;
@@ -25,8 +29,16 @@ interface EnteMenuItemProps {
* TODO: Try and reflect this is the type.
*/
label?: string;
- subText?: string;
- subIcon?: React.ReactNode;
+ /**
+ * The text (or icon) to show alongside the {@link label} when the variant
+ * is "captioned".
+ *
+ * This is usually expected to be a string and is wrapped in a Typography
+ * component before being rendered. However, it can also be an SvgIcon (or
+ * any an arbitrary component, though in terms of styling, only an SvgIcon
+ * usually makes sense).
+ */
+ caption?: React.ReactNode;
checked?: boolean;
labelComponent?: React.ReactNode;
disabled?: boolean;
@@ -38,8 +50,7 @@ export const EnteMenuItem: React.FC<EnteMenuItemProps> = ({
startIcon,
endIcon,
label,
- subText,
- subIcon,
+ caption,
checked,
variant = "primary",
fontWeight = "medium",
@@ -100,8 +111,7 @@ export const EnteMenuItem: React.FC<EnteMenuItemProps> = ({
<CaptionedText
color={color}
mainText={labelOrDefault}
- subText={subText}
- subIcon={subIcon}
+ caption={caption}
/>
) : variant === "mini" ? (
<Typography variant="mini" color="text.muted">
@@ -130,15 +140,13 @@ export const EnteMenuItem: React.FC<EnteMenuItemProps> = ({
interface CaptionedTextProps {
mainText: string;
- subText?: string;
- subIcon?: React.ReactNode;
+ caption?: React.ReactNode;
color?: ButtonProps["color"];
}
const CaptionedText: React.FC<CaptionedTextProps> = ({
mainText,
- subText,
- subIcon,
+ caption,
color,
}) => {
const subTextColor = color == "critical" ? "critical.main" : "text.faint";
@@ -149,7 +157,7 @@ const CaptionedText: React.FC<CaptionedTextProps> = ({
{"β€’"}
</Typography>
<Typography variant="small" sx={{ color: subTextColor }}>
- {subText ? subText : subIcon}
+ {caption}
</Typography>
</Stack>
);