Skip to content

armgit / ente

Public Imported from GitHub
0

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

style(photos):align-referral-settings-with-desktop-v2

Aswin Asok54d478526fa0
diff --git a/web/apps/photos/src/components/sidebar/ReferralSettings.tsx b/web/apps/photos/src/components/sidebar/ReferralSettings.tsx
index 2f07e192ff..e4f6ff0585 100644
--- a/web/apps/photos/src/components/sidebar/ReferralSettings.tsx
+++ b/web/apps/photos/src/components/sidebar/ReferralSettings.tsx
@@ -8,6 +8,7 @@ import {
type StorageBonusDetails,
} from "@/services/storage-bonus";
import CheckCircleOutlinedIcon from "@mui/icons-material/CheckCircleOutlined";
+import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import EditIcon from "@mui/icons-material/Edit";
import { Box, Button, IconButton, Stack, Typography } from "@mui/material";
import { TitledMiniDialog } from "ente-base/components/MiniDialog";
@@ -280,10 +281,28 @@ export const ReferralSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
? "details"
: screen == "success"
? "code_applied"
- : "referrals",
+ : "earn_free_storage",
)}
+ caption={
+ screen == "main" && referralView.status == "loaded"
+ ? t(
+ referralView.value.planInfo.isEnabled
+ ? "share_code_earn_storage"
+ : "referrals_paused",
+ )
+ : undefined
+ }
>
- <Stack sx={{ px: 2, py: 1, gap: 3 }}>{contents}</Stack>
+ <Stack
+ sx={{
+ px: 2,
+ py: 1,
+ gap: screen == "details" ? 2 : 3,
+ maxWidth: 552,
+ }}
+ >
+ {contents}
+ </Stack>
{isEditCodeDialogOpen && referralView.status == "loaded" && (
<EditCodeDialog
open={isEditCodeDialogOpen}
@@ -359,16 +378,6 @@ const MainContents: React.FC<MainContentsProps> = ({
return (
<>
- <Stack sx={{ gap: 0.5 }}>
- <Typography variant="h5">{t("earn_free_storage")}</Typography>
- <Typography sx={{ color: "text.muted" }}>
- {t(
- planInfo.isEnabled
- ? "share_code_earn_storage"
- : "referrals_paused",
- )}
- </Typography>
- </Stack>
{planInfo.isEnabled && (
<>
<Stack sx={{ gap: 1 }}>
@@ -396,12 +405,15 @@ const MainContents: React.FC<MainContentsProps> = ({
</>
)}
- <RowButtonGroup>
+ <RowButtonGroup sx={{ borderRadius: "14px", overflow: "hidden" }}>
{referralView.enableApplyCode && (
<>
<RowButton
variant="secondary"
label={t("apply_code")}
+ endIcon={
+ <ChevronRightIcon className="ente-chevron-right" />
+ }
onClick={onApplyCode}
/>
<RowButtonDivider />
@@ -410,6 +422,9 @@ const MainContents: React.FC<MainContentsProps> = ({
<RowButton
variant="secondary"
label={t("faq")}
+ endIcon={
+ <ChevronRightIcon className="ente-chevron-right" />
+ }
onClick={() =>
openURL(
"https://ente.com/help/photos/features/account/referral-program/",
@@ -420,6 +435,9 @@ const MainContents: React.FC<MainContentsProps> = ({
<RowButton
variant="secondary"
label={t("details")}
+ endIcon={
+ <ChevronRightIcon className="ente-chevron-right" />
+ }
onClick={onShowDetails}
/>
</RowButtonGroup>
@@ -441,9 +459,9 @@ const ReferralCodeCard: React.FC<ReferralCodeCardProps> = ({
position: "relative",
border: "1px dashed",
borderColor: "fill.muted",
- borderRadius: 2,
+ borderRadius: "14px",
px: 2,
- py: 3,
+ py: "26px",
textAlign: "center",
}}
>
@@ -466,13 +484,14 @@ const ReferralCodeCard: React.FC<ReferralCodeCardProps> = ({
sx={{
position: "absolute",
top: "50%",
- right: 4,
- width: 48,
- height: 48,
+ right: 8,
+ width: 44,
+ height: 44,
+ borderRadius: "12px",
transform: "translateY(-50%)",
}}
>
- <EditIcon />
+ <EditIcon sx={{ fontSize: 20 }} />
</IconButton>
)}
</Box>
@@ -494,11 +513,23 @@ const SuccessContents: React.FC<SuccessContentsProps> = ({
<Stack
role="status"
aria-live="polite"
- sx={{ alignItems: "center", gap: 1, pt: 2 }}
+ sx={{ alignItems: "center", gap: 1.5, pt: 1, pb: 0.5 }}
>
- <CheckCircleOutlinedIcon
- sx={{ color: "accent.main", fontSize: 72 }}
- />
+ <Box
+ sx={{
+ width: 72,
+ height: 72,
+ borderRadius: "50%",
+ bgcolor:
+ "color-mix(in srgb, var(--mui-palette-accent-main) 12%, transparent)",
+ display: "grid",
+ placeItems: "center",
+ }}
+ >
+ <CheckCircleOutlinedIcon
+ sx={{ color: "accent.main", fontSize: 40 }}
+ />
+ </Box>
<Typography
variant="h2"
component="h3"
@@ -508,21 +539,19 @@ const SuccessContents: React.FC<SuccessContentsProps> = ({
storageAmountInGB: planInfo.storageInGB,
})}
</Typography>
- </Stack>
- <RowButtonGroup>
- <RowButton
- variant="secondary"
- label={t("details")}
- onClick={onShowDetails}
- />
- </RowButtonGroup>
- <Stack sx={{ gap: 2 }}>
<Typography
variant="h5"
- sx={{ fontSize: "16px", lineHeight: "22px" }}
+ sx={{
+ fontSize: "16px",
+ lineHeight: "22px",
+ textAlign: "center",
+ pt: 1,
+ }}
>
{t("earn_more_space")}
</Typography>
+ </Stack>
+ <Stack sx={{ gap: 3 }}>
<ReferralCodeCard code={code} />
<Typography sx={{ color: "text.muted" }}>
{t("referral_storage_for_both", {
@@ -534,6 +563,16 @@ const SuccessContents: React.FC<SuccessContentsProps> = ({
storageInGB={planInfo.storageInGB}
/>
</Stack>
+ <RowButtonGroup sx={{ borderRadius: "14px", overflow: "hidden" }}>
+ <RowButton
+ variant="secondary"
+ label={t("details")}
+ endIcon={
+ <ChevronRightIcon className="ente-chevron-right" />
+ }
+ onClick={onShowDetails}
+ />
+ </RowButtonGroup>
</>
);
};
@@ -756,7 +795,12 @@ const InviteShareButton: React.FC<InviteShareButtonProps> = ({
};
return (
- <Button fullWidth color="accent" onClick={() => void handleShare()}>
+ <Button
+ fullWidth
+ color="accent"
+ sx={{ minHeight: 48, borderRadius: "12px" }}
+ onClick={() => void handleShare()}
+ >
<span aria-live="polite">
{t(copied ? "invite_copied" : "share_invite")}
</span>
@@ -835,7 +879,7 @@ const DetailsContents: React.FC<DetailsContentsProps> = ({
<>
<Stack
divider={<RowButtonDivider />}
- sx={{ bgcolor: "fill.faint", borderRadius: 2 }}
+ sx={{ bgcolor: "fill.faint", borderRadius: "14px" }}
>
{stats.map(({ label, value }) => (
<Stack