Improve batch edit confirmation text

This commit is contained in:
Sam Becker 2026-02-19 17:43:33 -06:00
parent 922a33354f
commit 7b115da8d4
5 changed files with 18 additions and 8 deletions

View File

@ -122,22 +122,32 @@ export default function AdminBatchEditPanelClient({
onClick={() => { onClick={() => {
setIsPerformingSelectEdit?.(true); setIsPerformingSelectEdit?.(true);
if (isInTagMode) { if (isInTagMode) {
const tagsArray = convertStringToArray(tags, false);
const tagsFormatted = tagsArray
.map(tag => `"${tag}"`)
.join(', ');
batchPhotoAction({ batchPhotoAction({
...batchPhotoActionArguments, ...batchPhotoActionArguments,
tags: convertStringToArray(tags, false), tags: tagsArray,
}) })
.then(() => { .then(() => {
toastSuccess(`${photosText} tagged`); toastSuccess(`${photosText} tagged ${tagsFormatted}`);
stopSelectingPhotos?.(); stopSelectingPhotos?.();
}) })
.finally(() => setIsPerformingSelectEdit?.(false)); .finally(() => setIsPerformingSelectEdit?.(false));
} else if (isInAlbumMode) { } else if (isInAlbumMode) {
const albumTitlesArray = convertStringToArray(albumTitles, false);
const albumTitlesFormatted = albumTitlesArray
.map(title => `"${title}"`)
.join(', ');
batchPhotoAction({ batchPhotoAction({
...batchPhotoActionArguments, ...batchPhotoActionArguments,
albumTitles: albumTitles.split(','), albumTitles: albumTitlesArray,
}) })
.then(() => { .then(() => {
toastSuccess(`${photosText} added`); toastSuccess(
`${photosText} added to ${albumTitlesFormatted}`,
);
stopSelectingPhotos?.(); stopSelectingPhotos?.();
}) })
.finally(() => setIsPerformingSelectEdit?.(false)); .finally(() => setIsPerformingSelectEdit?.(false));

View File

@ -71,7 +71,7 @@ export default function TagInput({
, [options]); , [options]);
const selectedOptions = useMemo(() => const selectedOptions = useMemo(() =>
convertStringToArray(value, shouldParameterize) ?? [] convertStringToArray(value, shouldParameterize)
, [value, shouldParameterize]); , [value, shouldParameterize]);
const hasReachedLimit = useMemo(() => const hasReachedLimit = useMemo(() =>

View File

@ -401,7 +401,7 @@ export const convertFormDataToPhotoDbInsert = (
: formData; : formData;
// Capture tags before 'favorite' is excluded from insert // Capture tags before 'favorite' is excluded from insert
const tags = convertStringToArray(photoForm.tags) ?? []; const tags = convertStringToArray(photoForm.tags);
if (photoForm.favorite === 'true') { if (photoForm.favorite === 'true') {
tags.push(TAG_FAVS); tags.push(TAG_FAVS);
} }

View File

@ -30,7 +30,7 @@ export const formatTag = (tag?: string) =>
capitalizeWords(tag?.replaceAll('-', ' ')); capitalizeWords(tag?.replaceAll('-', ' '));
export const getValidationMessageForTags = (tags?: string) => { export const getValidationMessageForTags = (tags?: string) => {
const reservedTags = (convertStringToArray(tags) ?? []) const reservedTags = convertStringToArray(tags)
.filter(tag => isTagFavs(tag) || isTagPrivate(tag)) .filter(tag => isTagFavs(tag) || isTagPrivate(tag))
.map(tag => tag.toLocaleUpperCase()); .map(tag => tag.toLocaleUpperCase());
return reservedTags.length return reservedTags.length

View File

@ -10,7 +10,7 @@ export const convertStringToArray = (
? string.split(',').map(item => shouldParameterize ? string.split(',').map(item => shouldParameterize
? parameterize(item) ? parameterize(item)
: item.trim()) : item.trim())
: undefined; : [];
export const capitalize = (string: string) => export const capitalize = (string: string) =>
string.charAt(0).toLocaleUpperCase() + string.slice(1); string.charAt(0).toLocaleUpperCase() + string.slice(1);