This commit is contained in:
Manav Rathi 2024-04-30 12:03:05 +05:30
parent ab95b4daee
commit e2cd1ea380
No known key found for this signature in database
2 changed files with 21 additions and 5 deletions

View file

@ -51,8 +51,6 @@ import { CollectionMappingChoiceModal } from "./CollectionMappingChoiceModal";
import UploadProgress from "./UploadProgress";
import UploadTypeSelector from "./UploadTypeSelector";
const FIRST_ALBUM_NAME = "My First Album";
enum PICKED_UPLOAD_TYPE {
FILES = "files",
FOLDERS = "folders",
@ -415,7 +413,9 @@ export default function Uploader({
}
if (isFirstUpload && !importSuggestion.rootFolderName) {
importSuggestion.rootFolderName = FIRST_ALBUM_NAME;
importSuggestion.rootFolderName = t(
"autogenerated_first_album_name",
);
}
if (isDragAndDrop.current) {
@ -714,7 +714,21 @@ export default function Uploader({
const didSelectCollectionMapping = (mapping: CollectionMapping) => {
switch (mapping) {
case "root":
uploadToSingleNewCollection(importSuggestion.rootFolderName);
uploadToSingleNewCollection(
// rootFolderName would be empty here if one edge case:
// - User drags and drops a mixture of files and folders
// - They select the "upload to multiple albums" option
// - The see the error, close the error
// - Then they select the "upload to single album" option
//
// In such a flow, we'll reach here with an empty
// rootFolderName. The proper fix for this would be
// rearrange the flow and ask them to name the album here,
// but we currently don't have support for chaining modals.
// So in the meanwhile, keep a fallback album name at hand.
importSuggestion.rootFolderName ??
t("autogenerated_default_album_name"),
);
break;
case "parent":
if (importSuggestion.hasRootLevelFileWithFolder) {

View file

@ -621,5 +621,7 @@
"PASSKEY_LOGIN_ERRORED": "An error occurred while logging in with passkey.",
"TRY_AGAIN": "Try again",
"PASSKEY_FOLLOW_THE_STEPS_FROM_YOUR_BROWSER": "Follow the steps from your browser to continue logging in.",
"LOGIN_WITH_PASSKEY": "Login with passkey"
"LOGIN_WITH_PASSKEY": "Login with passkey",
"autogenerated_first_album_name": "My First Album",
"autogenerated_default_album_name": "New Album"
}