Skip to content

Commit e1013e5

Browse files
address PR comments
1 parent a74817c commit e1013e5

File tree

10 files changed

+44
-39
lines changed

10 files changed

+44
-39
lines changed

web/renderer/components/CloneDatabaseForm/index.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.form .checkbox {
1+
.form {
22
svg {
33
@apply -top-1;
44
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.radios {
2+
@apply mb-6;
3+
}

web/renderer/components/CreateDatabaseOrSchemaModal/index.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import useRole from "@hooks/useRole";
1010
import { ApolloErrorType } from "@lib/errors/types";
1111
import { SyntheticEvent, useState } from "react";
1212
import CloneDatabaseForm from "@components/CloneDatabaseForm";
13-
import css from "@components/CloneDatabaseForm/index.module.css";
13+
import css from "./index.module.css";
1414

1515
type InnerProps = {
1616
onClose: () => void;
@@ -52,24 +52,24 @@ export default function CreateDatabaseOrSchemaModal(props: InnerProps) {
5252
<ModalInner>
5353
{props.isDolt && (
5454
<>
55-
<Radio
56-
checked={!cloneDolt}
57-
onChange={() => {
58-
setCloneDolt(false);
59-
}}
60-
name="create-database"
61-
label="Create a new database"
62-
className={css.checkbox}
63-
/>
64-
<Radio
65-
checked={cloneDolt}
66-
onChange={() => {
67-
setCloneDolt(true);
68-
}}
69-
name="clone-dolt-server"
70-
label="Clone a remote Dolt database from DoltHub"
71-
className={css.checkbox}
72-
/>
55+
<div className={css.radios}>
56+
<Radio
57+
checked={!cloneDolt}
58+
onChange={() => {
59+
setCloneDolt(false);
60+
}}
61+
name="create-database"
62+
label="Create a new database"
63+
/>
64+
<Radio
65+
checked={cloneDolt}
66+
onChange={() => {
67+
setCloneDolt(true);
68+
}}
69+
name="clone-dolt-server"
70+
label="Clone a remote Dolt database from DoltHub"
71+
/>
72+
</div>
7373
{cloneDolt && <CloneDatabaseForm />}
7474
</>
7575
)}

web/renderer/components/GoBack/index.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("tests GoBack", () => {
1010
setup(<GoBack url={mockRoute} pageName="Test Page" />);
1111

1212
expect(screen.getByRole("link")).toBeInTheDocument();
13-
expect(screen.getByText("Back to Test Page")).toBeInTheDocument();
13+
expect(screen.getByText("back to Test Page")).toBeInTheDocument();
1414
});
1515

1616
it("renders with mobile styles when isMobile is true", () => {
@@ -58,7 +58,7 @@ describe("tests GoBack", () => {
5858
it("renders with different page names", () => {
5959
setup(<GoBack url={mockRoute} pageName="Dashboard" />);
6060

61-
expect(screen.getByText("Back to Dashboard")).toBeInTheDocument();
61+
expect(screen.getByText("back to Dashboard")).toBeInTheDocument();
6262
});
6363

6464
it("combines all props correctly", () => {
@@ -79,6 +79,6 @@ describe("tests GoBack", () => {
7979

8080
const link = screen.getByRole("link");
8181
expect(link).toHaveAttribute("href", "/test");
82-
expect(screen.getByText("Back to Complex Page")).toBeInTheDocument();
82+
expect(screen.getByText("back to Complex Page")).toBeInTheDocument();
8383
});
8484
});

web/renderer/components/GoBack/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function GoBack(props: Props) {
2222
>
2323
<Link {...props.url}>
2424
<IoIosArrowDropleftCircle />
25-
<span>{props.pageName ? `Back to ${props.pageName}` : "Back"}</span>
25+
<span>{props.pageName ? `back to ${props.pageName}` : "back"}</span>
2626
</Link>
2727
</div>
2828
);

web/renderer/components/pageComponents/ConnectionsPage/NewConnection/About.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default function About() {
6060
}}
6161
name="existing-dolt-server"
6262
label="Connect to an existing Dolt server"
63-
className={css.checkbox}
63+
className={css.radio}
6464
/>
6565
<Radio
6666
checked={connectionOption === ConnectionOption.New}
@@ -75,7 +75,7 @@ export default function About() {
7575
name="start-dolt-server"
7676
label="Start a fresh Dolt server"
7777
description="Run a Dolt SQL server hosted directly within the Workbench. The app supports only one internal server instance, but this restriction does not apply to external Dolt server connections."
78-
className={css.checkbox}
78+
className={css.radio}
7979
/>
8080
<Radio
8181
checked={connectionOption === ConnectionOption.Clone}
@@ -90,7 +90,7 @@ export default function About() {
9090
}}
9191
name="clone-dolt-server"
9292
label="Clone a remote Dolt database from DoltHub"
93-
className={css.checkbox}
93+
className={css.radio}
9494
/>
9595
</>
9696
)}
@@ -146,7 +146,7 @@ export default function About() {
146146
}}
147147
label="Connection Name"
148148
labelClassName={css.label}
149-
placeholder="my-database (required)"
149+
placeholder="my-connection (required)"
150150
light
151151
data-cy="connection-name-input"
152152
/>

web/renderer/components/pageComponents/ConnectionsPage/NewConnection/StartDoltServerForm.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
} from "@dolthub/react-components";
88
import { useConfigContext } from "./context/config";
99
import css from "./index.module.css";
10-
import { ReactNode, useState } from "react";
10+
import { ReactNode } from "react";
11+
import { DisabledReturnType } from "@pageComponents/ConnectionsPage/NewConnection/context/utils";
1112

1213
type Props = {
1314
disabledForConnection: boolean;
@@ -21,10 +22,9 @@ export default function StartDoltServerForm({
2122
const { state, setState, error, setErr, onStartDoltServer } =
2223
useConfigContext();
2324

24-
const [databaseName, setDatabaseName] = useState("");
2525
const { disabled, message } = getDisabled(
2626
disabledForConnection,
27-
databaseName,
27+
state.database,
2828
disabledForConnectionMessage,
2929
);
3030

@@ -53,9 +53,10 @@ export default function StartDoltServerForm({
5353
labelClassName={css.label}
5454
/>
5555
<FormInput
56-
value={databaseName}
56+
value={state.database}
5757
onChangeString={db => {
58-
setDatabaseName(db);
58+
setState({ database: db });
59+
setErr(undefined);
5960
}}
6061
label="Database Name"
6162
labelClassName={css.label}
@@ -77,7 +78,7 @@ export default function StartDoltServerForm({
7778
type="submit"
7879
disabled={disabled || state.loading}
7980
className={css.button}
80-
onClick={async e => onStartDoltServer(e, databaseName)}
81+
onClick={onStartDoltServer}
8182
>
8283
Start and Connect to Dolt Server
8384
<SmallLoader
@@ -100,7 +101,7 @@ function getDisabled(
100101
disabledForConnection: boolean,
101102
databaseName: string,
102103
disabledForConnectionMessage?: ReactNode,
103-
) {
104+
): DisabledReturnType {
104105
if (disabledForConnection) {
105106
return { disabled: true, message: disabledForConnectionMessage };
106107
}

web/renderer/components/pageComponents/ConnectionsPage/NewConnection/context/config.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ export function ConfigProvider({ children }: Props) {
9696
}
9797
};
9898

99-
const onStartDoltServer = async (e: SyntheticEvent, databaseName: string) => {
99+
const onStartDoltServer = async (e: SyntheticEvent) => {
100100
e.preventDefault();
101101
setState({ loading: true });
102102
try {
103103
const result = await window.ipc.invoke(
104104
"start-dolt-server",
105105
state.name.trim(),
106106
state.port,
107-
databaseName,
107+
state.database,
108108
!state.cloneDolt,
109109
);
110110

web/renderer/components/pageComponents/ConnectionsPage/NewConnection/context/state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type ConfigContextType = {
4444
setErr: SetApolloErrorType;
4545
clearState: () => void;
4646
storedConnections?: DatabaseConnectionFragment[];
47-
onStartDoltServer: (e: SyntheticEvent, databaseName: string) => Promise<void>;
47+
onStartDoltServer: (e: SyntheticEvent) => Promise<void>;
4848
onCloneDoltHubDatabase: (
4949
e: SyntheticEvent,
5050
owner: string,

web/renderer/components/pageComponents/ConnectionsPage/NewConnection/index.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
}
106106
}
107107

108-
.checkbox {
108+
.checkbox,
109+
.radio {
109110
@apply mb-3 text-sm w-full;
110111
}
111112

0 commit comments

Comments
 (0)