Skip to content

armgit / ente

Public Imported from GitHub
0

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

People list - 1

Manav Rathibcd1fd0cc853
diff --git a/web/packages/new/photos/components/PeopleList.tsx b/web/packages/new/photos/components/PeopleList.tsx
index edfb813fcf..161539a52a 100644
--- a/web/packages/new/photos/components/PeopleList.tsx
+++ b/web/packages/new/photos/components/PeopleList.tsx
@@ -1,3 +1,4 @@
+import { useIsMobileWidth } from "@/base/hooks";
import type { Person } from "@/new/photos/services/ml";
import { faceCrop, unidentifiedFaceIDs } from "@/new/photos/services/ml";
import type { EnteFile } from "@/new/photos/types/file";
@@ -21,24 +22,49 @@ export const PeopleList: React.FC<PeopleListProps> = ({
maxRows,
onSelect,
}) => {
+ const isMobileWidth = useIsMobileWidth();
+ // TODO-Cluster: FaceCropImageView has hardcoded placeholder dimensions
return (
- <FaceChipContainer style={{ maxHeight: maxRows * 122 + 28 }}>
- {people.map((person, index) => (
- <FaceChip
+ <SearchFaceChipContainer style={{ maxHeight: maxRows * 87 + 28 }}>
+ {people.slice(0, isMobileWidth ? 6 : 7).map((person, index) => (
+ <SearchFaceChip
key={person.id}
- clickable={!!onSelect}
onClick={() => onSelect && onSelect(person, index)}
>
<FaceCropImageView
faceID={person.displayFaceID}
enteFile={person.displayFaceFile}
/>
- </FaceChip>
+ </SearchFaceChip>
))}
- </FaceChipContainer>
+ </SearchFaceChipContainer>
);
};
+const SearchFaceChipContainer = styled("div")`
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ gap: 5px;
+ margin-block: 16px;
+ /* On very small (~ < 375px) mobile screens 6 faces won't fit in 2 rows.
+ Clip the third one. */
+ overflow: hidden;
+`;
+
+const SearchFaceChip = styled("div")`
+ width: 87px;
+ height: 87px;
+ border-radius: 50%;
+ overflow: hidden;
+ cursor: "pointer";
+ & > img {
+ width: 100%;
+ height: 100%;
+ }
+`;
+
const FaceChipContainer = styled("div")`
display: flex;
flex-wrap: wrap;
diff --git a/web/packages/new/photos/components/SearchBar.tsx b/web/packages/new/photos/components/SearchBar.tsx
index d163fb5536..c0817cc5e8 100644
--- a/web/packages/new/photos/components/SearchBar.tsx
+++ b/web/packages/new/photos/components/SearchBar.tsx
@@ -394,18 +394,21 @@ const EmptyState: React.FC<EmptyStateProps> = () => {
}
return (
- <Box>
- {people && (
- <PeopleList
- people={people}
- maxRows={2}
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- onSelect={(...args: any) => console.log(args)}
- />
+ <Box sx={{ textAlign: "left" }}>
+ {people && people.length > 0 && (
+ <>
+ <Typography color="text.base" variant="large">
+ {t("people")}
+ </Typography>
+ <PeopleList
+ people={people}
+ maxRows={2}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ onSelect={(...args: any) => console.log(args)}
+ />
+ </>
)}
- <Typography variant="mini" sx={{ textAlign: "left" }}>
- {label}
- </Typography>
+ <Typography variant="mini">{label}</Typography>
</Box>
);