Skip to content

armgit / ente

Public Imported from GitHub
0

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

Make tsc happy

Manav Rathi642c85fe5908
diff --git a/web/packages/new/photos/components/Gallery/index.tsx b/web/packages/new/photos/components/Gallery/index.tsx
index 43c9bc5177..9e9dcceb3e 100644
--- a/web/packages/new/photos/components/Gallery/index.tsx
+++ b/web/packages/new/photos/components/Gallery/index.tsx
@@ -19,6 +19,8 @@ import MoreHoriz from "@mui/icons-material/MoreHoriz";
import { Typography } from "@mui/material";
import { t } from "i18next";
import React, { useCallback, useState } from "react";
+import type { FaceCluster } from "../../services/ml/cluster";
+import type { CGroupUserEntity } from "../../services/user-entity";
import type { NewAppContextPhotos } from "../../types/context";
import { SpaceBetweenFlex } from "../mui-custom";
import { NameInputDialog } from "../NameInputDialog";
@@ -71,14 +73,16 @@ export const PeopleHeader: React.FC<PeopleHeaderProps> = ({
nameProps={person.name ? {} : { color: "text.muted" }}
fileCount={person.fileIDs.length}
/>
- {person.underlying.type == "cgroup" ? (
+ {person.type == "cgroup" ? (
<CGroupPersonOptions
person={person}
+ cgroup={person.cgroupUserEntity}
appContext={appContext}
/>
) : (
<ClusterPersonOptions
person={person}
+ cluster={person.cluster}
appContext={appContext}
/>
)}
@@ -88,9 +92,8 @@ export const PeopleHeader: React.FC<PeopleHeaderProps> = ({
};
interface CGroupPersonOptionsProps {
- person: Omit<Person, "underlying"> & {
- underlying: Extract<Person["underlying"], { type: "cgroup" }>;
- };
+ person: Person;
+ cgroup: CGroupUserEntity;
appContext: NewAppContextPhotos;
}
@@ -118,14 +121,14 @@ const CGroupPersonOptions: React.FC<CGroupPersonOptionsProps> = ({
};
interface ClusterPersonOptionsProps {
- person: Omit<Person, "underlying"> & {
- underlying: Extract<Person["underlying"], { type: "cluster" }>;
- };
+ person: Person;
+ cluster: FaceCluster;
appContext: NewAppContextPhotos;
}
const ClusterPersonOptions: React.FC<ClusterPersonOptionsProps> = ({
person,
+ cluster,
appContext,
}) => {
const { startLoading, finishLoading } = appContext;
diff --git a/web/packages/new/photos/services/ml/people.ts b/web/packages/new/photos/services/ml/people.ts
index 4ff190fcfa..7770cbd096 100644
--- a/web/packages/new/photos/services/ml/people.ts
+++ b/web/packages/new/photos/services/ml/people.ts
@@ -102,13 +102,10 @@ export interface CGroupUserEntityData {
* efficiently use, as compared to a {@link CGroupUserEntityData}, which is
* tailored for transmission and storage.
*/
-export interface Person {
- /**
- * The underlying data.
- */
- underlying:
- | { type: "cgroup"; cgroupUserEntity: CGroupUserEntity }
- | { type: "cluster"; cluster: FaceCluster };
+export type Person = (
+ | { type: "cgroup"; cgroupUserEntity: CGroupUserEntity }
+ | { type: "cluster"; cluster: FaceCluster }
+) & {
/**
* Nanoid of the underlying cgroup or {@link FaceCluster}.
*/
@@ -132,7 +129,7 @@ export interface Person {
* The {@link EnteFile} which contains the display face.
*/
displayFaceFile: EnteFile;
-}
+};
export type NamedPerson = Omit<Person, "name"> & {
name: string;
@@ -223,7 +220,8 @@ export const reconstructPeople = async (): Promise<Person[]> => {
}
return {
- underlying: { type: "cgroup", cgroupUserEntity },
+ type: "cgroup",
+ cgroupUserEntity,
id,
name: cgroup.name,
fileIDs,
@@ -247,7 +245,8 @@ export const reconstructPeople = async (): Promise<Person[]> => {
);
return {
- underlying: { type: "cluster", cluster },
+ type: "cluster",
+ cluster,
id: cluster.id,
name: undefined,
fileIDs: [...new Set(faces.map((f) => f.file.id))],