Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove referral banner from public albums

Anand Baburajancb5fe4019638
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 2aa18e4253..bccb2f8db9 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -50,7 +50,6 @@ import {
useIsTouchscreen,
} from "ente-base/components/utils/hooks";
import { useBaseContext } from "ente-base/context";
-import { isDevBuild } from "ente-base/env";
import {
isHTTP401Error,
isHTTPErrorWithStatus,
@@ -80,7 +79,6 @@ import { type EnteFile } from "ente-media/file";
import {
removePublicCollectionAccessTokenJWT,
removePublicCollectionByKey,
- savedLastPublicCollectionReferralCode,
savedPublicCollectionAccessTokenJWT,
savedPublicCollectionByKey,
savedPublicCollectionFiles,
@@ -116,7 +114,6 @@ export default function PublicCollectionGallery() {
const [publicFiles, setPublicFiles] = useState<EnteFile[] | undefined>(
undefined,
);
- const [referralCode, setReferralCode] = useState<string>("");
const [errorMessage, setErrorMessage] = useState<string>("");
const [loading, setLoading] = useState(true);
const [isPasswordProtected, setIsPasswordProtected] = useState(false);
@@ -229,9 +226,6 @@ export default function PublicCollectionGallery() {
return;
}
- setReferralCode(
- (await savedLastPublicCollectionReferralCode()) ?? "",
- );
setPublicCollection(collection);
setIsPasswordProtected(
!!collection.publicURLs[0]?.passwordEnabled,
@@ -276,15 +270,15 @@ export default function PublicCollectionGallery() {
showLoadingBar();
setLoading(true);
try {
- const { collection, referralCode: userReferralCode } =
- await pullCollection(accessToken, collectionKey.current!);
+ const { collection } = await pullCollection(
+ accessToken,
+ collectionKey.current!,
+ );
if (checkAndRedirectForTripAlbum(collection)) {
return;
}
- setReferralCode(userReferralCode);
-
setPublicCollection(collection);
const isPasswordProtected =
!!collection.publicURLs[0]?.passwordEnabled;
@@ -443,8 +437,6 @@ export default function PublicCollectionGallery() {
: undefined;
}, [publicCollection]);
- const shouldShowReferralBanner = isDevBuild || !isCustomAlbumsAppOrigin;
-
const closeUploadTypeSelectorView = () => {
setUploadTypeSelectorView(false);
};
@@ -470,16 +462,13 @@ export default function PublicCollectionGallery() {
);
const fileListFooter = useMemo<FileListHeaderOrFooter>(() => {
- const props = {
- referralCode: shouldShowReferralBanner ? referralCode : undefined,
- onAddPhotos,
- };
+ const props = { onAddPhotos };
return {
component: <FileListFooter {...props} />,
height: fileListFooterHeightForProps(props),
extendToInlineEdges: true,
};
- }, [referralCode, onAddPhotos, shouldShowReferralBanner]);
+ }, [onAddPhotos]);
if (loading && (!publicFiles || !credentials.current)) {
return <LoadingIndicator />;
@@ -750,17 +739,14 @@ const FileListHeader: React.FC<FileListHeaderProps> = ({
};
interface FileListFooterProps {
- referralCode?: string;
onAddPhotos?: () => void;
}
/**
* The dynamic (prop-dependent) height of {@link FileListFooter}.
*/
-const fileListFooterHeightForProps = ({
- referralCode,
- onAddPhotos,
-}: FileListFooterProps) => (onAddPhotos ? 104 : 0) + (referralCode ? 113 : 75);
+const fileListFooterHeightForProps = ({ onAddPhotos }: FileListFooterProps) =>
+ (onAddPhotos ? 104 : 0) + 75;
/**
* A footer shown after the listing of files.
@@ -769,10 +755,7 @@ const fileListFooterHeightForProps = ({
* props, calculated using {@link fileListFooterHeightForProps}.
*/
-const FileListFooter: React.FC<FileListFooterProps> = ({
- referralCode,
- onAddPhotos,
-}) => (
+const FileListFooter: React.FC<FileListFooterProps> = ({ onAddPhotos }) => (
<Stack sx={{ flex: 1, alignSelf: "flex-end" }}>
{onAddPhotos && (
<CenteredFill>
@@ -808,22 +791,5 @@ const FileListFooter: React.FC<FileListFooterProps> = ({
/>
</Typography>
</Link>
- {referralCode && (
- <Typography
- sx={{
- mt: "6px",
- mb: 0,
- padding: "8px",
- bgcolor: "accent.main",
- color: "accent.contrastText",
- textAlign: "center",
- }}
- >
- <Trans
- i18nKey={"sharing_referral_code"}
- values={{ referralCode }}
- />
- </Typography>
- )}
</Stack>
);