Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat: add alert for demo page (#85)

Andrejeeca442f0ef7
diff --git a/apps/web/src/components/demo-alert.tsx b/apps/web/src/components/demo-alert.tsx
new file mode 100644
index 000000000..0bfcc8aa6
--- /dev/null
+++ b/apps/web/src/components/demo-alert.tsx
@@ -0,0 +1,26 @@
+import { AlertTriangle } from "lucide-react";
+import { Button } from "./ui/button";
+
+export function DemoAlert() {
+ return (
+ <div className="flex flex-col min-h-screen bg-zinc-50 dark:bg-zinc-950">
+ <div className="bg-amber-500/10 border-b border-amber-500/20 px-4 py-3 sm:py-2 text-center">
+ <div className="flex flex-col sm:flex-row items-center justify-center gap-2 text-sm text-amber-900 dark:text-amber-300">
+ <AlertTriangle className="w-5 h-5 sm:w-4 sm:h-4 mb-1 sm:mb-0" />
+ <p className="flex flex-col sm:flex-row items-center gap-2">
+ This is a demo environment. All data will be automatically purged
+ every 24 hours.
+ <Button
+ onClick={() =>
+ window.open("https://github.com/kaneo-app/app", "_blank")
+ }
+ className="text-xs bg-amber-500/10 hover:bg-amber-500/20 text-amber-900 dark:text-amber-300 h-7 sm:h-6 px-3 sm:px-2 whitespace-nowrap"
+ >
+ Deploy your own
+ </Button>
+ </p>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/constants/urls.ts b/apps/web/src/constants/urls.ts
index 5575bde29..fa650fa1a 100644
--- a/apps/web/src/constants/urls.ts
+++ b/apps/web/src/constants/urls.ts
@@ -1,2 +1,4 @@
export const API_URL: string =
import.meta.env.VITE_API_URL ?? "http://localhost:1337";
+
+export const isDemoMode = window.location.hostname === "demo.kaneo.app";
diff --git a/apps/web/src/routes/dashboard.tsx b/apps/web/src/routes/dashboard.tsx
index 23d39ba69..295bf1f06 100644
--- a/apps/web/src/routes/dashboard.tsx
+++ b/apps/web/src/routes/dashboard.tsx
@@ -1,6 +1,8 @@
import { Sidebar } from "@/components/common/sidebar";
+import { DemoAlert } from "@/components/demo-alert";
import EmptyWorkspaceState from "@/components/workspace/empty-state";
import SelectWorkspaceState from "@/components/workspace/select-workspace-state";
+import { isDemoMode } from "@/constants/urls";
import useGetWorkspaces from "@/hooks/queries/workspace/use-get-workspaces";
import useWorkspaceStore from "@/store/workspace";
import { Outlet, createFileRoute, redirect } from "@tanstack/react-router";
@@ -27,6 +29,7 @@ function DashboardIndexRouteComponent() {
<>
<Sidebar />
<main className="flex-1 overflow-hidden scroll-smooth">
+ {isDemoMode && <DemoAlert />}
{hasNoWorkspacesAndNoSelectedWorkspace && <EmptyWorkspaceState />}
{!workspace && workspaces && workspaces.length > 0 && (
<SelectWorkspaceState />