Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Restore Links album group and gate rail icon

AswinAsokf800a4f5335c
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
index 47756ba741..fc43920857 100644
--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
@@ -29,6 +29,7 @@ import { useIsSmallWidth } from "ente-base/components/utils/hooks";
import { useModalVisibility } from "ente-base/components/utils/modal";
import { ut } from "ente-base/i18n";
import { thumbnailGridPadding } from "ente-new/photos/components/utils/thumbnail-grid-layout";
+import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import { PseudoCollectionID } from "ente-new/photos/services/collection-summary";
import { isMLSupported } from "ente-new/photos/services/ml";
import { t } from "i18next";
@@ -67,6 +68,7 @@ export const PhotosNavigationShell: React.FC<
children,
...props
}) => {
+ const { isInternalUser } = useSettingsSnapshot();
const [railOpen, setRailOpen] = useState(true);
const [navigationCollapsed, setNavigationCollapsed] = useState(false);
const toggleRail = () => setRailOpen((open) => !open);
@@ -176,6 +178,7 @@ export const PhotosNavigationShell: React.FC<
{showNormalNavigation && (
<NormalNavigationRail
{...props}
+ isInternalUser={isInternalUser}
isHome={
props.mode == "albums" &&
!props.isInSearchMode &&
@@ -312,6 +315,7 @@ const NormalNavigationRail: React.FC<
isHome: boolean;
opensDialog: boolean;
navigationOpen: boolean;
+ isInternalUser: boolean;
}
> = ({
onSidebar,
@@ -321,6 +325,7 @@ const NormalNavigationRail: React.FC<
isHome,
opensDialog,
navigationOpen,
+ isInternalUser,
...props
}) => (
<>
@@ -338,7 +343,8 @@ const NormalNavigationRail: React.FC<
})}
/>
{(["albums", "people", "links"] as const).map((item) =>
- item == "people" && !isMLSupported ? null : (
+ (item == "people" && !isMLSupported) ||
+ (item == "links" && !isInternalUser) ? null : (
<Tooltip key={item} title={t(item)}>
<FocusVisibleButton
color="secondary"
diff --git a/web/apps/photos/src/utils/album-filters.ts b/web/apps/photos/src/utils/album-filters.ts
index 1442ad99d0..17a9d3c9c6 100644
--- a/web/apps/photos/src/utils/album-filters.ts
+++ b/web/apps/photos/src/utils/album-filters.ts
@@ -4,7 +4,8 @@ import {
} from "ente-new/photos/services/collection-summary";
import { t } from "i18next";
-export type AlbumFilter = "ente" | "shared" | "received" | "empty-albums";
+export type AlbumFilter =
+ "ente" | "shared" | "received" | "links" | "empty-albums";
export const albumFilters: {
value: AlbumFilter;
@@ -22,6 +23,11 @@ export const albumFilters: {
label: () => t("received_albums_label"),
title: () => t("received_albums_title"),
},
+ {
+ value: "links",
+ label: () => t("links_albums_label"),
+ title: () => t("links_albums_title"),
+ },
{
value: "empty-albums",
label: () => t("empty_albums"),
@@ -55,6 +61,8 @@ export const matchesAlbumFilter = (
!cs.attributes.has("archived") &&
cs.attributes.has("sharedIncoming")
);
+ case "links":
+ return cs.attributes.has("quickLink");
case "empty-albums":
return isBulkDeletableEmptyAlbum(cs);
}
diff --git a/web/apps/photos/tests/album-filters.test.ts b/web/apps/photos/tests/album-filters.test.ts
index ec63a24730..7a3d657498 100644
--- a/web/apps/photos/tests/album-filters.test.ts
+++ b/web/apps/photos/tests/album-filters.test.ts
@@ -85,6 +85,7 @@ describe("album filters shared by the dialog and sidebar", () => {
expect(ids("ente")).toEqual([1, 2, 3, 4]);
expect(ids("shared")).toEqual([2, 4]);
expect(ids("received")).toEqual([3]);
+ expect(ids("links")).toEqual([5]);
expect(albums.map(({ id }) => id)).toEqual([1, 2, 3, 4, 5]);
});
@@ -129,6 +130,7 @@ describe("album filters shared by the dialog and sidebar", () => {
"ente",
"shared",
"received",
+ "links",
"empty-albums",
]);
expect(visibleAlbumFilters([]).map(({ value }) => value)).toEqual([
@@ -145,11 +147,11 @@ describe("album filters shared by the dialog and sidebar", () => {
];
const groups = (query: string) =>
visibleAlbumFilters(albums, query).map(({ value }) => value);
- expect(groups("holiday")).toEqual([]);
+ expect(groups("holiday")).toEqual(["links"]);
expect(groups(" WINTER ")).toEqual(["ente", "shared", "received"]);
expect(groups("summer")).toEqual(["ente"]);
expect(groups("missing")).toEqual([]);
- expect(groups(" ")).toEqual(["ente", "shared", "received"]);
+ expect(groups(" ")).toEqual(["ente", "shared", "received", "links"]);
});
test("search preserves empty-group availability when only one empty album matches", () => {
diff --git a/web/apps/photos/tests/sidebar-album-search.test.tsx b/web/apps/photos/tests/sidebar-album-search.test.tsx
index 20182685bd..0c5a6a5d46 100644
--- a/web/apps/photos/tests/sidebar-album-search.test.tsx
+++ b/web/apps/photos/tests/sidebar-album-search.test.tsx
@@ -93,6 +93,15 @@ const renderSearch = (
};
describe("sidebar album search across groups", () => {
+ test("reveals matching quick links in the Albums Links group", () => {
+ const html = renderSearch("trip");
+ expect(html).toContain('aria-label="links_albums_title"');
+ expect(html).not.toContain('aria-label="Ente"');
+ expect(html).not.toContain('aria-label="shared_albums_title"');
+ expect(html).toContain("Trip link");
+ expect(html).not.toContain("no-matches.svg");
+ });
+
test("reveals matching Shared albums while Ente is selected", () => {
const html = renderSearch("holiday");
expect(html).toContain('aria-label="shared_albums_title"');
@@ -121,6 +130,7 @@ describe("sidebar album search across groups", () => {
const html = renderSearch(query);
expect(html).toContain('aria-label="Ente"');
expect(html).toContain('aria-label="shared_albums_title"');
+ expect(html).toContain('aria-label="links_albums_title"');
expect(html).toContain("Family");
expect(html).toContain("Holiday album");
expect(html).not.toContain("no-matches.svg");