diff --git a/.gitignore b/.gitignore
index 5ef6a52..23e3156 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,8 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
+
+# Sentry Config File
+.env.sentry-build-plugin
+.cursor
+.cursor/*
diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx
index fe8e9ab..e9aebda 100644
--- a/app/dashboard/page.tsx
+++ b/app/dashboard/page.tsx
@@ -2,7 +2,7 @@
import Image from "next/image";
import { useRouter } from "next/navigation";
-import { useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { useTheme } from "next-themes";
import { useMutation, useQuery } from "convex/react";
import {
@@ -33,6 +33,8 @@ import { authClient } from "@/lib/auth-client";
import { CreditOverview } from "@/components/dashboard/credit-overview";
import { RecentTransactions } from "@/components/dashboard/recent-transactions";
import CanvasCard from "@/components/dashboard/canvas-card";
+import { toast } from "@/lib/toast";
+import { msg } from "@/lib/toast-messages";
function getInitials(nameOrEmail: string) {
@@ -49,6 +51,7 @@ function getInitials(nameOrEmail: string) {
export default function DashboardPage() {
const router = useRouter();
+ const welcomeToastSentRef = useRef(false);
const { theme = "system", setTheme } = useTheme();
const { data: session, isPending: isSessionPending } = authClient.useSession();
const canvases = useQuery(
@@ -61,7 +64,17 @@ export default function DashboardPage() {
const displayName = session?.user.name?.trim() || session?.user.email || "Nutzer";
const initials = getInitials(displayName);
+ useEffect(() => {
+ if (!session?.user || welcomeToastSentRef.current) return;
+ const key = `ls-dashboard-welcome-${session.user.id}`;
+ if (typeof window !== "undefined" && sessionStorage.getItem(key)) return;
+ welcomeToastSentRef.current = true;
+ sessionStorage.setItem(key, "1");
+ toast.success(msg.auth.welcomeOnDashboard.title);
+ }, [session?.user]);
+
const handleSignOut = async () => {
+ toast.info(msg.auth.signedOut.title);
await authClient.signOut();
router.replace("/auth/sign-in");
router.refresh();
diff --git a/app/error.tsx b/app/error.tsx
index a4a4bfa..3dbf0da 100644
--- a/app/error.tsx
+++ b/app/error.tsx
@@ -1,5 +1,6 @@
"use client";
+import * as Sentry from "@sentry/nextjs";
import { useEffect } from "react";
import { Button } from "@/components/ui/button";
@@ -11,6 +12,8 @@ type AppErrorProps = {
export default function AppError({ error, unstable_retry }: AppErrorProps) {
useEffect(() => {
+ Sentry.captureException(error);
+
const safeError = {
name: error.name,
message:
diff --git a/app/global-error.tsx b/app/global-error.tsx
index c360426..c806be3 100644
--- a/app/global-error.tsx
+++ b/app/global-error.tsx
@@ -1,5 +1,8 @@
"use client";
+import * as Sentry from "@sentry/nextjs";
+import { useEffect } from "react";
+
import { Button } from "@/components/ui/button";
type GlobalErrorProps = {
@@ -11,6 +14,10 @@ export default function GlobalError({
error,
unstable_retry,
}: GlobalErrorProps) {
+ useEffect(() => {
+ Sentry.captureException(error);
+ }, [error]);
+
return (
diff --git a/app/layout.tsx b/app/layout.tsx
index 0f061e2..3c75876 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -1,10 +1,11 @@
import type { Metadata } from "next";
import { Manrope } from "next/font/google";
+import * as Sentry from "@sentry/nextjs";
import "./globals.css";
import { cn } from "@/lib/utils";
import { Providers } from "@/components/providers";
import { InitUser } from "@/components/init-user";
-import { getToken } from "@/lib/auth-server";
+import { getAuthUser, getToken } from "@/lib/auth-server";
const manrope = Manrope({ subsets: ["latin"], variable: "--font-sans" });
@@ -19,6 +20,16 @@ export default async function RootLayout({
children: React.ReactNode;
}>) {
const initialToken = await getToken();
+ const user = await getAuthUser();
+ if (user) {
+ const id = user.userId ?? String(user._id);
+ Sentry.setUser({
+ id,
+ email: user.email ?? undefined,
+ });
+ } else {
+ Sentry.setUser(null);
+ }
return (