From b20142055a32bc0209ca93e4a722772183a244f6 Mon Sep 17 00:00:00 2001 From: Charis Kyriakou Date: Thu, 16 Jun 2022 09:53:34 +0100 Subject: [PATCH] Remove use of Primer's box component --- .../src/remote-queries/view/CodePaths.tsx | 34 +++++----- .../remote-queries/view/FileCodeSnippet.tsx | 67 +++++++++---------- .../remote-queries/view/RawResultsTable.tsx | 33 ++++----- .../src/remote-queries/view/RemoteQueries.tsx | 14 ++-- 4 files changed, 75 insertions(+), 73 deletions(-) diff --git a/extensions/ql-vscode/src/remote-queries/view/CodePaths.tsx b/extensions/ql-vscode/src/remote-queries/view/CodePaths.tsx index 8996c1f0e02..37400216bf3 100644 --- a/extensions/ql-vscode/src/remote-queries/view/CodePaths.tsx +++ b/extensions/ql-vscode/src/remote-queries/view/CodePaths.tsx @@ -1,5 +1,5 @@ import { TriangleDownIcon, XCircleIcon } from '@primer/octicons-react'; -import { ActionList, ActionMenu, Box, Button, Label, Overlay } from '@primer/react'; +import { ActionList, ActionMenu, Button, Label, Overlay } from '@primer/react'; import { VSCodeLink } from '@vscode/webview-ui-toolkit/react'; import * as React from 'react'; import { useRef, useState } from 'react'; @@ -54,21 +54,21 @@ const CodePath = ({
{index !== 0 && } - - +
+
Step {index + 1} - +
{index === 0 && - +
- +
} {index === codeFlow.threadFlows.length - 1 && - +
- +
} -
+
setIsOpen(false); return ( - +
setIsOpen(true)} ref={linkRef} @@ -154,14 +154,14 @@ const CodePaths = ({ {ruleDescription} - - +
+
{codeFlows.length} paths available: {selectedCodeFlow.threadFlows.length} steps in - - +
+
- - +
+
)} -
+
); }; diff --git a/extensions/ql-vscode/src/remote-queries/view/FileCodeSnippet.tsx b/extensions/ql-vscode/src/remote-queries/view/FileCodeSnippet.tsx index 276a5b9a0e5..23978acd3c7 100644 --- a/extensions/ql-vscode/src/remote-queries/view/FileCodeSnippet.tsx +++ b/extensions/ql-vscode/src/remote-queries/view/FileCodeSnippet.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import styled from 'styled-components'; import { CodeSnippet, FileLink, HighlightedRegion, AnalysisMessage, ResultSeverity } from '../shared/analysis-result'; -import { Box } from '@primer/react'; import VerticalSpace from './VerticalSpace'; import { createRemoteFileRef } from '../../pure/location-link-utils'; import { parseHighlightedLine, shouldHighlightLine } from '../../pure/sarif-utils'; @@ -68,13 +67,13 @@ const Message = ({ message, currentLineNumber, highlightedRegion, - borderColor, + borderLeftColor, children }: { message: AnalysisMessage, currentLineNumber: number, highlightedRegion?: HighlightedRegion, - borderColor: string, + borderLeftColor: string, children: React.ReactNode }) => { if (!highlightedRegion || highlightedRegion.endLine !== currentLineNumber) { @@ -82,14 +81,15 @@ const Message = ({ } return - +
{message.tokens.map((token, index) => { switch (token.t) { @@ -115,8 +115,7 @@ const Message = ({ } - - +
; }; @@ -188,36 +187,36 @@ const FileCodeSnippet = ({ {code.map((line, index) => (
- - +
+
{startingLine + index} - - +
+
- - +
+
{message && severity && + borderLeftColor={getSeverityColor(severity)}> {messageChildren} }
diff --git a/extensions/ql-vscode/src/remote-queries/view/RawResultsTable.tsx b/extensions/ql-vscode/src/remote-queries/view/RawResultsTable.tsx index 5323985107b..4a0bf26a6cb 100644 --- a/extensions/ql-vscode/src/remote-queries/view/RawResultsTable.tsx +++ b/extensions/ql-vscode/src/remote-queries/view/RawResultsTable.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { Box } from '@primer/react'; import { VSCodeLink } from '@vscode/webview-ui-toolkit/react'; import { CellValue, RawResultSet, ResultSetSchema } from '../../pure/bqrs-cli-types'; import { tryGetRemoteLocation } from '../../pure/bqrs-utils'; @@ -7,6 +6,8 @@ import { useState } from 'react'; import TextButton from './TextButton'; import { convertNonPrintableChars } from '../../text-utils'; +const borderColor = 'var(--vscode-editor-snippetFinalTabstopHighlightBorder)'; + const numOfResultsInContractedMode = 5; const Row = ({ @@ -20,15 +21,16 @@ const Row = ({ }) => ( <> {row.map((cell, cellIndex) => ( - +
- +
))} ); @@ -81,15 +83,16 @@ const RawResultsTable = ({ return ( <> - +
{results.rows.slice(0, numOfResultsToShow).map((row, rowIndex) => ( ))} - +
{ showButton && setTableExpanded(!tableExpanded)}> diff --git a/extensions/ql-vscode/src/remote-queries/view/RemoteQueries.tsx b/extensions/ql-vscode/src/remote-queries/view/RemoteQueries.tsx index cecc8ef657a..fd559858277 100644 --- a/extensions/ql-vscode/src/remote-queries/view/RemoteQueries.tsx +++ b/extensions/ql-vscode/src/remote-queries/view/RemoteQueries.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { useEffect, useState } from 'react'; import * as Rdom from 'react-dom'; -import { Box, Flash, ThemeProvider } from '@primer/react'; +import { Flash, ThemeProvider } from '@primer/react'; import { ToRemoteQueriesMessage } from '../../pure/interface-types'; import { AnalysisSummary, RemoteQueryResult } from '../shared/remote-query-result'; import { MAX_RAW_RESULTS } from '../shared/result-limits'; @@ -350,16 +350,16 @@ const AnalysesResults = ({ return ( <> - - +
+
- - +
+
Export all - - +
+