π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web][photos] Align sidebar colors and typography
Aswin Asokc8ef7b482fed
diff --git a/web/apps/photos/src/components/sidebar/DropdownInput.tsx b/web/apps/photos/src/components/sidebar/DropdownInput.tsxindex 1d0182f70a..5bd9a09944 100644--- a/web/apps/photos/src/components/sidebar/DropdownInput.tsx+++ b/web/apps/photos/src/components/sidebar/DropdownInput.tsx@@ -38,7 +38,15 @@ export const DropdownInput = <T extends string>({renderValue={() => {const label = options.find((o) => o.value == selected)?.label;return label ? (- <Typography sx={{ whiteSpace: "normal" }}>{label}</Typography>+ <Typography+ sx={{+ whiteSpace: "normal",+ fontSize: "13px",+ fontWeight: 500,+ }}+ >+ {label}+ </Typography>) : (<Typography sx={{ color: "text.muted" }}>{placeholder}diff --git a/web/apps/photos/src/components/sidebar/ReferralSettings.tsx b/web/apps/photos/src/components/sidebar/ReferralSettings.tsxindex 05241607d1..2f07e192ff 100644--- a/web/apps/photos/src/components/sidebar/ReferralSettings.tsx+++ b/web/apps/photos/src/components/sidebar/ReferralSettings.tsx@@ -440,7 +440,7 @@ const ReferralCodeCard: React.FC<ReferralCodeCardProps> = ({sx={{position: "relative",border: "1px dashed",- borderColor: "stroke.muted",+ borderColor: "fill.muted",borderRadius: 2,px: 2,py: 3,@@ -448,8 +448,10 @@ const ReferralCodeCard: React.FC<ReferralCodeCardProps> = ({}}><Typography- variant="h3"+ variant="h2"+ component="h3"sx={{+ fontSize: "28px",letterSpacing: "0.08em",overflowWrap: "anywhere",...(onEdit && { px: 6 }),@@ -497,7 +499,11 @@ const SuccessContents: React.FC<SuccessContentsProps> = ({<CheckCircleOutlinedIconsx={{ color: "accent.main", fontSize: 72 }}/>- <Typography variant="h3" sx={{ textAlign: "center" }}>+ <Typography+ variant="h2"+ component="h3"+ sx={{ textAlign: "center" }}+ >{t("referral_storage_claimed", {storageAmountInGB: planInfo.storageInGB,})}@@ -511,7 +517,12 @@ const SuccessContents: React.FC<SuccessContentsProps> = ({/></RowButtonGroup><Stack sx={{ gap: 2 }}>- <Typography variant="h5">{t("earn_more_space")}</Typography>+ <Typography+ variant="h5"+ sx={{ fontSize: "16px", lineHeight: "22px" }}+ >+ {t("earn_more_space")}+ </Typography><ReferralCodeCard code={code} /><Typography sx={{ color: "text.muted" }}>{t("referral_storage_for_both", {@@ -840,7 +851,7 @@ const DetailsContents: React.FC<DetailsContentsProps> = ({}}><Typography>{label}</Typography>- <Typography sx={{ fontWeight: "medium" }}>+ <Typography sx={{ fontWeight: 600 }}>{value}</Typography></Stack>diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsxindex 2f9c5d0bc6..14449abd7f 100644--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx@@ -35,6 +35,7 @@ import {useModalVisibility,type ModalVisibilityProps,} from "ente-base/components/utils/modal";+import { photosTheme } from "ente-base/components/utils/theme";import { RowCard } from "ente-base/components/v2/RowCard";import { useBaseContext } from "ente-base/context";import log from "ente-base/log";@@ -81,6 +82,7 @@ import { Account, type AccountAction } from "./accounts/Account";import { ManageMemberSubscription } from "./accounts/ManageMemberSubscription";import { openManageSubscription } from "./accounts/subscription";import { Preferences, type PreferencesAction } from "./preferences/Preferences";+import { sidebarTheme } from "./theme";type SidebarProps = ModalVisibilityProps & {normalCollectionSummaries: CollectionSummaries;@@ -390,7 +392,13 @@ type RootSidebarDrawerProps = React.PropsWithChildren<ModalVisibilityProps & { menu: React.ReactNode; onEnter?: () => void }>;-function RootSidebarDrawer({+const RootSidebarDrawer: React.FC<RootSidebarDrawerProps> = (props) => (+ <ThemeProvider theme={sidebarTheme}>+ <RootSidebarContents {...props} />+ </ThemeProvider>+);++function RootSidebarContents({open,onClose,onEnter,@@ -488,7 +496,19 @@ function RootSidebarDrawer({minHeight: 0,}}>- <Box sx={{ overflowY: "auto", scrollbarWidth: "thin" }}>+ <Box+ sx={{+ overflowY: "auto",+ scrollbarWidth: "thin",+ "& .MuiDivider-root": {+ borderColor: "stroke.muted",+ },+ "&& .MuiButton-root:hover": {+ bgcolor:+ "color-mix(in srgb, var(--mui-palette-text-base) 8%, var(--mui-palette-background-paper))",+ },+ }}+ >{menu}</Box><Box@@ -518,7 +538,7 @@ interface SectionProps {const HeaderSection: React.FC<SectionProps> = ({ onCloseSidebar }) => (<SpacedRow sx={{ mt: { xs: "6px", md: 0 }, pl: "12px", flexShrink: 0 }}>- <Typography variant="h3" sx={{ fontSize: "22px" }}>+ <Typography variant="h2" component="h3">{t("settings")}</Typography><IconButton@@ -572,10 +592,30 @@ const UserDetailsSection: React.FC<UserDetailsSectionProps> = ({return (<><Box sx={{ px: 0.5, mt: 1.5, pb: 1.5, mb: 1 }}>- <SubscriptionCard- userDetails={userDetails}- onClick={handleSubscriptionCardClick}- />+ <ThemeProvider theme={photosTheme}>+ <Box+ data-sidebar-subscription+ sx={(theme) => ({+ "--mui-palette-stroke-base":+ theme.colorSchemes.light?.palette.stroke.base,+ "--mui-palette-stroke-faint":+ theme.colorSchemes.light?.palette.stroke.faint,+ ...theme.applyStyles("dark", {+ "--mui-palette-stroke-base":+ theme.colorSchemes.dark?.palette.stroke+ .base,+ "--mui-palette-stroke-faint":+ theme.colorSchemes.dark?.palette.stroke+ .faint,+ }),+ })}+ >+ <SubscriptionCard+ userDetails={userDetails}+ onClick={handleSubscriptionCardClick}+ />+ </Box>+ </ThemeProvider>{userDetails && (<SubscriptionStatus{...{ userDetails, onShowPlanSelector }}diff --git a/web/apps/photos/src/components/sidebar/theme.ts b/web/apps/photos/src/components/sidebar/theme.tsnew file mode 100644index 0000000000..d957e968b1--- /dev/null+++ b/web/apps/photos/src/components/sidebar/theme.ts@@ -0,0 +1,170 @@+import type { CSSObject, Theme } from "@mui/material/styles";++const inter =+ '"Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';++const sidebarHeadingFont = '"Outfit Variable", Outfit, sans-serif';++/** Keep the settings palette local, including drawers and portalled menus. */+export const sidebarTheme = (theme: Theme): Theme => {+ const colors: CSSObject = {+ "--mui-palette-background-default": "#F4F4F4",+ "--mui-palette-background-paper": "#FFFFFF",+ "--mui-palette-background-paper2": "#FFFFFF",+ "--mui-palette-background-elevatedPaper": "#FFFFFF",+ "--mui-palette-text-base": "#000000",+ "--mui-palette-text-primary": "#000000",+ "--mui-palette-text-muted": "#666666",+ "--mui-palette-text-secondary": "#666666",+ "--mui-palette-text-faint": "#969696",+ "--mui-palette-fill-faint": "#F4F4F4",+ "--mui-palette-fill-fainter": "#F4F4F4",+ "--mui-palette-fill-muted": "#D2D2D2",+ "--mui-palette-fill-faintHover": "#F4F4F4",+ "--mui-palette-stroke-base": "#000000",+ "--mui-palette-stroke-muted": "#E0E0E0",+ "--mui-palette-stroke-faint": "#EBEBEB",+ "--mui-palette-stroke-fainter": "#EBEBEB",+ "--mui-palette-divider": "#EBEBEB",+ "--mui-palette-secondary-main": "#F4F4F4",+ "--mui-palette-secondary-dark": "#EAEAEA",+ "--mui-palette-primary-main": "#08C225",+ "--mui-palette-primary-mainChannel": "8 194 37",+ "--mui-palette-primary-dark": "#069D1E",+ "--mui-palette-primary-contrastText": "#FFFFFF",+ "--mui-palette-accent-main": "#08C225",+ "--mui-palette-accent-mainChannel": "8 194 37",+ "--mui-palette-accent-dark": "#069D1E",+ "--mui-palette-accent-contrastText": "#FFFFFF",+ "--mui-palette-critical-main": "#F63A3A",+ "--mui-palette-critical-mainChannel": "246 58 58",+ "--mui-palette-critical-dark": "#DD3434",+ "--mui-palette-error-main": "#F63A3A",+ "--mui-palette-FilledInput-bg": "var(--mui-palette-background-default)",+ "--mui-palette-FilledInput-hoverBg":+ "var(--mui-palette-background-default)",+ "--mui-palette-fixed-switchOn": "#08C225",+ "--mui-palette-backdrop-muted": "rgba(0, 0, 0, 0.4)",+ ...theme.applyStyles("dark", {+ "--mui-palette-background-default": "#161616",+ "--mui-palette-background-paper": "#212121",+ "--mui-palette-background-paper2": "#212121",+ "--mui-palette-background-elevatedPaper": "#212121",+ "--mui-palette-text-base": "#FFFFFF",+ "--mui-palette-text-primary": "#FFFFFF",+ "--mui-palette-text-muted": "#999999",+ "--mui-palette-text-secondary": "#999999",+ "--mui-palette-fill-faint": "#161616",+ "--mui-palette-fill-fainter": "#161616",+ "--mui-palette-fill-muted": "#292929",+ "--mui-palette-fill-faintHover": "#161616",+ "--mui-palette-stroke-base": "#FFFFFF",+ "--mui-palette-stroke-muted": "#3E3E3E",+ "--mui-palette-stroke-faint": "#2A2A2A",+ "--mui-palette-stroke-fainter": "#2A2A2A",+ "--mui-palette-divider": "#2A2A2A",+ "--mui-palette-secondary-main": "#161616",+ "--mui-palette-secondary-dark": "#0A0A0A",+ }),+ fontFamily: inter,+ "& .MuiTypography-h3:not([data-sidebar-subscription] *)": {+ fontSize: "18px",+ lineHeight: "24px",+ },+ "& .MuiTypography-small.MuiTypography-noWrap": { lineHeight: "16px" },+ "& .MuiTypography-h3 + .MuiTypography-small": {+ fontSize: "13px",+ lineHeight: "18px",+ },+ "& .MuiButton-root": { fontSize: "14px", fontWeight: 600 },+ "& .MuiButton-root:has(> .MuiStack-root):hover": {+ backgroundColor: "var(--mui-palette-background-default)",+ },+ "& .MuiInputBase-root": { fontSize: "14px" },+ "& .MuiInputBase-input::placeholder": { color: "#969696", opacity: 1 },+ "& .MuiIconButton-root:hover": {+ backgroundColor:+ "color-mix(in srgb, var(--mui-palette-text-base) 8%, var(--mui-palette-background-paper))",+ },+ "& .MuiSwitch-switchBase:not(.Mui-disabled) .MuiSwitch-thumb": {+ color: "var(--mui-palette-background-paper)",+ },+ '& svg[data-testid="ChevronRightIcon"]:not([data-sidebar-subscription] *)':+ { color: "#969696" },+ };++ return {+ ...theme,+ typography: {+ ...theme.typography,+ fontFamily: inter,+ fontWeightRegular: 400,+ fontWeightMedium: 500,+ h2: {+ ...theme.typography.h2,+ fontFamily: sidebarHeadingFont,+ fontSize: "24px",+ lineHeight: "32px",+ fontWeight: 600,+ },+ h3: { ...theme.typography.h3, fontFamily: inter, fontWeight: 600 },+ h5: {+ ...theme.typography.h5,+ fontSize: "18px",+ lineHeight: "24px",+ },+ body: {+ ...theme.typography.body,+ fontFamily: inter,+ fontSize: "14px",+ lineHeight: "20px",+ fontWeight: 400,+ },+ small: {+ ...theme.typography.small,+ fontSize: "12px",+ lineHeight: "16px",+ fontWeight: 400,+ },+ mini: {+ ...theme.typography.mini,+ fontSize: "12px",+ lineHeight: "16px",+ fontWeight: 400,+ },+ },+ components: {+ ...theme.components,+ MuiDialog: {+ ...theme.components?.MuiDialog,+ styleOverrides: {+ ...theme.components?.MuiDialog?.styleOverrides,+ root: [+ theme.components?.MuiDialog?.styleOverrides?.root,+ colors,+ ],+ },+ },+ MuiDrawer: {+ ...theme.components?.MuiDrawer,+ styleOverrides: {+ ...theme.components?.MuiDrawer?.styleOverrides,+ root: [+ theme.components?.MuiDrawer?.styleOverrides?.root,+ colors,+ ],+ },+ },+ MuiPopover: {+ ...theme.components?.MuiPopover,+ styleOverrides: {+ ...theme.components?.MuiPopover?.styleOverrides,+ root: [+ theme.components?.MuiPopover?.styleOverrides?.root,+ colors,+ ],+ },+ },+ },+ };+};