Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Nov 19, 2024
1 parent 8117546 commit e14be2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 4 additions & 2 deletions apps/dashboard/src/components/forms/tracker-project-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export function TrackerProjectForm({

<SelectTags
tags={form.getValues("tags")}
key={form.getValues("id")}
onRemove={(tag) => {
deleteProjectTag.execute({
tagId: tag.id,
Expand Down Expand Up @@ -294,7 +293,10 @@ export function TrackerProjectForm({
</Collapsible>

<div className="fixed bottom-8 w-full sm:max-w-[455px] right-8">
<Button className="w-full" disabled={isSaving}>
<Button
className="w-full"
disabled={isSaving || form.formState.isValid}
>
{isSaving ? <Loader2 className="h-4 w-4 animate-spin" /> : "Save"}
</Button>
</div>
Expand Down
11 changes: 10 additions & 1 deletion apps/dashboard/src/components/sheets/tracker-update-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { ScrollArea } from "@midday/ui/scroll-area";
import { Sheet, SheetContent, SheetHeader } from "@midday/ui/sheet";
import { useToast } from "@midday/ui/use-toast";
import { useAction } from "next-safe-action/hooks";
import React, { useEffect } from "react";
import React, { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import type { z } from "zod";

Expand All @@ -46,6 +46,7 @@ type Props = {
export function TrackerUpdateSheet({ teamId, customers }: Props) {
const { toast } = useToast();
const isDesktop = useMediaQuery("(min-width: 768px)");
const [isLoading, setIsLoading] = useState(false);
const { setParams, update, projectId } = useTrackerParams();
const supabase = createClient();
const id = projectId ?? "";
Expand All @@ -70,6 +71,8 @@ export function TrackerUpdateSheet({ teamId, customers }: Props) {

useEffect(() => {
const fetchData = async () => {
setIsLoading(true);

const { data } = await getTrackerProjectQuery(supabase, {
teamId,
projectId: id,
Expand All @@ -94,6 +97,8 @@ export function TrackerUpdateSheet({ teamId, customers }: Props) {
})) ?? undefined,
});
}

setIsLoading(false);
};

if (id) {
Expand Down Expand Up @@ -135,6 +140,10 @@ export function TrackerUpdateSheet({ teamId, customers }: Props) {
}
}, [isOpen]);

if (isLoading) {
return null;
}

if (isDesktop) {
return (
<AlertDialog>
Expand Down

0 comments on commit e14be2e

Please sign in to comment.