|
| 1 | +"use client"; |
| 2 | +import { useSession } from "@/app/(outerbase)/session-provider"; |
| 3 | +import { useWorkspaces } from "@/app/(outerbase)/workspace-provider"; |
| 4 | +import { Button } from "@/components/orbit/button"; |
| 5 | +import { Loader } from "@/components/orbit/loader"; |
| 6 | +import { getDatabaseFriendlyName } from "@/components/resource-card/utils"; |
| 7 | +import { |
| 8 | + ArrowLeft, |
| 9 | + ChartBar, |
| 10 | + Folder, |
| 11 | + Icon, |
| 12 | + MagicWand, |
| 13 | + ShieldCheck, |
| 14 | + UsersThree, |
| 15 | +} from "@phosphor-icons/react"; |
| 16 | +import Link from "next/link"; |
| 17 | + |
| 18 | +function OuterbaseHighlightCard({ |
| 19 | + title, |
| 20 | + description, |
| 21 | + icon: Icon, |
| 22 | +}: { |
| 23 | + title: string; |
| 24 | + description: string; |
| 25 | + icon: Icon; |
| 26 | +}) { |
| 27 | + return ( |
| 28 | + <div className="flex flex-col gap-2 py-4"> |
| 29 | + <div className="mb-4"> |
| 30 | + <div className="bg-muted inline-flex rounded p-4"> |
| 31 | + <Icon className="h-6 w-6" /> |
| 32 | + </div> |
| 33 | + </div> |
| 34 | + <h2 className="font-bold">{title}</h2> |
| 35 | + <p className="text-base">{description}</p> |
| 36 | + </div> |
| 37 | + ); |
| 38 | +} |
| 39 | + |
| 40 | +function SignupPromotion({ type }: { type: string }) { |
| 41 | + const { isLoading, session } = useSession(); |
| 42 | + const { workspaces, loading } = useWorkspaces(); |
| 43 | + |
| 44 | + if (isLoading || loading) { |
| 45 | + return ( |
| 46 | + <div className="flex min-h-[300px] w-1/2 flex-col items-center justify-center gap-4 p-4"> |
| 47 | + <Loader size={40} /> |
| 48 | + </div> |
| 49 | + ); |
| 50 | + } |
| 51 | + |
| 52 | + if (!session?.user) { |
| 53 | + return ( |
| 54 | + <div className="flex w-1/2 flex-col p-4"> |
| 55 | + <h1 className="text-2xl font-bold">Outerbase Cloud</h1> |
| 56 | + |
| 57 | + <Link |
| 58 | + href="/signin" |
| 59 | + className="text-primary-foreground bg-primary my-4 rounded-lg p-4 px-4 text-center text-xl font-semibold" |
| 60 | + > |
| 61 | + Sign In To Our Cloud |
| 62 | + </Link> |
| 63 | + |
| 64 | + <div className="grid grid-cols-2 gap-2"> |
| 65 | + <OuterbaseHighlightCard |
| 66 | + icon={UsersThree} |
| 67 | + title="Collaboration" |
| 68 | + description="Collaborate with your team to explore and analyze the data, and share insights from the database." |
| 69 | + /> |
| 70 | + |
| 71 | + <OuterbaseHighlightCard |
| 72 | + icon={MagicWand} |
| 73 | + title="AI-powered" |
| 74 | + description="Integrate AI to assist with querying, chart generation, and more." |
| 75 | + /> |
| 76 | + |
| 77 | + <OuterbaseHighlightCard |
| 78 | + icon={ChartBar} |
| 79 | + title="Visual Charts" |
| 80 | + description="Create visually appealing charts from multiple data sources in minutes." |
| 81 | + /> |
| 82 | + |
| 83 | + <OuterbaseHighlightCard |
| 84 | + icon={ShieldCheck} |
| 85 | + title="HIPAA Compliant" |
| 86 | + description="We protect patient health details, keeping them safe and confidential." |
| 87 | + /> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + ); |
| 91 | + } |
| 92 | + |
| 93 | + return ( |
| 94 | + <div className="flex w-1/2 flex-col gap-2 p-4"> |
| 95 | + <div className="mb-4"> |
| 96 | + <h1 className="text-2xl font-bold">Outerbase Cloud</h1> |
| 97 | + <p>Please select the workspace</p> |
| 98 | + </div> |
| 99 | + |
| 100 | + {(workspaces ?? []).map((workspace) => { |
| 101 | + return ( |
| 102 | + <Link |
| 103 | + key={workspace.id} |
| 104 | + className="bg-secondary hover:border-primary flex cursor-pointer items-center gap-2 rounded border border-2 p-4 text-base" |
| 105 | + href={`/w/${workspace.short_name}/new-base/${type}`} |
| 106 | + > |
| 107 | + <Folder weight="bold" size={20} /> |
| 108 | + {workspace.name} |
| 109 | + </Link> |
| 110 | + ); |
| 111 | + })} |
| 112 | + </div> |
| 113 | + ); |
| 114 | +} |
| 115 | + |
| 116 | +export function CloudDriverSupportOnly({ type }: { type: string }) { |
| 117 | + return ( |
| 118 | + <div className="container"> |
| 119 | + <div className="my-8 flex"> |
| 120 | + <Button variant="secondary" size="lg" href="/local" as="link"> |
| 121 | + <ArrowLeft /> |
| 122 | + Back |
| 123 | + </Button> |
| 124 | + </div> |
| 125 | + |
| 126 | + <div className="mb-8 p-4 text-xl leading-8"> |
| 127 | + Running {getDatabaseFriendlyName(type)} from a browser is not possible. |
| 128 | + <br /> Please use the desktop app or our cloud services instead. |
| 129 | + </div> |
| 130 | + |
| 131 | + <div className="mb-8 flex"> |
| 132 | + <SignupPromotion type={type} /> |
| 133 | + |
| 134 | + <div className="flex w-1/2 flex-col gap-4 p-4"> |
| 135 | + <div> |
| 136 | + <h1 className="text-2xl font-bold">Desktop App</h1> |
| 137 | + </div> |
| 138 | + |
| 139 | + <Link |
| 140 | + href="https://github.com/outerbase/studio-desktop/releases" |
| 141 | + className="relative w-full" |
| 142 | + > |
| 143 | + <img |
| 144 | + src="/outerbase-banner.jpg" |
| 145 | + alt="" |
| 146 | + className="w-full rounded-lg" |
| 147 | + /> |
| 148 | + |
| 149 | + <div className="bg-opacity-50 absolute right-0 bottom-0 left-0 flex cursor-pointer flex-col gap-2 rounded-lg bg-black p-4 text-white"> |
| 150 | + <div className="text-2xl font-bold">Download the desktop app</div> |
| 151 | + <p className="text-base"> |
| 152 | + Outerbase Studio Desktop is a lightweight Electron wrapper for |
| 153 | + the Outerbase Studio web version. It enables support for drivers |
| 154 | + that aren't feasible in a browser environment, such as |
| 155 | + MySQL and PostgreSQL. |
| 156 | + </p> |
| 157 | + </div> |
| 158 | + </Link> |
| 159 | + </div> |
| 160 | + </div> |
| 161 | + </div> |
| 162 | + ); |
| 163 | +} |
0 commit comments