Skip to content

Commit

Permalink
remove go back
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu-dev committed Jan 10, 2025
1 parent 5de970f commit 344590c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,14 @@ import {
} from "@dolthub/react-components";
import { DatabaseType } from "@gen/graphql-types";
import { dockerHubRepo } from "@lib/constants";
import { IoIosArrowDropleftCircle } from "@react-icons/all-files/io/IoIosArrowDropleftCircle";
import { connections } from "@lib/urls";
import { useRouter } from "next/router";
import MainLayout from "@components/layouts/MainLayout";
import cx from "classnames";
import useConfig, { getCanSubmit } from "./useConfig";
import css from "./index.module.css";
import WelcomeMessage from "./WelcomeMessage";
import css from "./index.module.css";

type Props = {
canGoBack: boolean;
};

export default function NewConnection(props: Props) {
const { onSubmit, state, setState, error, clearState } = useConfig();
const router = useRouter();

const onCancel = props.canGoBack
? () => {
const { href, as } = connections;
router.push(href, as).catch(console.error);
}
: clearState;
export default function NewConnection() {
const { onSubmit, state, setState, error } = useConfig();

return (
<MainLayout className={css.container}>
Expand Down Expand Up @@ -190,11 +175,7 @@ export default function NewConnection(props: Props) {
className={css.checkbox}
/>
</div>
<ButtonsWithError
error={error}
onCancel={onCancel}
cancelText={props.canGoBack ? "cancel" : "clear"}
>
<ButtonsWithError error={error}>
<Button type="submit" disabled={!getCanSubmit(state)}>
Launch Workbench
</Button>
Expand All @@ -203,11 +184,6 @@ export default function NewConnection(props: Props) {
)}
</form>
</div>
{props.canGoBack && (
<Button.Link onClick={onCancel} className={css.goback}>
<IoIosArrowDropleftCircle /> back to connections
</Button.Link>
)}
</div>
</MainLayout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function ConfigurationPage() {
data.storedConnections.length ? (
<ExistingConnections connections={data.storedConnections} />
) : (
<NewConnection canGoBack={!!data.storedConnections.length} />
<NewConnection />
)
}
/>
Expand Down
2 changes: 1 addition & 1 deletion web/renderer/pages/connections/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NextPage } from "next";

const AddConnection: NextPage = () => (
<Page title="Add SQL Connection">
<NewConnection canGoBack />
<NewConnection />
</Page>
);

Expand Down

0 comments on commit 344590c

Please sign in to comment.