Skip to content

Commit

Permalink
fix: fix some patch bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Aug 7, 2024
1 parent 9719302 commit b5d094c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
import CreateTable from "./create-table.svelte"
import { Button } from "$lib/components/ui/button"
import ScrollArea from "$lib/components/ui/scroll-area/scroll-area.svelte"
import { CREATE_RLS_MODAL, CREATE_TABLE_MODAL, closeModal, isModalOpen, toggleModal } from "$lib/store/modal.store"
import { CREATE_TABLE_MODAL, closeModal, isModalOpen } from "$lib/store/modal.store"
import { baseId, currentBase } from "$lib/store/base.store"
import { QueryObserver, useIsMutating, useQueryClient } from "@tanstack/svelte-query"
import { useIsMutating } from "@tanstack/svelte-query"
import { LoaderCircleIcon } from "lucide-svelte"
const isCreating = useIsMutating({ mutationKey: ["createTable"] })
</script>

<Sheet.Root
open={$isModalOpen(CREATE_TABLE_MODAL)}
closeOnOutsideClick={false}
closeOnEscape={false}
onOpenChange={(open) => {
if (!open) {
closeModal(CREATE_TABLE_MODAL)
Expand All @@ -35,7 +37,7 @@
</ScrollArea>

<Sheet.Footer>
<Button variant="outline" type="button" on:click={() => closeModal(CREATE_RLS_MODAL)}>Cancel</Button>
<Button variant="outline" type="button" on:click={() => closeModal(CREATE_TABLE_MODAL)}>Cancel</Button>
<Button type="submit" disabled={$isCreating > 0} form="createTable">
{#if $isCreating > 0}
<LoaderCircleIcon class="mr-2 h-5 w-5 animate-spin" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
validators: zodClient(schema),
resetForm: false,
invalidateAll: true,
onUpdate(event) {
async onUpdate(event) {
if (!event.form.valid) {
console.log(event.form.errors)
return
}
const baseId = $currentBase?.id
if (!baseId) return
$mutation.mutate({
await $mutation.mutateAsync({
...event.form.data,
baseId: baseId,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
class="group relative col-span-1 flex w-full items-center justify-center rounded-sm border"
>
{#if isImage(v)}
<button class="h-10 w-10" on:click={() => ($selectedAttachment = v)}>
<button type="button" class="h-full w-full" on:click={() => ($selectedAttachment = v)}>
<img src={v.signedUrl ?? v.url} alt={v.name} />
</button>
{:else}
Expand All @@ -183,6 +183,7 @@
<AlertDialog.Root>
<AlertDialog.Trigger>
<button
type="button"
class="absolute right-0 top-1 hidden -translate-y-1/2 translate-x-1/2 group-hover:block"
>
<XIcon class="text-muted-foreground h-5 w-5"></XIcon>
Expand All @@ -201,6 +202,7 @@
<AlertDialog.Footer>
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
<AlertDialog.Action
type="button"
on:click={() => removeFile(i)}
class="bg-red-500 text-white hover:bg-red-600">Delete</AlertDialog.Action
>
Expand Down

0 comments on commit b5d094c

Please sign in to comment.