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={() => {
setIsPerformingSelectEdit?.(true);
if (isInTagMode) {
const tagsArray = convertStringToArray(tags, false);
const tagsFormatted = tagsArray
.map(tag => `"${tag}"`)
.join(', ');
batchPhotoAction({
...batchPhotoActionArguments,
tags: convertStringToArray(tags, false),
tags: tagsArray,
})
.then(() => {
toastSuccess(`${photosText} tagged`);
toastSuccess(`${photosText} tagged ${tagsFormatted}`);
stopSelectingPhotos?.();
})
.finally(() => setIsPerformingSelectEdit?.(false));
} else if (isInAlbumMode) {
const albumTitlesArray = convertStringToArray(albumTitles, false);
const albumTitlesFormatted = albumTitlesArray
.map(title => `"${title}"`)
.join(', ');
batchPhotoAction({
...batchPhotoActionArguments,
albumTitles: albumTitles.split(','),
albumTitles: albumTitlesArray,
})
.then(() => {
toastSuccess(`${photosText} added`);
toastSuccess(
`${photosText} added to ${albumTitlesFormatted}`,
);
stopSelectingPhotos?.();
})
.finally(() => setIsPerformingSelectEdit?.(false));

View File

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

View File

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

View File

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

View File

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