Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos] Refresh album picker and Links navigation

AswinAsok0e8947039700
diff --git a/web/apps/photos/src/components/CollectionDialog/Primitives.tsx b/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
index 147be86fb9..10fb36f7fc 100644
--- a/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
+++ b/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
@@ -1,16 +1,24 @@
-import AddIcon from "@mui/icons-material/Add";
+import { collectionDialogSearchFieldSx } from "@/components/CollectionDialog/styles";
import CloseIcon from "@mui/icons-material/Close";
import SearchIcon from "@mui/icons-material/Search";
-import { InputBase, Stack, styled, type Theme } from "@mui/material";
-import { BaseTileButton } from "ente-new/photos/components/Tiles";
+import { InputBase, Stack, type SxProps, type Theme } from "@mui/material";
+import { isSxArray } from "ente-base/components/utils/sx";
import { t } from "i18next";
import React, { useRef } from "react";
export const CollectionDialogSearchField: React.FC<{
+ icon?: React.ReactNode;
+ sx?: SxProps<Theme>;
placeholder?: string;
value: string;
onChange: (value: string) => void;
-}> = ({ value, onChange, placeholder = t("albums_search_hint") }) => {
+}> = ({
+ value,
+ onChange,
+ icon,
+ sx = [],
+ placeholder = t("albums_search_hint"),
+}) => {
const inputRef = useRef<HTMLInputElement>(null);
const handleClear = () => {
@@ -19,8 +27,15 @@ export const CollectionDialogSearchField: React.FC<{
};
return (
- <Stack direction="row" sx={searchFieldSx}>
- <SearchIcon sx={searchIconSx} />
+ <Stack
+ direction="row"
+ sx={[collectionDialogSearchFieldSx, ...(isSxArray(sx) ? sx : [sx])]}
+ >
+ {icon ? (
+ <Stack sx={searchIconSx}>{icon}</Stack>
+ ) : (
+ <SearchIcon sx={searchIconSx} />
+ )}
<InputBase
inputRef={inputRef}
fullWidth
@@ -50,15 +65,6 @@ const searchIconSx = (theme: Theme) => ({
...theme.applyStyles("dark", { color: "rgba(255 255 255 / 0.4)" }),
});
-const searchFieldSx = (theme: Theme) => ({
- alignItems: "center",
- gap: "10px",
- height: 44,
- borderRadius: "16px",
- backgroundColor: "background.paper",
- px: "14px",
- ...theme.applyStyles("dark", { backgroundColor: "#282828" }),
-});
const searchInputSx = {
fontSize: 14,
lineHeight: "20px",
@@ -71,52 +77,3 @@ const clearIconSx = {
cursor: "pointer",
"&:hover": { color: "text.base" },
};
-
-export const CollectionTileButton = styled(BaseTileButton)`
- flex: none;
- width: var(--tile-size, 100%);
- height: auto;
- aspect-ratio: 1;
- border-radius: 16px;
-`;
-
-export const CollectionTileTextOverlay = styled("div")`
- position: absolute;
- inset: 0;
- padding: 10px;
- color: #fff;
- background: linear-gradient(
- -10deg,
- rgba(0, 0, 0, 0.1) 0%,
- rgba(0, 0, 0, 0.2) 50%,
- rgba(0, 0, 0, 0.4) 60%,
- rgba(0, 0, 0, 0.6) 100%
- );
-`;
-
-export const CreateAlbumTile: React.FC<{ onClick: () => void }> = ({
- onClick,
-}) => (
- <CollectionTileButton aria-label={t("new_album")} onClick={onClick}>
- <CreateTileInner>
- <AddIcon />
- </CreateTileInner>
- </CollectionTileButton>
-);
-
-const CreateTileInner = styled("span")(({ theme }) => ({
- position: "absolute",
- inset: 0,
- padding: 10,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- border: "1px dashed",
- borderColor: theme.vars.palette.stroke.muted,
- borderRadius: 16,
- color: theme.vars.palette.text.muted,
- "&:hover": { borderColor: "rgba(0 0 0 / 0.45)" },
- ...theme.applyStyles("dark", {
- "&:hover": { borderColor: "rgba(255 255 255 / 0.45)" },
- }),
-}));
diff --git a/web/apps/photos/src/components/CollectionDialog/styles.ts b/web/apps/photos/src/components/CollectionDialog/styles.ts
index cfa71226fe..43d6dacf6c 100644
--- a/web/apps/photos/src/components/CollectionDialog/styles.ts
+++ b/web/apps/photos/src/components/CollectionDialog/styles.ts
@@ -39,11 +39,6 @@ export const collectionDialogHeaderRowSx = {
justifyContent: "space-between",
gap: "12px",
};
-export const collectionDialogHeaderActionsSx = {
- alignItems: "center",
- gap: 1,
- flexShrink: 0,
-};
export const collectionDialogTitleSx = {
fontSize: 24,
lineHeight: "32px",
@@ -69,13 +64,6 @@ export const collectionDialogIconButtonSx = (theme: Theme) => ({
backgroundColor: "rgba(255 255 255 / 0.12)",
}),
});
-export const collectionDialogDividerSx = (theme: Theme) => ({
- height: "1px",
- backgroundColor: "rgba(0 0 0 / 0.06)",
- ...theme.applyStyles("dark", {
- backgroundColor: "rgba(255 255 255 / 0.08)",
- }),
-});
export const collectionDialogNoResultsSx = {
flex: 1,
display: "flex",
@@ -83,3 +71,13 @@ export const collectionDialogNoResultsSx = {
alignItems: "center",
minHeight: 154,
};
+
+export const collectionDialogSearchFieldSx = (theme: Theme) => ({
+ alignItems: "center",
+ gap: "10px",
+ height: 44,
+ borderRadius: "16px",
+ backgroundColor: "background.paper",
+ px: "14px",
+ ...theme.applyStyles("dark", { backgroundColor: "#282828" }),
+});
diff --git a/web/apps/photos/src/components/CollectionSelector.tsx b/web/apps/photos/src/components/CollectionSelector.tsx
index 64e03e4b35..25619169a1 100644
--- a/web/apps/photos/src/components/CollectionSelector.tsx
+++ b/web/apps/photos/src/components/CollectionSelector.tsx
@@ -1,24 +1,24 @@
-import {
- CreateAlbumTile,
- CollectionDialogSearchField as SearchField,
- CollectionTileButton as TileButton,
- CollectionTileTextOverlay as TopGradientOverlay,
-} from "@/components/CollectionDialog/Primitives";
+import { CollectionDialogSearchField as SearchField } from "@/components/CollectionDialog/Primitives";
import {
collectionDialogFullScreenQuery,
- collectionDialogBodyMutedSx as countSx,
- collectionDialogDividerSx as dividerSx,
- collectionDialogHeaderActionsSx as headerActionsSx,
collectionDialogHeaderRowSx as headerRowSx,
collectionDialogHeaderSx as headerSx,
collectionDialogIconButtonSx as iconButtonSx,
collectionDialogNoResultsSx as noResultsSx,
collectionDialogPaperSx as paperSx,
+ collectionDialogSearchFieldSx as searchFieldSx,
collectionDialogTitleSx as titleSx,
} from "@/components/CollectionDialog/styles";
import { CollectionsSortOptions } from "@/components/CollectionsSortOptions";
+import {
+ Cancel01Icon,
+ FilterHorizontalIcon,
+ Image01Icon,
+ ImageAdd02Icon,
+ Search01Icon,
+} from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
import ArchiveIcon from "@mui/icons-material/Archive";
-import CloseIcon from "@mui/icons-material/Close";
import FavoriteIcon from "@mui/icons-material/Favorite";
import PushPinIcon from "@mui/icons-material/PushPin";
import {
@@ -26,13 +26,19 @@ import {
Dialog,
IconButton,
Stack,
- Tooltip,
+ styled,
+ Tab,
+ Tabs,
Typography,
useMediaQuery,
+ type Theme,
} from "@mui/material";
+import { CenteredFill } from "ente-base/components/containers";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
+import { isSxArray } from "ente-base/components/utils/sx";
import type { Collection } from "ente-media/collection";
import { ItemCard } from "ente-new/photos/components/Tiles";
+import { UnstyledButton } from "ente-new/photos/components/UnstyledButton";
import {
canAddToCollection,
canMoveToCollection,
@@ -84,6 +90,10 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
const isFullScreen = useMediaQuery(collectionDialogFullScreenQuery);
const [searchTerm, setSearchTerm] = useState("");
+ const [scrollFade, setScrollFade] = useState(0);
+ const [category, setCategory] = useState<
+ "all" | "mine" | "shared" | "received"
+ >("all");
const [sortBy, setSortBy] =
useCollectionSelectorSortByLocalState("name-asc");
const [filteredCollections, setFilteredCollections] = useState<
@@ -92,6 +102,8 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
const handleExited = useCallback(() => {
setSearchTerm("");
+ setScrollFade(0);
+ setCategory("all");
onExited?.();
}, [onExited]);
@@ -116,33 +128,17 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
return true;
}
- const isUserFavorites =
- collectionSummary.type === "userFavorites";
- if (
- attributes.action === "add" ||
- attributes.action === "move"
- ) {
- return (
- canAddToCollection(collectionSummary) &&
- !isUserFavorites
- );
- }
- if (attributes.action === "upload") {
- return (
- (canAddToCollection(collectionSummary) ||
- collectionSummary.type === "uncategorized") &&
- !isUserFavorites
- );
- }
- if (attributes.action === "restore") {
- return (
- (canMoveToCollection(collectionSummary) ||
- collectionSummary.type === "uncategorized") &&
- !isUserFavorites
- );
- }
+ if (collectionSummary.type === "userFavorites") return false;
+ const canSelect =
+ attributes.action === "restore" ||
+ attributes.action === "unhide"
+ ? canMoveToCollection
+ : canAddToCollection;
return (
- canMoveToCollection(collectionSummary) && !isUserFavorites
+ canSelect(collectionSummary) ||
+ ((attributes.action === "upload" ||
+ attributes.action === "restore") &&
+ collectionSummary.type === "uncategorized")
);
},
);
@@ -168,16 +164,31 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
}, [collectionSummaries, attributes, open, onClose, sortBy, handleExited]);
const searchFilteredCollections = useMemo(() => {
- if (!searchTerm.trim()) return filteredCollections;
- const searchLower = searchTerm.toLowerCase();
- return filteredCollections.filter((collectionSummary) =>
- collectionSummary.name.toLowerCase().includes(searchLower),
- );
- }, [filteredCollections, searchTerm]);
+ const searchLower = searchTerm.trim() ? searchTerm.toLowerCase() : "";
+ return filteredCollections.filter((collectionSummary) => {
+ const { attributes } = collectionSummary;
+ const isReceived = attributes.has("sharedIncoming");
+ const matchesCategory =
+ category == "all" ||
+ (category == "mine" && !isReceived) ||
+ (category == "shared" &&
+ !isReceived &&
+ (attributes.has("sharedOutgoing") ||
+ attributes.has("sharedViaLink"))) ||
+ (category == "received" && isReceived);
+ return (
+ matchesCategory &&
+ collectionSummary.name.toLowerCase().includes(searchLower)
+ );
+ });
+ }, [filteredCollections, searchTerm, category]);
const showCreateButton =
- !searchTerm.trim() ||
- t("create_albums").toLowerCase().includes(searchTerm.toLowerCase());
+ (category == "all" || category == "mine") &&
+ (!searchTerm.trim() ||
+ t("create_albums")
+ .toLowerCase()
+ .includes(searchTerm.toLowerCase()));
if (!filteredCollections.length || !attributes) return null;
@@ -201,42 +212,109 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
fullScreen={isFullScreen}
maxWidth={false}
slotProps={{
- paper: { sx: paperSx },
+ paper: {
+ sx: [
+ ...(isSxArray(paperSx) ? paperSx : [paperSx]),
+ {
+ width: isFullScreen
+ ? "100%"
+ : "min(600px, calc(100svw - 64px))",
+ maxWidth: isFullScreen ? "100%" : 600,
+ maxHeight: isFullScreen
+ ? "100%"
+ : "min(600px, calc(100svh - 64px))",
+ boxSizing: "border-box",
+ },
+ ],
+ },
transition: { onExited: handleExited },
}}
>
- <Stack sx={headerSx}>
- <Stack direction="row" sx={headerRowSx}>
- <Stack sx={{ minWidth: 0, gap: "2px" }}>
- <Typography sx={titleSx}>
- {collectionSelectorTitle(action)}
- </Typography>
- <Typography sx={countSx}>
- {searchTerm
- ? `${searchFilteredCollections.length} / ${filteredCollections.length} ${t("albums")}`
- : t("albums_count", {
- count: filteredCollections.length,
- })}
- </Typography>
- </Stack>
- <Stack direction="row" sx={headerActionsSx}>
+ <Stack
+ sx={{
+ ...headerSx,
+ gap: "20px",
+ pb: 0,
+ position: "relative",
+ zIndex: 1,
+ flexShrink: 0,
+ }}
+ >
+ <Stack
+ direction="row"
+ sx={{ ...headerRowSx, alignItems: "center" }}
+ >
+ <Typography
+ sx={{
+ ...titleSx,
+ fontFamily: '"Outfit Variable", sans-serif',
+ }}
+ >
+ {collectionSelectorTitle(action)}
+ </Typography>
+ <IconButton
+ aria-label={t("close")}
+ onClick={handleClose}
+ sx={iconButtonSx}
+ >
+ <HugeiconsIcon icon={Cancel01Icon} size={18} />
+ </IconButton>
+ </Stack>
+ <Stack sx={{ gap: "16px" }}>
+ <Stack
+ direction="row"
+ sx={{ alignItems: "center", gap: "8px" }}
+ >
+ <SearchField
+ value={searchTerm}
+ onChange={setSearchTerm}
+ icon={
+ <HugeiconsIcon
+ icon={Search01Icon}
+ size={18}
+ color="currentColor"
+ />
+ }
+ sx={{
+ flex: 1,
+ minWidth: 0,
+ px: "16px",
+ gap: "12px",
+ }}
+ />
<CollectionsSortOptions
activeSortBy={sortBy}
onChangeSortBy={setSortBy}
variant="v2"
+ triggerIcon={
+ <HugeiconsIcon
+ icon={FilterHorizontalIcon}
+ size={18}
+ />
+ }
+ triggerSx={[searchFieldSx, { width: 44, p: 0 }]}
/>
- <IconButton
- aria-label={t("close")}
- onClick={handleClose}
- sx={iconButtonSx}
- >
- <CloseIcon sx={{ fontSize: 18 }} />
- </IconButton>
</Stack>
+ <Tabs
+ value={category}
+ onChange={(_, value: typeof category) =>
+ setCategory(value)
+ }
+ variant="scrollable"
+ scrollButtons="auto"
+ aria-label={t("filter_albums")}
+ sx={categoryTabsSx}
+ >
+ <Tab value="all" label={t("all")} />
+ <Tab value="mine" label={t("my_albums")} />
+ <Tab value="shared" label={t("shared_albums_label")} />
+ <Tab
+ value="received"
+ label={t("received_albums_label")}
+ />
+ </Tabs>
</Stack>
- <SearchField value={searchTerm} onChange={setSearchTerm} />
</Stack>
- <Box sx={dividerSx} />
{searchFilteredCollections.length === 0 && !showCreateButton ? (
<Box sx={noResultsSx}>
<Typography sx={{ color: "text.muted" }}>
@@ -244,15 +322,32 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
</Typography>
</Box>
) : (
- <Box sx={gridSx}>
+ <Box
+ sx={gridSx}
+ style={{
+ maskImage: `linear-gradient(to bottom, rgba(0, 0, 0, ${1 - scrollFade}), #000 64px)`,
+ }}
+ onScroll={(event) =>
+ setScrollFade(
+ Math.min(
+ Math.max(event.currentTarget.scrollTop, 0) / 32,
+ 1,
+ ),
+ )
+ }
+ >
{showCreateButton && (
- <CreateAlbumTile onClick={onCreateCollection} />
+ <AlbumTile onClick={onCreateCollection} />
)}
{searchFilteredCollections.map((collectionSummary) => (
- <CollectionSummaryButton
+ <AlbumTile
key={collectionSummary.id}
collectionSummary={collectionSummary}
- onClick={handleCollectionSummaryClick}
+ onClick={() =>
+ void handleCollectionSummaryClick(
+ collectionSummary.id,
+ )
+ }
/>
))}
</Box>
@@ -261,20 +356,16 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
);
};
-const collectionSelectorTitle = (action: CollectionSelectorAction) => {
- switch (action) {
- case "upload":
- return t("upload_to_album");
- case "add":
- return t("add_to_album");
- case "move":
- return t("move_to_album");
- case "restore":
- return t("restore_to_album");
- case "unhide":
- return t("unhide_to_album");
- }
-};
+const collectionSelectorTitle = (action: CollectionSelectorAction) =>
+ t(
+ {
+ upload: "upload_to_album",
+ add: "pick_an_album",
+ move: "move_to_album",
+ restore: "restore_to_album",
+ unhide: "unhide_to_album",
+ }[action],
+ );
const useCollectionSelectorSortByLocalState = (
initialValue: CollectionsSortBy,
@@ -297,77 +388,170 @@ const useCollectionSelectorSortByLocalState = (
return [value, setter] as const;
};
+const categoryTabsSx = (theme: Theme) => ({
+ minHeight: 26,
+ borderBottom: "1px solid",
+ borderColor: "rgba(0 0 0 / 0.04)",
+ ...theme.applyStyles("dark", { borderColor: "rgba(255 255 255 / 0.06)" }),
+ "& .MuiTabs-list": { gap: "24px", px: "4px" },
+ "& .MuiTabs-indicator": {
+ height: 2,
+ borderRadius: "1px",
+ bgcolor: "text.base",
+ },
+ "& .MuiTab-root": {
+ minWidth: 0,
+ minHeight: 26,
+ p: "0 0 8px",
+ fontSize: 13,
+ lineHeight: "16px",
+ fontWeight: 500,
+ textTransform: "none",
+ color: "text.muted",
+ "&.Mui-selected": { color: "text.base", fontWeight: 600 },
+ },
+});
+
const gridSx = {
flex: 1,
minHeight: 0,
p: "16px 20px 20px",
display: "grid",
- gridTemplateColumns: "repeat(3, minmax(0, 1fr))",
+ gridTemplateColumns: "repeat(4, minmax(0, 124px))",
+ justifyContent: "space-between",
+ "@media (width < 600px)": {
+ gridTemplateColumns: "repeat(3, minmax(0, 1fr))",
+ },
+ "@media (width < 360px)": {
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
+ },
gridAutoRows: "max-content",
- gap: "8px",
+ columnGap: "16px",
+ rowGap: "24px",
alignContent: "start",
overflowY: "auto",
};
-interface CollectionSummaryButtonProps {
- collectionSummary: CollectionSummary;
- onClick: (collectionSummaryID: number) => void;
-}
-
-const CollectionSummaryButton: React.FC<CollectionSummaryButtonProps> = ({
- collectionSummary,
- onClick,
-}) => {
- const isFavorite = collectionSummary.type === "userFavorites";
+const AlbumTile: React.FC<{
+ collectionSummary?: CollectionSummary;
+ onClick: () => void;
+}> = ({ collectionSummary, onClick }) => {
+ const isFavorite = collectionSummary?.type === "userFavorites";
const isPinned =
- collectionSummary.attributes.has("pinned") ||
- collectionSummary.attributes.has("shareePinned");
- const isArchived = collectionSummary.attributes.has("archived");
+ collectionSummary?.attributes.has("pinned") ||
+ collectionSummary?.attributes.has("shareePinned");
+ const isArchived = collectionSummary?.attributes.has("archived");
+ const name = collectionSummary?.name ?? t("new_album");
+ const emptyCover = (
+ <CenteredFill
+ sx={{ position: "absolute", inset: 0, color: "text.muted" }}
+ >
+ <HugeiconsIcon
+ icon={collectionSummary ? Image01Icon : ImageAdd02Icon}
+ size={36}
+ strokeWidth={1.5}
+ />
+ </CenteredFill>
+ );
return (
- <ItemCard
- TileComponent={TileButton}
- coverFile={collectionSummary.coverFile}
- onClick={() => onClick(collectionSummary.id)}
+ <AlbumButton
+ title={collectionSummary?.name}
+ aria-label={collectionSummary ? undefined : name}
+ onClick={onClick}
>
- <TopGradientOverlay>
- <Tooltip title={collectionSummary.name} arrow>
+ {collectionSummary ? (
+ <ItemCard
+ TileComponent={AlbumCover}
+ coverFile={collectionSummary.coverFile}
+ >
+ {!collectionSummary.coverFile && emptyCover}
+ {(isFavorite || isPinned || isArchived) && (
+ <Box
+ sx={{
+ position: "absolute",
+ bottom: 8,
+ left: 8,
+ display: "flex",
+ gap: 0.5,
+ color: "white",
+ filter: "drop-shadow(0 1px 2px rgba(0,0,0,.4))",
+ }}
+ >
+ {isFavorite && (
+ <FavoriteIcon sx={{ fontSize: 16 }} />
+ )}
+ {isPinned && <PushPinIcon sx={{ fontSize: 16 }} />}
+ {isArchived && (
+ <ArchiveIcon sx={{ fontSize: 16 }} />
+ )}
+ </Box>
+ )}
+ </ItemCard>
+ ) : (
+ <AlbumCover>{emptyCover}</AlbumCover>
+ )}
+ <Stack
+ component="span"
+ sx={{ minWidth: 0, width: "100%", gap: "2px" }}
+ >
+ <Typography component="span" noWrap sx={albumNameSx}>
+ {name}
+ </Typography>
+ {collectionSummary && (
<Typography
+ component="span"
+ noWrap
sx={{
- fontSize: 14,
- lineHeight: "20px",
+ fontSize: 12,
+ lineHeight: "16px",
fontWeight: 500,
- overflow: "hidden",
- textOverflow: "ellipsis",
- display: "-webkit-box",
- WebkitLineClamp: 3,
- WebkitBoxOrient: "vertical",
+ color: "text.muted",
}}
>
- {collectionSummary.name}
+ {t("album_items_count", {
+ count: collectionSummary.fileCount,
+ })}
</Typography>
- </Tooltip>
- </TopGradientOverlay>
- {(isFavorite || isPinned || isArchived) && (
- <Box
- sx={{
- position: "absolute",
- bottom: 8,
- right: 8,
- display: "flex",
- gap: 0.5,
- }}
- >
- {isFavorite && (
- <FavoriteIcon sx={{ fontSize: 20, color: "white" }} />
- )}
- {isPinned && (
- <PushPinIcon sx={{ fontSize: 20, color: "white" }} />
- )}
- {isArchived && (
- <ArchiveIcon sx={{ fontSize: 20, color: "white" }} />
- )}
- </Box>
- )}
- </ItemCard>
+ )}
+ </Stack>
+ </AlbumButton>
);
};
+
+const albumNameSx = { fontSize: 14, lineHeight: "20px", fontWeight: 500 };
+
+const AlbumButton = styled(UnstyledButton)(({ theme }) => ({
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "flex-start",
+ gap: 8,
+ minWidth: 0,
+ width: "100%",
+ textAlign: "left",
+ color: theme.vars.palette.text.base,
+ borderRadius: 20,
+ "&:hover": { opacity: 0.86 },
+ "&:focus-visible": {
+ outline: `2px solid ${theme.vars.palette.stroke.base}`,
+ outlineOffset: 4,
+ },
+}));
+
+const AlbumCover = styled("div")(({ theme }) => ({
+ backgroundColor: theme.vars.palette.background.paper,
+ ...theme.applyStyles("dark", {
+ backgroundColor: theme.vars.palette.fill.faint,
+ }),
+ width: "100%",
+ aspectRatio: "1",
+ flexShrink: 0,
+ borderRadius: 20,
+ overflow: "hidden",
+ position: "relative",
+ "& > img": {
+ width: "100%",
+ height: "100%",
+ objectFit: "cover",
+ display: "block",
+ },
+}));
diff --git a/web/apps/photos/src/components/SortOptions.tsx b/web/apps/photos/src/components/SortOptions.tsx
index 11a952ed47..249e2f8d2c 100644
--- a/web/apps/photos/src/components/SortOptions.tsx
+++ b/web/apps/photos/src/components/SortOptions.tsx
@@ -9,11 +9,14 @@ import {
} from "@mui/material";
import type { MenuProps } from "@mui/material/Menu";
import { ContextMenu, ContextMenuItem } from "ente-base/components/ContextMenu";
+import { isSxArray } from "ente-base/components/utils/sx";
import { t } from "i18next";
import React, { useRef, useState } from "react";
export interface SortOptionsAppearanceProps {
variant?: "default" | "v2";
+ triggerIcon?: React.ReactNode;
+ triggerSx?: IconButtonProps["sx"];
transparentTriggerButtonBackground?: boolean;
}
@@ -42,6 +45,8 @@ export function SortOptions<Category extends string>({
options,
onChange,
variant = "default",
+ triggerIcon,
+ triggerSx = [],
transparentTriggerButtonBackground,
}: SortOptionsProps<Category>) {
const [anchorEl, setAnchorEl] = useState<MenuProps["anchorEl"]>();
@@ -79,9 +84,16 @@ export function SortOptions<Category extends string>({
aria-haspopup="true"
aria-expanded={anchorEl ? "true" : undefined}
aria-label={isV2 ? t("sort_by") : undefined}
- sx={triggerButtonSxProps}
+ sx={[
+ ...(isSxArray(triggerButtonSxProps)
+ ? triggerButtonSxProps
+ : [triggerButtonSxProps]),
+ ...(isSxArray(triggerSx) ? triggerSx : [triggerSx]),
+ ]}
>
- <SortIcon sx={isV2 ? { fontSize: 20 } : undefined} />
+ {triggerIcon ?? (
+ <SortIcon sx={isV2 ? { fontSize: 20 } : undefined} />
+ )}
</IconButton>
<ContextMenu
id={ariaID}
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
index 1b776fec04..3b9840e7cb 100644
--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
@@ -138,7 +138,6 @@ export const PhotosNavigationShell: React.FC<
if (
galleryNavigation &&
!props.isInSearchMode &&
- mode != "links" &&
((props.mode == mode &&
galleryNavigation.activeCollectionID !=
PseudoCollectionID.all) ||
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index cccc5f6bd7..660f9fa4c2 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -800,6 +800,8 @@
"no_large_files": "No large files found",
"delete_files_button": "Delete {{count, number}} files",
"all": "All",
+ "my_albums": "My albums",
+ "pick_an_album": "Pick an album",
"filter_albums": "Filter albums",
"shared_albums_label": "Shared",
"received_albums_label": "Received",