Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

[web][photos] Move gallery status below photo container

AswinAsok02eb8acec295
diff --git a/web/apps/photos/public/images/subscription-card-background/1x.png b/web/apps/photos/public/images/subscription-card-background/1x.png
deleted file mode 100644
index 724b8beb1a..0000000000
Binary files a/web/apps/photos/public/images/subscription-card-background/1x.png and /dev/null differ
diff --git a/web/apps/photos/public/images/subscription-card-background/2x.png b/web/apps/photos/public/images/subscription-card-background/2x.png
deleted file mode 100644
index 26be3d8fc9..0000000000
Binary files a/web/apps/photos/public/images/subscription-card-background/2x.png and /dev/null differ
diff --git a/web/apps/photos/public/images/subscription-card-background/3x.png b/web/apps/photos/public/images/subscription-card-background/3x.png
deleted file mode 100644
index 8dfb56cd9a..0000000000
Binary files a/web/apps/photos/public/images/subscription-card-background/3x.png and /dev/null differ
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
index ce9f2f7db5..405d9dda29 100644
--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
@@ -10,11 +10,14 @@ import {
UserGroupIcon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
+import CloudOffIcon from "@mui/icons-material/CloudOff";
import {
Box,
+ CircularProgress,
Stack,
SvgIcon,
Tooltip,
+ Typography,
useMediaQuery,
useTheme,
} from "@mui/material";
@@ -58,11 +61,20 @@ type PhotosNavigationShellProps = SearchBarProps & {
export const PhotosNavigationShell: React.FC<
React.PropsWithChildren<
PhotosNavigationShellProps & {
+ isFirstLoad: boolean;
+ isOffline: boolean;
alternateHeader: ReactNode;
galleryNavigation: GalleryNavigation | undefined;
}
>
-> = ({ alternateHeader, galleryNavigation, children, ...props }) => {
+> = ({
+ isFirstLoad,
+ isOffline,
+ alternateHeader,
+ galleryNavigation,
+ children,
+ ...props
+}) => {
const [railOpen, setRailOpen] = useState(true);
const [navigationCollapsed, setNavigationCollapsed] = useState(false);
const toggleRail = () => setRailOpen((open) => !open);
@@ -232,22 +244,32 @@ export const PhotosNavigationShell: React.FC<
</>
)}
<Stack
- sx={(theme) => ({
- flex: 1,
- minWidth: 0,
- minHeight: 0,
- pt: { xs: `${thumbnailGridPadding}px`, md: "36px" },
- px: { xs: 0, md: "12px" },
- "--mui-palette-background-default": "#FFFFFF",
- bgcolor: "background.default",
- borderRadius: "20px",
- overflow: "hidden",
- ...theme.applyStyles("dark", {
- "--mui-palette-background-default": "#212121",
- }),
- })}
+ sx={{ flex: 1, minWidth: 0, minHeight: 0, gap: "8px" }}
>
- {children}
+ <Stack
+ sx={(theme) => ({
+ flex: 1,
+ minWidth: 0,
+ minHeight: 0,
+ pt: {
+ xs: `${thumbnailGridPadding}px`,
+ md: "36px",
+ },
+ px: { xs: 0, md: "12px" },
+ "--mui-palette-background-default": "#FFFFFF",
+ bgcolor: "background.default",
+ borderRadius: "20px",
+ overflow: "hidden",
+ ...theme.applyStyles("dark", {
+ "--mui-palette-background-default":
+ "#212121",
+ }),
+ })}
+ >
+ {children}
+ </Stack>
+ {isFirstLoad && <FirstLoadMessage />}
+ {isOffline && <OfflineMessage />}
</Stack>
</Stack>
</Stack>
@@ -506,3 +528,50 @@ const UploadButton: React.FC<ButtonishProps> = ({ onClick }) => {
</>
);
};
+
+const GalleryStatusMessage: React.FC<
+ React.PropsWithChildren<{ icon: ReactNode }>
+> = ({ icon, children }) => (
+ <Stack
+ direction="row"
+ role="status"
+ sx={{
+ flexShrink: 0,
+ alignItems: "center",
+ justifyContent: "center",
+ gap: 1.25,
+ px: 1,
+ py: 1.25,
+ color: "text.muted",
+ opacity: 0.65,
+ }}
+ >
+ {icon}
+ <Typography variant="small" sx={{ textAlign: "center" }}>
+ {children}
+ </Typography>
+ </Stack>
+);
+
+const FirstLoadMessage: React.FC = () => (
+ <GalleryStatusMessage
+ icon={
+ <CircularProgress
+ size={12}
+ thickness={5}
+ color="inherit"
+ aria-hidden
+ />
+ }
+ >
+ {t("initial_load_delay_warning")}
+ </GalleryStatusMessage>
+);
+
+const OfflineMessage: React.FC = () => (
+ <GalleryStatusMessage
+ icon={<CloudOffIcon sx={{ fontSize: 16 }} aria-hidden />}
+ >
+ {t("offline_message")}
+ </GalleryStatusMessage>
+);
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index b55cfc48da..626cd18dd9 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -82,7 +82,6 @@ import { ensureLocalUser } from "ente-accounts/services/user";
import { isDesktop } from "ente-base/app";
import type { MiniDialogAttributes } from "ente-base/components/MiniDialog";
import { SingleInputDialog } from "ente-base/components/SingleInputDialog";
-import { CenteredRow } from "ente-base/components/containers";
import { TranslucentLoadingOverlay } from "ente-base/components/loaders";
import { errorDialogAttributes } from "ente-base/components/utils/dialog";
import { useModalVisibility } from "ente-base/components/utils/modal";
@@ -701,7 +700,6 @@ const Page: React.FC = () => {
return;
}
- preloadImage("/images/subscription-card-background");
initSettings();
setupSelectAllKeyBoardShortcutHandler();
@@ -2189,6 +2187,8 @@ const Page: React.FC = () => {
onRemotePull={remotePull}
/>
<PhotosNavigationShell
+ isFirstLoad={!isCleanupViewOpen && isFirstLoad}
+ isOffline={!isCleanupViewOpen && isOffline}
isInSearchMode={isInSearchMode}
isSettingsOpen={sidebarVisibilityProps.open}
mode={barMode}
@@ -2292,8 +2292,6 @@ const Page: React.FC = () => {
shareSuggestionEmails={state.shareSuggestionEmails}
onRemotePull={remotePull}
/>
- {isFirstLoad && <FirstLoadMessage />}
- {isOffline && <OfflineMessage />}
</>
)}
{cleanupView === "duplicates" ? (
@@ -2572,29 +2570,6 @@ const Page: React.FC = () => {
export default Page;
-const FirstLoadMessage: React.FC = () => (
- <CenteredRow>
- <Typography variant="small" sx={{ color: "text.muted" }}>
- {t("initial_load_delay_warning")}
- </Typography>
- </CenteredRow>
-);
-
-const OfflineMessage: React.FC = () => (
- <Typography
- variant="small"
- sx={{ bgcolor: "background.paper", p: 2, mb: 1, textAlign: "center" }}
- >
- {t("offline_message")}
- </Typography>
-);
-
-const preloadImage = (imgBasePath: string) => {
- const srcset: string[] = [];
- for (let i = 1; i <= 3; i++) srcset.push(`${imgBasePath}/${i}x.png ${i}x`);
- new Image().srcset = srcset.join(",");
-};
-
const handleSubscriptionCompletionRedirectIfNeeded = async (
showMiniDialog: (attributes: MiniDialogAttributes) => void,
showLoadingBar: () => void,
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index 31c68e203e..c1e2eca7b9 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -154,7 +154,7 @@
"review_items": "Review items",
"stop_uploads_resume_message": "You can upload later, we'll skip already uploaded items.",
"stop_uploads": "Stop uploads",
- "initial_load_delay_warning": "First load may take some time",
+ "initial_load_delay_warning": "Loading your library…",
"no_account": "Don't have an account",
"existing_account": "Already have an account",
"create": "Create",
@@ -350,7 +350,7 @@
"success": "Success",
"error": "Error",
"note": "Note",
- "offline_message": "You are offline, cached memories are being shown",
+ "offline_message": "Offline · Showing cached photos",
"network_error": "Network error. Please check your connection.",
"install": "Install",
"install_mobile_app": "Install our <a>Android</a> or <b>iOS</b> app to automatically backup all your photos",