Skip to content

Commit

Permalink
Fix flacky header
Browse files Browse the repository at this point in the history
  • Loading branch information
geido committed Dec 8, 2021
1 parent 8c25f2f commit 65be822
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
19 changes: 18 additions & 1 deletion superset-frontend/src/components/EditableTitle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
*/
import React, { useEffect, useState, useRef } from 'react';
import cx from 'classnames';
import { t } from '@superset-ui/core';
import { styled, t } from '@superset-ui/core';
import { Tooltip } from 'src/components/Tooltip';
import CertifiedIcon from '../CertifiedIcon';

export interface EditableTitleProps {
canEdit?: boolean;
Expand All @@ -34,8 +35,14 @@ export interface EditableTitleProps {
title?: string;
defaultTitle?: string;
placeholder?: string;
certifiedBy?: string;
certificationDetails?: string;
}

const StyledCertifiedIcon = styled(CertifiedIcon)`
vertical-align: middle;
`;

export default function EditableTitle({
canEdit = false,
editing = false,
Expand All @@ -48,6 +55,8 @@ export default function EditableTitle({
title = '',
defaultTitle = '',
placeholder = '',
certifiedBy,
certificationDetails,
}: EditableTitleProps) {
const [isEditing, setIsEditing] = useState(editing);
const [currentTitle, setCurrentTitle] = useState(title);
Expand Down Expand Up @@ -222,6 +231,14 @@ export default function EditableTitle({
)}
style={style}
>
{certifiedBy && (
<>
<StyledCertifiedIcon
certifiedBy={certifiedBy}
details={certificationDetails}
/>{' '}
</>
)}
{titleComponent}
</span>
);
Expand Down
11 changes: 2 additions & 9 deletions superset-frontend/src/dashboard/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import { styled, t } from '@superset-ui/core';
import ButtonGroup from 'src/components/ButtonGroup';
import CertifiedIcon from 'src/components/CertifiedIcon';

import {
LOG_ACTIONS_PERIODIC_RENDER_DASHBOARD,
Expand Down Expand Up @@ -499,19 +498,13 @@ class Header extends React.PureComponent {
data-test-id={`${dashboardInfo.id}`}
>
<div className="dashboard-component-header header-large">
{dashboardInfo.certified_by && (
<>
<CertifiedIcon
certifiedBy={dashboardInfo.certified_by}
details={dashboardInfo.certification_details}
/>{' '}
</>
)}
<EditableTitle
title={dashboardTitle}
canEdit={userCanEdit && editMode}
onSaveTitle={this.handleChangeText}
showTooltip={false}
certifiedBy={dashboardInfo.certified_by}
certificationDetails={dashboardInfo.certification_details}
/>
<PublishedStatus
dashboardId={dashboardInfo.id}
Expand Down

0 comments on commit 65be822

Please sign in to comment.