* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { withTheme } from '@emotion/react';
import styled from '@emotion/styled';
import {
import { Hotspot, HotspotStatusOption } from '../../../types/security-hotspots';
import { Component } from '../../../types/types';
import HotspotHeaderRightSection from './HotspotHeaderRightSection';
+import HotspotSnippetHeader from './HotspotSnippetHeader';
import Status from './status/Status';
import StatusReviewButton from './status/StatusReviewButton';
hotspot: Hotspot;
component: Component;
branchLike?: BranchLike;
+ isCodeTab?: boolean;
standards?: Standards;
onUpdateHotspot: (statusUpdate?: boolean, statusOption?: HotspotStatusOption) => Promise<void>;
tabs: React.ReactNode;
}
export function HotspotHeader(props: HotspotHeaderProps) {
- const { hotspot, component, branchLike, standards, tabs, isCompressed, isScrolled } = props;
+ const { branchLike, component, hotspot, isCodeTab, isCompressed, isScrolled, standards, tabs } =
+ props;
const { message, messageFormattings, rule, key } = hotspot;
const refrechBranchStatus = useRefreshBranchStatus();
};
const content = isCompressed ? (
- <div className="sw-flex sw-justify-between">
- {tabs}
- <StatusReviewButton hotspot={hotspot} onStatusChange={handleStatusChange} />
- </div>
+ <span>
+ <div className="sw-flex sw-justify-between">
+ {tabs}
+
+ <StatusReviewButton hotspot={hotspot} onStatusChange={handleStatusChange} />
+ </div>
+
+ {isCodeTab && (
+ <HotspotSnippetHeader hotspot={hotspot} component={component} branchLike={branchLike} />
+ )}
+ </span>
) : (
<>
<div className="sw-flex sw-justify-between sw-gap-8 sw-mb-4">
</div>
</div>
{tabs}
+
+ {isCodeTab && (
+ <HotspotSnippetHeader hotspot={hotspot} component={component} branchLike={branchLike} />
+ )}
</>
);
};
render() {
- const { branchLike, component, hotspot, selectedHotspotLocation } = this.props;
+ const { hotspot, selectedHotspotLocation } = this.props;
const { highlightedSymbols, lastLine, loading, sourceLines, secondaryLocations } = this.state;
const locations = locationsByLine([hotspot]);
return (
<HotspotSnippetContainerRenderer
- branchLike={branchLike}
- component={component}
highlightedSymbols={highlightedSymbols}
hotspot={hotspot}
loading={loading}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { withTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { themeBorder, themeColor } from 'design-system';
import * as React from 'react';
import Spinner from '../../../components/ui/Spinner';
import { translate } from '../../../helpers/l10n';
-import { BranchLike } from '../../../types/branch-like';
import { Hotspot } from '../../../types/security-hotspots';
import {
- Component,
ExpandDirection,
FlowLocation,
LinearIssueLocation,
} from '../../../types/types';
import SnippetViewer from '../../issues/crossComponentSourceViewer/SnippetViewer';
import HotspotPrimaryLocationBox from './HotspotPrimaryLocationBox';
-import HotspotSnippetHeader from './HotspotSnippetHeader';
export interface HotspotSnippetContainerRendererProps {
- branchLike?: BranchLike;
highlightedSymbols: string[];
hotspot: Hotspot;
loading: boolean;
sourceLines: SourceLine[];
sourceViewerFile: SourceViewerFile;
secondaryLocations: FlowLocation[];
- component: Component;
}
const noop = () => undefined;
props: HotspotSnippetContainerRendererProps
) {
const {
- branchLike,
highlightedSymbols,
hotspot,
loading,
locations: primaryLocations,
- sourceLines,
- sourceViewerFile,
secondaryLocations,
- component,
selectedHotspotLocation,
+ sourceLines,
+ sourceViewerFile,
} = props;
const scrollableRef = React.useRef<HTMLDivElement>(null);
)}
<SourceFileWrapper className="sw-box-border sw-w-full sw-rounded-1" ref={scrollableRef}>
- <HotspotSnippetHeader hotspot={hotspot} component={component} branchLike={branchLike} />
-
<Spinner className="big-spacer" loading={loading} />
{!loading && sourceLines.length > 0 && (
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { withTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { ClipboardIconButton, HoverLink, Note, themeBorder, themeColor } from 'design-system';
const displayProjectName = component.qualifier === ComponentQualifier.Application;
return (
- <StyledHeader className="sw-flex sw-justify-between sw-gap-2 sw-px-4 sw-py-3 sw-box-border">
- <Note className="sw-flex sw-items-center sw-gap-2 sw-flex-wrap sw-flex-1 sw-my-1/2">
+ <StyledHeader
+ className={`sw-box-border sw-flex sw-gap-2 sw-justify-between -sw-mb-4 sw-mt-6 sw-px-4
+ sw-py-3`}
+ >
+ <Note className="sw-flex sw-flex-1 sw-flex-wrap sw-gap-2 sw-items-center sw-my-1/2">
{displayProjectName && (
<span>
<HoverLink to={getBranchLikeUrl(project.key, branchLike)}>
const StyledHeader = withTheme(styled.div`
background-color: ${themeColor('codeLine')};
- border-bottom: ${themeBorder('default', 'codeLineBorder')};
+ border: ${themeBorder('default', 'codeLineBorder')};
`);
export default withCurrentUserContext(HotspotSnippetHeader);
branchLike={branchLike}
component={component}
hotspot={hotspot}
+ isCodeTab={currentTab.value === TabKeys.Code}
isCompressed={isCompressed}
isScrolled={isScrolled}
onUpdateHotspot={props.onUpdateHotspot}