π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[photos][web] Make link toggle rows clickable
AswinAsoke820f0751bc8
diff --git a/web/apps/photos/src/components/collections/CollectionShare.tsx b/web/apps/photos/src/components/collections/CollectionShare.tsxindex 9ada74f784..25766752f5 100644--- a/web/apps/photos/src/components/collections/CollectionShare.tsx+++ b/web/apps/photos/src/components/collections/CollectionShare.tsx@@ -35,7 +35,6 @@ import {import NumberAvatar from "@mui/material/Avatar";import TextField from "@mui/material/TextField";import type { LocalUser } from "ente-accounts/services/user";-import { EnteSwitch } from "ente-base/components/EnteSwitch";import { LoadingButton } from "ente-base/components/mui/LoadingButton";import {NestedSidebarDrawer,@@ -2626,13 +2625,7 @@ const PublicLinkSwitch: React.FC<variant == "inline" ? (<RowCardtitle={label}- endIcon={- <EnteSwitch- checked={checked}- onChange={onClick}- slotProps={{ input: { "aria-label": label } }}- />- }+ toggle={{ checked: !!checked, onChange: onClick }}/>) : (<RowSwitch {...{ label, checked, onClick }} />diff --git a/web/packages/base/components/RowButton.tsx b/web/packages/base/components/RowButton.tsxindex 83f2882890..15c0e05400 100644--- a/web/packages/base/components/RowButton.tsx+++ b/web/packages/base/components/RowButton.tsx@@ -206,19 +206,31 @@ export const RowSwitch: React.FC<RowSwitchProps> = ({onClick,}) => (<Stack+ component="label"direction="row"- sx={{+ sx={(theme) => ({flex: 1,justifyContent: "space-between",alignItems: "center",- px: "16px",- pr: "12px",- }}+ p: "14px 16px",+ gap: 1,+ cursor: "pointer",+ borderRadius: "8px",+ "&:hover": { bgcolor: "fill.faintHover" },+ "&:has(:focus-visible)": {+ outline: `1px solid ${theme.vars.palette.stroke.base}`,+ outlineOffset: "2px",+ },+ })}>- <Typography sx={{ py: "14px", px: "2px", fontWeight: "medium" }}>+ <Typography component="span" sx={{ fontWeight: "medium" }}>{label}</Typography>- <EnteSwitch {...{ checked, onClick }} />+ <EnteSwitch+ checked={checked}+ onChange={onClick}+ sx={{ flexShrink: 0 }}+ /></Stack>);diff --git a/web/packages/base/components/v2/RowCard.tsx b/web/packages/base/components/v2/RowCard.tsxindex 16b0be0ebc..d9459fd958 100644--- a/web/packages/base/components/v2/RowCard.tsx+++ b/web/packages/base/components/v2/RowCard.tsx@@ -1,31 +1,38 @@import ChevronRightIcon from "@mui/icons-material/ChevronRight";import { Box, Stack, Typography } from "@mui/material";+import { EnteSwitch } from "ente-base/components/EnteSwitch";import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";import React from "react";-interface RowCardProps {+type RowCardProps = {variant?: "default" | "parent";title: React.ReactNode;subtitle?: string;- onClick?: () => void;- endIcon?: React.ReactNode;-}+} & (+ | { onClick?: () => void; endIcon?: React.ReactNode; toggle?: never }+ | {+ onClick?: never;+ endIcon?: never;+ toggle: { checked: boolean; onChange: () => void };+ }+);export const RowCard: React.FC<RowCardProps> = ({variant = "default",title,subtitle,onClick,+ toggle,endIcon = <ChevronRightIcon className="ente-chevron-right" />,}) => (<Box- component={onClick ? FocusVisibleButton : "div"}+ component={toggle ? "label" : onClick ? FocusVisibleButton : "div"}onClick={onClick}sx={[{display: "flex",width: "100%",- p: "14px 8px 14px 0.5rem",+ p: "14px 8px",gap: 1,justifyContent: "space-between",alignItems: "center",@@ -33,7 +40,10 @@ export const RowCard: React.FC<RowCardProps> = ({borderRadius: "10px",color: "text.base",bgcolor: "transparent",- "&:hover": { bgcolor: onClick ? "fill.faintHover" : undefined },+ cursor: onClick || toggle ? "pointer" : undefined,+ "&:hover": {+ bgcolor: onClick || toggle ? "fill.faintHover" : undefined,+ },"& .MuiSvgIcon-root": { fontSize: "20px", color: "text.muted" },},variant == "parent" && {@@ -42,24 +52,33 @@ export const RowCard: React.FC<RowCardProps> = ({width: "calc(100% - 8px)",borderRadius: 2,},+ !!toggle &&+ ((theme) => ({+ "&:has(:focus-visible)": {+ outline: `1px solid ${theme.vars.palette.stroke.base}`,+ outlineOffset: "2px",+ },+ })),(theme) =>theme.applyStyles("dark", {"&:hover": {- bgcolor: onClick- ? variant == "parent"- ? "fill.faintHover"- : "backdrop.muted"- : undefined,+ bgcolor:+ onClick || toggle+ ? variant == "parent"+ ? "fill.faintHover"+ : "backdrop.muted"+ : undefined,},}),]}>- <Stack sx={{ minWidth: 0 }}>- <Typography noWrap sx={{ fontWeight: "medium" }}>+ <Stack component="span" sx={{ minWidth: 0 }}>+ <Typography component="span" noWrap sx={{ fontWeight: "medium" }}>{title}</Typography>{subtitle && (<Typography+ component="span"noWrapvariant="small"sx={{@@ -72,6 +91,6 @@ export const RowCard: React.FC<RowCardProps> = ({</Typography>)}</Stack>- {endIcon}+ {toggle ? <EnteSwitch {...toggle} sx={{ flexShrink: 0 }} /> : endIcon}</Box>);