Skip to content

Commit

Permalink
Update database/branch wording on dashboard page
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclarke committed Mar 15, 2024
1 parent e6b1930 commit 143f6ce
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions shared/studio/tabs/dashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useEffect} from "react";
import {useEffect, useMemo} from "react";
import {observer} from "mobx-react-lite";

import styles from "./databaseDashboard.module.scss";
Expand Down Expand Up @@ -166,6 +166,12 @@ const FirstRunDashboard = observer(function FirstRunDashboard() {
const {navigate} = useDBRouter();

const exampleDBExists = instanceState.databases?.includes("_example");
const dbOrBranch = useMemo(() => {
for (const func of dbState.schemaData?.functions.values() ?? []) {
if (func.name === "sys::get_current_branch") return "branch";
}
return "database";
}, [dbState.schemaData]);

return (
<CustomScrollbars
Expand All @@ -178,23 +184,25 @@ const FirstRunDashboard = observer(function FirstRunDashboard() {
<HeaderDatabaseIcon />
<span>{dbState.name}</span>
</div>
<div className={styles.congrats}>Your new database is ready!</div>
<div className={styles.congrats}>
Your new {dbOrBranch} is ready!
</div>

<div className={styles.importData}>
<h3>First time using EdgeDB?</h3>
<p>
{exampleDBExists ? "Switch to the" : "Create an"} example branch
with our "movies" schema and data set, and play with the web UI
right away.
{exampleDBExists ? "Switch to the" : "Create an"} example{" "}
{dbOrBranch} with our "movies" schema and data set, and play with
the web UI right away.
</p>
<div>
<Button
label={
instanceState.creatingExampleDB
? "Creating example branch..."
? `Creating example ${dbOrBranch}...`
: exampleDBExists
? "Switch to example branch"
: "Create example branch"
? `Switch to example ${dbOrBranch}`
: `Create example ${dbOrBranch}`
}
loading={instanceState.creatingExampleDB}
disabled={instanceState.creatingExampleDB}
Expand Down

0 comments on commit 143f6ce

Please sign in to comment.