Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web: connections and connection configuration page redesign #350

Merged
merged 27 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6d0f617
separate connections and add connection pages
liuliu-dev Jan 9, 2025
5de970f
connection form sections
liuliu-dev Jan 9, 2025
344590c
remove go back
liuliu-dev Jan 10, 2025
c4d3619
context, tabs
liuliu-dev Jan 10, 2025
aff7b43
tooltip for missing fields
liuliu-dev Jan 10, 2025
911e374
only show welcome when there's no connections
liuliu-dev Jan 10, 2025
dff3c25
with cancel
liuliu-dev Jan 10, 2025
6ffc071
wip
liuliu-dev Jan 13, 2025
f5a8a11
connecting lines
liuliu-dev Jan 13, 2025
4b77638
Merge remote-tracking branch 'origin/main' into liuliu/reorganize-con…
liuliu-dev Jan 15, 2025
a91f5f0
add button to add connection page
liuliu-dev Jan 15, 2025
cef99ec
lines and connect
liuliu-dev Jan 16, 2025
d0c316f
center
liuliu-dev Jan 16, 2025
76eeca5
tab
liuliu-dev Jan 16, 2025
a774aaa
Merge branch 'liuliu/reorganize-connections-pages' into liuliu/connec…
liuliu-dev Jan 16, 2025
20cb150
db list
liuliu-dev Jan 16, 2025
46e4cdf
Merge remote-tracking branch 'origin/main' into liuliu/reorganize-con…
liuliu-dev Jan 22, 2025
94119ba
Merge branch 'liuliu/reorganize-connections-pages' into liuliu/connec…
liuliu-dev Jan 22, 2025
39d95b0
connect lines ui fixes, tab, color, size
liuliu-dev Jan 23, 2025
8df872e
db list width, margin
liuliu-dev Jan 23, 2025
27ab2db
Merge pull request #352 from dolthub/liuliu/connections-pages
liuliu-dev Jan 23, 2025
33fc121
small ui fixes: connection line height, checkbox hover color
liuliu-dev Jan 23, 2025
4ea3a57
branch label, clear err, font size
liuliu-dev Jan 23, 2025
ba51d68
url, color, typo
liuliu-dev Jan 24, 2025
7b4f15a
rename boolean
liuliu-dev Jan 24, 2025
bddb1e0
disabled
liuliu-dev Jan 24, 2025
3af7806
prettier
liuliu-dev Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"@apollo/client": "^3.9.9",
"@dolthub/react-components": "^0.2.6",
"@dolthub/react-components": "^0.2.8",
"@dolthub/react-contexts": "^0.1.0",
"@dolthub/react-hooks": "^0.1.7",
"@dolthub/web-utils": "^0.1.8",
Expand Down
13 changes: 10 additions & 3 deletions web/renderer/components/ConnectionsAndDatabases/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import cx from "classnames";
import Link from "@components/links/Link";
import { ErrorMsg, SmallLoader } from "@dolthub/react-components";
import CreateDatabase from "@components/CreateDatabase";
import { AiOutlinePlusCircle } from "@react-icons/all-files/ai/AiOutlinePlusCircle";
import { connections, newConnection } from "@lib/urls";
import { FiTool } from "@react-icons/all-files/fi/FiTool";
import { StateType } from "./useSelectedConnection";
import DatabaseItem from "./DatabaseItem";
Expand All @@ -30,9 +32,14 @@ export default function Popup({
<div className={css.top}>
<div className={cx(css.header, css.left)}>
<span>CONNECTIONS</span>
<Link href="/connections">
<FiTool className={css.wrench} />
</Link>
<div className={css.icons}>
<Link {...connections}>
<FiTool className={css.wrench} />
</Link>
<Link {...newConnection}>
<AiOutlinePlusCircle className={css.plus} />
</Link>
</div>
</div>
<div className={cx(css.header, css.right)}>
<span>DATABASES</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,16 @@
@apply border-none rounded-bl;
}

.icons {
@apply flex;
}

.wrench {
@apply w-4 h-4 border border-sky-400 rounded-full p-[0.1rem] -rotate-90;
@apply w-5 h-5 border border-sky-400 rounded-full p-[0.1rem] -rotate-90;
}

.top .plus {
@apply ml-2 w-[21px] h-[21px];
}

.connectionTop {
Expand Down
3 changes: 2 additions & 1 deletion web/renderer/components/ConnectionsAndDatabases/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import Link from "@components/links/Link";
import { FiDatabase } from "@react-icons/all-files/fi/FiDatabase";
import { excerpt } from "@dolthub/web-utils";
import { connections } from "@lib/urls";
import cx from "classnames";
import useSelectedConnection from "./useSelectedConnection";
import Popup from "./Popup";
Expand Down Expand Up @@ -84,7 +85,7 @@ export default function ConnectionsAndDatabases(props: Props) {
data.currentConnection ? (
<Inner {...props} connection={data.currentConnection} />
) : (
<Link href="/connections" className={css.connectionError}>
<Link {...connections} className={css.connectionError}>
Connections
</Link>
)
Expand Down
8 changes: 5 additions & 3 deletions web/renderer/components/CreateDatabase/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
import useMutation from "@hooks/useMutation";
import { database } from "@lib/urls";
import { AiOutlinePlusCircle } from "@react-icons/all-files/ai/AiOutlinePlusCircle";
import { AiOutlinePlus } from "@react-icons/all-files/ai/AiOutlinePlus";
import cx from "classnames";
import { useRouter } from "next/router";
import { SyntheticEvent, useState } from "react";
Expand Down Expand Up @@ -56,8 +55,11 @@ export default function CreateDatabase(props: Props) {
onClick={() => setIsOpen(true)}
className={cx(css.createDB, props.buttonClassName)}
>
{props.showText ? <AiOutlinePlus /> : <AiOutlinePlusCircle />}
{props.showText && <span className={css.text}>Create database</span>}
{props.showText ? (
<span className={css.text}>Create Database</span>
) : (
<AiOutlinePlusCircle />
)}
</Button.Link>
<ModalOuter
isOpen={isOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Props = {
export default function DoltDisabledSelector(props: Props) {
return (
<div className={css.disabledWrapper}>
{props.showLabel && <span className={css.label}>Branch</span>}
{props.showLabel && <span className={css.label}>Branch:</span>}
<div
className={cx(css.doltDisabled, css.branchAndTagSelect)}
data-tooltip-content="Use Dolt to enable branches"
Expand Down
4 changes: 2 additions & 2 deletions web/renderer/components/FormSelectForRefs/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
}

.label {
@apply inline-block mt-2 mr-2 text-storm-50 font-normal text-sm w-[3.3rem];
@apply inline-block mr-2 text-storm-50 font-normal text-sm w-[3.3rem];
}

.branchLabel {
@apply mt-2 mr-2 text-storm-50 font-normal text-sm w-[3.3rem];
@apply my-auto mr-2 text-storm-50 font-normal text-sm w-[3.3rem];
}

.doltDisabled {
Expand Down
3 changes: 2 additions & 1 deletion web/renderer/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { dockerHubRepo, workbenchGithubRepo } from "@lib/constants";
import { ExternalLink, MobileNavbar } from "@dolthub/react-components";
import { FaGithub } from "@react-icons/all-files/fa/FaGithub";
import { FaDocker } from "@react-icons/all-files/fa/FaDocker";
import { connections } from "@lib/urls";
import DocsLink from "@components/links/DocsLink";
import css from "./index.module.css";

Expand Down Expand Up @@ -70,7 +71,7 @@ function Inner({ params, setNoDrag }: InnerProps) {
logo={<Logo imgSrc="/images/dolt-workbench.png" />}
bgColor="bg-storm-600"
>
<Link href="/connections">Connections</Link>
<Link {...connections}>Connections</Link>
<RightLinks />
</MobileNavbar>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.diagram {
@apply flex text-white text-base bg-[#FF8964] px-6 items-center;
@apply flex text-white text-base bg-coral-300 px-6 items-center;
&:hover {
@apply bg-coral-400;
}
Expand Down
2 changes: 1 addition & 1 deletion web/renderer/components/TableList/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@apply flex my-8 mx-3 text-sm text-white font-normal;

&:hover {
@apply text-[#FF8964];
@apply text-coral-300;
}

svg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,62 @@ import { getDatabaseType } from "@components/DatabaseTypeLabel";
import { Button, ErrorMsg, Loader } from "@dolthub/react-components";
import { DatabaseConnectionFragment } from "@gen/graphql-types";
import { IoMdClose } from "@react-icons/all-files/io/IoMdClose";
import Image from "next/legacy/image";
import cx from "classnames";
import { DatabaseTypeLabel } from "@components/ConnectionsAndDatabases/DatabaseTypeLabel";
import useAddConnection from "./useAddConnection";
import css from "./index.module.css";

type Props = {
conn: DatabaseConnectionFragment;
onDeleteClicked?: (n: string) => void;
onDeleteClicked: (n: string) => void;
borderClassName: string;
shorterLine: boolean;
};

export default function Item({ conn, onDeleteClicked }: Props) {
export default function Item({
conn,
onDeleteClicked,
borderClassName,
shorterLine,
}: Props) {
const { onAdd, err, loading } = useAddConnection(conn);

const type = getDatabaseType(conn.type ?? undefined, !!conn.isDolt);
return (
<>
<li key={conn.name} className={css.connection}>
<Button.Link onClick={onAdd}>{conn.name}</Button.Link>
<span className={css.right}>
<DatabaseTypeLabel conn={conn} />
{onDeleteClicked && (
<Button.Link onClick={() => onDeleteClicked(conn.name)}>
<li key={conn.name} className={css.connectionContainer}>
<div
className={cx(css.line, css[borderClassName], {
[css.shorterLine]: shorterLine,
})}
/>
<div className={css.connection}>
<div className={cx(css.left, css[type.toLowerCase()])}>
<Image
src="/images/database-icon.png"
alt="DatabaseIcon"
height={51}
width={51}
/>
</div>
<div className={css.right}>
<Button.Link
onClick={() => onDeleteClicked(conn.name)}
className={css.delete}
>
<IoMdClose />
</Button.Link>
)}
</span>
<div className={css.typeAndName}>
<DatabaseTypeLabel conn={conn} />
<Button.Link onClick={onAdd} className={css.name}>
{conn.name}
</Button.Link>
</div>
</div>
</div>
</li>
<Loader loaded={!loading} />
<ErrorMsg err={err} className={css.err} />
</>
);
}

type LabelProps = {
conn: DatabaseConnectionFragment;
};

export function DatabaseTypeLabel({ conn }: LabelProps) {
const type = getDatabaseType(conn.type ?? undefined, !!conn.isDolt);
return <span className={cx(css.label, css[type.toLowerCase()])}>{type}</span>;
}
Loading