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: added connections and databases selector, changed theme color #302

Merged
merged 44 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c5fd504
Merge branch 'liuliu/add-custom-title-bar' into liuliu/web-nav-dropdown
liuliu-dev Nov 20, 2024
0c61823
wip
liuliu-dev Nov 20, 2024
8a51cbb
conn and db list, todo: ui on click, reset, default on open
liuliu-dev Nov 21, 2024
d8272a2
use current as default, reset db
liuliu-dev Nov 22, 2024
e10306e
remove breadcrumbs for app, todo:fix lint
liuliu-dev Nov 22, 2024
bb7938e
mobile, gradient, ui fixes
liuliu-dev Nov 22, 2024
b1b57c5
show connections link before database page
liuliu-dev Nov 22, 2024
68696d9
feedback wip
liuliu-dev Nov 25, 2024
f65f9d9
move to middle, fix long name, same db name issues
liuliu-dev Nov 26, 2024
74024a1
click outside works
liuliu-dev Nov 27, 2024
b20259b
color, weight, top
liuliu-dev Nov 27, 2024
bd50529
wip
liuliu-dev Dec 6, 2024
a30dc4a
web and app top nav
liuliu-dev Dec 6, 2024
c0625dc
dropdown wip
liuliu-dev Dec 6, 2024
dce6e2e
Merge remote-tracking branch 'origin/main' into liuliu/web-nav-dropdown
liuliu-dev Dec 11, 2024
65411ec
popup ui
liuliu-dev Dec 11, 2024
4d108ba
mobile wip
liuliu-dev Dec 11, 2024
9f5d54a
plus icon
liuliu-dev Dec 12, 2024
cbb0254
views, definitions
liuliu-dev Dec 12, 2024
498749d
colors
liuliu-dev Dec 12, 2024
9c5b32f
label
liuliu-dev Dec 16, 2024
e3196ff
Merge branch 'liuliu/web-nav-dropdown' into liuliu/left-nav-ui
liuliu-dev Dec 16, 2024
7d08936
table, view, definition list
liuliu-dev Dec 16, 2024
55d76a3
hide icons, bottom, scroll
liuliu-dev Dec 17, 2024
488af3f
conflict
liuliu-dev Dec 30, 2024
76bb6d3
add min window size, web app nav
liuliu-dev Dec 30, 2024
bfc9566
ci
liuliu-dev Dec 30, 2024
2b7418b
mobile fix
liuliu-dev Dec 30, 2024
c522458
Merge branch 'liuliu/web-nav-dropdown' into liuliu/left-nav-ui
liuliu-dev Dec 31, 2024
7a8dbc1
selectors
liuliu-dev Dec 31, 2024
2ba37df
buttons ui
liuliu-dev Jan 2, 2025
af12a83
viewing
liuliu-dev Jan 2, 2025
c4362ea
Merge branch 'liuliu/web-nav-dropdown' into liuliu/left-nav-ui
liuliu-dev Jan 2, 2025
eadfde7
dropdown updates
liuliu-dev Jan 3, 2025
a1ca0ad
Merge remote-tracking branch 'origin/main' into liuliu/web-nav-dropdown
liuliu-dev Jan 3, 2025
7fbe51b
Merge branch 'liuliu/web-nav-dropdown' into liuliu/left-nav-ui
liuliu-dev Jan 3, 2025
1a5c3b0
Merge pull request #317 from dolthub/liuliu/left-nav-ui
liuliu-dev Jan 3, 2025
c5abb76
color
liuliu-dev Jan 3, 2025
6f92205
refresh
liuliu-dev Jan 3, 2025
f4b758e
active, font size, lowercase
liuliu-dev Jan 3, 2025
26af6ad
url
liuliu-dev Jan 3, 2025
8d84e7c
branch label fixes in mysql and postgres, reset button tooltip, conne…
liuliu-dev Jan 15, 2025
50d72fb
ci fix, nodrag
liuliu-dev Jan 15, 2025
977d422
showlabel for all non-dolt, clearstore,selected conn
liuliu-dev Jan 15, 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
Prev Previous commit
Next Next commit
dropdown wip
  • Loading branch information
liuliu-dev committed Dec 6, 2024
commit c0625dc45ed821ca15d457ee63bc0932fccb3c74
8 changes: 5 additions & 3 deletions web/renderer/components/ConnectionsAndDatabases/Popup.tsx
Original file line number Diff line number Diff line change
@@ -6,11 +6,12 @@ import { FaChevronRight } from "@react-icons/all-files/fa/FaChevronRight";
import { Button, ErrorMsg, SmallLoader } from "@dolthub/react-components";
import CreateDatabase from "@components/CreateDatabase";
import { excerpt } from "@dolthub/web-utils";
import { AiOutlinePlus } from "@react-icons/all-files/ai/AiOutlinePlus";
import { AiOutlinePlusCircle } from "@react-icons/all-files/ai/AiOutlinePlusCircle";
import { StateType } from "./useSelectedConnection";
import DatabaseItem from "./DatabaseItem";
import css from "./index.module.css";

import { DatabaseTypeLabel } from "@components/pageComponents/ConnectionsPage/ExistingConnections/Item";

