Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix lint errors, add missing translations, and skip social fetch when disabled

Anand Baburajan17e92b4a40ad
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index ae2b070369..eb44473d5b 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -88,7 +88,6 @@ export interface CollectionHeaderProps
onRemotePull: (opts?: RemotePullOpts) => Promise<void>;
onCollectionShare: () => void;
onCollectionCast: () => void;
- onCollectionFeed: () => void;
/**
* A function that can be used to create a UI notification to track the
* progress of user-initiated download, and to cancel it if needed.
@@ -145,7 +144,6 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({
onRemotePull,
onCollectionShare,
onCollectionCast,
- onCollectionFeed,
onAddSaveGroup,
isActiveCollectionDownloadInProgress,
onMarkTempDeleted,
@@ -660,7 +658,6 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({
isDownloadInProgress={isActiveCollectionDownloadInProgress}
onEmptyTrashClick={confirmEmptyTrash}
onDownloadClick={downloadCollection}
- onFeedClick={onCollectionFeed}
onShareClick={onCollectionShare}
/>
{validMenuOptions.length > 0 && (
@@ -718,15 +715,12 @@ interface QuickOptionsProps {
isDownloadInProgress: () => boolean;
onEmptyTrashClick: () => void;
onDownloadClick: () => void;
- onFeedClick: () => void;
onShareClick: () => void;
}
const QuickOptions: React.FC<QuickOptionsProps> = ({
onEmptyTrashClick,
onDownloadClick,
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- onFeedClick,
onShareClick,
collectionSummary,
isDownloadInProgress,
@@ -751,9 +745,6 @@ const QuickOptions: React.FC<QuickOptionsProps> = ({
onClick={onShareClick}
/>
)}
- {/* {showFeedQuickOption(collectionSummary) && (
- <FeedQuickOption onClick={onFeedClick} />
- )} */}
</Stack>
);
@@ -835,11 +826,6 @@ const DownloadQuickOption: React.FC<DownloadQuickOptionProps> = ({
</Tooltip>
);
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-const showFeedQuickOption = ({ type, attributes }: CollectionSummary) =>
- type == "sharedIncoming" ||
- ((type == "album" || type == "folder") && attributes.has("shared"));
-
export const FeedIcon: React.FC = () => (
<svg
width="23"
@@ -867,25 +853,6 @@ export const FeedIcon: React.FC = () => (
</svg>
);
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-const FeedQuickOption: React.FC<OptionProps> = ({ onClick }) => (
- <Tooltip title={t("feed")}>
- <IconButton onClick={onClick}>
- <Box
- sx={{
- width: 24,
- height: 24,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- }}
- >
- <FeedIcon />
- </Box>
- </IconButton>
- </Tooltip>
-);
-
const showShareQuickOption = ({ type, attributes }: CollectionSummary) =>
type == "album" ||
type == "folder" ||
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index fba0433aaa..8db9693a35 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -196,7 +196,6 @@ export const GalleryBarAndListHeader: React.FC<
collectionSummary={collectionSummary!}
onCollectionShare={showCollectionShare}
onCollectionCast={showCollectionCast}
- onCollectionFeed={showCollectionFeed}
/>
) : mode != "people" && collectionSummary ? (
<GalleryItemsHeaderAdapter>
diff --git a/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx
index 0c58efb0e5..9f556c4d53 100644
--- a/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx
+++ b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx
@@ -211,4 +211,3 @@ const MobileSignUpButton = styled(Button)({
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
"&:hover": { backgroundColor: "rgba(255, 255, 255, 1)" },
});
-
diff --git a/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx b/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx
index 826bf4df75..a0ada41cfa 100644
--- a/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx
+++ b/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx
@@ -158,4 +158,3 @@ const SignUpButton = styled(Button)({
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
"&:hover": { backgroundColor: "rgba(255, 255, 255, 1)" },
});
-
diff --git a/web/apps/photos/src/components/TripLayout/index.tsx b/web/apps/photos/src/components/TripLayout/index.tsx
index 0efaab2896..4cfee47b75 100644
--- a/web/apps/photos/src/components/TripLayout/index.tsx
+++ b/web/apps/photos/src/components/TripLayout/index.tsx
@@ -3,12 +3,14 @@ import { DownloadStatusNotifications } from "components/DownloadStatusNotificati
import { useModalVisibility } from "ente-base/components/utils/modal";
import type { PublicAlbumsCredentials } from "ente-base/http";
import { useSaveGroups } from "ente-gallery/components/utils/save-groups";
-import { FileViewer } from "ente-gallery/components/viewer/FileViewer";
+import {
+ FileViewer,
+ type FileViewerInitialSidebar,
+} from "ente-gallery/components/viewer/FileViewer";
import {
PublicFeedSidebar,
type PublicFeedItemClickInfo,
} from "ente-gallery/components/viewer/PublicFeedSidebar";
-import { type FileViewerInitialSidebar } from "ente-gallery/components/viewer/FileViewer";
import { downloadAndSaveCollectionFiles } from "ente-gallery/services/save";
import { type Collection } from "ente-media/collection";
import { type EnteFile } from "ente-media/file";
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 6ddbc0a353..1f62e2eea6 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -15,6 +15,7 @@ import {
Tooltip,
} from "@mui/material";
import Typography from "@mui/material/Typography";
+import { FeedIcon } from "components/Collections/CollectionHeader";
import { DownloadStatusNotifications } from "components/DownloadStatusNotifications";
import { type FileListHeaderOrFooter } from "components/FileList";
import { FileListWithViewer } from "components/FileListWithViewer";
@@ -67,16 +68,16 @@ import {
useSaveGroups,
type AddSaveGroup,
} from "ente-gallery/components/utils/save-groups";
+import { type FileViewerInitialSidebar } from "ente-gallery/components/viewer/FileViewer";
+import {
+ PublicFeedSidebar,
+ type PublicFeedItemClickInfo,
+} from "ente-gallery/components/viewer/PublicFeedSidebar";
import { downloadManager } from "ente-gallery/services/download";
import {
downloadAndSaveCollectionFiles,
downloadAndSaveFiles,
} from "ente-gallery/services/save";
-import {
- PublicFeedSidebar,
- type PublicFeedItemClickInfo,
-} from "ente-gallery/components/viewer/PublicFeedSidebar";
-import { type FileViewerInitialSidebar } from "ente-gallery/components/viewer/FileViewer";
import { extractCollectionKeyFromShareURL } from "ente-gallery/services/share";
import { updateShouldDisableCFUploadProxy } from "ente-gallery/services/upload";
import { sortFiles } from "ente-gallery/utils/file";
@@ -102,7 +103,6 @@ import {
} from "ente-new/photos/components/gallery/ListHeader";
import { PseudoCollectionID } from "ente-new/photos/services/collection-summary";
import { usePhotosAppContext } from "ente-new/photos/types/context";
-import { FeedIcon } from "components/Collections/CollectionHeader";
import { useJoinAlbum } from "hooks/useJoinAlbum";
import { t } from "i18next";
import { useRouter } from "next/router";
@@ -865,7 +865,11 @@ const FileListHeader: React.FC<FileListHeaderProps> = ({
name={publicCollection.name}
fileCount={publicFiles.length}
/>
- <Stack direction="row" spacing={1} sx={{ alignItems: "center" }}>
+ <Stack
+ direction="row"
+ spacing={1}
+ sx={{ alignItems: "center" }}
+ >
{onShowFeed && (
<IconButton onClick={onShowFeed}>
<Box
@@ -952,4 +956,3 @@ const FileListFooter: React.FC<FileListFooterProps> = ({ onAddPhotos }) => (
</Link>
</Stack>
);
-
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index 337c6f13b7..b5e2a8cb48 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -125,6 +125,15 @@
"selected_count": "{{selected, number}} selected",
"selected_and_yours_count": "{{selected, number}} selected {{yours, number}} yours",
"delete": "Delete",
+ "like": "Like",
+ "unlike": "Unlike",
+ "reply": "Reply",
+ "like_count_one": "{{count, number}} like",
+ "like_count": "{{count, number}} likes",
+ "loading": "Loading...",
+ "no_activity_yet": "No activity yet",
+ "no_comments_yet": "No comments yet",
+ "no_likes_yet": "No likes yet",
"favorite": "Favorite",
"convert": "Convert",
"multi_folder_upload": "Multiple folders detected",
diff --git a/web/packages/gallery/components/viewer/AddNameModal.tsx b/web/packages/gallery/components/viewer/AddNameModal.tsx
index b2f31ca436..7d22155474 100644
--- a/web/packages/gallery/components/viewer/AddNameModal.tsx
+++ b/web/packages/gallery/components/viewer/AddNameModal.tsx
@@ -202,7 +202,7 @@ export const AddNameModal: React.FC<AddNameModalProps> = ({
<StyledDialog
open={open}
onClose={handleClose}
- TransitionProps={{ onExited }}
+ slotProps={{ transition: { onExited } }}
>
<DialogWrapper>
<CloseButton onClick={handleClose}>
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index 398ee091d2..f1df44a219 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -1442,9 +1442,9 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
try {
// Use public API for anonymous users in public albums
if (isPublicAlbum && publicAlbumsCredentials) {
- const storedIdentity = selectedCollectionInfo
- ? getStoredAnonIdentity(selectedCollectionInfo.id)
- : undefined;
+ const storedIdentity = getStoredAnonIdentity(
+ selectedCollectionInfo.id,
+ );
if (storedIdentity) {
await deletePublicComment(
publicAlbumsCredentials,
@@ -1773,7 +1773,8 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
!showOwnTimestamp &&
commentIsOwn &&
!!prevComment &&
- prevComment.userID !== currentUserID &&
+ prevComment.userID !==
+ currentUserID &&
prevComment.anonUserID !==
storedIdentity?.anonUserID
}
@@ -1868,15 +1869,15 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
<HeartIcon small />
<span>
{contextMenuIsLikedRef.current
- ? "Unlike"
- : "Like"}
+ ? t("unlike")
+ : t("like")}
</span>
</StyledMenuItem>
<StyledMenuItem
onClick={() => handleContextMenuAction("reply")}
>
<ReplyIcon />
- <span>Reply</span>
+ <span>{t("reply")}</span>
</StyledMenuItem>
{contextMenu &&
canDeleteComment(contextMenu.comment) && (
@@ -2014,9 +2015,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
}),
},
"& .MuiInputBase-root, & .MuiInputBase-input":
- {
- cursor: "pointer",
- },
+ { cursor: "pointer" },
})
: undefined
}
diff --git a/web/packages/gallery/components/viewer/FeedSidebar.tsx b/web/packages/gallery/components/viewer/FeedSidebar.tsx
index 353a24a96e..9ae54506e2 100644
--- a/web/packages/gallery/components/viewer/FeedSidebar.tsx
+++ b/web/packages/gallery/components/viewer/FeedSidebar.tsx
@@ -22,6 +22,7 @@ import {
getAnonProfiles,
type UnifiedReaction,
} from "ente-new/photos/services/social";
+import { t } from "i18next";
import React, { useEffect, useMemo, useState } from "react";
// =============================================================================
@@ -716,11 +717,11 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({
// Fetch social data when sidebar opens
useEffect(() => {
const fetchSocialData = async () => {
- if (!open || !collection) return;
+ if (!open) return;
setIsLoading(true);
try {
- const hasPublicLink = (collection.publicURLs?.length ?? 0) > 0;
+ const hasPublicLink = collection.publicURLs.length > 0;
const [feedData, anonProfiles] = await Promise.all([
getAlbumFeed(collection.id, collection.key),
// Only fetch anon profiles if collection has public links
@@ -790,7 +791,7 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({
<CircularProgress size={24} />
</LoadingContainer>
) : feedItems.length === 0 ? (
- <EmptyStateText>No activity yet</EmptyStateText>
+ <EmptyStateText>{t("no_activity_yet")}</EmptyStateText>
) : (
feedItems.map((item) => (
<FeedItemRow
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 733e1ffa38..8c09854726 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -509,7 +509,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
hasOpenedInitialSidebarRef.current = true;
if (initialSidebar === "comments") {
setOpenComments(true);
- } else if (initialSidebar === "likes") {
+ } else {
setOpenLikes(true);
}
}
@@ -614,7 +614,9 @@ export const FileViewer: React.FC<FileViewerProps> = ({
setFileComments((prev) => {
const next = new Map(prev);
- const fileCommentsMap = new Map(prev.get(fileID) ?? new Map());
+ const fileCommentsMap = new Map<number, Comment[]>(
+ prev.get(fileID) ?? new Map(),
+ );
const collectionComments =
fileCommentsMap.get(comment.collectionID) ?? [];
fileCommentsMap.set(comment.collectionID, [
@@ -661,7 +663,9 @@ export const FileViewer: React.FC<FileViewerProps> = ({
setAllReactions((prev) => {
const next = new Map(prev);
- const fileReactionsMap = new Map(prev.get(fileID) ?? new Map());
+ const fileReactionsMap = new Map<number, UnifiedReaction[]>(
+ prev.get(fileID) ?? new Map(),
+ );
const collectionReactions =
fileReactionsMap.get(reaction.collectionID) ?? [];
fileReactionsMap.set(reaction.collectionID, [
@@ -750,22 +754,17 @@ export const FileViewer: React.FC<FileViewerProps> = ({
collectionId,
existingReaction.id,
);
- log.info(
- `Deleted public reaction: ${existingReaction.id}`,
- );
// Update local state
setAllReactions((prev) => {
const next = new Map(prev);
- const fileReactionsMap = new Map(
- prev.get(fileId) ?? new Map(),
- );
+ const fileReactionsMap = new Map<
+ number,
+ UnifiedReaction[]
+ >(prev.get(fileId) ?? new Map());
const updatedReactions = (
fileReactionsMap.get(collectionId) ?? []
- ).filter(
- (r: UnifiedReaction) =>
- r.id !== existingReaction.id,
- );
+ ).filter((r) => r.id !== existingReaction.id);
fileReactionsMap.set(
collectionId,
updatedReactions,
@@ -798,9 +797,10 @@ export const FileViewer: React.FC<FileViewerProps> = ({
// Update local state
setAllReactions((prev) => {
const next = new Map(prev);
- const fileReactionsMap = new Map(
- prev.get(fileId) ?? new Map(),
- );
+ const fileReactionsMap = new Map<
+ number,
+ UnifiedReaction[]
+ >(prev.get(fileId) ?? new Map());
const collectionReactions =
fileReactionsMap.get(collectionId) ?? [];
fileReactionsMap.set(collectionId, [
@@ -863,12 +863,12 @@ export const FileViewer: React.FC<FileViewerProps> = ({
"green_heart",
collection.key,
);
- log.info(`Added reaction: ${reactionId}`);
setAllReactions((prev) => {
const next = new Map(prev);
- const fileReactionsMap = new Map(
- prev.get(fileId) ?? new Map(),
- );
+ const fileReactionsMap = new Map<
+ number,
+ UnifiedReaction[]
+ >(prev.get(fileId) ?? new Map());
const collectionReactions =
fileReactionsMap.get(collectionId) ?? [];
fileReactionsMap.set(collectionId, [
@@ -903,9 +903,6 @@ export const FileViewer: React.FC<FileViewerProps> = ({
for (const reaction of reactions) {
await deleteReaction(reaction.reactionId);
deletedReactionIds.add(reaction.reactionId);
- log.info(
- `Deleted reaction: ${reaction.reactionId}`,
- );
}
setAllReactions((prev) => {
const next = new Map(prev);
@@ -944,9 +941,6 @@ export const FileViewer: React.FC<FileViewerProps> = ({
void (async () => {
try {
await deleteReaction(existingReaction.reactionId);
- log.info(
- `Deleted reaction: ${existingReaction.reactionId}`,
- );
setAllReactions((prev) => {
const next = new Map(prev);
const fileReactionsMap = prev.get(fileId);
@@ -982,12 +976,12 @@ export const FileViewer: React.FC<FileViewerProps> = ({
"green_heart",
collection.key,
);
- log.info(`Added reaction: ${reactionId}`);
setAllReactions((prev) => {
const next = new Map(prev);
- const fileReactionsMap = new Map(
- prev.get(fileId) ?? new Map(),
- );
+ const fileReactionsMap = new Map<
+ number,
+ UnifiedReaction[]
+ >(prev.get(fileId) ?? new Map());
const collectionReactions =
fileReactionsMap.get(activeCollectionID) ?? [];
fileReactionsMap.set(activeCollectionID, [
@@ -1043,9 +1037,6 @@ export const FileViewer: React.FC<FileViewerProps> = ({
void (async () => {
try {
await deleteReaction(reactionToDelete.reactionId);
- log.info(
- `Deleted reaction: ${reactionToDelete.reactionId}`,
- );
setAllReactions((prev) => {
const next = new Map(prev);
const fileReactionsMap = prev.get(fileId);
@@ -1083,12 +1074,12 @@ export const FileViewer: React.FC<FileViewerProps> = ({
"green_heart",
collection.key,
);
- log.info(`Added reaction: ${reactionId}`);
setAllReactions((prev) => {
const next = new Map(prev);
- const fileReactionsMap = new Map(
- prev.get(fileId) ?? new Map(),
- );
+ const fileReactionsMap = new Map<
+ number,
+ UnifiedReaction[]
+ >(prev.get(fileId) ?? new Map());
const collectionReactions =
fileReactionsMap.get(albumId) ?? [];
fileReactionsMap.set(albumId, [
@@ -1149,12 +1140,11 @@ export const FileViewer: React.FC<FileViewerProps> = ({
"green_heart",
collection.key,
);
- log.info(`Added reaction: ${reactionId}`);
newReactions.push({ collectionId, reactionId });
}
setAllReactions((prev) => {
const next = new Map(prev);
- const fileReactionsMap = new Map(
+ const fileReactionsMap = new Map<number, UnifiedReaction[]>(
prev.get(fileId) ?? new Map(),
);
for (const { collectionId, reactionId } of newReactions) {
@@ -1238,9 +1228,6 @@ export const FileViewer: React.FC<FileViewerProps> = ({
name,
collectionKey,
);
- log.info(
- `Created anonymous identity: ${identity.anonUserID}`,
- );
}
// Add the public reaction
@@ -1256,9 +1243,10 @@ export const FileViewer: React.FC<FileViewerProps> = ({
// Update local state
setAllReactions((prev) => {
const next = new Map(prev);
- const fileReactionsMap = new Map(
- prev.get(fileId) ?? new Map(),
- );
+ const fileReactionsMap = new Map<
+ number,
+ UnifiedReaction[]
+ >(prev.get(fileId) ?? new Map());
const collectionReactions =
fileReactionsMap.get(collectionId) ?? [];
fileReactionsMap.set(collectionId, [
@@ -2069,6 +2057,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
useEffect(() => {
if (
!open ||
+ !enableComment ||
!activeFileID ||
!publicAlbumsCredentials ||
!collectionKey
@@ -2172,7 +2161,14 @@ export const FileViewer: React.FC<FileViewerProps> = ({
log.error("Failed to fetch public social data", e);
}
})();
- }, [open, activeFileID, publicAlbumsCredentials, collectionKey, files]);
+ }, [
+ open,
+ enableComment,
+ activeFileID,
+ publicAlbumsCredentials,
+ collectionKey,
+ files,
+ ]);
// Refresh comment count when fileComments changes.
useEffect(() => {
@@ -2215,16 +2211,18 @@ export const FileViewer: React.FC<FileViewerProps> = ({
} else {
return undefined;
}
- }, [
// Be careful with adding new dependencies here, or changing the source
// of existing ones. If any of these dependencies change unnecessarily,
// then the file viewer will start getting reloaded even when it is
// already open.
//
- // Note: showSocialButtons is intentionally NOT included here even though
- // it's passed to the constructor. The delegate's shouldShowSocialButtons
- // handles dynamic visibility, and showSocialButtons only changes based on
- // collectionSummaries which we don't want to trigger a full recreation.
+ // Note: showSocialButtons and enableComment are intentionally NOT included
+ // here even though they're passed to the constructor. The delegate's
+ // shouldShowSocialButtons handles dynamic visibility, and these values only
+ // change based on collectionSummaries which we don't want to trigger a full
+ // recreation.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [
open,
onClose,
user,
diff --git a/web/packages/gallery/components/viewer/LikesSidebar.tsx b/web/packages/gallery/components/viewer/LikesSidebar.tsx
index af602fa364..4db31dee0b 100644
--- a/web/packages/gallery/components/viewer/LikesSidebar.tsx
+++ b/web/packages/gallery/components/viewer/LikesSidebar.tsx
@@ -17,6 +17,7 @@ import type { EnteFile } from "ente-media/file";
import { getStoredAnonIdentity } from "ente-new/albums/services/public-reaction";
import type { CollectionSummaries } from "ente-new/photos/services/collection-summary";
import { type UnifiedReaction } from "ente-new/photos/services/social";
+import { t } from "i18next";
import React, {
useCallback,
useEffect,
@@ -460,8 +461,8 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
})}
>
{loading
- ? "Loading..."
- : `${likers.length} ${likers.length === 1 ? "like" : "likes"}`}
+ ? t("loading")
+ : t("like_count", { count: likers.length })}
</Typography>
) : collectionsInfo.length > 1 ? (
<Box
@@ -568,8 +569,8 @@ export const LikesSidebar: React.FC<LikesSidebarProps> = ({
})}
>
{loading
- ? "Loading..."
- : `${likers.length} ${likers.length === 1 ? "like" : "likes"}`}
+ ? t("loading")
+ : t("like_count", { count: likers.length })}
</Typography>
)}
<CloseButton onClick={onClose}>
diff --git a/web/packages/gallery/components/viewer/PublicFeedSidebar.tsx b/web/packages/gallery/components/viewer/PublicFeedSidebar.tsx
index 3c58bd8265..04618a2f45 100644
--- a/web/packages/gallery/components/viewer/PublicFeedSidebar.tsx
+++ b/web/packages/gallery/components/viewer/PublicFeedSidebar.tsx
@@ -24,6 +24,7 @@ import {
type PublicFeedComment,
type PublicFeedReaction,
} from "ente-new/albums/services/public-reaction";
+import { t } from "i18next";
import React, { useEffect, useMemo, useState } from "react";
// =============================================================================
@@ -589,7 +590,7 @@ const FeedItemRow: React.FC<FeedItemRowProps> = ({ item, onClick }) => {
{user.isMaskedEmail ? (
<PersonIcon />
) : (
- displayName[0]?.toUpperCase() ?? "A"
+ (displayName[0]?.toUpperCase() ?? "A")
)}
</StyledAvatar>
);
@@ -612,7 +613,9 @@ const FeedItemRow: React.FC<FeedItemRowProps> = ({ item, onClick }) => {
/**
* Extracts navigation info from a feed item for click handling.
*/
-const getFeedItemClickInfo = (item: PublicFeedItem): PublicFeedItemClickInfo => {
+const getFeedItemClickInfo = (
+ item: PublicFeedItem,
+): PublicFeedItemClickInfo => {
switch (item.type) {
case "liked_photo":
case "liked_video":
@@ -788,7 +791,7 @@ export const PublicFeedSidebar: React.FC<PublicFeedSidebarProps> = ({
<CircularProgress size={24} />
</LoadingContainer>
) : feedItems.length === 0 ? (
- <EmptyStateText>No activity yet</EmptyStateText>
+ <EmptyStateText>{t("no_activity_yet")}</EmptyStateText>
) : (
feedItems.map((item) => (
<FeedItemRow
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 03ede8a8f2..1a0e82d5de 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -1190,8 +1190,6 @@ export class FileViewerPhotoSwipe {
}
const af = currentAnnotatedFile();
- // Guard: af may be undefined during initial setup.
- if (!af) return;
const isLiked = delegate.isLiked(af);
// Show fill (green) if liked, show outline (white) if not liked
@@ -1211,8 +1209,6 @@ export class FileViewerPhotoSwipe {
}
const af = currentAnnotatedFile();
- // Guard: af may be undefined during initial setup.
- if (!af) return;
const count = delegate.getCommentCount(af);
commentCountElement.textContent = String(count);
};
@@ -1527,13 +1523,12 @@ export class FileViewerPhotoSwipe {
// For public albums (no logged-in user), also check
// if comments are enabled on the public link.
const af = currentAnnotatedFile();
- // Guard: af may be undefined during initial setup.
- if (!af) return;
const baseShow =
showSocialButtons ||
delegate.shouldShowSocialButtons(af);
// For public albums (!haveUser), also require enableComment
- const shouldShow = baseShow && (haveUser || enableComment);
+ const shouldShow =
+ baseShow && (haveUser || enableComment);
actionButtonsEl.style.display = shouldShow
? "flex"
: "none";
diff --git a/web/packages/new/albums/services/public-reaction.ts b/web/packages/new/albums/services/public-reaction.ts
index 6a25c05da5..3fd5c329b9 100644
--- a/web/packages/new/albums/services/public-reaction.ts
+++ b/web/packages/new/albums/services/public-reaction.ts
@@ -421,7 +421,10 @@ const RemoteAnonProfile = z.object({
});
const GetAnonProfilesResponse = z.object({
- profiles: z.array(RemoteAnonProfile),
+ profiles: z
+ .array(RemoteAnonProfile)
+ .nullish()
+ .transform((v) => v ?? []),
});
/**
diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.ts
index 85506a8262..7507f56381 100644
--- a/web/packages/new/photos/services/collection.ts
+++ b/web/packages/new/photos/services/collection.ts
@@ -1435,7 +1435,11 @@ export const unshareCollection = async (collectionID: number, email: string) =>
*/
export type CreatePublicURLAttributes = Pick<
Partial<PublicURL>,
- "enableCollect" | "enableJoin" | "enableComment" | "validTill" | "deviceLimit"
+ | "enableCollect"
+ | "enableJoin"
+ | "enableComment"
+ | "validTill"
+ | "deviceLimit"
>;
/**
diff --git a/web/packages/new/photos/services/reaction.ts b/web/packages/new/photos/services/reaction.ts
index 980458afeb..b39b769762 100644
--- a/web/packages/new/photos/services/reaction.ts
+++ b/web/packages/new/photos/services/reaction.ts
@@ -78,7 +78,13 @@ export const addCommentReaction = async (
...(await authenticatedRequestHeaders()),
"Content-Type": "application/json",
},
- body: JSON.stringify({ collectionID, commentID, fileID, cipher, nonce }),
+ body: JSON.stringify({
+ collectionID,
+ commentID,
+ fileID,
+ cipher,
+ nonce,
+ }),
});
ensureOk(res);
const { id } = UpsertReactionResponse.parse(await res.json());
diff --git a/web/packages/new/photos/services/social.ts b/web/packages/new/photos/services/social.ts
index 6a38f19cea..2a61427e07 100644
--- a/web/packages/new/photos/services/social.ts
+++ b/web/packages/new/photos/services/social.ts
@@ -98,8 +98,7 @@ export const getAlbumFeed = async (
*/
const decryptSocialDiff = async (
collectionKey: string,
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- responseJson: any,
+ responseJson: unknown,
): Promise<UnifiedSocialDiff> => {
const data = UnifiedDiffResponse.parse(responseJson);