Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

컬렉션 변경 모달에서 컬렉션을 생성할 경우 자동으로 새로 생성한 컬렉션이 선택되도록 수정 #2245

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import mixpanel from 'mixpanel-browser';
import { createEventDispatcher } from 'svelte';
import IconCamera from '~icons/tabler/camera';
import { graphql } from '$glitch';
import { Icon, Image } from '$lib/components';
Expand All @@ -23,6 +24,10 @@
thumbnail = null;
}

const dispatch = createEventDispatcher<{
success: { id: string; name: string; thumbnail: (Image_image & { id: string }) | null };
}>();

const createSpaceCollection = graphql(`
mutation CreateCollectionModal_CreateSpaceCollection_Mutation($input: CreateSpaceCollectionInput!) {
createSpaceCollection(input: $input) {
Expand All @@ -42,6 +47,7 @@
description

thumbnail {
id
...Image_image
}
}
Expand All @@ -57,9 +63,10 @@
initialValues: {
spaceCollectionId: '',
},
onSuccess: ({ id }) => {
onSuccess: ({ id, name }) => {
open = false;
mixpanel.track('space:collection:create', { spaceId, collectionId: id });
dispatch('success', { id, name, thumbnail });
},
});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,8 @@
</Button>
</Modal>

<CreateCollectionModal bind:open={createCollectionOpen} bind:spaceId />
<CreateCollectionModal
bind:open={createCollectionOpen}
bind:spaceId
on:success={(e) => (selectedCollection = e.detail)}
/>
Loading