();
const onAddToCollection = ({ collectionId }: { collectionId: string }) => {
if (!collectionId || !objectIds?.length) {
return;
}
client.store.collections.addMembers(collectionId, objectIds).then(() => {
toast({
title: t('store.actions.addToCollectionSuccess'),
status: 'success',
description: t('store.actions.addToCollectionSuccessDesc', { count: objectIds.length }),
duration: 3000
});
onClose();
}).catch(() => {
toast({
title: t('store.actions.addToCollectionFailure'),
status: 'error',
description: t('store.actions.addToCollectionFailureDesc'),
duration: 5000
});
});
}
const onCollectionChange = (collectionId: string | string[] | undefined, _collection?: any) => {
if (typeof collectionId === "string" || typeof collectionId === "undefined") {
setSelectedCollectionId(collectionId);
} else if (Array.isArray(collectionId) && collectionId.length > 0) {
setSelectedCollectionId(collectionId[0]);
} else {
setSelectedCollectionId(undefined);
}
};
const tabs = [
{
name: 'select',
label: t('store.actions.selectCollection'),
content: (
{t('store.actions.chooseExistingCollections')}
)
},
{
name: 'create',
label: t('store.actions.createNew'),
content:
onAddToCollection({ collectionId: id })} redirect={false} />
}
];
return (
)
}