Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web] Refresh File Info panel design

AswinAsok45ed1b14c937
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index 72bee17fd9..b6114e7d68 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -17,12 +17,16 @@ import {
SidebarPanelContext,
} from "./SidebarDrawerContext";
-type SidebarDrawerProps = DrawerProps & { maxWidth?: string };
+type SidebarDrawerProps = DrawerProps & {
+ maxWidth?: string;
+ disableAppTitlebarBackdrop?: boolean;
+};
export const SidebarDrawer: React.FC<SidebarDrawerProps> = ({
slotProps,
children,
maxWidth = "375px",
+ disableAppTitlebarBackdrop = false,
...rest
}) => {
const container = useContext(SidebarPanelContext);
@@ -65,7 +69,9 @@ export const SidebarDrawer: React.FC<SidebarDrawerProps> = ({
},
}}
>
- {isDesktop && !inShell && <AppTitlebarBackdrop />}
+ {isDesktop && !inShell && !disableAppTitlebarBackdrop && (
+ <AppTitlebarBackdrop />
+ )}
<Box sx={{ p: 1 }}>{children}</Box>
</Drawer>
);
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index 7555d03909..ca349fe867 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -1,19 +1,23 @@
+import {
+ ArrowLeft01Icon,
+ Calendar04Icon,
+ Camera01Icon,
+ CameraLensIcon,
+ Cancel01Icon,
+ Edit02Icon,
+ Image01Icon,
+ Location01Icon,
+ UserAdd01Icon,
+ Video02Icon,
+} from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
// TODO: Split this file to deal with the ente-new/photos imports.
-import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
-import CameraOutlinedIcon from "@mui/icons-material/CameraOutlined";
import CloseIcon from "@mui/icons-material/Close";
import DoneIcon from "@mui/icons-material/Done";
-import EditIcon from "@mui/icons-material/Edit";
-import FaceRetouchingNaturalIcon from "@mui/icons-material/FaceRetouchingNatural";
-import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";
import KeyboardArrowLeftIcon from "@mui/icons-material/KeyboardArrowLeft";
import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight";
import KeyboardOptionKeyIcon from "@mui/icons-material/KeyboardOptionKey";
-import LocationOnOutlinedIcon from "@mui/icons-material/LocationOnOutlined";
-import PhotoOutlinedIcon from "@mui/icons-material/PhotoOutlined";
-import TextSnippetOutlinedIcon from "@mui/icons-material/TextSnippetOutlined";
-import VideocamOutlinedIcon from "@mui/icons-material/VideocamOutlined";
import {
Box,
Button,
@@ -262,12 +266,30 @@ export const FileInfo: React.FC<FileInfoProps> = ({
return (
<BottomAlignedFileInfoSidebar open={open} onClose={handleClose}>
- <SidebarDrawerTitlebar
- onClose={handleClose}
- onRootClose={handleClose}
- title={t("info")}
- />
- <Stack sx={{ pt: 1, pb: 3, gap: "20px" }}>
+ <FileInfoHeader>
+ <IconButton
+ aria-label={t("go_back")}
+ onClick={handleClose}
+ sx={{ width: 24, height: 40, flexShrink: 0, p: 0 }}
+ >
+ <HugeiconsIcon icon={ArrowLeft01Icon} size={18} />
+ </IconButton>
+ <Typography
+ component="h2"
+ sx={{
+ flex: 1,
+ fontSize: 20,
+ lineHeight: "28px",
+ fontWeight: 600,
+ }}
+ >
+ {t("details")}
+ </Typography>
+ <IconButton aria-label={t("close")} onClick={handleClose}>
+ <HugeiconsIcon icon={Cancel01Icon} size={18} />
+ </IconButton>
+ </FileInfoHeader>
+ <Stack sx={{ pb: 2.5, gap: 2.5 }}>
<Caption
{...{
file,
@@ -277,99 +299,127 @@ export const FileInfo: React.FC<FileInfoProps> = ({
onEditStateChange: setCaptionEditState,
}}
/>
- <CreationTime
- {...{
- file,
- allowEdits,
- onFileMetadataUpdate,
- onNavigationLockChange: setDateTimeNavigationLocked,
- }}
- />
- <FileName
- {...{
- file,
- annotatedExif,
- allowEdits,
- onFileMetadataUpdate,
- onNavigationLockChange: setRenameNavigationLocked,
- }}
- />
-
- {annotatedExif?.takenOnDevice && (
- <InfoItem
- icon={<CameraOutlinedIcon />}
- title={annotatedExif.takenOnDevice}
- caption={createMultipartCaption(
- annotatedExif.fNumber,
- annotatedExif.exposureTime,
- annotatedExif.iso,
- )}
+ <Stack sx={{ gap: "2px" }}>
+ <CreationTime
+ {...{
+ file,
+ allowEdits,
+ onFileMetadataUpdate,
+ onNavigationLockChange: setDateTimeNavigationLocked,
+ }}
+ />
+ <FileName
+ {...{
+ file,
+ annotatedExif,
+ allowEdits,
+ onFileMetadataUpdate,
+ onNavigationLockChange: setRenameNavigationLocked,
+ }}
/>
- )}
- {location ? (
- <>
+ {annotatedExif?.takenOnDevice && (
<InfoItem
- icon={<LocationOnOutlinedIcon />}
- title={t("location")}
- caption={
- !mapEnabled || !allowMap ? (
- <Link
- href={openStreetMapLink(location)}
- target="_blank"
- rel="noopener"
- sx={{ fontWeight: "medium" }}
- >
- {t("view_on_map")}
- </Link>
- ) : (
- <LinkButtonUndecorated
- onClick={() => updateMapEnabled(false)}
- >
- {t("disable_map")}
- </LinkButtonUndecorated>
- )
+ icon={
+ <HugeiconsIcon icon={Camera01Icon} size={18} />
}
- trailingButton={
- <Stack direction="row" sx={{ gap: 1 }}>
- {allowEdits && (
- <EditButton
- onClick={showEditLocation}
+ title={annotatedExif.takenOnDevice}
+ caption={createMultipartCaption(
+ annotatedExif.fNumber,
+ annotatedExif.exposureTime,
+ annotatedExif.iso,
+ )}
+ />
+ )}
+ </Stack>
+ {(location || allowEdits) && (
+ <FileInfoSection title={t("location")}>
+ {location ? (
+ <>
+ <InfoItem
+ icon={
+ <HugeiconsIcon
+ icon={Location01Icon}
+ size={18}
/>
- )}
- <CopyButton
- size="medium"
- text={openStreetMapLink(location)}
+ }
+ caption={
+ !mapEnabled || !allowMap ? (
+ <Link
+ href={openStreetMapLink(
+ location,
+ )}
+ target="_blank"
+ rel="noopener"
+ sx={{ fontWeight: "medium" }}
+ >
+ {t("view_on_map")}
+ </Link>
+ ) : (
+ <LinkButtonUndecorated
+ onClick={() =>
+ updateMapEnabled(false)
+ }
+ >
+ {t("disable_map")}
+ </LinkButtonUndecorated>
+ )
+ }
+ trailingButton={
+ <Stack
+ direction="row"
+ sx={{
+ gap: { xs: 0, sm: 1 },
+ flexShrink: 0,
+ }}
+ >
+ {allowEdits && (
+ <EditButton
+ onClick={showEditLocation}
+ />
+ )}
+ <CopyButton
+ size="small"
+ text={openStreetMapLink(
+ location,
+ )}
+ />
+ </Stack>
+ }
+ />
+ {allowMap && (
+ <MapBox
+ key={`${location.latitude}-${location.longitude}`}
+ location={location}
+ mapEnabled={mapEnabled}
/>
- </Stack>
- }
- />
- {allowMap && (
- <MapBox
- key={`${location.latitude}-${location.longitude}`}
- location={location}
- mapEnabled={mapEnabled}
- />
+ )}
+ </>
+ ) : (
+ allowEdits && (
+ <InfoItem
+ icon={
+ <HugeiconsIcon
+ icon={Location01Icon}
+ size={18}
+ />
+ }
+ caption={
+ <LinkButtonUndecorated
+ onClick={showEditLocation}
+ >
+ {t("add_location_button")}
+ </LinkButtonUndecorated>
+ }
+ />
+ )
)}
- </>
- ) : (
- allowEdits && (
- <InfoItem
- icon={<LocationOnOutlinedIcon />}
- title={t("location")}
- caption={
- <LinkButtonUndecorated
- onClick={showEditLocation}
- >
- {t("add_location_button")}
- </LinkButtonUndecorated>
- }
- />
- )
+ </FileInfoSection>
)}
+ <FileInfoDivider />
<InfoItem
- icon={<TextSnippetOutlinedIcon />}
- title={t("details")}
+ icon={<HugeiconsIcon icon={CameraLensIcon} size={18} />}
+ title={t("exif")}
caption={
!exif ? (
<ActivityIndicator size={12} />
@@ -386,20 +436,32 @@ export const FileInfo: React.FC<FileInfoProps> = ({
(annotatedFaces.length > 0 ||
manuallyAssignedPeople.length > 0 ||
canAddPerson) && (
- <InfoItem icon={<FaceRetouchingNaturalIcon />}>
- <FilePeopleList
- file={file}
- annotatedFaceIDs={annotatedFaces}
- onSelectFace={handleSelectFace}
- manuallyAssignedPeople={manuallyAssignedPeople}
- onSelectPerson={onSelectPerson}
- onAddPerson={
- canAddPerson ? showAssignPerson : undefined
- }
- addPersonTitle={t("add_a_person")}
- addPersonLabel={t("add")}
- />
- </InfoItem>
+ <FileInfoSection title={t("people")}>
+ <FileInfoPeople>
+ <FilePeopleList
+ file={file}
+ annotatedFaceIDs={annotatedFaces}
+ onSelectFace={handleSelectFace}
+ manuallyAssignedPeople={
+ manuallyAssignedPeople
+ }
+ onSelectPerson={onSelectPerson}
+ onAddPerson={
+ canAddPerson
+ ? showAssignPerson
+ : undefined
+ }
+ addPersonTitle={t("add_a_person")}
+ addPersonLabel={t("add")}
+ addPersonIcon={
+ <HugeiconsIcon
+ icon={UserAdd01Icon}
+ size={24}
+ />
+ }
+ />
+ </FileInfoPeople>
+ </FileInfoSection>
)}
{showCollections &&
fileCollectionIDs &&
@@ -418,7 +480,12 @@ export const FileInfo: React.FC<FileInfoProps> = ({
{uploaderName && (
<Typography
variant="small"
- sx={{ m: 2, textAlign: "right", color: "text.muted" }}
+ sx={{
+ fontSize: 12,
+ lineHeight: "16px",
+ textAlign: "right",
+ color: "text.muted",
+ }}
>
{t("added_by_name", { name: uploaderName })}
</Typography>
@@ -462,7 +529,7 @@ const FileInfoNavigationHint: React.FC = () => (
display: { xs: "none", sm: "block" },
mt: "auto",
pb: 3,
- px: 2,
+ px: 0,
color: "text.muted",
opacity: 0.24,
}}
@@ -592,6 +659,8 @@ const FileInfoSidebar = styled(
(props: Pick<DialogProps, "open" | "onClose" | "children">) => (
<SidebarDrawer
{...props}
+ maxWidth="425px"
+ disableAppTitlebarBackdrop
anchor="right"
// Avoid MUI's aria-hidden focus warning when this closes.
disableRestoreFocus={true}
@@ -606,14 +675,40 @@ const FileInfoSidebar = styled(
}),
}));
-const BottomAlignedFileInfoSidebar = styled(FileInfoSidebar)({
- ".MuiDrawer-paper": { display: "flex", flexDirection: "column" },
+const BottomAlignedFileInfoSidebar = styled(FileInfoSidebar)(({ theme }) => ({
+ ".MuiDrawer-paper": {
+ display: "flex",
+ flexDirection: "column",
+ top: "calc(env(titlebar-area-height, 0px) + 12px)",
+ bottom: "calc(env(safe-area-inset-bottom, 0px) + 12px)",
+ height: "auto",
+ borderRadius: 20,
+ [theme.breakpoints.down("sm")]: {
+ bottom: 0,
+ borderRadius: "20px 20px 0 0",
+ },
+ },
".MuiDrawer-paper > .MuiBox-root": {
flex: 1,
display: "flex",
flexDirection: "column",
+ padding: "0 clamp(28px, 6vw, 30px)",
+ minWidth: 0,
+ [theme.breakpoints.down("sm")]: {
+ paddingInline: "20px",
+ paddingBottom: "env(safe-area-inset-bottom, 0px)",
+ },
},
-});
+ [theme.breakpoints.down("sm")]: {
+ "& .MuiIconButton-root": {
+ width: 44,
+ height: 44,
+ flexShrink: 0,
+ padding: 12,
+ "& > svg": { width: 20, height: 20 },
+ },
+ },
+}));
interface InfoItemProps {
icon: React.ReactNode;
@@ -622,6 +717,71 @@ interface InfoItemProps {
trailingButton?: React.ReactNode;
}
+const FileInfoHeader = styled(Stack)(({ theme }) => ({
+ position: "sticky",
+ top: 0,
+ zIndex: 2,
+ flexDirection: "row",
+ alignItems: "center",
+ gap: 8,
+ minHeight: 100,
+ paddingTop: 24,
+ [theme.breakpoints.down("sm")]: {
+ minHeight: 64,
+ paddingTop: 0,
+ gap: 4,
+ "& .MuiIconButton-root:first-of-type": { marginLeft: -12 },
+ "& .MuiIconButton-root:last-of-type": { marginRight: -12 },
+ },
+ flexShrink: 0,
+ backgroundColor: theme.vars.palette.background.paper,
+ "& .MuiIconButton-root": { color: theme.vars.palette.text.base },
+}));
+const FileInfoDivider = styled("hr")(({ theme }) => ({
+ width: "100%",
+ margin: 0,
+ border: 0,
+ borderTop: `1px solid ${theme.vars.palette.stroke.faint}`,
+ ...theme.applyStyles("dark", {
+ borderColor: `color-mix(in srgb, ${theme.vars.palette.stroke.faint} 55%, transparent)`,
+ }),
+}));
+const FileInfoSection: React.FC<React.PropsWithChildren<{ title: string }>> = ({
+ title,
+ children,
+}) => (
+ <Stack component="section" sx={{ gap: 1.75 }}>
+ <FileInfoDivider sx={{ mb: 0.75 }} />
+ <Typography
+ component="h3"
+ sx={{ fontSize: 18, lineHeight: "24px", fontWeight: 600 }}
+ >
+ {title}
+ </Typography>
+ {children}
+ </Stack>
+);
+// Keep the shared people lists unchanged outside File Info.
+const FileInfoPeople = styled(Box)(({ theme }) => ({
+ "& > div": { gap: "14px 18px", marginBlockEnd: 0 },
+ "& button": { width: 60, minWidth: 0, gap: 7 },
+ "& button > img, & button > div, & button > .MuiSkeleton-root": {
+ width: 60,
+ height: 60,
+ borderRadius: 20,
+ },
+ "& button > div": { border: 0 },
+ "& .MuiTypography-root": {
+ fontSize: 14,
+ lineHeight: "20px",
+ color: theme.vars.palette.text.base,
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+ width: "100%",
+ textAlign: "center",
+ },
+}));
const InfoItem: React.FC<React.PropsWithChildren<InfoItemProps>> = ({
icon,
title,
@@ -631,18 +791,38 @@ const InfoItem: React.FC<React.PropsWithChildren<InfoItemProps>> = ({
}) => (
<Stack
direction="row"
- sx={{ alignItems: "flex-start", flex: 1, gap: "12px" }}
+ sx={{
+ alignItems: "center",
+ minHeight: 56,
+ gap: { xs: "8px", sm: "10px" },
+ p: { xs: "8px 0", sm: "8px 10px" },
+ minWidth: 0,
+ }}
>
<InfoItemIconContainer>{icon}</InfoItemIconContainer>
{children ? (
- <Box sx={{ flex: 1, mt: "4px" }}>{children}</Box>
+ <Box sx={{ flex: 1, minWidth: 0 }}>{children}</Box>
) : (
- <Stack sx={{ flex: 1, mt: "4px", gap: "4px" }}>
- <Typography sx={{ wordBreak: "break-all" }}>{title}</Typography>
+ <Stack sx={{ flex: 1, minWidth: 0, gap: "4px" }}>
+ {title && (
+ <Typography
+ sx={{
+ overflowWrap: "anywhere",
+ fontSize: 14,
+ lineHeight: "20px",
+ }}
+ >
+ {title}
+ </Typography>
+ )}
<Typography
- variant="small"
+ variant="mini"
{...(typeof caption != "string" && { component: "div" })}
- sx={{ color: "text.muted" }}
+ sx={{
+ color: "text.muted",
+ fontSize: 12,
+ lineHeight: "16px",
+ }}
>
{caption}
</Typography>
@@ -651,26 +831,33 @@ const InfoItem: React.FC<React.PropsWithChildren<InfoItemProps>> = ({
{trailingButton}
</Stack>
);
-
-const InfoItemIconContainer = styled("div")(
- ({ theme }) => `
- width: 48px;
- aspect-ratio: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- color: ${theme.vars.palette.stroke.muted}
-`,
-);
-
+const InfoItemIconContainer = styled("div")(({ theme }) => ({
+ width: 34,
+ height: 34,
+ flexShrink: 0,
+ display: "flex",
+ justifyContent: "center",
+ alignItems: "center",
+ color: theme.vars.palette.text.muted,
+ "& > svg": { width: 18, height: 18 },
+ [theme.breakpoints.down("sm")]: {
+ width: 32,
+ "& > svg": { width: 20, height: 20 },
+ },
+}));
type EditButtonProps = ButtonishProps & { loading?: boolean };
-
const EditButton: React.FC<EditButtonProps> = ({ onClick, loading }) => (
- <IconButton onClick={onClick} disabled={!!loading} color="secondary">
+ <IconButton
+ aria-label={t("edit_details")}
+ onClick={onClick}
+ disabled={!!loading}
+ color="secondary"
+ sx={{ width: 40, height: 40, flexShrink: 0, color: "text.muted" }}
+ >
{!loading ? (
- <EditIcon />
+ <HugeiconsIcon icon={Edit02Icon} size={18} />
) : (
- <CircularProgress size={"24px"} color="inherit" />
+ <CircularProgress size={18} color="inherit" />
)}
</IconButton>
);
@@ -773,7 +960,22 @@ const Caption: React.FC<CaptionProps> = ({
};
const CaptionForm = styled("form")(({ theme }) => ({
- padding: theme.spacing(1),
+ "& .MuiFilledInput-root": {
+ backgroundColor: "transparent",
+ borderRadius: 12,
+ padding: "6px 0",
+ fontSize: 14,
+ lineHeight: "20px",
+ color: theme.vars.palette.text.muted,
+ "&:hover": { backgroundColor: theme.vars.palette.fill.fainter },
+ "&.Mui-focused": { backgroundColor: theme.vars.palette.fill.fainter },
+ "&::before": { borderBottom: 0 },
+ "&:hover:not(.Mui-disabled, .Mui-error)::before": { borderBottom: 0 },
+ "&.Mui-disabled": { backgroundColor: "transparent" },
+ },
+ "& textarea.Mui-disabled": {
+ WebkitTextFillColor: theme.vars.palette.text.muted,
+ },
}));
type CreationTimeProps = Pick<
@@ -820,7 +1022,7 @@ const CreationTime: React.FC<CreationTimeProps> = ({
return (
<>
<InfoItem
- icon={<CalendarTodayIcon />}
+ icon={<HugeiconsIcon icon={Calendar04Icon} size={18} />}
title={formattedDate(originalDate)}
caption={formattedTime(originalDate)}
trailingButton={
@@ -871,9 +1073,9 @@ const FileName: React.FC<FileNameProps> = ({
const icon =
file.metadata.fileType == FileType.video ? (
- <VideocamOutlinedIcon />
+ <HugeiconsIcon icon={Video02Icon} size={18} />
) : (
- <PhotoOutlinedIcon />
+ <HugeiconsIcon icon={Image01Icon} size={18} />
);
const fileSize = file.info?.fileSize;
@@ -907,7 +1109,7 @@ const createMultipartCaption = (
p2: string | undefined,
p3: string | undefined,
) => (
- <Stack direction="row" sx={{ gap: 1 }}>
+ <Stack direction="row" sx={{ gap: 1, flexWrap: "wrap" }}>
{p1 && <div>{p1}</div>}
{p2 && <div>{p2}</div>}
{p3 && <div>{p3}</div>}
@@ -1044,8 +1246,11 @@ const MapBox: React.FC<MapBoxProps> = ({ location, mapEnabled }) => {
};
const MapBoxContainer = styled("div")`
- height: 200px;
+ height: 156px;
width: 100%;
+ border-radius: 20px;
+ overflow: hidden;
+ flex-shrink: 0;
`;
const MapBoxEnableContainer = styled(MapBoxContainer)(
@@ -1170,7 +1375,7 @@ const Albums: React.FC<AlbumsProps> = ({
hiddenCollectionIDs,
onSelectCollection,
}) => (
- <InfoItem icon={<FolderOutlinedIcon />}>
+ <FileInfoSection title={t("albums")}>
<Stack
direction="row"
sx={{
@@ -1202,9 +1407,19 @@ const Albums: React.FC<AlbumsProps> = ({
);
})}
</Stack>
- </InfoItem>
+ </FileInfoSection>
);
const ChipButton = styled((props: ButtonProps) => (
<Button color="secondary" {...props} />
-))(({ theme }) => ({ ...theme.typography.small, padding: "8px" }));
+))(({ theme }) => ({
+ ...theme.typography.mini,
+ minHeight: 38,
+ padding: "10px 16px",
+ borderRadius: 24,
+ color: theme.vars.palette.text.muted,
+ backgroundColor: theme.vars.palette.fill.fainter,
+ textTransform: "none",
+ overflowWrap: "anywhere",
+ maxWidth: "100%",
+}));
diff --git a/web/packages/new/photos/components/PeopleList.tsx b/web/packages/new/photos/components/PeopleList.tsx
index 050d030241..1a60a114fb 100644
--- a/web/packages/new/photos/components/PeopleList.tsx
+++ b/web/packages/new/photos/components/PeopleList.tsx
@@ -122,6 +122,7 @@ export interface FilePeopleListProps {
onAddPerson?: () => void;
addPersonTitle?: string;
addPersonLabel?: string;
+ addPersonIcon?: React.ReactNode;
}
export const FilePeopleList: React.FC<FilePeopleListProps> = ({
@@ -133,6 +134,7 @@ export const FilePeopleList: React.FC<FilePeopleListProps> = ({
onAddPerson,
addPersonTitle,
addPersonLabel,
+ addPersonIcon,
}) => (
<FilePeopleList_>
{manuallyAssignedPeople
@@ -182,7 +184,7 @@ export const FilePeopleList: React.FC<FilePeopleListProps> = ({
aria-label={addPersonTitle}
>
<AddPersonAvatar>
- <PersonAddIcon />
+ {addPersonIcon ?? <PersonAddIcon />}
</AddPersonAvatar>
<Typography variant="small" sx={{ color: "text.muted" }}>
{addPersonLabel}