-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from liam-hq/feat/table-detail
feat: Add TableDetail component
- Loading branch information
Showing
41 changed files
with
620 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
export { | ||
type DBStructure, | ||
type Table, | ||
type Columns, | ||
type Column, | ||
type Index, | ||
type Indices, | ||
dbStructureSchema, | ||
} from './schema/index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...re/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Columns/Columns.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.wrapper { | ||
border-bottom: 1px solid var(--global-border); | ||
} | ||
|
||
.heading { | ||
padding: var(--spacing-2); | ||
border-bottom: 1px solid var(--global-border); | ||
color: var(--global-foreground); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-2); | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: normal; | ||
} | ||
|
||
.itemWrapper { | ||
border-bottom: 1px solid var(--global-border); | ||
} |
21 changes: 21 additions & 0 deletions
21
.../erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Columns/Columns.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { Columns as ColumnsType } from '@liam-hq/db-structure' | ||
import type { FC } from 'react' | ||
import styles from './Columns.module.css' | ||
import { ColumnsItem } from './ColumnsItem' | ||
|
||
type Props = { | ||
columns: ColumnsType | ||
} | ||
|
||
export const Columns: FC<Props> = ({ columns }) => { | ||
return ( | ||
<div className={styles.wrapper}> | ||
<h2 className={styles.heading}>Columns</h2> | ||
{Object.entries(columns).map(([key, column]) => ( | ||
<div className={styles.itemWrapper} key={key}> | ||
<ColumnsItem column={column} /> | ||
</div> | ||
))} | ||
</div> | ||
) | ||
} |
84 changes: 84 additions & 0 deletions
84
...s/ERDRenderer/ERDContent/TableNode/TableDetail/Columns/ColumnsItem/ColumnsItem.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
.wrapper { | ||
display: grid; | ||
gap: var(--spacing-2); | ||
padding: var(--spacing-4); | ||
} | ||
|
||
.heading { | ||
color: var(--global-foreground); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-3); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
} | ||
|
||
.comment { | ||
color: var(--color-white-alpha-70); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-2); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 150%; | ||
} | ||
|
||
.dl { | ||
background-color: var(--pane-muted-background); | ||
border: solid 1px var(--global-border); | ||
border-collapse: separate; | ||
border-spacing: 0; | ||
border-radius: var(--border-radius-sm); | ||
} | ||
|
||
.dlItem { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.dlItem:not(:last-of-type) { | ||
border-bottom: solid 1px var(--global-border); | ||
} | ||
|
||
.dt { | ||
width: 5.5625rem; | ||
padding: var(--spacing-1) var(--spacing-2); | ||
border-right: solid 1px var(--global-border); | ||
color: var(--color-white-alpha-70); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-2); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 150%; | ||
} | ||
|
||
.dd { | ||
display: flex; | ||
align-items: center; | ||
padding: var(--spacing-1) var(--spacing-2); | ||
color: var(--global-foreground); | ||
font-family: var(--code-font, 'IBM Plex Mono'); | ||
font-size: var(--font-size-1); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
} | ||
|
||
.dtWithIcon { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--spacing-1); | ||
width: 100%; | ||
border-style: none; | ||
} | ||
|
||
.primaryKeyIcon { | ||
width: 0.75rem; | ||
height: 0.75rem; | ||
color: var(--primary-accent); | ||
} | ||
|
||
.diamondIcon { | ||
width: 0.75rem; | ||
height: 0.75rem; | ||
color: var(--overlay-70); | ||
} |
53 changes: 53 additions & 0 deletions
53
...mponents/ERDRenderer/ERDContent/TableNode/TableDetail/Columns/ColumnsItem/ColumnsItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import type { Column } from '@liam-hq/db-structure' | ||
import { DiamondFillIcon, DiamondIcon, KeyRound } from '@liam-hq/ui' | ||
import { clsx } from 'clsx' | ||
import type { FC } from 'react' | ||
import styles from './ColumnsItem.module.css' | ||
|
||
type Props = { | ||
column: Column | ||
} | ||
|
||
export const ColumnsItem: FC<Props> = ({ column }) => { | ||
return ( | ||
<div className={styles.wrapper}> | ||
<h3 className={styles.heading}>{column.name}</h3> | ||
{column.comment && <p className={styles.comment}>{column.comment}</p>} | ||
<dl className={styles.dl}> | ||
<div className={styles.dlItem}> | ||
<dt className={styles.dt}>Type</dt> | ||
<dd className={styles.dd}>{column.type}</dd> | ||
</div> | ||
{column.default && ( | ||
<div className={styles.dlItem}> | ||
<dt className={styles.dt}>Default</dt> | ||
<dd className={styles.dd}>{column.default}</dd> | ||
</div> | ||
)} | ||
{column.primary && ( | ||
<div className={styles.dlItem}> | ||
<dt className={clsx(styles.dt, styles.dtWithIcon)}> | ||
<KeyRound className={styles.primaryKeyIcon} /> | ||
<span>Primary Key</span> | ||
</dt> | ||
</div> | ||
)} | ||
{column.notNull ? ( | ||
<div className={styles.dlItem}> | ||
<dt className={clsx(styles.dt, styles.dtWithIcon)}> | ||
<DiamondFillIcon className={styles.diamondIcon} /> | ||
<span>Not-null</span> | ||
</dt> | ||
</div> | ||
) : ( | ||
<div className={styles.dlItem}> | ||
<dt className={clsx(styles.dt, styles.dtWithIcon)}> | ||
<DiamondIcon className={styles.diamondIcon} /> | ||
<span>Nullable</span> | ||
</dt> | ||
</div> | ||
)} | ||
</dl> | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
.../src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Columns/ColumnsItem/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './ColumnsItem' |
1 change: 1 addition & 0 deletions
1
...ges/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Columns/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Columns' |
16 changes: 16 additions & 0 deletions
16
...re/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Comment/Comment.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.wrapper { | ||
padding: var(--spacing-4); | ||
border-bottom: 1px solid var(--global-border); | ||
} | ||
|
||
.text { | ||
padding: var(--spacing-2); | ||
border-radius: var(--border-radius-base); | ||
background: var(--pane-muted-background); | ||
color: var(--color-white-alpha-70); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-3); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 150%; | ||
} |
14 changes: 14 additions & 0 deletions
14
.../erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Comment/Comment.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { FC } from 'react' | ||
import styles from './Comment.module.css' | ||
|
||
type Props = { | ||
comment: string | ||
} | ||
|
||
export const Comment: FC<Props> = ({ comment }) => { | ||
return ( | ||
<div className={styles.wrapper}> | ||
<p className={styles.text}>{comment}</p> | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
...ges/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Comment/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Comment' |
37 changes: 37 additions & 0 deletions
37
...re/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Indices/Indices.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.wrapper { | ||
display: grid; | ||
gap: var(--spacing-2); | ||
padding: var(--spacing-4); | ||
border-bottom: 1px solid var(--global-border); | ||
} | ||
|
||
.heading { | ||
display: inline-flex; | ||
align-items: center; | ||
gap: var(--spacing-1); | ||
color: var(--global-foreground); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-3); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
} | ||
|
||
.icon { | ||
width: 0.75rem; | ||
height: 0.75rem; | ||
color: var(--overlay-70); | ||
} | ||
|
||
.list { | ||
list-style: inside; | ||
} | ||
|
||
.listItem { | ||
color: var(--color-white-alpha-70); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-2); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 150%; | ||
} |
26 changes: 26 additions & 0 deletions
26
.../erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Indices/Indices.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { Indices as IndicesType } from '@liam-hq/db-structure' | ||
import { Hash } from '@liam-hq/ui' | ||
import type { FC } from 'react' | ||
import styles from './Indices.module.css' | ||
|
||
type Props = { | ||
indices: IndicesType | ||
} | ||
|
||
export const Indices: FC<Props> = ({ indices }) => { | ||
return ( | ||
<div className={styles.wrapper}> | ||
<h2 className={styles.heading}> | ||
<Hash className={styles.icon} /> | ||
<span>Indexes</span> | ||
</h2> | ||
<ul className={styles.list}> | ||
{Object.entries(indices).map(([key, index]) => ( | ||
<li key={key} className={styles.listItem}> | ||
{index.name} | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
...ges/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/Indices/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Indices' |
27 changes: 27 additions & 0 deletions
27
...nents/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.wrapper { | ||
display: grid; | ||
gap: var(--spacing-4); | ||
padding: var(--spacing-4); | ||
} | ||
|
||
.header { | ||
display: grid; | ||
grid-auto-flow: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
|
||
.heading { | ||
color: var(--global-foreground); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-3); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
} | ||
|
||
.contentWrapper { | ||
border-radius: var(--border-radius-smbase); | ||
border: 1px solid var(--pane-border); | ||
background: var(--global-background); | ||
} |
19 changes: 19 additions & 0 deletions
19
...c/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { GotoIcon, IconButton } from '@liam-hq/ui' | ||
import type { FC } from 'react' | ||
import styles from './RelatedTables.module.css' | ||
import img from './related-table-ex.png' | ||
|
||
export const RelatedTables: FC = () => { | ||
return ( | ||
<div className={styles.wrapper}> | ||
<div className={styles.header}> | ||
<h2 className={styles.heading}>Related tables</h2> | ||
<IconButton icon={<GotoIcon />} tooltipContent="Go to Related tables" /> | ||
</div> | ||
<div className={styles.contentWrapper}> | ||
{/* TODO: Replace the placeholder image with the actual component */} | ||
<img alt="related tables" src={img} width="100%" /> | ||
</div> | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
...d-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './RelatedTables' |
Binary file added
BIN
+273 KB
...ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/related-table-ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions
31
...d-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/TableDetail.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.wrapper { | ||
display: grid; | ||
grid-template-rows: auto 1fr; | ||
width: 500px; | ||
height: 100%; | ||
border-left: 1px solid var(--pane-border, #383a3b); | ||
background-color: var(--pane-background, #232526); | ||
box-shadow: 0px 4px 20px 0px var(--shadow-basic-shadow, #000); | ||
} | ||
|
||
.header { | ||
display: grid; | ||
grid-auto-flow: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: var(--spacing-2); | ||
border-bottom: 1px solid var(--global-border); | ||
} | ||
|
||
.heading { | ||
color: var(--global-foreground); | ||
font-family: var(--main-font); | ||
font-size: var(--font-size-2); | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: normal; | ||
} | ||
|
||
.body { | ||
overflow-y: scroll; | ||
} |
Oops, something went wrong.