diff --git a/surfsense_web/app/dashboard/page.tsx b/surfsense_web/app/dashboard/page.tsx index aa6709af3..3e6d71829 100644 --- a/surfsense_web/app/dashboard/page.tsx +++ b/surfsense_web/app/dashboard/page.tsx @@ -1,7 +1,7 @@ "use client"; import { useAtomValue } from "jotai"; -import { AlertCircle, Loader2 } from "lucide-react"; +import { AlertCircle, Loader2, Plus, Search } from "lucide-react"; import { motion } from "motion/react"; import { useRouter } from "next/navigation"; import { useTranslations } from "next-intl"; @@ -88,6 +88,37 @@ function ErrorScreen({ message }: { message: string }) { ); } +function EmptyState({ onCreateClick }: { onCreateClick: () => void }) { + const t = useTranslations("searchSpace"); + + return ( +
+ +
+ +
+ +
+

{t("welcome_title")}

+

+ {t("welcome_description")} +

+
+ + +
+
+ ); +} + export default function DashboardPage() { const router = useRouter(); const [showCreateDialog, setShowCreateDialog] = useState(false); @@ -101,17 +132,11 @@ export default function DashboardPage() { useEffect(() => { if (isLoading) return; - if (searchSpaces.length === 0) { - setShowCreateDialog(true); - } else { + if (searchSpaces.length > 0) { router.replace(`/dashboard/${searchSpaces[0].id}/new-chat`); } }, [isLoading, searchSpaces, router]); - const handleDialogChange = (open: boolean) => { - setShowCreateDialog(open); - }; - if (isLoading) return ; if (error) return ; @@ -120,8 +145,9 @@ export default function DashboardPage() { } return ( -
- -
+ <> + setShowCreateDialog(true)} /> + + ); } diff --git a/surfsense_web/messages/en.json b/surfsense_web/messages/en.json index 65ff75978..b3d816925 100644 --- a/surfsense_web/messages/en.json +++ b/surfsense_web/messages/en.json @@ -96,7 +96,10 @@ "members_count": "{count, plural, =1 {1 member} other {# members}}", "create_new_search_space": "Create new search space", "delete_title": "Delete Search Space", - "delete_confirm": "Are you sure you want to delete \"{name}\"? This action cannot be undone and will permanently remove all data." + "delete_confirm": "Are you sure you want to delete \"{name}\"? This action cannot be undone and will permanently remove all data.", + "welcome_title": "Welcome to SurfSense", + "welcome_description": "Create your first search space to start organizing your knowledge, connecting sources, and chatting with AI.", + "create_first_button": "Create your first search space" }, "dashboard": { "title": "Dashboard", diff --git a/surfsense_web/messages/zh.json b/surfsense_web/messages/zh.json index e6a61528b..678aa174a 100644 --- a/surfsense_web/messages/zh.json +++ b/surfsense_web/messages/zh.json @@ -96,7 +96,10 @@ "members_count": "{count, plural, other {# 位成员}}", "create_new_search_space": "创建新的搜索空间", "delete_title": "删除搜索空间", - "delete_confirm": "您确定要删除「{name}」吗?此操作无法撤销,将永久删除所有数据。" + "delete_confirm": "您确定要删除「{name}」吗?此操作无法撤销,将永久删除所有数据。", + "welcome_title": "欢迎使用 SurfSense", + "welcome_description": "创建您的第一个搜索空间,开始组织知识、连接数据源并与AI对话。", + "create_first_button": "创建第一个搜索空间" }, "dashboard": { "title": "仪表盘",