Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos] Restore the original album picker sort control

AswinAsok45fa9dd86981
diff --git a/web/apps/photos/src/components/CollectionDialog/Primitives.tsx b/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
index 10fb36f7fc..01445fb849 100644
--- a/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
+++ b/web/apps/photos/src/components/CollectionDialog/Primitives.tsx
@@ -1,4 +1,3 @@
-import { collectionDialogSearchFieldSx } from "@/components/CollectionDialog/styles";
import CloseIcon from "@mui/icons-material/Close";
import SearchIcon from "@mui/icons-material/Search";
import { InputBase, Stack, type SxProps, type Theme } from "@mui/material";
@@ -29,7 +28,7 @@ export const CollectionDialogSearchField: React.FC<{
return (
<Stack
direction="row"
- sx={[collectionDialogSearchFieldSx, ...(isSxArray(sx) ? sx : [sx])]}
+ sx={[searchFieldSx, ...(isSxArray(sx) ? sx : [sx])]}
>
{icon ? (
<Stack sx={searchIconSx}>{icon}</Stack>
@@ -65,6 +64,16 @@ 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",
diff --git a/web/apps/photos/src/components/CollectionDialog/styles.ts b/web/apps/photos/src/components/CollectionDialog/styles.ts
index 43d6dacf6c..43fb068d27 100644
--- a/web/apps/photos/src/components/CollectionDialog/styles.ts
+++ b/web/apps/photos/src/components/CollectionDialog/styles.ts
@@ -39,6 +39,11 @@ export const collectionDialogHeaderRowSx = {
justifyContent: "space-between",
gap: "12px",
};
+export const collectionDialogHeaderActionsSx = {
+ alignItems: "center",
+ gap: 1,
+ flexShrink: 0,
+};
export const collectionDialogTitleSx = {
fontSize: 24,
lineHeight: "32px",
@@ -71,13 +76,3 @@ 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 55918c2e51..a78d8af94a 100644
--- a/web/apps/photos/src/components/CollectionSelector.tsx
+++ b/web/apps/photos/src/components/CollectionSelector.tsx
@@ -1,18 +1,17 @@
import { CollectionDialogSearchField as SearchField } from "@/components/CollectionDialog/Primitives";
import {
collectionDialogFullScreenQuery,
+ 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,
@@ -252,49 +251,34 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = (
>
{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",
- }}
- />
+ <Stack direction="row" sx={headerActionsSx}>
<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}
+ >
+ <HugeiconsIcon icon={Cancel01Icon} size={18} />
+ </IconButton>
</Stack>
+ </Stack>
+ <Stack sx={{ gap: "16px" }}>
+ <SearchField
+ value={searchTerm}
+ onChange={setSearchTerm}
+ icon={
+ <HugeiconsIcon
+ icon={Search01Icon}
+ size={18}
+ color="currentColor"
+ />
+ }
+ sx={{ minWidth: 0, px: "16px", gap: "12px" }}
+ />
<Tabs
value={category}
onChange={(_, value: typeof category) =>
diff --git a/web/apps/photos/src/components/SortOptions.tsx b/web/apps/photos/src/components/SortOptions.tsx
index 249e2f8d2c..11a952ed47 100644
--- a/web/apps/photos/src/components/SortOptions.tsx
+++ b/web/apps/photos/src/components/SortOptions.tsx
@@ -9,14 +9,11 @@ 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;
}
@@ -45,8 +42,6 @@ export function SortOptions<Category extends string>({
options,
onChange,
variant = "default",
- triggerIcon,
- triggerSx = [],
transparentTriggerButtonBackground,
}: SortOptionsProps<Category>) {
const [anchorEl, setAnchorEl] = useState<MenuProps["anchorEl"]>();
@@ -84,16 +79,9 @@ export function SortOptions<Category extends string>({
aria-haspopup="true"
aria-expanded={anchorEl ? "true" : undefined}
aria-label={isV2 ? t("sort_by") : undefined}
- sx={[
- ...(isSxArray(triggerButtonSxProps)
- ? triggerButtonSxProps
- : [triggerButtonSxProps]),
- ...(isSxArray(triggerSx) ? triggerSx : [triggerSx]),
- ]}
+ sx={triggerButtonSxProps}
>
- {triggerIcon ?? (
- <SortIcon sx={isV2 ? { fontSize: 20 } : undefined} />
- )}
+ <SortIcon sx={isV2 ? { fontSize: 20 } : undefined} />
</IconButton>
<ContextMenu
id={ariaID}