diff --git a/.env-example b/.env-example index 3368d80af9..85199895da 100644 --- a/.env-example +++ b/.env-example @@ -1,5 +1,6 @@ NEXT_PUBLIC_SUPABASE_URL= NEXT_PUBLIC_SUPABASE_ANON_KEY= +NEXT_PUBLIC_SUPABASE_ID= RESEND_API_KEY= LOOPS_ENDPOINT= GOCARDLESS_SECRET_ID= diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index 5a6b66fa11..404cb41a43 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -22,12 +22,12 @@ "@midday/supabase": "workspace:*", "@midday/ui": "workspace:*", "@novu/headless": "^0.21.0", - "@trigger.dev/nextjs": "^2.2.10", + "@trigger.dev/nextjs": "^2.2.11", "@vercel/edge-config": "^0.4.1", "@vercel/toolbar": "^0.1.6", - "@zip.js/zip.js": "^2.7.31", + "@zip.js/zip.js": "^2.7.32", "change-case": "^5.2.0", - "framer-motion": "^10.16.12", + "framer-motion": "^10.16.14", "ms": "^2.1.3", "next": "14.0.3", "next-international": "^1.1.4", @@ -47,7 +47,7 @@ "@midday/tsconfig": "workspace:*", "@t3-oss/env-nextjs": "^0.7.1", "@types/node": "^20.10.3", - "@types/react": "^18.2.41", + "@types/react": "^18.2.42", "@types/react-dom": "^18.2.17", "typescript": "^5.3.2" } diff --git a/apps/dashboard/src/components/tables/vault/upload-zone.tsx b/apps/dashboard/src/components/tables/vault/upload-zone.tsx index 49860df503..cad0bffe61 100644 --- a/apps/dashboard/src/components/tables/vault/upload-zone.tsx +++ b/apps/dashboard/src/components/tables/vault/upload-zone.tsx @@ -52,8 +52,8 @@ export function UploadZone({ children }) { const createFolder = useAction(createFolderAction, { onError: () => { toast({ - duration: 4000, - // position: "bottom-right", + duration: 2500, + variant: "error", title: "The folder already exists in the current directory. Please use a different name.", }); @@ -64,14 +64,14 @@ export function UploadZone({ children }) { setShowProgress(true); const { data: userData } = await getCurrentUserTeamQuery(supabase); - console.log(`${userData?.team_id}/${folderPath}`); + const filePath = [userData?.team_id, ...folders].join("/"); try { await Promise.all( files.map(async (file, idx) => { await resumableUpload(supabase, { bucket: "vault", - path: `${userData?.team_id}/${folderPath}`, + path: filePath, file, onProgress: (bytesUploaded, bytesTotal) => { uploadProgress.current[idx] = (bytesUploaded / bytesTotal) * 100; @@ -103,6 +103,7 @@ export function UploadZone({ children }) { } catch { toast({ duration: 2500, + variant: "error", title: "Something went wrong please try again.", }); } diff --git a/apps/website/package.json b/apps/website/package.json index cd3019d246..b719008bdf 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -25,7 +25,7 @@ "devDependencies": { "@midday/tsconfig": "workspace:*", "@types/node": "^20.10.3", - "@types/react": "^18.2.41", + "@types/react": "^18.2.42", "@types/react-dom": "^18.2.17" } } diff --git a/bun.lockb b/bun.lockb index 2bd5001288..3ac4754fbb 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/jobs/package.json b/packages/jobs/package.json index 8a9948af66..ec0c08a3f7 100644 --- a/packages/jobs/package.json +++ b/packages/jobs/package.json @@ -10,9 +10,9 @@ "check:types": "tsc --noEmit" }, "dependencies": { - "@trigger.dev/react": "^2.2.10", - "@trigger.dev/sdk": "^2.2.10", - "@trigger.dev/supabase": "^2.2.10" + "@trigger.dev/react": "^2.2.11", + "@trigger.dev/sdk": "^2.2.11", + "@trigger.dev/supabase": "^2.2.11" } } \ No newline at end of file diff --git a/packages/jobs/src/client.ts b/packages/jobs/src/client.ts index 67579025c2..d36ae792f1 100644 --- a/packages/jobs/src/client.ts +++ b/packages/jobs/src/client.ts @@ -10,7 +10,7 @@ export const client = new TriggerClient({ export const supabase = new Supabase({ id: "supabase", - projectId: process.env.SUPABASE_ID!, + projectId: process.env.NEXT_PUBLIC_SUPABASE_ID!, supabaseKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, }); @@ -18,4 +18,6 @@ export const supabaseManagement = new SupabaseManagement({ id: "supabase-integration", }); -export const supabaseTriggers = supabaseManagement.db(process.env.SUPABASE_ID!); +export const supabaseTriggers = supabaseManagement.db( + process.env.NEXT_PUBLIC_SUPABASE_ID! +); diff --git a/packages/supabase/src/queries/cached-queries.ts b/packages/supabase/src/queries/cached-queries.ts index 2f06e1001f..1c7c3dd54e 100644 --- a/packages/supabase/src/queries/cached-queries.ts +++ b/packages/supabase/src/queries/cached-queries.ts @@ -170,6 +170,7 @@ export const getVault = async (params) => { }, ["vault", teamId], { + revalidate: 10, tags: [`vault_${teamId}`], } )(params); diff --git a/packages/supabase/src/utils/storage.ts b/packages/supabase/src/utils/storage.ts index a949aa2a66..a5ccd79582 100644 --- a/packages/supabase/src/utils/storage.ts +++ b/packages/supabase/src/utils/storage.ts @@ -28,9 +28,16 @@ export async function upload( throw result.error; } +type ResumableUploadParmas = { + file: File; + path: string; + bucket: string; + onProgress?: (bytesUploaded: number, bytesTotal: number) => void; +}; + export async function resumableUpload( client: SupabaseClient, - { file, path, bucket, onProgress }: UploadParams + { file, path, bucket, onProgress }: ResumableUploadParmas ) { const { data: { session }, @@ -38,15 +45,14 @@ export async function resumableUpload( const fullPath = `${path}/${file.name}`; - console.log(fullPath); - return new Promise((resolve, reject) => { const upload = new tus.Upload(file, { - endpoint: `https://pytddvqiozwrhfbwqazp.supabase.co/storage/v1/upload/resumable`, - retryDelays: [0, 3000, 5000, 10000, 20000], + endpoint: `https://${process.env.NEXT_PUBLIC_SUPABASE_ID}.supabase.co/storage/v1/upload/resumable`, + retryDelays: [0, 3000, 5000, 10000], headers: { authorization: `Bearer ${session?.access_token}`, - "x-upsert": "true", // optionally set upsert to true to overwrite existing files + // optionally set upsert to true to overwrite existing files + "x-upsert": "true", }, uploadDataDuringCreation: true, // Important if you want to allow re-uploading the same file https://github.com/tus/tus-js-client/blob/main/docs/api.md#removefingerprintonsuccess diff --git a/packages/ui/package.json b/packages/ui/package.json index 99c218e047..45f7de273d 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -85,8 +85,8 @@ "lucide-react": "^0.294.0", "react-day-picker": "^8.9.1", "react-icons": "^4.12.0", - "tailwind-merge": "2.0.0", - "tailwindcss": "^3.3.5", + "tailwind-merge": "2.1.0", + "tailwindcss": "^3.3.6", "tailwindcss-animate": "^1.0.7" } } \ No newline at end of file diff --git a/packages/ui/src/components/icons.tsx b/packages/ui/src/components/icons.tsx index 1f7072c557..831a051e0d 100644 --- a/packages/ui/src/components/icons.tsx +++ b/packages/ui/src/components/icons.tsx @@ -12,6 +12,7 @@ import { MdDevices, MdDriveFileMove, MdDynamicForm, + MdErrorOutline, MdExpandMore, MdFastfood, MdFence, @@ -411,4 +412,5 @@ export const Icons = { FileUpload: MdFileUpload, Search: MdSearch, CreateNewFolder: MdCreateNewFolder, + Error: MdErrorOutline, }; diff --git a/packages/ui/src/components/toast.tsx b/packages/ui/src/components/toast.tsx index a78fcbad6b..9b6da837a8 100644 --- a/packages/ui/src/components/toast.tsx +++ b/packages/ui/src/components/toast.tsx @@ -28,6 +28,7 @@ const toastVariants = cva( variants: { variant: { default: "border bg-secondary text-foreground", + error: "border bg-secondary text-foreground", success: "border bg-secondary text-foreground", progress: "border bg-secondary text-foreground", destructive: diff --git a/packages/ui/src/components/toaster.tsx b/packages/ui/src/components/toaster.tsx index 6bfc3ff756..474494fcd7 100644 --- a/packages/ui/src/components/toaster.tsx +++ b/packages/ui/src/components/toaster.tsx @@ -26,6 +26,9 @@ export function Toaster() {
{props?.variant === "success" && } + {props?.variant === "error" && ( + + )} {props?.variant === "progress" && (