refactor: convert to monorepo

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2025-09-16 23:01:40 +00:00
parent e62535916a
commit 12922618dd
46 changed files with 68 additions and 66 deletions

View File

@@ -0,0 +1,30 @@
import { toast } from "sonner"
import { Code as ErrorCode, isApplicationError } from "@convex/model/error"
const ERROR_MESSAGE = {
[ErrorCode.DirectoryExists]: "Directory already exists",
[ErrorCode.FileExists]: "File already exists",
[ErrorCode.Internal]: "Internal application error",
} as const
export function formatError(error: unknown): string {
if (isApplicationError(error)) {
return ERROR_MESSAGE[error.data.code]
}
if (error instanceof Error) {
return error.message
}
return "Unknown error"
}
export function defaultOnError(error: unknown) {
console.log(error)
toast.error(formatError(error))
}
export function withDefaultOnError(fn: (error: unknown) => void) {
return (error: unknown) => {
defaultOnError(error)
fn(error)
}
}

View File

@@ -0,0 +1,6 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}