Skip to content

Commit

Permalink
add: conditional render of modals if service is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
matfire committed Jan 20, 2024
1 parent c972bad commit d660bfa
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions src/routes/app/write/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -171,29 +171,36 @@
<Command.List>
<Command.Empty>No results found.</Command.Empty>
<Command.Group heading="Images">
<Command.Item
onSelect={() => {
giphyDialogOpen = !giphyDialogOpen;
commandDialogOpen = false;
}}
>Giphy
</Command.Item>
<Command.Item
onSelect={() => {
unsplashDialogOpen = !unsplashDialogOpen;
commandDialogOpen = false;
}}
>
Unsplash
</Command.Item>
{#if data.enabledOptions.giphy}
<Command.Item
onSelect={() => {
giphyDialogOpen = !giphyDialogOpen;
commandDialogOpen = false;
}}
>Giphy
</Command.Item>
{/if}
{#if data.enabledOptions.unsplash}
<Command.Item
onSelect={() => {
unsplashDialogOpen = !unsplashDialogOpen;
commandDialogOpen = false;
}}
>
Unsplash
</Command.Item>
{/if}
</Command.Group>
<Command.Separator />
</Command.List>
</Command.Dialog>

<Giphy on:addToDoc={addToDoc} bind:open={giphyDialogOpen} />
<Unsplash on:addToDoc={addToDoc} bind:open={unsplashDialogOpen} />

{#if data.enabledOptions.giphy}
<Giphy on:addToDoc={addToDoc} bind:open={giphyDialogOpen} />
{/if}
{#if data.enabledOptions.unsplash}
<Unsplash on:addToDoc={addToDoc} bind:open={unsplashDialogOpen} />
{/if}
<div class="flex h-full w-full flex-col relative p-4">
{#if loading}
<LoadingOverlay text={loadingText} />
Expand Down

0 comments on commit d660bfa

Please sign in to comment.