Skip to content

Commit

Permalink
chore: Empty state refactor (#31860)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Jan 22, 2025
1 parent 7482b20 commit fcd1661
Show file tree
Hide file tree
Showing 48 changed files with 528 additions and 656 deletions.
118 changes: 24 additions & 94 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useEffect, useMemo, useState } from 'react';
import { shallowEqual, useSelector } from 'react-redux';
import { useInView } from 'react-intersection-observer';
import { omit } from 'lodash';
import { EmptyStateMedium } from 'src/components/EmptyState';
import { EmptyState } from 'src/components/EmptyState';
import {
t,
styled,
Expand Down Expand Up @@ -143,8 +143,9 @@ const QueryHistory = ({
</>
) : (
<StyledEmptyStateWrapper>
<EmptyStateMedium
<EmptyState
title={t('Run a query to display query history')}
size="medium"
image="document.svg"
/>
</StyledEmptyStateWrapper>
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/SqlLab/components/SouthPane/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { FC } from 'react';
import { shallowEqual, useSelector } from 'react-redux';
import Alert from 'src/components/Alert';
import { EmptyStateMedium } from 'src/components/EmptyState';
import { EmptyState } from 'src/components/EmptyState';
import { FeatureFlag, styled, t, isFeatureEnabled } from '@superset-ui/core';

import { SqlLabRootState } from 'src/SqlLab/types';
Expand Down Expand Up @@ -67,7 +67,7 @@ const Results: FC<Props> = ({
) {
return (
<StyledEmptyStateWrapper>
<EmptyStateMedium
<EmptyState
title={t('Run a query to display results')}
image="document.svg"
/>
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/src/SqlLab/components/SqlEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ import {
LocalStorageKeys,
setItem,
} from 'src/utils/localStorageHelpers';
import { EmptyStateBig } from 'src/components/EmptyState';
import { EmptyState } from 'src/components/EmptyState';
import Alert from 'src/components/Alert';
import getBootstrapData from 'src/utils/getBootstrapData';
import useLogAction from 'src/logger/useLogAction';
Expand Down Expand Up @@ -968,8 +968,9 @@ const SqlEditor: FC<Props> = ({
<Skeleton active />
</div>
) : showEmptyState && !hasSqlStatement ? (
<EmptyStateBig
<EmptyState
image="vector.svg"
size="large"
title={t('Select a database to write a query')}
description={t(
'Choose one of the available databases from the panel on the left.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { TableSelectorMultiple } from 'src/components/TableSelector';
import { IconTooltip } from 'src/components/IconTooltip';
import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor';
import type { DatabaseObject } from 'src/components/DatabaseSelector';
import { emptyStateComponent } from 'src/components/EmptyState';
import { EmptyState } from 'src/components/EmptyState';
import {
getItem,
LocalStorageKeys,
Expand Down Expand Up @@ -113,7 +113,7 @@ const SqlEditorLeftBar = ({
'schema',
]);

const [emptyResultsWithSearch, setEmptyResultsWithSearch] = useState(false);
const [_emptyResultsWithSearch, setEmptyResultsWithSearch] = useState(false);
const [userSelectedDb, setUserSelected] = useState<DatabaseObject | null>(
null,
);
Expand Down Expand Up @@ -249,7 +249,7 @@ const SqlEditorLeftBar = ({
<LeftBarStyles data-test="sql-editor-left-bar">
<TableSelectorMultiple
onEmptyResults={onEmptyResults}
emptyState={emptyStateComponent(emptyResultsWithSearch)}
emptyState={<EmptyState />}
database={userSelectedDb}
getDbList={handleDbList}
handleError={handleError}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Logger } from 'src/logger/LogUtils';
import { Tooltip } from 'src/components/Tooltip';
import { detectOS } from 'src/utils/common';
import * as Actions from 'src/SqlLab/actions/sqlLab';
import { EmptyStateBig } from 'src/components/EmptyState';
import { EmptyState } from 'src/components/EmptyState';
import getBootstrapData from 'src/utils/getBootstrapData';
import { locationContext } from 'src/pages/SqlLab/LocationContext';
import SqlEditor from '../SqlEditor';
Expand Down Expand Up @@ -259,8 +259,9 @@ class TabbedSqlEditors extends PureComponent<TabbedSqlEditorsProps> {
tab={emptyTab}
closable={false}
>
<EmptyStateBig
<EmptyState
image="empty_sql_chart.svg"
size="large"
description={t('Add a new tab to create SQL Query')}
/>
</EditableTabs.TabPane>
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/assets/images/chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions superset-frontend/src/assets/images/document.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fcd1661

Please sign in to comment.