diff --git a/app/javascript/flavours/glitch/features/collection_adder/index.tsx b/app/javascript/flavours/glitch/features/collection_adder/index.tsx index 0fa131579c..21a1772804 100644 --- a/app/javascript/flavours/glitch/features/collection_adder/index.tsx +++ b/app/javascript/flavours/glitch/features/collection_adder/index.tsx @@ -10,6 +10,7 @@ import { useCurrentAccountId } from '@/flavours/glitch/hooks/useAccountId'; import type { Account } from '@/flavours/glitch/models/account'; import { addCollectionItem, + collectionEditorActions, removeCollectionItem, } from '@/flavours/glitch/reducers/slices/collections'; import CloseIcon from '@/material-icons/400-24px/close.svg?react'; @@ -23,6 +24,7 @@ import { } from '../collections/overview/created_by_account'; import { CollectionToggle } from './collection_toggle'; +import classes from './styles.module.scss'; const messages = defineMessages({ close: { @@ -107,6 +109,23 @@ export const CollectionAdder: React.FC<{ const account = useAppSelector((state) => state.accounts.get(accountId)); const currentAccountId = useCurrentAccountId(); const { collections, status } = useCollectionsCreatedBy(currentAccountId); + const dispatch = useAppDispatch(); + + const handleNewCollection = useCallback(() => { + if (account) { + dispatch( + collectionEditorActions.reset({ + account_id: account.id, + state: + account.feature_approval.current_user === 'manual' + ? 'pending' + : 'accepted', + }), + ); + } + + onClose(); + }, [account, dispatch, onClose]); return (