Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(photos):return-home-when-ml-is-disabled

Aswin Asokcec257741dbf
diff --git a/web/apps/photos/src/components/gallery/index.tsx b/web/apps/photos/src/components/gallery/index.tsx
index 43d5dacded..fcb95a3e48 100644
--- a/web/apps/photos/src/components/gallery/index.tsx
+++ b/web/apps/photos/src/components/gallery/index.tsx
@@ -16,7 +16,6 @@ import {
Typography,
} from "@mui/material";
import { CenteredFill, SpacedRow } from "ente-base/components/containers";
-import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import { OverflowMenuOption } from "ente-base/components/OverflowMenu";
import {
v2CloseButtonSx,
@@ -194,20 +193,12 @@ const SearchSortOrderMenu: React.FC<SearchSortOrderMenuProps> = ({
);
};
-export const PeopleEmptyState: React.FC<{ onEnableML: () => void }> = ({
- onEnableML,
-}) => {
+export const PeopleEmptyState: React.FC = () => {
const mlStatus = useMLStatusSnapshot();
switch (mlStatus?.phase) {
case "disabled":
- return (
- <CenteredFill>
- <FocusVisibleButton color="accent" onClick={onEnableML}>
- {t("enable")}
- </FocusVisibleButton>
- </CenteredFill>
- );
+ return null;
case "done":
return (
<PeopleEmptyStateMessage>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 914a0fd272..be665cfbbb 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -99,6 +99,7 @@ import { ItemVisibility, metadataHash } from "ente-media/file-metadata";
import { AssignPersonDialog } from "ente-new/photos/components/AssignPersonDialog";
import { EditLocationDialog } from "ente-new/photos/components/EditLocationDialog";
import {
+ useMLStatusSnapshot,
usePeopleStateSnapshot,
useSettingsSnapshot,
useUserDetailsSnapshot,
@@ -255,6 +256,7 @@ const Page: React.FC = () => {
const { customDomain, mapEnabled } = useSettingsSnapshot();
const userDetails = useUserDetailsSnapshot();
const peopleState = usePeopleStateSnapshot();
+ const mlStatus = useMLStatusSnapshot();
const {
show: showContextMenuAssignPerson,
@@ -1433,6 +1435,12 @@ const Page: React.FC = () => {
[],
);
+ useEffect(() => {
+ if (mlStatus?.phase == "disabled" && barMode == "people") {
+ handleShowCollectionSummaryWithID(PseudoCollectionID.all);
+ }
+ }, [mlStatus?.phase, barMode, handleShowCollectionSummaryWithID]);
+
const showCollectionSummary = useCallback(
(
collectionSummaryID: number | undefined,
@@ -2121,7 +2129,7 @@ const Page: React.FC = () => {
!isFirstLoad &&
state.view?.type == "people" &&
!state.view.activePerson ? (
- <PeopleEmptyState onEnableML={showPeopleConsent} />
+ <PeopleEmptyState />
) : (
<FileListWithViewer
mode={barMode}