Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add clear button and autofocus to all albums search field

anandbaburajan021d9c13f84c
diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsx
index 8ee2ca377f..30ed3903af 100644
--- a/web/apps/photos/src/components/Collections/AllAlbums.tsx
+++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx
@@ -192,6 +192,7 @@ const SearchField: React.FC<SearchFieldProps> = ({ value, onChange }) => (
placeholder={t("albums_search_hint")}
value={value}
onChange={(e) => onChange(e.target.value)}
+ autoFocus
slotProps={{
input: {
startAdornment: (
@@ -199,6 +200,22 @@ const SearchField: React.FC<SearchFieldProps> = ({ value, onChange }) => (
<SearchIcon />
</InputAdornment>
),
+ endAdornment: value && (
+ <InputAdornment
+ position="end"
+ sx={{ marginRight: "0 !important" }}
+ >
+ <CloseIcon
+ fontSize="small"
+ onClick={() => onChange("")}
+ sx={{
+ color: "stroke.muted",
+ cursor: "pointer",
+ "&:hover": { color: "text.base" },
+ }}
+ />
+ </InputAdornment>
+ ),
},
}}
sx={{
@@ -215,8 +232,6 @@ const SearchField: React.FC<SearchFieldProps> = ({ value, onChange }) => (
color: "text.base",
paddingTop: "8.5px !important",
paddingBottom: "8.5px !important",
- paddingLeft: "0 !important",
- paddingRight: "14px !important",
},
"& .MuiInputAdornment-root": {
color: "stroke.muted",
@@ -346,11 +361,7 @@ const AllAlbumsContent: React.FC<AllAlbumsContentProps> = ({
// Show "no results" message if there's a search query but no results
if (hasSearchQuery && collectionSummaries.length === 0) {
return (
- <DialogContent
- sx={{
- height: "80svh",
- }}
- >
+ <DialogContent sx={{ height: "80svh" }}>
<Box
sx={{
display: "flex",
@@ -368,12 +379,7 @@ const AllAlbumsContent: React.FC<AllAlbumsContentProps> = ({
}
return (
- <DialogContent
- sx={{
- "&&": { padding: 0 },
- height: "80svh",
- }}
- >
+ <DialogContent sx={{ "&&": { padding: 0 }, height: "80svh" }}>
<AutoSizer>
{({ width, height }) => (
<FixedSizeList
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index 06b585e0da..18d6107560 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -235,7 +235,7 @@
"search_results": "Search results",
"no_results": "No results found",
"search_hint": "Search for albums, dates, descriptions, ...",
- "albums_search_hint": "Search for albums",
+ "albums_search_hint": "Search for albums...",
"album": "Album",
"date": "Date",
"description": "Description",