Skip to content

🪟 🎨 Streams table design pass #18908

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

Merged
merged 27 commits into from
Nov 14, 2022
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
a7f09ef
typography
teallarson Oct 27, 2022
992e342
wip
teallarson Oct 27, 2022
d2affee
continued progress
teallarson Oct 28, 2022
a8e933d
merge cleanup
teallarson Nov 3, 2022
2b180d1
table item alignment
teallarson Nov 3, 2022
4c6d248
row styling
teallarson Nov 3, 2022
004dbf9
remove extra item
teallarson Nov 4, 2022
c655e4a
continued styling
teallarson Nov 4, 2022
c3f385e
alignment works with scrollbar
teallarson Nov 4, 2022
bfd682b
headings align with or without scrollbars
teallarson Nov 4, 2022
a6c8ffb
stream connection header alignment
teallarson Nov 4, 2022
4439cf0
cleanup
teallarson Nov 4, 2022
43a24d0
pill-select justify
teallarson Nov 4, 2022
b35b1e8
cleanup
teallarson Nov 4, 2022
542d466
fix ternary logic for disabled streams rows
teallarson Nov 5, 2022
9b2ca97
streams table design tweaks
teallarson Nov 7, 2022
3e86c5f
make table rows flush with card edge
teallarson Nov 8, 2022
9d13609
review cleanup, fix scroll overflow for firefox
teallarson Nov 9, 2022
81f46fd
use gap not padding
teallarson Nov 9, 2022
81a4b07
add scrollbar-gutter to rows too
teallarson Nov 9, 2022
2094b52
use ellipsis for cell text, not wrap
teallarson Nov 9, 2022
e299741
fix alignment of syncCatalogField
teallarson Nov 10, 2022
07b68e4
fix text ellipses and syncmode cell width
teallarson Nov 10, 2022
d8f90bc
use a div to make this col static 200px
teallarson Nov 10, 2022
458914a
remove debug border
teallarson Nov 10, 2022
35d1808
scss variables cleanup
teallarson Nov 10, 2022
95a0186
Merge branch 'master' into teal/streams-table-design-pass
teallarson Nov 14, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ export const Cell = styled.div<{
light?: boolean;
lighter?: boolean;
ellipsis?: boolean;
flush?: boolean;
}>`
flex: ${({ flex }) => flex || 1} 0 0;
padding-right: 10px;
padding-right: ${({ flush }) => (flush ? 0 : 10)}px;
min-width: 0;

word-break: break-word;
color: ${({ theme, light, lighter }) => (light ? theme.greyColor40 : lighter ? theme.greyColor60 : "inherit")};
font-weight: ${({ light, lighter }) => (light || lighter ? "normal" : "inherit")};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
@use "scss/_variables";

.searchInput {
padding: 10px 8px 9px;
}

.searchContent {
position: relative;
width: 100%;
padding: 0 variables.$spacing-xl;

&::before {
content: attr(data-content);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@use "scss/_colors";
@use "scss/_variables";

.cellText {
color: colors.$grey;
}

.headerContainer {
margin: variables.$spacing-md variables.$spacing-md variables.$spacing-sm variables.$spacing-sm;
gap: variables.$spacing-sm;
overflow: hidden;
scrollbar-gutter: stable;
min-height: 33px;
}

.checkboxCell {
margin-right: variables.$spacing-sm;
max-width: 43px;
font-size: 10px;
line-height: 13px;
display: flex;
flex-direction: row;
justify-content: flex-end;
padding-left: calc(#{variables.$spacing-xl} + #{variables.$spacing-sm});
}

.arrowPlaceholder {
width: 20px;
}
Original file line number Diff line number Diff line change
@@ -1,70 +1,77 @@
import React from "react";
import { FormattedMessage } from "react-intl";

import { Cell, Header } from "components/SimpleTableComponents";
import { CheckBox } from "components/ui/CheckBox";
import { Text } from "components/ui/Text";
import { InfoTooltip, TooltipLearnMoreLink } from "components/ui/Tooltip";

import { useBulkEditService } from "hooks/services/BulkEdit/BulkEditService";
import { useConnectionFormService } from "hooks/services/ConnectionForm/ConnectionFormService";
import { links } from "utils/links";

import styles from "./CatalogTreeTableHeader.module.scss";

const TextCell: React.FC<React.PropsWithChildren<{ flex?: number }>> = ({ flex, children }) => {
return (
<Cell flex={flex}>
<Text size="sm" className={styles.cellText}>
{children}
</Text>
</Cell>
);
};

export const CatalogTreeTableHeader: React.FC = () => {
const { mode } = useConnectionFormService();
const { onCheckAll, selectedBatchNodeIds, allChecked } = useBulkEditService();

return (
<Header>
<Cell>
<Header className={styles.headerContainer}>
<div className={styles.checkboxCell}>
{mode !== "readonly" && (
<CheckBox
onChange={onCheckAll}
indeterminate={selectedBatchNodeIds.length > 0 && !allChecked}
checked={allChecked}
/>
)}
</Cell>
<Cell>
</div>
<TextCell flex={0.5}>
<FormattedMessage id="sources.sync" />
</Cell>
<Cell>
</TextCell>
{/* <TextCell>
<FormattedMessage id="form.fields" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw the field count looks like it will be in the design in a future round. Leaving this here.

</Cell>
<Cell>
</TextCell> */}
<TextCell flex={1}>
<FormattedMessage id="form.namespace" />
</Cell>
<Cell>
</TextCell>
<TextCell flex={1}>
<FormattedMessage id="form.streamName" />
</Cell>
<Cell>
</TextCell>
<TextCell flex={2}>
<FormattedMessage id="form.syncMode" />
<InfoTooltip>
<FormattedMessage id="connectionForm.syncType.info" />
<TooltipLearnMoreLink url={links.syncModeLink} />
</InfoTooltip>
</Cell>
<Cell>
</TextCell>
<TextCell flex={1}>
<FormattedMessage id="form.cursorField" />
<InfoTooltip>
<FormattedMessage id="connectionForm.cursor.info" />
</InfoTooltip>
</Cell>
<Cell>
</TextCell>
<TextCell flex={1}>
<FormattedMessage id="form.primaryKey" />
</Cell>
<Cell />
<Cell>
</TextCell>
<div className={styles.arrowPlaceholder} />
<TextCell flex={1}>
<FormattedMessage id="form.namespace" />
</Cell>
<Cell>
</TextCell>
<TextCell flex={1}>
<FormattedMessage id="form.streamName" />
</Cell>
<Cell>
<FormattedMessage id="form.syncMode" />
<InfoTooltip>
<FormattedMessage id="connectionForm.syncType.info" />
<TooltipLearnMoreLink url={links.syncModeLink} />
</InfoTooltip>
</Cell>
</TextCell>
</Header>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
.streamHeaderContent {
background: colors.$white;
border-bottom: 1px solid colors.$grey-50;
padding-right: variables.$spacing-md;
padding-left: variables.$spacing-sm;
margin-bottom: 1px;
gap: variables.$spacing-sm;
min-height: 50px;
height: 50px;
align-items: center;
overflow-y: auto;
scrollbar-gutter: stable;

&:hover {
background: colors.$grey-30;
Expand All @@ -38,11 +47,35 @@
&.selected {
background-color: colors.$blue-transparent;
}

&.disabled {
background-color: colors.$grey-50;
}
}

.streamRowCheckboxCell {
margin-right: variables.$spacing-sm;
max-width: 43px;
text-align: center;
font-size: 10px;
line-height: 13px;
display: flex;
flex-direction: row;
justify-content: flex-end;
padding-left: 27px;
padding-left: calc(#{variables.$spacing-xl} + #{variables.$spacing-sm});
}

.arrowCell {
width: 20px;
}

.cellText {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.syncModeCell {
width: variables.$width-wide-menu;
min-width: variables.$width-wide-menu;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import { FormattedMessage } from "react-intl";
import { Cell, Row } from "components/SimpleTableComponents";
import { CheckBox } from "components/ui/CheckBox";
import { Switch } from "components/ui/Switch";
import { Text } from "components/ui/Text";

import { useBulkEditSelect } from "hooks/services/BulkEdit/BulkEditService";

import { StreamHeaderProps } from "../StreamHeader";
import { HeaderCell } from "../styles";
import styles from "./CatalogTreeTableRow.module.scss";
import { StreamPathSelect } from "./StreamPathSelect";
import { SyncModeSelect } from "./SyncModeSelect";

export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({
stream,
destName,
Expand All @@ -35,7 +34,7 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({
hasError,
disabled,
}) => {
const { primaryKey, syncMode, cursorField, destinationSyncMode } = stream.config ?? {};
const { primaryKey, cursorField, syncMode, destinationSyncMode } = stream.config ?? {};
const isStreamEnabled = stream.config?.selected;

const { defaultCursorField } = stream.stream ?? {};
Expand Down Expand Up @@ -63,14 +62,13 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({
[styles.disabledChange]: changedSelected && !isStreamEnabled,
[styles.selected]: isSelected,
[styles.error]: hasError,
[styles.disabled]: !changedSelected && !isStreamEnabled,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this makes the syncmode dropdown blend into the background. I do see this in the designs as well, and users can't save changes to a disabled stream anyways currently... so maybe that's ok? Since they can't change things, I wonder if we want to disable the dropdowns in these rows though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that! I'm not a big fan, and maybe we can work around it by disabling it. Additionally, I feel the color contrast may be too low and we may need to revisit this with design.

});

const checkboxCellCustomStyle = classnames(styles.checkboxCell, styles.streamRowCheckboxCell);

return (
<Row onClick={onRowClick} className={streamHeaderContentStyle}>
{!disabled && (
<div className={checkboxCellCustomStyle}>
<div className={styles.streamRowCheckboxCell}>
{changedSelected && (
<div>
{isStreamEnabled ? (
Expand All @@ -83,24 +81,33 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({
<CheckBox checked={isSelected} onChange={selectForBulkEdit} />
</div>
)}
<Cell>
<Cell flex={0.5} flush>
<Switch small checked={stream.config?.selected} onChange={onSelectStream} disabled={disabled} />
</Cell>
<Cell>{fieldCount}</Cell>
<HeaderCell ellipsis title={stream.stream?.namespace || ""}>
{stream.stream?.namespace || <FormattedMessage id="form.noNamespace" />}
</HeaderCell>
<Cell>{stream.stream?.name}</Cell>
<Cell>
{/* <Cell>{fieldCount}</Cell> */}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

field counts look like they're coming back in a future iteration, leaving this here for now... there may need to be adjustments to the flex properties in the cells and header(s) as a result.

<Cell flex={1} title={stream.stream?.namespace || ""}>
<Text size="md" className={styles.cellText}>
{stream.stream?.namespace || <FormattedMessage id="form.noNamespace" />}
</Text>
</Cell>
<Cell flex={1} title={stream.stream?.name || ""}>
<Text size="md" className={styles.cellText}>
{stream.stream?.name}
</Text>
</Cell>
<div className={styles.syncModeCell}>
{disabled ? (
<HeaderCell ellipsis title={syncSchema.syncMode}>
{syncSchema.syncMode}
</HeaderCell>
<Cell title={syncSchema.syncMode}>
<Text size="md" className={styles.cellText}>
{syncSchema.syncMode}
</Text>
</Cell>
) : (
// todo: SyncModeSelect should probably have a Tooltip, append/dedupe ends up ellipsing
<SyncModeSelect options={availableSyncModes} onChange={onSelectSyncMode} value={syncSchema} />
)}
</Cell>
<HeaderCell>
</div>
<Cell flex={1}>
{cursorType && (
<StreamPathSelect
pathType={cursorType}
Expand All @@ -109,8 +116,8 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({
onPathChange={onCursorChange}
/>
)}
</HeaderCell>
<HeaderCell ellipsis>
</Cell>
<Cell flex={1}>
{pkType && (
<StreamPathSelect
pathType={pkType}
Expand All @@ -120,25 +127,17 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({
onPathChange={onPrimaryKeyChange}
/>
)}
</HeaderCell>
<Cell>
<FontAwesomeIcon icon={faArrowRight} />
</Cell>
<HeaderCell ellipsis title={destNamespace}>
{destNamespace}
</HeaderCell>
<HeaderCell ellipsis title={destName}>
{destName}
</HeaderCell>
<Cell>
{disabled ? (
<HeaderCell ellipsis title={syncSchema.destinationSyncMode}>
{syncSchema.destinationSyncMode}
</HeaderCell>
) : (
// TODO: Replace with Dropdown/Popout
syncSchema.destinationSyncMode
)}
<FontAwesomeIcon icon={faArrowRight} className={styles.arrowCell} />
<Cell flex={1} title={destNamespace}>
<Text size="md" className={styles.cellText}>
{destNamespace}
</Text>
</Cell>
<Cell flex={1} title={destName}>
<Text size="md" className={styles.cellText}>
{destName}
</Text>
</Cell>
</Row>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,37 @@ $icon-size: 15px;
.container {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: variables.$spacing-lg calc(variables.$spacing-lg * 2);
padding: variables.$spacing-xl calc(#{variables.$spacing-lg} * 2) 0;
height: 43px;
align-items: center;
overflow: hidden;
scrollbar-gutter: stable;
}

.connector {
display: flex;
flex-direction: row;
flex: none;
align-self: stretch;
align-items: center;
gap: variables.$spacing-sm;
}

.source {
flex: 7.3 0 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The .3 is an unfortunate awkward number. This value is the sum of the flex values + that .3 "buffer" for the gaps.

min-width: 0;
}

.destination {
flex: 2 0 0;
min-width: 0;
}

.icon {
height: $icon-size;
width: $icon-size;
height: $icon-size;
}

.arrowContainer {
width: 20px;
}
Loading