π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
refactor(photos):refine-sidebar-rows-and-help-about
Aswin Asokaee1063dad52
diff --git a/web/apps/photos/src/components/sidebar/Help.tsx b/web/apps/photos/src/components/sidebar/Help.tsxindex 2f4c2e3b8f..86cb8bc979 100644--- a/web/apps/photos/src/components/sidebar/Help.tsx+++ b/web/apps/photos/src/components/sidebar/Help.tsx@@ -11,7 +11,7 @@ import { saveStringAsFile } from "ente-base/utils/web";import type { SidebarActionID } from "ente-new/photos/services/search/types";import { initiateEmail, openURL } from "ente-new/photos/utils/web";import { t } from "i18next";-import React, { useCallback, useEffect } from "react";+import React, { useCallback, useEffect, useState } from "react";import { Trans } from "react-i18next";export type HelpAction = Extract<@@ -36,6 +36,11 @@ export const Help: React.FC<HelpProps> = ({onActionHandled,}) => {const { showMiniDialog } = useBaseContext();+ const [appVersion, setAppVersion] = useState("");++ useEffect(() => {+ void globalThis.electron?.appVersion().then(setAppVersion);+ }, []);const handleRootClose = () => {onClose();@@ -143,6 +148,13 @@ export const Help: React.FC<HelpProps> = ({subtitle="Share with support when something goes wrong"onClick={confirmViewLogs}/>+ {appVersion && (+ <RowCard+ title="About"+ subtitle={`Photos ${appVersion}`}+ endIcon={null}+ />+ )}</Stack></TitledNestedSidebarDrawer>);diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsxindex e5f95d81bf..372e0e9168 100644--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx@@ -26,6 +26,7 @@ import {useModalVisibility,type ModalVisibilityProps,} from "ente-base/components/utils/modal";+import { RowCard } from "ente-base/components/v2/RowCard";import { useBaseContext } from "ente-base/context";import log from "ente-base/log";import { customAPIHost } from "ente-base/origins";@@ -286,7 +287,7 @@ export const Sidebar: React.FC<SidebarProps> = ({sidebarOpen={open}{...{ onShowPlanSelector }}/>- <Stack sx={{ gap: 0.5, mb: 3 }}>+ <Stack sx={{ gap: 0.5 }}><ShortcutSectiononCloseSidebar={onClose}{...{@@ -675,45 +676,41 @@ const UtilitySection: React.FC<UtilitySectionProps> = ({}) => {return (<>- <RowButton- variant="secondary"- label={t("account")}+ <RowCard+ variant="parent"+ title={t("account")}onClick={showAccount}/>- <RowButton- variant="secondary"- label={t("referrals")}+ <RowCard+ variant="parent"+ title={t("referrals")}onClick={showReferrals}/>{isDesktop && (- <RowButton- variant="secondary"- label={t("watch_folders")}+ <RowCard+ variant="parent"+ title={t("watch_folders")}onClick={onShowWatchFolder}/>)}- <RowButton- variant="secondary"- label={t("free_up_space")}+ <RowCard+ variant="parent"+ title={t("free_up_space")}onClick={showFreeUpSpace}/>- <RowButton- variant="secondary"- label={t("preferences")}+ <RowCard+ variant="parent"+ title={t("preferences")}onClick={showPreferences}/>- <RowButton- variant="secondary"- label={t("help")}- onClick={showHelp}- />- <RowButton- variant="secondary"- label={t("export_data")}+ <RowCard variant="parent" title={t("help")} onClick={showHelp} />+ <RowCard+ variant="parent"+ title={t("export_data")}endIcon={- exportService.isExportInProgress() && (+ exportService.isExportInProgress() ? (<RowButtonEndActivityIndicator />- )+ ) : undefined}onClick={showExport}/>@@ -777,24 +774,28 @@ const UtilitySection: React.FC<UtilitySectionProps> = ({const ExitSection: React.FC<{ onLogout: () => void }> = ({ onLogout }) => (<>- <RowButton- variant="secondary"- color="critical"- label={t("logout")}+ <RowCard+ variant="parent"+ title={+ <Box component="span" sx={{ color: "critical.main" }}>+ {t("logout")}+ </Box>+ }+ endIcon={null}onClick={onLogout}/></>);const InfoSection: React.FC = () => {- const [appVersion, setAppVersion] = useState("");const [host, setHost] = useState<string | undefined>("");useEffect(() => {- void globalThis.electron?.appVersion().then(setAppVersion);void customAPIHost().then(setHost);}, []);+ if (!host) return null;+return (<><Stack@@ -804,9 +805,6 @@ const InfoSection: React.FC = () => {color: "text.muted",}}>- {appVersion && (- <Typography variant="mini">{appVersion}</Typography>- )}{host && <Typography variant="mini">{host}</Typography>}</Stack></>diff --git a/web/apps/photos/src/components/sidebar/SidebarDrawerShell.tsx b/web/apps/photos/src/components/sidebar/SidebarDrawerShell.tsxindex 88945282e8..74b14b1e6b 100644--- a/web/apps/photos/src/components/sidebar/SidebarDrawerShell.tsx+++ b/web/apps/photos/src/components/sidebar/SidebarDrawerShell.tsx@@ -35,11 +35,19 @@ export function SidebarDrawerShell({paper: {sx: {width: "min(1200px, calc(100vw - 48px))",- height: "calc(100dvh - 48px)",- maxHeight: "none",+ maxHeight: "calc(100dvh - 48px)",m: 3,borderRadius: 3,overflow: "hidden",+ "& > .MuiDrawer-docked": {+ position: "relative",+ width: "360px",+ "& > .MuiDrawer-paper": {+ position: "relative",+ height: "auto",+ maxHeight: "calc(100dvh - 48px)",+ },+ },},},}}diff --git a/web/packages/base/components/v2/RowCard.tsx b/web/packages/base/components/v2/RowCard.tsxindex 54b145f88c..21ac35151e 100644--- a/web/packages/base/components/v2/RowCard.tsx+++ b/web/packages/base/components/v2/RowCard.tsx@@ -4,6 +4,7 @@ import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton"import React from "react";interface RowCardProps {+ variant?: "default" | "parent";title: React.ReactNode;subtitle?: string;onClick?: () => void;@@ -11,6 +12,7 @@ interface RowCardProps {}export const RowCard: React.FC<RowCardProps> = ({+ variant = "default",title,subtitle,onClick,@@ -31,12 +33,24 @@ export const RowCard: React.FC<RowCardProps> = ({borderRadius: "10px",color: "text.base",bgcolor: "transparent",- "&:hover": { bgcolor: "fill.faintHover" },+ "&:hover": { bgcolor: onClick ? "fill.faintHover" : undefined },"& .MuiSvgIcon-root": { fontSize: "20px", color: "text.muted" },},+ variant == "parent" && {+ px: 2,+ m: 0.5,+ width: "calc(100% - 8px)",+ borderRadius: 2,+ },(theme) =>theme.applyStyles("dark", {- "&:hover": { bgcolor: "backdrop.muted" },+ "&:hover": {+ bgcolor: onClick+ ? variant == "parent"+ ? "fill.faintHover"+ : "backdrop.muted"+ : undefined,+ },}),]}>