Skip to content

armgit / ente

Public Imported from GitHub
0

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

Adjust public album CTA buttons

Anand Baburajane0de15ebdec6
diff --git a/web/apps/albums/src/public-album/components/TripLayout/MobileNavBar.tsx b/web/apps/albums/src/public-album/components/TripLayout/MobileNavBar.tsx
index ba628c7b1b..297d751f46 100644
--- a/web/apps/albums/src/public-album/components/TripLayout/MobileNavBar.tsx
+++ b/web/apps/albums/src/public-album/components/TripLayout/MobileNavBar.tsx
@@ -1,5 +1,4 @@
import { LazyNotification } from "@/app/lazy/global-ui";
-import { useJoinAlbum } from "@/public-album/access/hooks/useJoinAlbum";
import { getEnteURL } from "@/public-album/access/utils/external-links";
import { FeedIcon } from "@/public-album/social/components/FeedIcon";
import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateOutlined";
@@ -8,8 +7,6 @@ import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import ShareIcon from "@mui/icons-material/Share";
import { Box, Button, IconButton, styled } from "@mui/material";
import { EnteLogo } from "ente-base/components/EnteLogo";
-import type { PublicAlbumsCredentials } from "ente-base/http";
-import type { Collection } from "ente-media/collection";
import { t } from "i18next";
import { useState } from "react";
@@ -19,10 +16,6 @@ interface MobileNavBarProps {
enableDownload?: boolean;
onShowFeed?: () => void;
collectionTitle?: string;
- publicCollection?: Collection;
- accessToken?: string;
- collectionKey?: string;
- credentials?: React.RefObject<PublicAlbumsCredentials | undefined>;
}
export const MobileNavBar: React.FC<MobileNavBarProps> = ({
@@ -31,21 +24,9 @@ export const MobileNavBar: React.FC<MobileNavBarProps> = ({
enableDownload,
onShowFeed,
collectionTitle,
- publicCollection,
- accessToken,
- collectionKey,
- credentials,
}) => {
const [showCopiedMessage, setShowCopiedMessage] = useState(false);
- const enableJoin = publicCollection?.publicURLs[0]?.enableJoin;
- const { handleJoinAlbum } = useJoinAlbum({
- publicCollection,
- accessToken,
- collectionKey,
- credentials,
- });
-
const handleShare = async () => {
if (typeof window !== "undefined") {
const albumName = collectionTitle || "Trip";
@@ -113,15 +94,11 @@ export const MobileNavBar: React.FC<MobileNavBarProps> = ({
)}
<MobileSignUpButton
- onClick={
- enableJoin
- ? handleJoinAlbum
- : () => {
- window.location.href = getEnteURL();
- }
- }
+ onClick={() => {
+ window.location.href = getEnteURL();
+ }}
>
- {enableJoin ? t("join_album") : t("get_ente_photos")}
+ {t("get_ente_photos")}
</MobileSignUpButton>
</ButtonGroup>
</MobileNavContainer>
diff --git a/web/apps/albums/src/public-album/components/TripLayout/TopNavButtons.tsx b/web/apps/albums/src/public-album/components/TripLayout/TopNavButtons.tsx
index 5cd65b8239..f2dee4e683 100644
--- a/web/apps/albums/src/public-album/components/TripLayout/TopNavButtons.tsx
+++ b/web/apps/albums/src/public-album/components/TripLayout/TopNavButtons.tsx
@@ -1,5 +1,4 @@
import { LazyNotification } from "@/app/lazy/global-ui";
-import { useJoinAlbum } from "@/public-album/access/hooks/useJoinAlbum";
import { getEnteURL } from "@/public-album/access/utils/external-links";
import { FeedIcon } from "@/public-album/social/components/FeedIcon";
import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateOutlined";
@@ -7,8 +6,6 @@ import CheckIcon from "@mui/icons-material/Check";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import ShareIcon from "@mui/icons-material/Share";
import { Box, Button, IconButton, styled } from "@mui/material";
-import type { PublicAlbumsCredentials } from "ente-base/http";
-import type { Collection } from "ente-media/collection";
import { t } from "i18next";
import { useState } from "react";
@@ -17,10 +14,6 @@ interface TopNavButtonsProps {
downloadAllFiles: () => void;
enableDownload?: boolean;
onShowFeed?: () => void;
- publicCollection?: Collection;
- accessToken?: string;
- collectionKey?: string;
- credentials?: React.RefObject<PublicAlbumsCredentials | undefined>;
}
export const TopNavButtons: React.FC<TopNavButtonsProps> = ({
@@ -28,21 +21,9 @@ export const TopNavButtons: React.FC<TopNavButtonsProps> = ({
downloadAllFiles,
enableDownload,
onShowFeed,
- publicCollection,
- accessToken,
- collectionKey,
- credentials,
}) => {
const [showCopiedMessage, setShowCopiedMessage] = useState(false);
- const enableJoin = publicCollection?.publicURLs[0]?.enableJoin;
- const { handleJoinAlbum } = useJoinAlbum({
- publicCollection,
- accessToken,
- collectionKey,
- credentials,
- });
-
const handleShare = () => {
if (typeof window !== "undefined") {
void navigator.clipboard.writeText(window.location.href);
@@ -79,15 +60,11 @@ export const TopNavButtons: React.FC<TopNavButtonsProps> = ({
)}
<SignUpButton
- onClick={
- enableJoin
- ? handleJoinAlbum
- : () => {
- window.location.href = getEnteURL();
- }
- }
+ onClick={() => {
+ window.location.href = getEnteURL();
+ }}
>
- {enableJoin ? t("join_album") : t("get_ente_photos")}
+ {t("get_ente_photos")}
</SignUpButton>
</ButtonContainer>
diff --git a/web/apps/albums/src/public-album/components/TripLayout/index.tsx b/web/apps/albums/src/public-album/components/TripLayout/index.tsx
index f48ede73fa..83137ff9e6 100644
--- a/web/apps/albums/src/public-album/components/TripLayout/index.tsx
+++ b/web/apps/albums/src/public-album/components/TripLayout/index.tsx
@@ -360,10 +360,6 @@ export const TripLayout: React.FC<TripLayoutProps> = ({
enableDownload={enableDownload}
onShowFeed={enableComment ? showPublicFeed : undefined}
collectionTitle={collectionTitle}
- publicCollection={collection}
- accessToken={accessToken}
- collectionKey={collectionKey}
- credentials={credentials}
/>
) : (
<TopNavButtons
@@ -371,10 +367,6 @@ export const TripLayout: React.FC<TripLayoutProps> = ({
downloadAllFiles={downloadAllFiles}
enableDownload={enableDownload}
onShowFeed={enableComment ? showPublicFeed : undefined}
- publicCollection={collection}
- accessToken={accessToken}
- collectionKey={collectionKey}
- credentials={credentials}
/>
))}
{/* Mobile Layout */}
diff --git a/web/apps/albums/src/public-album/page/PublicAlbumPage.tsx b/web/apps/albums/src/public-album/page/PublicAlbumPage.tsx
index 732f53ab82..3178c1ab57 100644
--- a/web/apps/albums/src/public-album/page/PublicAlbumPage.tsx
+++ b/web/apps/albums/src/public-album/page/PublicAlbumPage.tsx
@@ -57,10 +57,8 @@ import {
LoadingIndicator,
TranslucentLoadingOverlay,
} from "ente-base/components/loaders";
-import type { ButtonishProps } from "ente-base/components/mui";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import { NavbarBase } from "ente-base/components/Navbar";
-import { useIsSmallWidth } from "ente-base/components/utils/hooks";
import { useModalVisibility } from "ente-base/components/utils/modal";
import { useBaseContext } from "ente-base/context";
import {
@@ -577,7 +575,6 @@ export default function PublicAlbumPage() {
const commentsEnabled =
publicCollection?.publicURLs[0]?.enableComment ?? false;
const joinEnabled = publicCollection?.publicURLs[0]?.enableJoin ?? false;
- const addPhotosEnabled = collectEnabled;
const handleDrop = useCallback((files: FileWithPath[]) => {
setShouldRenderUpload(true);
setDragAndDropFiles(files);
@@ -733,17 +730,10 @@ export default function PublicAlbumPage() {
</EnteLogoLink>
<Stack direction="row" spacing={2}>
<SecondaryActionButton
- onAddPhotos={onAddPhotos}
- addPhotosDisabled={isUploadInProgress}
enableJoin={joinEnabled}
onJoinAlbum={handleJoinAlbum}
/>
- <PrimaryActionButton
- showJoinAsPrimary={
- addPhotosEnabled && joinEnabled
- }
- onJoinAlbum={handleJoinAlbum}
- />
+ <PrimaryActionButton />
</Stack>
</SpacedRow>
)}
@@ -894,52 +884,7 @@ const GreenButton = styled(Button)(() => ({
const navbarActionButtonSx = { borderRadius: "16px", paddingBlock: "11px" };
-type AddPhotosButtonProps = ButtonishProps & { disabled?: boolean };
-
-const AddPhotosButton: React.FC<AddPhotosButtonProps> = ({
- onClick,
- disabled,
-}) => {
- const isSmallWidth = useIsSmallWidth();
-
- return (
- <FocusVisibleButton
- color="secondary"
- startIcon={
- isSmallWidth ? undefined : (
- <HugeiconsIcon
- icon={ImageAdd02Icon}
- size={20}
- strokeWidth={1.8}
- />
- )
- }
- sx={navbarActionButtonSx}
- {...{ onClick, disabled }}
- >
- {t("add_photos")}
- </FocusVisibleButton>
- );
-};
-
-interface PrimaryActionButtonProps {
- /** If true, shows "Join Album" as the primary action */
- showJoinAsPrimary?: boolean;
- onJoinAlbum?: () => void;
-}
-
-const PrimaryActionButton: React.FC<PrimaryActionButtonProps> = ({
- showJoinAsPrimary,
- onJoinAlbum,
-}) => {
- if (showJoinAsPrimary) {
- return (
- <GreenButton color="accent" onClick={onJoinAlbum}>
- {t("join_album")}
- </GreenButton>
- );
- }
-
+const PrimaryActionButton: React.FC = () => {
const handleGetEnte = () => {
window.location.href = getEnteURL();
};
@@ -952,27 +897,14 @@ const PrimaryActionButton: React.FC<PrimaryActionButtonProps> = ({
};
interface SecondaryActionButtonProps {
- onAddPhotos?: () => void;
- addPhotosDisabled?: boolean;
enableJoin?: boolean;
onJoinAlbum?: () => void;
}
const SecondaryActionButton: React.FC<SecondaryActionButtonProps> = ({
- onAddPhotos,
- addPhotosDisabled,
enableJoin,
onJoinAlbum,
}) => {
- if (onAddPhotos) {
- return (
- <AddPhotosButton
- onClick={onAddPhotos}
- disabled={addPhotosDisabled}
- />
- );
- }
-
if (enableJoin) {
return (
<FocusVisibleButton