type Props = {
params: DatabaseParams;
currentConnection: DatabaseConnection;
@@ -32,7 +33,7 @@ export default function Popup({
<div className={cx(css.header, css.left)}>
<span>CONNECTIONS</span>
<Link href="/connections">
<AiOutlinePlus />
<AiOutlinePlusCircle />
</Link>
</div>
<div className={cx(css.header, css.right)}>
@@ -53,6 +54,7 @@ export default function Popup({
onClick={async () => onSelected(conn)}
>
<span className={css.alignLeft}>{excerpt(conn.name, 16)}</span>
<DatabaseTypeLabel conn={conn} />
<FaChevronRight />
</Button.Link>
))}
22 changes: 12 additions & 10 deletions web/renderer/components/ConnectionsAndDatabases/index.module.css
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
}

.container {
@apply flex w-[32rem] flex-col;
@apply flex w-[36rem] flex-col;
}

.top,
@@ -28,29 +28,31 @@
@apply flex;
}

.left {
@apply w-1/3;
}

.middle {
@apply min-h-32;
}

.left {
@apply w-2/5 border-r border-stone-100 pt-2;
@apply w-3/5 border-r border-stone-100;
svg{
@apply text-sky-400;
}
}

.right {
@apply w-3/5 pt-2;
@apply w-2/5;
svg{
@apply text-sky-400;
}
}

.header {
@apply flex items-center border-b border-stone-100 py-2 px-4 justify-between;
span {
@apply font-semibold text-sm text-storm-500;
}
svg {
@apply text-[#000];
@apply font-semibold text-sm text-storm-200;
}

}

.item {
2 changes: 1 addition & 1 deletion web/renderer/components/CreateDatabase/index.module.css
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@
@apply text-sm flex items-center;

svg {
@apply mr-1;
@apply h-4 w-4;
}
}
4 changes: 2 additions & 2 deletions web/renderer/components/CreateDatabase/index.tsx
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ import {
} from "@gen/graphql-types";
import useMutation from "@hooks/useMutation";
import { database } from "@lib/urls";
import { AiOutlinePlus } from "@react-icons/all-files/ai/AiOutlinePlus";
import { AiOutlinePlusCircle } from "@react-icons/all-files/ai/AiOutlinePlusCircle";
import cx from "classnames";
import { useRouter } from "next/router";
import { SyntheticEvent, useState } from "react";
@@ -55,7 +55,7 @@ export default function CreateDatabase(props: Props) {
onClick={() => setIsOpen(true)}
className={cx(css.createDB, props.buttonClassName)}
>
<AiOutlinePlus />
<AiOutlinePlusCircle />
{props.showText && "Create database"}
</Button.Link>
<ModalOuter
93 changes: 0 additions & 93 deletions web/renderer/components/Navbar/DesktopAppNavbar.tsx

This file was deleted.

89 changes: 86 additions & 3 deletions web/renderer/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,93 @@
import { DatabaseParams } from "@lib/params";
import DesktopAppNavbar from "./DesktopAppNavbar";
import ConnectionsAndDatabases from "@components/ConnectionsAndDatabases";
import Link from "@components/links/Link";
import { useState } from "react";
import cx from "classnames";
import { dockerHubRepo, workbenchGithubRepo } from "@lib/constants";
import { ExternalLink } from "@dolthub/react-components";
import { FaGithub } from "@react-icons/all-files/fa/FaGithub";
import { FaDocker } from "@react-icons/all-files/fa/FaDocker";
import DocsLink from "@components/links/DocsLink";
import css from "./index.module.css";

// TODO: Support desktop app nav bar on windows
const forMacNav = process.env.NEXT_PUBLIC_FOR_MAC_NAV === "true";

const handleDoubleClick = (e: React.MouseEvent<HTMLDivElement>) => {
if (e.currentTarget === e.target) {
window.ipc.macTitlebarClicked();
}
};

type Props = {
params?: DatabaseParams;
};

export default function Nav({ params }: Props) {
return <DesktopAppNavbar params={params} />;
export default function DesktopAppNavbar({ params }: Props) {
const [noDrag, setNoDrag] = useState(false);

return (
<div
className={cx(css.titlebar, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
className={cx(css.titlebar, {
className={cx(css.titleBar, {

[css.drag]: !noDrag,
[css.noDrag]: noDrag,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make .drag part of .titlebar since that's the default state?

})}
onDoubleClick={handleDoubleClick}
>
{params ? (
<Inner params={params} setNoDrag={setNoDrag} />
) : (
<Logo imgSrc="/images/dolt-workbench.png" />
)}
</div>
);
}

type InnerProps = {
params: DatabaseParams;
setNoDrag: (noDrag: boolean) => void;
};

function Inner({ params, setNoDrag }: InnerProps) {
if (forMacNav) {
return (
<div className={css.outer}>
<ConnectionsAndDatabases params={params} setNoDrag={setNoDrag} />
<Logo imgSrc="/images/dolt-workbench-grey.png" />
</div>
);
}
return (
<div className={css.desktopOuter}>
<Logo imgSrc="/images/dolt-workbench.png" className={css.left} />
<ConnectionsAndDatabases params={params} className={css.middle} />
<RightLinks />
</div>
);
}

type LogoProps = {
imgSrc: string;
className?: string;
};

export function Logo({ imgSrc, className }: LogoProps) {
return (
<Link href="/" className={cx(className)}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Link href="/" className={cx(className)}>
<Link href="/" className={className}>

<img src={imgSrc} alt="Dolt Workbench" className={css.logo} />
</Link>
);
}
function RightLinks() {
return (
<div className={css.right}>
<DocsLink>Documentation</DocsLink>
<ExternalLink href={workbenchGithubRepo}>
<FaGithub /> GitHub
</ExternalLink>
<ExternalLink href={dockerHubRepo}>
<FaDocker /> Docker Hub
</ExternalLink>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ type LabelProps = {
conn: DatabaseConnectionFragment;
};

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