diff --git a/apps/claim-db-worker/app/robots.ts b/apps/claim-db-worker/app/robots.ts
new file mode 100644
index 0000000..4a6cd9d
--- /dev/null
+++ b/apps/claim-db-worker/app/robots.ts
@@ -0,0 +1,14 @@
+import type { MetadataRoute } from "next";
+
+// Served as /robots.txt. Pages under /web/ create a temporary database when
+// they open, and /api/ only answers the app's own requests, so both prefixes
+// are disallowed. The bare /web path gets noindex from app/web/layout.tsx.
+export default function robots(): MetadataRoute.Robots {
+ return {
+ rules: {
+ userAgent: "*",
+ allow: "/",
+ disallow: ["/web/", "/api/"],
+ },
+ };
+}
diff --git a/apps/claim-db-worker/app/web/WebLayoutClient.tsx b/apps/claim-db-worker/app/web/WebLayoutClient.tsx
new file mode 100644
index 0000000..a987076
--- /dev/null
+++ b/apps/claim-db-worker/app/web/WebLayoutClient.tsx
@@ -0,0 +1,292 @@
+"use client";
+
+import React, { useState, useEffect, Suspense } from "react";
+import { useRouter, usePathname } from "next/navigation";
+import { useDropContext } from "../contexts/DropContext";
+import { customToast } from "@/lib/custom-toast";
+import Modal from "@/components/Modal";
+import { Database, Code, Eye, PlusCircle, Copy } from "lucide-react";
+import LoadingScreen from "@/components/LoadingScreen";
+import { LoadingMark, Mascot } from "@/components/brand/Brand";
+import { PrismButton, PrismButtonOutline } from "@/components/brand/PrismButton";
+import { DatabaseProvider, useDatabase } from "./DatabaseContext";
+
+interface WebLayoutProps {
+ children: React.ReactNode;
+}
+
+const WebLayoutContent = ({ children }: WebLayoutProps) => {
+ const [showNewDbConfirm, setShowNewDbConfirm] = useState(false);
+ const { dbInfo, loading, clearDatabase } = useDatabase();
+ const {
+ setTimeRemaining,
+ setProjectId,
+ handleClaimDatabase,
+ timeRemaining,
+ } = useDropContext();
+ const router = useRouter();
+ const pathname = usePathname();
+
+ const currentTab = pathname.split("/").pop() || "connect";
+
+ useEffect(() => {
+ if (dbInfo.projectId) {
+ setProjectId(dbInfo.projectId);
+ }
+ }, [dbInfo.projectId, setProjectId]);
+
+ useEffect(() => {
+ if (!loading && dbInfo.expirationTime) {
+ const calculateTimeRemaining = () => {
+ const now = Date.now();
+ const timeRemainingMs = dbInfo.expirationTime! - now;
+ if (timeRemainingMs <= 0) {
+ setTimeRemaining(0);
+ clearDatabase();
+ return;
+ }
+
+ setTimeRemaining(Math.floor(timeRemainingMs / 1000));
+ };
+
+ calculateTimeRemaining();
+ const timer = setInterval(calculateTimeRemaining, 1000);
+ return () => clearInterval(timer);
+ }
+ }, [loading, dbInfo.expirationTime, setTimeRemaining, clearDatabase]);
+
+ const handleCreateNewDatabase = () => {
+ setShowNewDbConfirm(true);
+ };
+
+ const confirmCreateNewDatabase = () => {
+ clearDatabase();
+ window.location.reload();
+ };
+
+ const handleTabChange = (tab: string) => {
+ router.push(`/web/${tab}`);
+ };
+
+ if (!loading && (timeRemaining === 0 || timeRemaining === null)) {
+ return (
+
+
+
+
+ Your temporary database has expired or has been claimed. Please create a new one.
+
+
+
+
+ );
+ }
+
+ return (
+ <>
+
+
+
+
+
+
+ Claim database
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {loading ? (
+
+
+
+ ) : (
+
+ {children}
+
+ )}
+
+
+
+
+ setShowNewDbConfirm(false)}
+ title="Create New Database?"
+ >
+
+ This will delete your current database and create a new one. Your
+ current connection strings and data will be lost.
+
+
+
setShowNewDbConfirm(false)}>
+ Cancel
+
+
+ Create new database
+
+
+
+ >
+ );
+};
+
+interface TabHeaderProps {
+ activeTab: string;
+ onTabChange: (tab: string) => void;
+ tabName: string;
+ buttonText: string;
+ icon: string;
+ buttonTextMobile: string;
+}
+
+const TabHeader = ({
+ activeTab,
+ onTabChange,
+ tabName,
+ buttonText,
+ icon,
+ buttonTextMobile,
+}: TabHeaderProps) => {
+ const isActive = activeTab === tabName;
+
+ const getIcon = () => {
+ switch (icon) {
+ case "database":
+ return ;
+ case "code":
+ return ;
+ case "eye":
+ return ;
+ default:
+ return ;
+ }
+ };
+
+ return (
+
+ );
+};
+
+const WebLayout = ({ children }: WebLayoutProps) => {
+ return (
+
+
+
+
+
+
+ }
+ >
+ {children}
+
+
+ );
+};
+
+export default WebLayout;
diff --git a/apps/claim-db-worker/app/web/layout.tsx b/apps/claim-db-worker/app/web/layout.tsx
index a987076..b7bb919 100644
--- a/apps/claim-db-worker/app/web/layout.tsx
+++ b/apps/claim-db-worker/app/web/layout.tsx
@@ -1,292 +1,16 @@
-"use client";
+import type { Metadata } from "next";
+import WebLayout from "./WebLayoutClient";
-import React, { useState, useEffect, Suspense } from "react";
-import { useRouter, usePathname } from "next/navigation";
-import { useDropContext } from "../contexts/DropContext";
-import { customToast } from "@/lib/custom-toast";
-import Modal from "@/components/Modal";
-import { Database, Code, Eye, PlusCircle, Copy } from "lucide-react";
-import LoadingScreen from "@/components/LoadingScreen";
-import { LoadingMark, Mascot } from "@/components/brand/Brand";
-import { PrismButton, PrismButtonOutline } from "@/components/brand/PrismButton";
-import { DatabaseProvider, useDatabase } from "./DatabaseContext";
-
-interface WebLayoutProps {
- children: React.ReactNode;
-}
-
-const WebLayoutContent = ({ children }: WebLayoutProps) => {
- const [showNewDbConfirm, setShowNewDbConfirm] = useState(false);
- const { dbInfo, loading, clearDatabase } = useDatabase();
- const {
- setTimeRemaining,
- setProjectId,
- handleClaimDatabase,
- timeRemaining,
- } = useDropContext();
- const router = useRouter();
- const pathname = usePathname();
-
- const currentTab = pathname.split("/").pop() || "connect";
-
- useEffect(() => {
- if (dbInfo.projectId) {
- setProjectId(dbInfo.projectId);
- }
- }, [dbInfo.projectId, setProjectId]);
-
- useEffect(() => {
- if (!loading && dbInfo.expirationTime) {
- const calculateTimeRemaining = () => {
- const now = Date.now();
- const timeRemainingMs = dbInfo.expirationTime! - now;
- if (timeRemainingMs <= 0) {
- setTimeRemaining(0);
- clearDatabase();
- return;
- }
-
- setTimeRemaining(Math.floor(timeRemainingMs / 1000));
- };
-
- calculateTimeRemaining();
- const timer = setInterval(calculateTimeRemaining, 1000);
- return () => clearInterval(timer);
- }
- }, [loading, dbInfo.expirationTime, setTimeRemaining, clearDatabase]);
-
- const handleCreateNewDatabase = () => {
- setShowNewDbConfirm(true);
- };
-
- const confirmCreateNewDatabase = () => {
- clearDatabase();
- window.location.reload();
- };
-
- const handleTabChange = (tab: string) => {
- router.push(`/web/${tab}`);
- };
-
- if (!loading && (timeRemaining === 0 || timeRemaining === null)) {
- return (
-
-
-
-
- Your temporary database has expired or has been claimed. Please create a new one.
-
-
-
-
- );
- }
-
- return (
- <>
-
-
-
-
-
-
- Claim database
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {loading ? (
-
-
-
- ) : (
-
- {children}
-
- )}
-
-
-
-
- setShowNewDbConfirm(false)}
- title="Create New Database?"
- >
-
- This will delete your current database and create a new one. Your
- current connection strings and data will be lost.
-
-
-
setShowNewDbConfirm(false)}>
- Cancel
-
-
- Create new database
-
-
-
- >
- );
+// Opening a /web page creates a temporary database for the visitor, so these
+// pages stay out of search results. app/robots.ts also disallows /web/.
+export const metadata: Metadata = {
+ robots: { index: false },
};
-interface TabHeaderProps {
- activeTab: string;
- onTabChange: (tab: string) => void;
- tabName: string;
- buttonText: string;
- icon: string;
- buttonTextMobile: string;
+export default function Layout({
+ children,
+}: Readonly<{
+ children: React.ReactNode;
+}>) {
+ return {children};
}
-
-const TabHeader = ({
- activeTab,
- onTabChange,
- tabName,
- buttonText,
- icon,
- buttonTextMobile,
-}: TabHeaderProps) => {
- const isActive = activeTab === tabName;
-
- const getIcon = () => {
- switch (icon) {
- case "database":
- return ;
- case "code":
- return ;
- case "eye":
- return ;
- default:
- return ;
- }
- };
-
- return (
-
- );
-};
-
-const WebLayout = ({ children }: WebLayoutProps) => {
- return (
-
-
-
-
-
-
- }
- >
- {children}
-
-
- );
-};
-
-export default WebLayout;