Improve batch edit confirmation text
This commit is contained in:
parent
922a33354f
commit
7b115da8d4
@ -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));
|
||||
|
||||
@ -71,7 +71,7 @@ export default function TagInput({
|
||||
, [options]);
|
||||
|
||||
const selectedOptions = useMemo(() =>
|
||||
convertStringToArray(value, shouldParameterize) ?? []
|
||||
convertStringToArray(value, shouldParameterize)
|
||||
, [value, shouldParameterize]);
|
||||
|
||||
const hasReachedLimit = useMemo(() =>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user