Improve batch edit confirmation text
This commit is contained in:
parent
922a33354f
commit
7b115da8d4
@ -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));
|
||||||
|
|||||||
@ -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(() =>
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user