Skip to content

armgit / ente

Public Imported from GitHub
0

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

style(photos):refine-search-people-rows-and-results-height

Aswin Asok816f279e7405
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 5f6bb7445e..389442218c 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -564,6 +564,8 @@ const createSelectStyles = (
}),
menuList: (style) => ({
...style,
+ minHeight: "min(320px, max(0px, calc(100dvh - 280px)))",
+ maxHeight: "min(320px, max(0px, calc(100dvh - 280px)))",
display: "flex",
flexDirection: "column",
gap: "8px",
@@ -598,6 +600,7 @@ const createSelectStyles = (
},
}),
groupHeading: (style) => ({ ...style, margin: 0, padding: 0 }),
+ noOptionsMessage: (style) => ({ ...style, padding: 0 }),
option: (style, { isFocused }) => ({
...style,
padding: 0,
@@ -744,9 +747,7 @@ const EmptyState: React.FC<
const SearchPeopleHeader: React.FC<ButtonishProps> = ({ onClick }) => (
<UnstyledButton {...{ onClick }}>
- <Typography
- sx={{ color: "text.muted", ":hover": { color: "text.base" } }}
- >
+ <Typography variant="h6" sx={{ color: "text.base" }}>
{t("people")}
</Typography>
</UnstyledButton>
diff --git a/web/packages/new/photos/components/PeopleList.tsx b/web/packages/new/photos/components/PeopleList.tsx
index 80d17ddf9e..165016473d 100644
--- a/web/packages/new/photos/components/PeopleList.tsx
+++ b/web/packages/new/photos/components/PeopleList.tsx
@@ -1,5 +1,6 @@
+import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
import PersonAddIcon from "@mui/icons-material/PersonAdd";
-import { Skeleton, styled, Typography } from "@mui/material";
+import { Skeleton, Stack, styled, Typography } from "@mui/material";
import { useIsSmallWidth } from "ente-base/components/utils/hooks";
import type { EnteFile } from "ente-media/file";
import { faceCrop, type AnnotatedFaceID } from "ente-new/photos/services/ml";
@@ -7,7 +8,9 @@ import type {
Person,
PreviewableFace,
} from "ente-new/photos/services/ml/people";
+import { t } from "i18next";
import React, { useEffect, useState } from "react";
+import { ItemCard } from "./Tiles";
import { UnstyledButton } from "./UnstyledButton";
export interface SearchPeopleListProps {
@@ -21,22 +24,49 @@ export const SearchPeopleList: React.FC<SearchPeopleListProps> = ({
}) => {
const isSmallWidth = useIsSmallWidth();
return (
- <SearchPeopleContainer
- sx={[
- people.length > 3
- ? { justifyContent: "center" }
- : { justifyContent: "start" },
- ]}
- >
+ <SearchPeopleContainer>
{people.slice(0, isSmallWidth ? 6 : 7).map((person) => (
<SearchPersonButton
key={person.id}
onClick={() => onSelectPerson(person.id)}
>
- <FaceCropImageView
- faceID={person.displayFaceID}
- file={person.displayFaceFile}
- placeholderDimension={87}
+ <ItemCard
+ TileComponent={SearchPersonAvatar}
+ coverFaceID={person.displayFaceID}
+ coverFile={person.displayFaceFile}
+ />
+ <Stack sx={{ flex: 1, minWidth: 0, gap: "4px" }}>
+ {person.name && (
+ <Typography
+ component="span"
+ sx={{
+ fontSize: 14,
+ fontWeight: 500,
+ overflowWrap: "anywhere",
+ }}
+ >
+ {person.name}
+ </Typography>
+ )}
+ <Typography
+ component="span"
+ variant="mini"
+ sx={{
+ color: "text.muted",
+ overflowWrap: "anywhere",
+ }}
+ >
+ {`${t("people")} Β· ${t("photos_count", {
+ count: person.fileIDs.length,
+ })}`}
+ </Typography>
+ </Stack>
+ <ArrowForwardIosIcon
+ sx={{
+ fontSize: 12,
+ color: "text.muted",
+ flexShrink: 0,
+ }}
/>
</SearchPersonButton>
))}
@@ -46,29 +76,41 @@ export const SearchPeopleList: React.FC<SearchPeopleListProps> = ({
const SearchPeopleContainer = styled("div")`
display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: 5px;
+ flex-direction: column;
+ gap: 8px;
margin-block-start: 12px;
margin-block-end: 15px;
`;
-const SearchPersonButton = styled(UnstyledButton)(
- ({ theme }) => `
- width: 87px;
- height: 87px;
- border-radius: 50%;
- overflow: hidden;
- & > img {
- width: 100%;
- height: 100%;
- }
- :hover {
- outline: 1px solid ${theme.vars.palette.stroke.faint};
- outline-offset: 2px;
- }
-`,
-);
+const SearchPersonButton = styled(UnstyledButton)(({ theme }) => ({
+ display: "flex",
+ width: "100%",
+ minHeight: 56,
+ alignItems: "center",
+ gap: "12px",
+ padding: "8px 12px 8px 8px",
+ borderRadius: "12px",
+ textAlign: "left",
+ color: theme.vars.palette.text.base,
+ backgroundColor: theme.vars.palette.background.paper,
+ "&:hover": {
+ backgroundColor: `color-mix(in srgb, ${theme.vars.palette.text.base} 8%, ${theme.vars.palette.background.paper})`,
+ },
+ "&:focus-visible": {
+ outline: `2px solid color-mix(in srgb, ${theme.vars.palette.accent.main} 55%, transparent)`,
+ outlineOffset: "-2px",
+ },
+}));
+
+const SearchPersonAvatar = styled("div")({
+ position: "relative",
+ width: 40,
+ height: 40,
+ flexShrink: 0,
+ borderRadius: "50%",
+ overflow: "hidden",
+ "& img": { width: "100%", height: "100%", objectFit: "cover" },
+});
export interface FilePeopleListProps {
file: EnteFile;