diff --git a/apps/app/package.json b/apps/app/package.json index fa64140..16614ca 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -10,6 +10,7 @@ "clean-react": "rm -rf node_modules/react; rm -rf node_modules/react-dom" }, "dependencies": { + "@ai-sdk/openai": "^1.1.12", "@browserbasehq/sdk": "^2.3.0", "@bubba/notifications": "workspace:*", "@date-fns/tz": "^1.2.0", @@ -19,10 +20,14 @@ "@prisma/instrumentation": "^6.3.1", "@tanstack/react-query": "^5.66.0", "@tanstack/react-table": "^8.21.2", + "@tiptap/pm": "^2.11.5", + "@tiptap/react": "^2.11.5", + "@tiptap/starter-kit": "^2.11.5", "@trigger.dev/react-hooks": "3.3.16", "@trigger.dev/sdk": "3.3.16", "@uploadthing/react": "^7.2.0", "@upstash/ratelimit": "^2.0.5", + "ai": "^4.1.41", "argon2": "^0.41.1", "bun": "^1.2.2", "crypto": "^1.0.1", diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/layout.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/layout.tsx index 13e511a..1025ddb 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/layout.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/layout.tsx @@ -20,7 +20,7 @@ export default async function Layout({ } return ( -
+
{children}
); diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/page.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/page.tsx index 6db6485..72b3dd0 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/page.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/page.tsx @@ -1,5 +1,6 @@ "use client"; +import Tiptap from "@/components/editor/editor"; import { Button } from "@bubba/ui/button"; import { Separator } from "@bubba/ui/separator"; import { useAction } from "next-safe-action/hooks"; @@ -18,6 +19,9 @@ export default function PolicyPage() { onSuccess: () => { toast.success("Policy published successfully"); }, + onError: () => { + toast.error("Failed to publish policy, please try again."); + }, }, ); @@ -44,7 +48,7 @@ export default function PolicyPage() {
- Editor +
diff --git a/apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/layout.tsx b/apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/layout.tsx index 7e72e88..bf11906 100644 --- a/apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/layout.tsx +++ b/apps/app/src/app/[locale]/(app)/(dashboard)/policies/all/layout.tsx @@ -10,7 +10,7 @@ export default async function Layout({ const t = await getI18n(); return ( -
+
Loading...
}> +
Loading...
}> { + const [editorState, setEditorState] = useState(null); + + const editor = useEditor({ + extensions: [StarterKit], + content: content, + }); + + useEffect(() => { + setEditorState(JSON.parse(editor?.getText() || "{}")); + }, [editor]); + + return ; +}; + +export default Tiptap; diff --git a/apps/app/src/components/google-sign-in.tsx b/apps/app/src/components/google-sign-in.tsx index c948336..70c3708 100644 --- a/apps/app/src/components/google-sign-in.tsx +++ b/apps/app/src/components/google-sign-in.tsx @@ -24,7 +24,7 @@ export function GoogleSignIn() { return (