π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web][photos] Always show Get Ente button on public albums when join is disabled
Anand Baburajanb116abbe0d53
diff --git a/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsxindex 9f556c4d53..b0aa109e4b 100644--- a/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx+++ b/web/apps/photos/src/components/TripLayout/MobileNavBar.tsx@@ -12,7 +12,7 @@ import { Notification } from "ente-new/photos/components/Notification";import { useJoinAlbum } from "hooks/useJoinAlbum";import { t } from "i18next";import { useState } from "react";-import { getSignUpOrInstallURL } from "utils/public-album";+import { getEnteURL } from "utils/public-album";interface MobileNavBarProps {onAddPhotos?: () => void;@@ -69,22 +69,6 @@ export const MobileNavBar: React.FC<MobileNavBarProps> = ({}};- const handleSignUpOrInstall = () => {- if (typeof window !== "undefined") {- window.open(- getSignUpOrInstallURL(isTouchscreen),- "_blank",- "noopener",- );- }- };-- const buttonText = enableJoin- ? t("join_album")- : isTouchscreen- ? t("install")- : t("sign_up");-return (<><MobileNavContainer>@@ -99,7 +83,18 @@ export const MobileNavBar: React.FC<MobileNavBarProps> = ({{onShowFeed && (<MobileNavButton onClick={onShowFeed}>- <FeedIcon />+ <Box+ sx={{+ width: 16,+ height: 16,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ "& svg": { width: "100%", height: "100%" },+ }}+ >+ <FeedIcon />+ </Box></MobileNavButton>)}@@ -119,17 +114,20 @@ export const MobileNavBar: React.FC<MobileNavBarProps> = ({</MobileNavButton>)}- {(!onAddPhotos || enableJoin) && (- <MobileSignUpButton- onClick={- enableJoin- ? handleJoinAlbum- : handleSignUpOrInstall- }- >- {buttonText}- </MobileSignUpButton>- )}+ <MobileSignUpButton+ onClick={+ enableJoin+ ? handleJoinAlbum+ : () =>+ window.open(+ getEnteURL(isTouchscreen),+ "_blank",+ "noopener",+ )+ }+ >+ {enableJoin ? t("join_album") : t("get_ente")}+ </MobileSignUpButton></ButtonGroup></MobileNavContainer>diff --git a/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx b/web/apps/photos/src/components/TripLayout/TopNavButtons.tsxindex a0ada41cfa..eb9b22e61d 100644--- a/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx+++ b/web/apps/photos/src/components/TripLayout/TopNavButtons.tsx@@ -11,7 +11,7 @@ import { Notification } from "ente-new/photos/components/Notification";import { useJoinAlbum } from "hooks/useJoinAlbum";import { t } from "i18next";import { useState } from "react";-import { getSignUpOrInstallURL } from "utils/public-album";+import { getEnteURL } from "utils/public-album";interface TopNavButtonsProps {onAddPhotos?: () => void;@@ -53,22 +53,6 @@ export const TopNavButtons: React.FC<TopNavButtonsProps> = ({}};- const handleSignUpOrInstall = () => {- if (typeof window !== "undefined") {- window.open(- getSignUpOrInstallURL(isTouchscreen),- "_blank",- "noopener",- );- }- };-- const buttonText = enableJoin- ? t("join_album")- : isTouchscreen- ? t("install")- : t("sign_up");-return (<><ButtonContainer>@@ -96,15 +80,20 @@ export const TopNavButtons: React.FC<TopNavButtonsProps> = ({</NavButton>)}- {(!onAddPhotos || enableJoin) && (- <SignUpButton- onClick={- enableJoin ? handleJoinAlbum : handleSignUpOrInstall- }- >- {buttonText}- </SignUpButton>- )}+ <SignUpButton+ onClick={+ enableJoin+ ? handleJoinAlbum+ : () =>+ window.open(+ getEnteURL(isTouchscreen),+ "_blank",+ "noopener",+ )+ }+ >+ {enableJoin ? t("join_album") : t("get_ente")}+ </SignUpButton></ButtonContainer><Notificationdiff --git a/web/apps/photos/src/components/TripLayout/index.tsx b/web/apps/photos/src/components/TripLayout/index.tsxindex bd48fd3585..edc225aeac 100644--- a/web/apps/photos/src/components/TripLayout/index.tsx+++ b/web/apps/photos/src/components/TripLayout/index.tsx@@ -614,7 +614,6 @@ export const TripLayout: React.FC<TripLayoutProps> = ({{collection && credentials?.current && collectionKey && (<PublicFeedSidebar{...publicFeedVisibilityProps}- albumName={collectionTitle}files={files}credentials={credentials.current}collectionKey={collectionKey}diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex 5366005517..12b0107fee 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -6,14 +6,7 @@ import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateimport CloseIcon from "@mui/icons-material/Close";import DownloadIcon from "@mui/icons-material/Download";-import {- Box,- Button,- IconButton,- Stack,- styled,- Tooltip,-} from "@mui/material";+import { Box, Button, IconButton, Stack, styled, Tooltip } from "@mui/material";import Typography from "@mui/material/Typography";import { FeedIcon } from "components/Collections/CollectionHeader";import { DownloadStatusNotifications } from "components/DownloadStatusNotifications";@@ -25,10 +18,7 @@ import {AccountsPageContents,AccountsPageTitle,} from "ente-accounts/components/layouts/centered-paper";-import {- SpacedRow,- Stack100vhCenter,-} from "ente-base/components/containers";+import { SpacedRow, Stack100vhCenter } from "ente-base/components/containers";import { EnteLogo } from "ente-base/components/EnteLogo";import {LoadingIndicator,@@ -41,7 +31,10 @@ import {SingleInputForm,type SingleInputFormProps,} from "ente-base/components/SingleInputForm";-import { useIsSmallWidth } from "ente-base/components/utils/hooks";+import {+ useIsSmallWidth,+ useIsTouchscreen,+} from "ente-base/components/utils/hooks";import { useModalVisibility } from "ente-base/components/utils/modal";import { useBaseContext } from "ente-base/context";import {@@ -102,6 +95,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { type FileWithPath } from "react-dropzone";import { uploadManager } from "services/upload-manager";import { getSelectedFiles, type SelectedState } from "utils/file";+import { getEnteURL } from "utils/public-album";export default function PublicCollectionGallery() {const { showMiniDialog, onGenericError } = useBaseContext();@@ -745,6 +739,7 @@ const PrimaryActionButton: React.FC<PrimaryActionButtonProps> = ({collectionKey,credentials,}) => {+ const isTouchscreen = useIsTouchscreen();const { handleJoinAlbum } = useJoinAlbum({publicCollection,accessToken,@@ -760,8 +755,12 @@ const PrimaryActionButton: React.FC<PrimaryActionButtonProps> = ({);}+ const handleGetEnte = () => {+ window.open(getEnteURL(isTouchscreen), "_blank", "noopener");+ };+return (- <GreenButton color="accent" href="https://ente.io">+ <GreenButton color="accent" onClick={handleGetEnte}>{t("get_ente")}</GreenButton>);@@ -883,4 +882,6 @@ const fileListFooterHeight = 24;* It scrolls along with the content. It has a fixed height,* {@link fileListFooterHeight}.*/-const FileListFooter: React.FC = () => <Box sx={{ height: fileListFooterHeight }} />;+const FileListFooter: React.FC = () => (+ <Box sx={{ height: fileListFooterHeight }} />+);diff --git a/web/apps/photos/src/utils/public-album.ts b/web/apps/photos/src/utils/public-album.tsindex 7cd852766d..970b63635a 100644--- a/web/apps/photos/src/utils/public-album.ts+++ b/web/apps/photos/src/utils/public-album.ts@@ -1,9 +1,9 @@-import { photosAppOrigin } from "ente-base/origins";-/**- * Get the appropriate URL for sign up or install based on platform.+ * Get the appropriate URL for "Get Ente" button based on platform.+ *+ * Returns app store URLs for iOS/Android devices, ente.io for desktop.*/-export const getSignUpOrInstallURL = (isTouchscreen: boolean): string => {+export const getEnteURL = (isTouchscreen: boolean): string => {if (isTouchscreen) {// For mobile devices, redirect to app storesconst userAgent = navigator.userAgent || "";@@ -20,6 +20,6 @@ export const getSignUpOrInstallURL = (isTouchscreen: boolean): string => {}// For other touchscreen devices, fall back to web}- // For desktop or other platforms, redirect to photos app- return photosAppOrigin();+ // For desktop or other platforms, redirect to ente.io+ return "https://ente.io";};