-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
Web: Left nav UI improvements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, still reviewing UI
web/renderer/components/ConnectionsAndDatabases/useSelectedConnection.ts
Outdated
Show resolved
Hide resolved
<Button.Link | ||
key={conn.name} | ||
className={cx(css.connection, { | ||
[css.selected]: state.connection.name === conn.name, | ||
})} | ||
onClick={async () => onSelected(conn)} | ||
> | ||
<div className={css.connectionTop}> | ||
<div className={css.nameAndLabel}> | ||
<span className={css.connectionName}> | ||
{excerpt(conn.name, 16)} | ||
</span> | ||
<DatabaseTypeLabel conn={conn} /> | ||
{conn.name === currentConnection.name && ( | ||
<MdRemoveRedEye className={css.viewing} /> | ||
)} | ||
</div> | ||
<FaChevronRight className={css.arrow} /> | ||
</div> | ||
<div className={css.connectionUrl}> | ||
{excerpt(getHostAndPort(conn.connectionUrl), 42)} | ||
</div> | ||
</Button.Link> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would make this easier to read by moving this to a ConnectionItem
component
} | ||
return ( | ||
<Button.Link | ||
className={cx(css.DbItem, css.link)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className={cx(css.DbItem, css.link)} | |
className={cx(css.dbItem, css.link)} |
export function DatabaseTypeLabel({ conn }: Props) { | ||
const type = getDatabaseType(conn.type ?? undefined, !!conn.isDolt); | ||
switch (type) { | ||
case "Dolt": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is type
not an enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it's a string returned from getDatabaseType
className={cx(css.titlebar, { | ||
[css.drag]: !noDrag, | ||
[css.noDrag]: noDrag, |
There was a problem hiding this comment.
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?
|
||
return ( | ||
<div | ||
className={cx(css.titlebar, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className={cx(css.titlebar, { | |
className={cx(css.titleBar, { |
|
||
export function Logo({ imgSrc, className }: LogoProps) { | ||
return ( | ||
<Link href="/" className={cx(className)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Link href="/" className={cx(className)}> | |
<Link href="/" className={className}> |
@@ -15,11 +16,13 @@ export default function useDatabaseDetails(): ReturnType { | |||
const isDolt = res.data?.doltDatabaseDetails.isDolt ?? false; | |||
const isPostgres = | |||
res.data?.doltDatabaseDetails.type === DatabaseType.Postgres; | |||
const isMysql = res.data?.doltDatabaseDetails.type === DatabaseType.Mysql; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need this. If both isDolt
and isPostgres
are false then it's a mysql db
await res.client.clearStore(); | ||
if (!addedDb.data) { | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should clearStore
only be called if addedDb.data
exists?
if (conn.type === DatabaseType.Postgres) { | ||
await resetDB({ variables: { newDatabase: databaseName } }); | ||
} | ||
const { href, as } = database({ databaseName }); | ||
const { href, as } = maybeDatabase(databaseName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why maybeDatabase
? Shouldn't databaseName
always exist?
|
||
type Props = { | ||
conn: DatabaseConnectionFragment; | ||
state: StateType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to pass the whole state
? Seems like you only need connection
(which could use a clearer name to distinguish from conn
)?
App:
Web:
figma desgin: https://www.figma.com/design/Xzjg91DdTcn9NOlFtp93gO/Dolt-Workbench-v1?node-id=168-291&t=s9Q1reuw8Olc8KkS-0