Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(uploadProgress):update-internal-flag-to-bool-flag

Aswin Asokec909dd5cf5a
diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsx
index d1d4de0bc8..a0e94fc8e8 100644
--- a/web/apps/photos/src/components/Collections/AllAlbums.tsx
+++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx
@@ -31,7 +31,6 @@ import {
LargeTileCreateNewButton,
LargeTileTextOverlay,
} from "ente-new/photos/components/Tiles";
-import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import {
createAlbum,
createHiddenAlbum,
@@ -63,6 +62,8 @@ interface AllAlbums {
onRemotePull: () => Promise<void>;
}
+const enableV2 = true as boolean;
+
/**
* A modal showing the list of all the albums.
*/
@@ -80,7 +81,6 @@ export const AllAlbums: React.FC<AllAlbums> = ({
const fullScreen = useMediaQuery("(max-width: 428px)");
const [searchTerm, setSearchTerm] = useState("");
const { showNotification } = usePhotosAppContext();
- const { isInternalUser } = useSettingsSnapshot();
const { show: showAlbumNameInput, props: albumNameInputVisibilityProps } =
useModalVisibility();
const [albumCreatedToast, setAlbumCreatedToast] = useState<{
@@ -174,7 +174,7 @@ export const AllAlbums: React.FC<AllAlbums> = ({
</AllAlbumsDialog>
<SingleInputDialog
{...albumNameInputVisibilityProps}
- variant={isInternalUser ? "v2" : "default"}
+ variant={enableV2 ? "v2" : "default"}
title={t("new_album")}
label={t("album_name")}
submitButtonTitle={t("create")}
diff --git a/web/apps/photos/src/components/DefaultOptionsV2.tsx b/web/apps/photos/src/components/DefaultOptionsV2.tsx
index 5ca7a0bb51..9082330c48 100644
--- a/web/apps/photos/src/components/DefaultOptionsV2.tsx
+++ b/web/apps/photos/src/components/DefaultOptionsV2.tsx
@@ -13,6 +13,7 @@ import {
} from "@mui/material";
import { SpacedRow } from "ente-base/components/containers";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
+import { t } from "i18next";
import React from "react";
interface DefaultOptionsV2Props {
@@ -25,47 +26,6 @@ interface DefaultOptionsV2Props {
onSelectFolder: () => void;
}
-const importHelp = (
- <Typography
- sx={{
- color: "text.faint",
- fontSize: "14px",
- fontWeight: 500,
- lineHeight: "20px",
- textAlign: "center",
- }}
- >
- <Link
- href="https://ente.com/help/photos/migration/#import-your-photos-into-ente"
- target="_blank"
- rel="noopener"
- sx={{
- color: "accent.main",
- fontWeight: 500,
- textDecoration: "underline",
- }}
- >
- Need help?
- </Link>{" "}
- <span style={{ opacity: 0.7 }}>Not seeing your provider</span>
- </Typography>
-);
-
-const dragAndDropHint = (
- <Typography
- sx={{
- color: "text.faint",
- fontSize: "12px",
- fontWeight: 500,
- lineHeight: "16px",
- opacity: 0.7,
- textAlign: "center",
- }}
- >
- Or just drag and drop here
- </Typography>
-);
-
export function DefaultOptionsV2({
intent,
isFileSelectionPending,
@@ -93,10 +53,10 @@ export function DefaultOptionsV2({
lineHeight: "32px",
}}
>
- {intent == "import" ? "Import your library" : "Upload"}
+ {t(intent == "import" ? "import_library" : "upload")}
</Typography>
<IconButton
- aria-label="Close"
+ aria-label={t("close")}
onClick={onClose}
sx={(theme) => ({
width: "38px",
@@ -156,7 +116,7 @@ function ImportOptions({
color="var(--mui-palette-text-muted)"
/>
}
- label="Google Photos"
+ label={t("google_photos")}
onClick={onSelectGooglePhotos}
/>
<ImportProviderButton
@@ -167,13 +127,13 @@ function ImportOptions({
color="var(--mui-palette-text-muted)"
/>
}
- label="Folder"
+ label={t("folder")}
pending={isFolderSelectionPending}
onClick={onSelectFolder}
/>
</Stack>
- {dragAndDropHint}
- {importHelp}
+ <DragAndDropHint />
+ <ImportHelp />
</Stack>
);
}
@@ -196,7 +156,7 @@ function UploadOptions({
}: UploadOptionsProps): React.JSX.Element {
return (
<Stack sx={{ gap: "24px" }}>
- <ImportSection title="Upload from">
+ <ImportSection title={t("upload_from")}>
<Stack direction="row" sx={{ gap: "10px" }}>
<ImportProviderButton
icon={
@@ -206,7 +166,7 @@ function UploadOptions({
color="var(--mui-palette-text-muted)"
/>
}
- label="Files"
+ label={t("files")}
pending={isFileSelectionPending}
onClick={onSelectFiles}
/>
@@ -218,22 +178,22 @@ function UploadOptions({
color="var(--mui-palette-text-muted)"
/>
}
- label="Folder"
+ label={t("folder")}
pending={isFolderSelectionPending}
onClick={onSelectFolder}
/>
</Stack>
- {dragAndDropHint}
+ <DragAndDropHint />
</ImportSection>
- <ImportSection title="Import from" gap="20px">
+ <ImportSection title={t("import_from")} gap="20px">
<OptionRowButton
icon={
<GoogleIcon
sx={{ color: "text.muted", fontSize: "20px" }}
/>
}
- label="Google takeout"
+ label={t("google_takeout")}
onClick={onSelectGooglePhotos}
/>
</ImportSection>
@@ -405,6 +365,51 @@ function OptionRowButton({
);
}
+function ImportHelp(): React.JSX.Element {
+ return (
+ <Typography
+ sx={{
+ color: "text.faint",
+ fontSize: "14px",
+ fontWeight: 500,
+ lineHeight: "20px",
+ textAlign: "center",
+ }}
+ >
+ <Link
+ href="https://ente.com/help/photos/migration/#import-your-photos-into-ente"
+ target="_blank"
+ rel="noopener"
+ sx={{
+ color: "accent.main",
+ fontWeight: 500,
+ textDecoration: "underline",
+ }}
+ >
+ {t("need_help")}
+ </Link>{" "}
+ <span style={{ opacity: 0.7 }}>{t("provider_not_listed")}</span>
+ </Typography>
+ );
+}
+
+function DragAndDropHint(): React.JSX.Element {
+ return (
+ <Typography
+ sx={{
+ color: "text.faint",
+ fontSize: "12px",
+ fontWeight: 500,
+ lineHeight: "16px",
+ opacity: 0.7,
+ textAlign: "center",
+ }}
+ >
+ {t("drag_and_drop_here")}
+ </Typography>
+ );
+}
+
function PendingIndicator(): React.JSX.Element {
return <CircularProgress size={18} sx={{ color: "stroke.muted" }} />;
}
diff --git a/web/apps/photos/src/components/TakeoutOptionsV2.tsx b/web/apps/photos/src/components/TakeoutOptionsV2.tsx
index dc1dea9ddb..f8056adc7c 100644
--- a/web/apps/photos/src/components/TakeoutOptionsV2.tsx
+++ b/web/apps/photos/src/components/TakeoutOptionsV2.tsx
@@ -6,6 +6,7 @@ import CloseIcon from "@mui/icons-material/Close";
import { Box, IconButton, Link, Stack, Typography } from "@mui/material";
import { isDesktop } from "ente-base/app";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
+import { t } from "i18next";
import React from "react";
interface TakeoutOptionsV2Props {
@@ -29,7 +30,7 @@ export function TakeoutOptionsV2({
>
<Stack direction="row" sx={{ alignItems: "center", gap: 1 }}>
<IconButton
- aria-label="Back"
+ aria-label={t("go_back")}
onClick={onBack}
sx={{
width: "38px",
@@ -47,11 +48,11 @@ export function TakeoutOptionsV2({
lineHeight: "32px",
}}
>
- Import from Google Photos
+ {t("import_from_google_photos")}
</Typography>
</Stack>
<IconButton
- aria-label="Close"
+ aria-label={t("close")}
onClick={onClose}
sx={(theme) => ({
width: "38px",
@@ -71,17 +72,15 @@ export function TakeoutOptionsV2({
<Stack sx={{ gap: 1 }}>
<TakeoutOptionButton
icon={<HugeiconsIcon icon={Folder01Icon} size={18} />}
- label="Unzipped folder"
- description="Unzip everything into one folder, then select it"
+ label={t("unzipped_folder")}
+ description={t("unzipped_folder_hint")}
onClick={onSelectFolder}
/>
<TakeoutOptionButton
icon={<HugeiconsIcon icon={FileZipIcon} size={18} />}
- label="ZIP files"
+ label={t("zip_files")}
description={
- isDesktop
- ? "Select your ZIPs, we'll unzip them for you"
- : "Desktop only"
+ isDesktop ? t("zip_files_hint") : t("desktop_only")
}
disabled={!isDesktop}
onClick={onSelectZips}
@@ -97,7 +96,7 @@ export function TakeoutOptionsV2({
}}
>
<span style={{ opacity: 0.7 }}>
- Still have confusions?{" "}
+ {t("takeout_help_prompt")}{" "}
</span>
<Link
href="https://ente.com/help/photos/migration/from-google-photos/"
@@ -109,7 +108,7 @@ export function TakeoutOptionsV2({
textDecoration: "underline",
}}
>
- We&apos;re here to help
+ {t("takeout_help_action")}
</Link>
</Typography>
</Stack>
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index c371739a48..6fe3c8d489 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -87,7 +87,6 @@ import { CollectionMappingChoice } from "ente-new/photos/components/CollectionMa
import type { CollectionSelectorAttributes } from "ente-new/photos/components/CollectionSelector";
import type { RemotePullOpts } from "ente-new/photos/components/gallery";
import { downloadAppDialogAttributes } from "ente-new/photos/components/utils/download";
-import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import { suppressAutoLockOnBlurForTrustedPrompt } from "ente-new/photos/services/app-lock";
import {
addOrCopyToCollection,
@@ -172,6 +171,8 @@ interface UploadProps {
type UploadType = "files" | "folders" | "zips";
+const enableV2 = true as boolean;
+
interface UploadFilesOptions {
persistPendingUploads?: boolean;
postUploadTargetCollection?: Collection;
@@ -231,8 +232,6 @@ export const Upload: React.FC<UploadProps> = ({
}) => {
const { showMiniDialog, onGenericError } = useBaseContext();
const { showNotification, watchFolderView } = usePhotosAppContext();
- const { isInternalUser } = useSettingsSnapshot();
- const enableUploadProgressUIV2 = isInternalUser;
const [uploadProgressView, setUploadProgressView] = useState(false);
const [
@@ -857,7 +856,7 @@ export const Upload: React.FC<UploadProps> = ({
) => {
if (uploadItemsAndPaths.current !== uploadItemAndPaths) return;
- if (!isInternalUser) {
+ if (!enableV2) {
void commitUploadToExistingCollection(
collection,
uploadItemAndPaths,
@@ -988,7 +987,7 @@ export const Upload: React.FC<UploadProps> = ({
if (uploadItemsAndPaths.current !== uploadItemAndPaths) return;
- if (skipConfirmation || !isInternalUser) {
+ if (skipConfirmation || !enableV2) {
void commitUploadToNewCollections(
uploadItemAndPaths,
collectionNameToUploadItems,
@@ -1389,13 +1388,12 @@ export const Upload: React.FC<UploadProps> = ({
open={props.uploadTypeSelectorView}
onClose={props.closeUploadTypeSelector}
intent={props.uploadTypeSelectorIntent}
- {...{ isInternalUser }}
pendingUploadType={
isInputPending ? selectedUploadType.current : undefined
}
onSelect={handleUploadTypeSelect}
/>
- {enableUploadProgressUIV2 ? (
+ {enableV2 ? (
<UploadProgressV2
open={uploadProgressView}
onClose={closeUploadProgress}
@@ -1430,7 +1428,7 @@ export const Upload: React.FC<UploadProps> = ({
open={showCanvasReadbackBlockedDialog}
onClose={() => setShowCanvasReadbackBlockedDialog(false)}
/>
- {isInternalUser && (
+ {enableV2 && (
<UploadConfirmationDialog
open={!!uploadConfirmation}
isTakeout={uploadConfirmation?.isTakeout ?? false}
@@ -1452,7 +1450,7 @@ export const Upload: React.FC<UploadProps> = ({
)}
<SingleInputDialog
{...newAlbumNameInputVisibilityProps}
- variant={isInternalUser ? "v2" : "default"}
+ variant={enableV2 ? "v2" : "default"}
onClose={handleNewAlbumNameInputClose}
title={t("new_album")}
label={t("album_name")}
@@ -1738,8 +1736,6 @@ const setPendingUploads = async (
};
type UploadTypeSelectorProps = ModalVisibilityProps & {
- /** Whether experimental upload UI should be shown. */
- isInternalUser: boolean;
/**
* The particular context / scenario in which this upload is occurring.
*/
@@ -1767,7 +1763,6 @@ type UploadTypeSelectorProps = ModalVisibilityProps & {
const UploadTypeSelector: React.FC<UploadTypeSelectorProps> = ({
open,
onClose,
- isInternalUser,
intent,
pendingUploadType,
onSelect,
@@ -1814,13 +1809,7 @@ const UploadTypeSelector: React.FC<UploadTypeSelectorProps> = ({
}}
>
<UploadOptions
- {...{
- isInternalUser,
- intent,
- pendingUploadType,
- onSelect,
- onClose,
- }}
+ {...{ intent, pendingUploadType, onSelect, onClose }}
/>
</Dialog>
);
@@ -1828,11 +1817,10 @@ const UploadTypeSelector: React.FC<UploadTypeSelectorProps> = ({
type UploadOptionsProps = Pick<
UploadTypeSelectorProps,
- "isInternalUser" | "onClose" | "intent" | "pendingUploadType" | "onSelect"
+ "onClose" | "intent" | "pendingUploadType" | "onSelect"
>;
const UploadOptions: React.FC<UploadOptionsProps> = ({
- isInternalUser,
intent,
pendingUploadType,
onSelect,
@@ -1874,7 +1862,7 @@ const UploadOptions: React.FC<UploadOptionsProps> = ({
const handleSelectFolder = () => handleSelect("folders");
return showTakeoutOptions ? (
- isInternalUser ? (
+ enableV2 ? (
<TakeoutOptionsV2
onBack={handleTakeoutClose}
onSelectFolder={handleSelectFolder}
@@ -1887,7 +1875,7 @@ const UploadOptions: React.FC<UploadOptionsProps> = ({
onClose={handleTakeoutClose}
/>
)
- ) : isInternalUser && intent != "collect" ? (
+ ) : enableV2 && intent != "collect" ? (
<DefaultOptionsV2
intent={intent}
isFileSelectionPending={pendingUploadType == "files"}
diff --git a/web/apps/photos/src/components/UploadConfirmationDialog.tsx b/web/apps/photos/src/components/UploadConfirmationDialog.tsx
index 84a44f939e..eb6783e60c 100644
--- a/web/apps/photos/src/components/UploadConfirmationDialog.tsx
+++ b/web/apps/photos/src/components/UploadConfirmationDialog.tsx
@@ -15,6 +15,7 @@ import {
} from "@mui/material";
import { EnteSwitch } from "ente-base/components/EnteSwitch";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
+import { t } from "i18next";
import type { ChangeEvent, ReactElement } from "react";
interface UploadConfirmationDialogProps {
@@ -64,12 +65,12 @@ export function UploadConfirmationDialog({
<Stack direction="row" sx={headerSx}>
<Typography sx={displayTitleSx}>
{isTakeout
- ? "Import from Google Photos"
- : "Upload to Ente"}
+ ? t("import_from_google_photos")
+ : t("upload_to_ente")}
</Typography>
<Stack direction="row" sx={headerActionsSx}>
<IconButton
- aria-label="Close"
+ aria-label={t("close")}
onClick={onCancel}
sx={headerButtonSx}
>
@@ -96,24 +97,31 @@ export function UploadConfirmationDialog({
sx={displayTitleSx}
>
{isTakeout
- ? "Ready to import!"
- : "Ready to upload!"}
+ ? t("ready_to_import")
+ : t("ready_to_upload")}
</Typography>
</Stack>
<Stack direction="row" sx={statsSx}>
<StatCard
value={fileCount}
- label="photos and videos found"
+ label={t("preupload_media_found", {
+ count: fileCount,
+ })}
+ />
+ <StatCard
+ value={albumCount}
+ label={t("preupload_album_found", {
+ count: albumCount,
+ })}
/>
- <StatCard value={albumCount} label="albums found" />
</Stack>
</Stack>
{isTakeout && (
<Stack sx={{ gap: "20px" }}>
<Typography component="h3" sx={sectionTitleSx}>
- More options
+ {t("more_options")}
</Typography>
<Stack direction="row" sx={optionSx}>
<Box sx={optionIconSx}>
@@ -121,11 +129,10 @@ export function UploadConfirmationDialog({
</Box>
<Stack sx={optionTextSx}>
<Typography sx={bodySx}>
- Favourites
+ {t("favorites")}
</Typography>
<Typography sx={captionSx}>
- Carry over your favourites from Google
- Photos
+ {t("import_favorites_hint")}
</Typography>
</Stack>
<EnteSwitch
@@ -133,7 +140,7 @@ export function UploadConfirmationDialog({
checked={importFavorites}
onChange={onImportFavoritesChange}
slotProps={{
- input: { "aria-label": "Favourites" },
+ input: { "aria-label": t("favorites") },
}}
sx={switchSx}
/>
@@ -147,11 +154,10 @@ export function UploadConfirmationDialog({
</Box>
<Stack sx={optionTextSx}>
<Typography sx={bodySx}>
- Partner shared photos
+ {t("partner_shared_photos")}
</Typography>
<Typography sx={captionSx}>
- Import photos that were shared by your
- partner on Google Photos
+ {t("import_partner_shared_photos_hint")}
</Typography>
</Stack>
<EnteSwitch
@@ -160,8 +166,9 @@ export function UploadConfirmationDialog({
onChange={onIncludePartnerSharedFilesChange}
slotProps={{
input: {
- "aria-label":
- "Partner shared photos",
+ "aria-label": t(
+ "partner_shared_photos",
+ ),
},
}}
sx={switchSx}
@@ -177,7 +184,7 @@ export function UploadConfirmationDialog({
onClick={onConfirm}
sx={confirmButtonSx}
>
- {isTakeout ? "Start import" : "Start upload"}
+ {t(isTakeout ? "start_import" : "start_upload")}
</FocusVisibleButton>
</Stack>
</Dialog>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 76126fb59e..e40ee6ac90 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -188,6 +188,8 @@ import { Trans } from "react-i18next";
* --------------------- |
* Photo List v
*/
+const enableV2 = true as boolean;
+
const Page: React.FC = () => {
const { logout, showMiniDialog, onGenericError } = useBaseContext();
const {
@@ -261,7 +263,7 @@ const Page: React.FC = () => {
const [collectionSelectorAttributes, setCollectionSelectorAttributes] =
useState<CollectionSelectorAttributes | undefined>();
- const { customDomain, isInternalUser } = useSettingsSnapshot();
+ const { customDomain } = useSettingsSnapshot();
const userDetails = useUserDetailsSnapshot();
const peopleState = usePeopleStateSnapshot();
@@ -2217,7 +2219,7 @@ const Page: React.FC = () => {
!isFirstLoad &&
!state.collectionFiles.length &&
activeCollectionID === PseudoCollectionID.all ? (
- isInternalUser ? (
+ enableV2 ? (
<GalleryEmptyStateV2
isUploadInProgress={uploadManager.isUploadInProgress()}
onUpload={openUploader}
@@ -2316,7 +2318,7 @@ const Page: React.FC = () => {
/>
<SingleInputDialog
{...albumNameInputVisibilityProps}
- variant={isInternalUser ? "v2" : "default"}
+ variant={enableV2 ? "v2" : "default"}
title={t("new_album")}
label={t("album_name")}
submitButtonTitle={t("create")}
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index af98cb8a71..c68054bca6 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -73,6 +73,73 @@
"upload_cancelling": "Cancelling remaining uploads",
"upload_done": "{{count, number}} uploaded",
"upload_skipped": "{{count, number}} skipped",
+ "import_library": "Import your library",
+ "need_help": "Need help?",
+ "provider_not_listed": "Not seeing your provider",
+ "drag_and_drop_here": "Or just drag and drop here",
+ "upload_from": "Upload from",
+ "import_from": "Import from",
+ "google_photos": "Google Photos",
+ "import_from_google_photos": "Import from Google Photos",
+ "unzipped_folder": "Unzipped folder",
+ "unzipped_folder_hint": "Unzip everything into one folder, then select it",
+ "zip_files": "ZIP files",
+ "zip_files_hint": "Select your ZIPs, we'll unzip them for you",
+ "desktop_only": "Desktop only",
+ "takeout_help_prompt": "Still have questions?",
+ "takeout_help_action": "We're here to help",
+ "upload_to_ente": "Upload to Ente",
+ "ready_to_import": "Ready to import!",
+ "ready_to_upload": "Ready to upload!",
+ "preupload_media_found_one": "photo or video found",
+ "preupload_media_found": "photos and videos found",
+ "preupload_album_found_one": "album found",
+ "preupload_album_found": "albums found",
+ "more_options": "More options",
+ "import_favorites_hint": "Carry over your favorites from Google Photos",
+ "partner_shared_photos": "Partner shared photos",
+ "import_partner_shared_photos_hint": "Import photos that were shared by your partner on Google Photos",
+ "start_import": "Start import",
+ "start_upload": "Start upload",
+ "gallery_empty_state_v2_subtitle": "Store and share your memories with full privacy",
+ "upload_existing_library": "Upload your existing library",
+ "memories_secured_since_arrival_one": "{{count, number}} memory secured since you came here",
+ "memories_secured_since_arrival": "{{count, number}} memories secured since you came here",
+ "upload_details": "Upload details",
+ "minimize": "Minimize",
+ "expand": "Expand",
+ "uploaded_percent": "{{percent, number}}% uploaded",
+ "upload_getting_ready": "Getting your upload ready",
+ "upload_finishing_active": "Finishing active uploads safely",
+ "upload_reading_file_information": "Reading file information",
+ "this_may_take_a_moment": "This may take a moment",
+ "percent_complete": "{{percent, number}}%",
+ "uploading": "Uploading",
+ "upload_complete": "Upload complete",
+ "upload_items_progress": "{{count, number}} of {{total, number}} items",
+ "upload_reason_already_on_ente": "Already on Ente",
+ "upload_reason_shared_by_partner": "Shared by partner",
+ "upload_reason_not_enough_storage": "Not enough storage",
+ "upload_reason_file_too_large": "File over 10 GB",
+ "upload_reason_unsupported_file": "File type not supported",
+ "upload_reason_empty_file": "Empty file",
+ "upload_reason_blocked": "Upload blocked",
+ "upload_reason_failed": "Upload failed",
+ "upload_reason_blocked_hint": "Your browser or an addon is preventing Ente from using eTags to upload large files.",
+ "upload_reason_hidden_file": "Hidden file",
+ "upload_reason_unreadable_zip": "Unreadable zip",
+ "upload_stat_completed": "Completed",
+ "upload_stat_skipped": "Skipped",
+ "upload_stat_failed": "Failed",
+ "upload_stat_in_progress": "In progress",
+ "upload_empty_completed": "No completed uploads yet",
+ "upload_empty_skipped": "No skipped files yet",
+ "upload_empty_failed": "No failed uploads yet",
+ "upload_completion_title": "Your upload is done!",
+ "upload_completion_subtitle": "Uploaded items are now available on Ente.",
+ "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",
"no_account": "Don't have an account",
"existing_account": "Already have an account",
diff --git a/web/packages/gallery/components/UploadCompletionV2.tsx b/web/packages/gallery/components/UploadCompletionV2.tsx
index 908c49f76a..e9b70876bb 100644
--- a/web/packages/gallery/components/UploadCompletionV2.tsx
+++ b/web/packages/gallery/components/UploadCompletionV2.tsx
@@ -76,10 +76,10 @@ export function UploadCompletionV2({
component="h2"
sx={completionTitleSx}
>
- Your upload is done!
+ {t("upload_completion_title")}
</Typography>
<Typography sx={completionSubtitleSx}>
- Uploaded items are now available on Ente.
+ {t("upload_completion_subtitle")}
</Typography>
</Stack>
</Stack>
@@ -97,7 +97,7 @@ export function UploadCompletionV2({
}}
/>
<Typography sx={completionStatLabelSx}>
- {completionStatLabels[kind]}
+ {t(completionStatLabelKeys[kind])}
</Typography>
</Stack>
<Typography sx={completionStatValueSx}>
@@ -113,7 +113,7 @@ export function UploadCompletionV2({
onClick={onReviewFailed}
sx={primaryButtonSx}
>
- Review items
+ {t("review_items")}
</Button>
) : null}
<Button
@@ -125,7 +125,7 @@ export function UploadCompletionV2({
: primaryButtonSx
}
>
- Close
+ {t("close")}
</Button>
</Stack>
</Stack>
@@ -133,10 +133,10 @@ export function UploadCompletionV2({
);
}
-const completionStatLabels = {
- completed: "Completed",
- skipped: "Skipped",
- failed: "Failed",
+const completionStatLabelKeys = {
+ completed: "upload_stat_completed",
+ skipped: "upload_stat_skipped",
+ failed: "upload_stat_failed",
} as const;
const completionDialogPaperSx = (theme: Theme) => ({
diff --git a/web/packages/gallery/components/upload-progress-v2/MinimizedUploadProgress.tsx b/web/packages/gallery/components/upload-progress-v2/MinimizedUploadProgress.tsx
index f64f79e416..a954e60183 100644
--- a/web/packages/gallery/components/upload-progress-v2/MinimizedUploadProgress.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/MinimizedUploadProgress.tsx
@@ -64,7 +64,7 @@ export function MinimizedUploadProgress() {
<Stack sx={{ flex: 1, minWidth: 0, gap: 0.5 }}>
<Typography sx={minimizedTitleSx}>
{showUploadProgress
- ? `${progress.toLocaleString()}% uploaded`
+ ? t("uploaded_percent", { percent: progress })
: context.uploadPhase == "done"
? uploadStatusText(context.uploadPhase)
: t("file_upload")}
@@ -76,7 +76,7 @@ export function MinimizedUploadProgress() {
</Typography>
</Stack>
<IconButton
- aria-label="Expand"
+ aria-label={t("expand")}
onClick={handleExpand}
sx={minimizedIconButtonSx}
>
diff --git a/web/packages/gallery/components/upload-progress-v2/StopUploadConfirmationDialog.tsx b/web/packages/gallery/components/upload-progress-v2/StopUploadConfirmationDialog.tsx
index 5e4ea5cd5c..d28bd775c2 100644
--- a/web/packages/gallery/components/upload-progress-v2/StopUploadConfirmationDialog.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/StopUploadConfirmationDialog.tsx
@@ -69,13 +69,11 @@ export function StopUploadConfirmationDialog({
id="stop-upload-confirmation-message"
sx={stopConfirmationSubtitleSx}
>
- {
- "You can upload later, we'll skip already uploaded items."
- }
+ {t("stop_uploads_resume_message")}
</Typography>
</Stack>
<Stack direction="row" sx={stopConfirmationCountsSx}>
- {doneStatConfigs.map(({ kind, color, label }) => (
+ {doneStatConfigs.map(({ kind, color, labelKey }) => (
<Stack key={kind} sx={stopConfirmationCountTileSx}>
<Stack
direction="row"
@@ -88,7 +86,7 @@ export function StopUploadConfirmationDialog({
}}
/>
<Typography sx={stopConfirmationCountLabelSx}>
- {label}
+ {t(labelKey)}
</Typography>
</Stack>
<Typography sx={stopConfirmationCountValueSx}>
@@ -102,7 +100,7 @@ export function StopUploadConfirmationDialog({
onClick={onConfirm}
sx={stopConfirmationButtonSx}
>
- Stop uploads
+ {t("stop_uploads")}
</Button>
</Stack>
</Dialog>
diff --git a/web/packages/gallery/components/upload-progress-v2/UploadFileList.tsx b/web/packages/gallery/components/upload-progress-v2/UploadFileList.tsx
index 6216820746..20a5578059 100644
--- a/web/packages/gallery/components/upload-progress-v2/UploadFileList.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/UploadFileList.tsx
@@ -11,6 +11,7 @@ import {
Typography,
type Theme,
} from "@mui/material";
+import { t } from "i18next";
import { useEffect, useRef } from "react";
import { VariableSizeList } from "react-window";
import { uploadStatColors } from "../uploadProgressStats";
@@ -120,7 +121,9 @@ export function UploadProgressRow({
value={progress}
sx={rowProgressSx}
/>
- <Typography sx={rowProgressLabelSx}>{progress}%</Typography>
+ <Typography sx={rowProgressLabelSx}>
+ {t("percent_complete", { percent: progress })}
+ </Typography>
</Stack>
</Box>
);
diff --git a/web/packages/gallery/components/upload-progress-v2/UploadProgressDetails.tsx b/web/packages/gallery/components/upload-progress-v2/UploadProgressDetails.tsx
index eedfd08027..dd37131aa5 100644
--- a/web/packages/gallery/components/upload-progress-v2/UploadProgressDetails.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/UploadProgressDetails.tsx
@@ -12,12 +12,12 @@ import {
import { useUploadProgressContext } from "./context";
import {
doneStatConfigs,
- finishedTypeReasonHints,
- finishedTypeReasons,
+ finishedTypeReasonHintKeys,
+ finishedTypeReasonKeys,
normalizePercent,
- preUploadSkippedFileReasons,
+ preUploadSkippedFileReasonKeys,
statConfigs,
- statEmptyMessages,
+ statEmptyMessageKeys,
} from "./helpers";
import {
EmptyUploadRows,
@@ -71,11 +71,12 @@ export function UploadProgressDetails() {
? []
: [
...statFinishedTypes[activeStat].flatMap((type) => {
- const reason =
- type == "uploadedWithStaticThumbnail"
- ? t("thumbnail_generation_failed")
- : finishedTypeReasons[type];
- const reasonHint = finishedTypeReasonHints[type];
+ const reasonKey = finishedTypeReasonKeys[type];
+ const reasonHintKey = finishedTypeReasonHintKeys[type];
+ const reason = reasonKey ? t(reasonKey) : undefined;
+ const reasonHint = reasonHintKey
+ ? t(reasonHintKey)
+ : undefined;
return (finishedUploads.get(type) ?? []).map((id) => ({
name: uploadFileNames.get(id) ?? t("file"),
reason,
@@ -86,7 +87,9 @@ export function UploadProgressDetails() {
? preUploadSkippedFiles.map((file) => ({
name: basename(file.name),
title: file.name,
- reason: preUploadSkippedFileReasons[file.type],
+ reason: t(
+ preUploadSkippedFileReasonKeys[file.type],
+ ),
}))
: []),
];
@@ -126,13 +129,13 @@ export function UploadProgressDetails() {
)}
<Box sx={detailsCardSx}>
<Box sx={statsGridSx(isDone)}>
- {visibleStatConfigs.map(({ kind, color, label }) => (
+ {visibleStatConfigs.map(({ kind, color, labelKey }) => (
<UploadStat
key={kind}
active={activeStat == kind}
color={color}
kind={kind}
- label={label}
+ label={t(labelKey)}
value={statCounts[kind]}
onSelect={handleSelectStat}
/>
@@ -185,7 +188,7 @@ export function UploadProgressDetails() {
/>
) : (
<EmptyUploadRows
- message={statEmptyMessages[activeStat]}
+ message={t(statEmptyMessageKeys[activeStat])}
/>
)}
</Box>
diff --git a/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx b/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
index 165dac5f82..0dab3a8739 100644
--- a/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
@@ -55,7 +55,7 @@ export function UploadProgressDialog() {
function UploadProgressV2Header() {
const { onClose, setExpanded, uploadPhase } = useUploadProgressContext();
const isDone = uploadPhase == "done";
- const title = isDone ? "Upload details" : t("file_upload");
+ const title = t(isDone ? "upload_details" : "file_upload");
const handleMinimize = () => setExpanded(false);
@@ -70,7 +70,7 @@ function UploadProgressV2Header() {
</Typography>
<Stack direction="row" sx={headerActionsSx}>
<IconButton
- aria-label="Minimize"
+ aria-label={t("minimize")}
onClick={handleMinimize}
sx={headerActionButtonSx}
>
@@ -95,19 +95,19 @@ function UploadProgressV2Summary() {
const isDeterminate = isUploading || uploadPhase == "readingMetadata";
const progress = normalizePercent(percentComplete);
const headline = isUploading
- ? `${progress.toLocaleString()}% uploaded`
+ ? t("uploaded_percent", { percent: progress })
: uploadStatusText(uploadPhase);
const supportingText =
uploadPhase == "preparing"
- ? "Getting your upload ready"
+ ? t("upload_getting_ready")
: uploadPhase == "cancelling"
- ? "Finishing active uploads safely"
+ ? t("upload_finishing_active")
: uploadCountsText(context);
const progressCaption =
uploadPhase == "readingMetadata"
- ? "Reading file information"
+ ? t("upload_reading_file_information")
: uploadPhase == "cancelling"
- ? "This may take a moment"
+ ? t("this_may_take_a_moment")
: isUploading
? uploadStatusText(uploadPhase)
: undefined;
@@ -118,7 +118,7 @@ function UploadProgressV2Summary() {
<Stack sx={{ minWidth: 0, gap: "4px" }}>
<Typography
component="p"
- sx={[titleTextSx, !isDeterminate && waitingTitleSx]}
+ sx={[titleTextSx, !isDeterminate && animatedEllipsisSx]}
>
{headline}
</Typography>
@@ -140,13 +140,18 @@ function UploadProgressV2Summary() {
}}
>
{progressCaption && (
- <Typography sx={mutedCaptionSx}>
+ <Typography
+ sx={[
+ mutedCaptionSx,
+ isUploading && animatedEllipsisSx,
+ ]}
+ >
{progressCaption}
</Typography>
)}
{isDeterminate && (
<Typography sx={mutedCaptionSx}>
- {"100%"}
+ {t("percent_complete", { percent: 100 })}
</Typography>
)}
</Stack>
@@ -233,7 +238,7 @@ const waitingDotsAnimation = keyframes`
33% { content: ".."; }
66%, 100% { content: "..."; }
`;
-const waitingTitleSx = {
+const animatedEllipsisSx = {
"&::after": {
display: "inline-block",
width: "1.5em",
diff --git a/web/packages/gallery/components/upload-progress-v2/helpers.ts b/web/packages/gallery/components/upload-progress-v2/helpers.ts
index caf132ee1c..3653fae25d 100644
--- a/web/packages/gallery/components/upload-progress-v2/helpers.ts
+++ b/web/packages/gallery/components/upload-progress-v2/helpers.ts
@@ -12,57 +12,64 @@ import {
} from "../uploadProgressStats";
import type { UploadProgressContextT } from "./context";
-export const finishedTypeReasons: Partial<Record<FinishedUploadType, string>> =
- {
- alreadyUploaded: "Already on Ente",
- partnerShared: "Shared by partner",
- largerThanAvailableStorage: "Not enough storage",
- tooLarge: "File over 10 GB",
- unsupported: "File type not supported",
- zeroSize: "Empty file",
- blocked: "Upload blocked",
- failed: "Upload failed",
- };
+export const finishedTypeReasonKeys: Partial<
+ Record<FinishedUploadType, string>
+> = {
+ alreadyUploaded: "upload_reason_already_on_ente",
+ partnerShared: "upload_reason_shared_by_partner",
+ largerThanAvailableStorage: "upload_reason_not_enough_storage",
+ tooLarge: "upload_reason_file_too_large",
+ unsupported: "upload_reason_unsupported_file",
+ zeroSize: "upload_reason_empty_file",
+ blocked: "upload_reason_blocked",
+ failed: "upload_reason_failed",
+ uploadedWithStaticThumbnail: "thumbnail_generation_failed",
+};
-export const finishedTypeReasonHints: Partial<
+export const finishedTypeReasonHintKeys: Partial<
Record<FinishedUploadType, string>
> = {
- uploadedWithStaticThumbnail:
- "The file was uploaded, but we could not generate a thumbnail for it.",
- blocked:
- "Your browser or an addon is preventing Ente from using eTags to upload large files.",
+ uploadedWithStaticThumbnail: "thumbnail_generation_failed_hint",
+ blocked: "upload_reason_blocked_hint",
};
-export const preUploadSkippedFileReasons: Record<
+export const preUploadSkippedFileReasonKeys: Record<
PreUploadSkippedFile["type"],
string
-> = { hiddenFile: "Hidden file", failedZip: "Unreadable zip" };
+> = {
+ hiddenFile: "upload_reason_hidden_file",
+ failedZip: "upload_reason_unreadable_zip",
+};
-const finishedStatLabels: Record<FinishedStatKind, string> = {
- completed: "Completed",
- skipped: "Skipped",
- failed: "Failed",
+const finishedStatLabelKeys: Record<FinishedStatKind, string> = {
+ completed: "upload_stat_completed",
+ skipped: "upload_stat_skipped",
+ failed: "upload_stat_failed",
};
export const statConfigs = [
- { kind: "inProgress", color: "#d9d9d9", label: "In progress" },
+ {
+ kind: "inProgress",
+ color: "#d9d9d9",
+ labelKey: "upload_stat_in_progress",
+ },
...finishedStatKinds.map((kind) => ({
kind,
color: uploadStatColors[kind],
- label: finishedStatLabels[kind],
+ labelKey: finishedStatLabelKeys[kind],
})),
-] satisfies { kind: UploadStatKind; color: string; label: string }[];
+] satisfies { kind: UploadStatKind; color: string; labelKey: string }[];
export const doneStatConfigs = statConfigs.slice(1) as {
kind: FinishedStatKind;
color: string;
- label: string;
+ labelKey: string;
}[];
-export const statEmptyMessages: Record<FinishedStatKind, string> = {
- completed: "No completed uploads yet",
- skipped: "No skipped files yet",
- failed: "No failed uploads yet",
+export const statEmptyMessageKeys: Record<FinishedStatKind, string> = {
+ completed: "upload_empty_completed",
+ skipped: "upload_empty_skipped",
+ failed: "upload_empty_failed",
};
export const uploadStatusText = (uploadPhase: UploadPhase) => {
@@ -72,11 +79,11 @@ export const uploadStatusText = (uploadPhase: UploadPhase) => {
case "readingMetadata":
return t("upload_reading_metadata_files");
case "uploading":
- return "Uploading";
+ return t("uploading");
case "cancelling":
return t("upload_cancelling");
case "done":
- return "Upload complete";
+ return t("upload_complete");
}
};
@@ -107,7 +114,10 @@ export const uploadCountsText = ({
: t("upload_done", { count });
}
return uploadCounter.total
- ? `${uploadCounter.finished.toLocaleString()} of ${uploadCounter.total.toLocaleString()} items`
+ ? t("upload_items_progress", {
+ count: uploadCounter.finished,
+ total: uploadCounter.total,
+ })
: uploadStatusText(uploadPhase);
};
diff --git a/web/packages/new/photos/components/CollectionSelector.tsx b/web/packages/new/photos/components/CollectionSelector.tsx
index 979a86d726..afc01fef61 100644
--- a/web/packages/new/photos/components/CollectionSelector.tsx
+++ b/web/packages/new/photos/components/CollectionSelector.tsx
@@ -26,7 +26,6 @@ import {
LargeTileCreateNewButton,
LargeTileTextOverlay,
} from "ente-new/photos/components/Tiles";
-import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
import {
canAddToCollection,
canMoveToCollection,
@@ -47,6 +46,8 @@ import React, {
} from "react";
import { CollectionSelectorV2 } from "./CollectionSelectorV2";
+const enableV2 = true as boolean;
+
export type CollectionSelectorAction =
| "upload"
| "add"
@@ -148,8 +149,7 @@ export type CollectionSelectorProps = ModalVisibilityProps & {
export const CollectionSelector: React.FC<CollectionSelectorProps> = (
props,
) => {
- const { isInternalUser } = useSettingsSnapshot();
- return isInternalUser ? (
+ return enableV2 ? (
<CollectionSelectorV2 {...props} />
) : (
<CollectionSelectorClassic {...props} />
diff --git a/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx b/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
index 091b831eaf..f952dfeed8 100644
--- a/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
+++ b/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
@@ -141,7 +141,7 @@ export function GalleryEmptyStateV2({
fontWeight: 600,
}}
>
- Store and share your memories with full privacy
+ {t("gallery_empty_state_v2_subtitle")}
</Typography>
</Stack>
@@ -154,7 +154,7 @@ export function GalleryEmptyStateV2({
disabled={isUploadInProgress}
startIcon={<FileDownloadIcon />}
>
- Upload your existing library
+ {t("upload_existing_library")}
</GalleryEmptyStateButton>
<GalleryEmptyStateButton
color="secondary"
@@ -236,8 +236,7 @@ function MemoriesPreservedCount(): React.JSX.Element | null {
userSelect: "none",
}}
>
- {count.toLocaleString("en-US")} {count == 1 ? "memory" : "memories"}{" "}
- secured since you came here
+ {t("memories_secured_since_arrival", { count })}
</Typography>
);
}