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

feat: Add top-tier icons #1483

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 querybook/server/lib/elasticsearch/search_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def construct_tables_query(
}

if concise:
query["_source"] = ["id", "schema", "name"]
query["_source"] = ["id", "schema", "name", "golden"]

query.update(order_by_fields(sort_key, sort_order))
query.update(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ const TableRow: React.FC<{
onClick={handleLinkClick}
isRow
title={table.displayName}
icon={table.golden ? 'Crown' : null}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Popover } from 'ui/Popover/Popover';
import { SearchBar } from 'ui/SearchBar/SearchBar';
import { Title } from 'ui/Title/Title';
import { ToggleSwitch } from 'ui/ToggleSwitch/ToggleSwitch';
import { TopTierCrown } from 'ui/TopTierCrown/TopTierCrown';

import './DataTableNavigatorSearch.scss';

Expand Down Expand Up @@ -95,15 +96,18 @@ export const DataTableNavigatorSearch: React.FC<{
title="Top Tier"
className="toggle-padding"
>
<ToggleSwitch
checked={searchFilters.golden}
onChange={(checked) =>
updateSearchFilter(
'golden',
checked ? true : null
)
}
/>
<div className="flex-row">
<ToggleSwitch
checked={searchFilters.golden}
onChange={(checked) =>
updateSearchFilter(
'golden',
checked ? true : null
)
}
/>
<TopTierCrown className="ml4" />
</div>
</SearchFilterRow>
<SearchFilterRow title="Schema">
<SearchBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { CommentButton } from 'ui/Comment/CommentButton';
import { AccentText } from 'ui/StyledText/StyledText';
import { Tag } from 'ui/Tag/Tag';
import { ToggleButton } from 'ui/ToggleButton/ToggleButton';
import { TopTierCrown } from 'ui/TopTierCrown/TopTierCrown';

import './DataTableHeader.scss';

Expand Down Expand Up @@ -89,10 +90,15 @@ export const DataTableHeader: React.FunctionComponent<IDataTableHeader> = ({
onClick={updateDataTableGolden}
title={table.golden ? 'Top Tier' : 'Make Top Tier'}
size="small"
icon="Crown"
/>
);
} else if (table.golden) {
featuredBadge = <Tag>Top Tier</Tag>;
featuredBadge = (
<Tag>
Top Tier <TopTierCrown className="ml4" />
</Tag>
);
}

const iconDOM = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { getHumanReadableByteSize } from 'lib/utils/number';
import { IconButton } from 'ui/Button/IconButton';
import { AllLucideIconNames } from 'ui/Icon/LucideIcons';
import { Loader } from 'ui/Loader/Loader';
import { TopTierCrown } from 'ui/TopTierCrown/TopTierCrown';

import { ColumnIcon } from './ColumnIcon';
import { PanelSection, SubPanelSection } from './PanelSection';
Expand Down Expand Up @@ -38,7 +39,14 @@ export const TablePanelView: React.FunctionComponent<ITablePanelViewProps> = ({
const overviewSection = (
<PanelSection title="table">
<SubPanelSection title="schema">{schema.name}</SubPanelSection>
<SubPanelSection title="name">{table.name}</SubPanelSection>
<SubPanelSection title="name">
<span className="flex-row">
{table.name}
{table.golden && (
<TopTierCrown showTooltip={true} className="ml4" />
)}
</span>
</SubPanelSection>
<SubPanelSection title="description" hideIfNoContent>
{table.description
? (table.description as ContentState).getPlainText()
Expand Down
6 changes: 0 additions & 6 deletions querybook/webapp/components/Search/SearchOverview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@
display: flex;
align-items: center;
}

.crown svg {
color: var(--color-accent);
height: 16px;
stroke-width: 2.5px;
}
}

.Container-content {
Expand Down
3 changes: 2 additions & 1 deletion querybook/webapp/components/Search/SearchOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { SimpleReactSelect } from 'ui/SimpleReactSelect/SimpleReactSelect';
import { AccentText, EmptyText } from 'ui/StyledText/StyledText';
import { Tabs } from 'ui/Tabs/Tabs';
import { ToggleSwitch } from 'ui/ToggleSwitch/ToggleSwitch';
import { TopTierCrown } from 'ui/TopTierCrown/TopTierCrown';

import { EntitySelect } from './EntitySelect';
import { SearchDatePicker } from './SearchDatePicker';
Expand Down Expand Up @@ -752,7 +753,7 @@ export const SearchOverview: React.FC<ISearchOverviewProps> = ({
<div className="result-item-golden horizontal-space-between">
<span>
<span>top tier only</span>
<Icon className="crown ml4" name="Crown" />
<TopTierCrown />
</span>
<Checkbox
value={!!searchFilters.golden}
Expand Down
6 changes: 2 additions & 4 deletions querybook/webapp/components/Search/SearchResultItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import { Button } from 'ui/Button/Button';
import { IconButton } from 'ui/Button/IconButton';
import { ThemedCodeHighlight } from 'ui/CodeHighlight/ThemedCodeHighlight';
import { UrlContextMenu } from 'ui/ContextMenu/UrlContextMenu';
import { Icon } from 'ui/Icon/Icon';
import { Level } from 'ui/Level/Level';
import { LoadingRow } from 'ui/Loading/Loading';
import { AccentText, StyledText, UntitledText } from 'ui/StyledText/StyledText';
import { Tag } from 'ui/Tag/Tag';
import { TopTierCrown } from 'ui/TopTierCrown/TopTierCrown';

import { SearchResultItemBoardItemAddButton } from './SearchResultItemBoardItemAddButton';

Expand Down Expand Up @@ -379,9 +379,7 @@ export const DataTableItem: React.FunctionComponent<IDataTableItemProps> = ({
);

const goldenIcon = golden ? (
<div className="result-item-golden ml4">
<Icon className="crown" name="Crown" />
</div>
<TopTierCrown showTooltip={true} tooltipPos="right" />
) : null;

const highlightedDescription = (preview.highlight || {}).description;
Expand Down
1 change: 1 addition & 0 deletions querybook/webapp/redux/dataTableSearch/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ITableSearchResult {
id: number;
schema: string;
name: string;
golden?: boolean;
}

export interface ITableSearchFilters {
Expand Down
7 changes: 7 additions & 0 deletions querybook/webapp/ui/TopTierCrown/TopTierCrown.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.TopTierCrown {
svg {
color: var(--color-accent);
height: 16px;
stroke-width: 2.5px;
}
}
24 changes: 24 additions & 0 deletions querybook/webapp/ui/TopTierCrown/TopTierCrown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import clsx from 'clsx';
import React from 'react';

import { Icon } from 'ui/Icon/Icon';

import './TopTierCrown.scss';

export const TopTierCrown: React.FunctionComponent<{
className?: string;
showTooltip?: boolean;
tooltipPos?: string;
}> = ({ className, showTooltip = false, tooltipPos = 'down' }) => (
<span
className={clsx('TopTierCrown', 'flex-row', className)}
{...(showTooltip
? {
'data-balloon': 'Top Tier',
'data-balloon-pos': tooltipPos,
}
: {})}
>
<Icon name="Crown" />
</span>
);
Loading