File tree Expand file tree Collapse file tree 2 files changed +63
-6
lines changed
extensions/ql-vscode/src/view Expand file tree Collapse file tree 2 files changed +63
-6
lines changed Original file line number Diff line number Diff line change 1+ import * as React from "react" ;
2+ import styled from "styled-components" ;
3+
4+ type Props = {
5+ percent : number ;
6+ label ?: string ;
7+ } ;
8+
9+ const Circle = styled . div `
10+ width: 16px;
11+ height: 16px;
12+ ` ;
13+
14+ const Background = styled . circle `
15+ stroke: var(--vscode-editorWidget-background);
16+ fill: none;
17+ stroke-width: 2px;
18+ ` ;
19+
20+ const Determinate = styled . circle `
21+ stroke: var(--vscode-progressBar-background);
22+ fill: none;
23+ stroke-width: 2px;
24+ stroke-linecap: round;
25+ transform-origin: 50% 50%;
26+ transform: rotate(-90deg);
27+ transition: all 0.2s ease-in-out 0s;
28+ ` ;
29+
30+ const progressSegments = 44 ;
31+
32+ // This is a re-implementation of the FAST component progress ring
33+ // See https://github.com/microsoft/fast/blob/21c210f2164c5cf285cade1a328460c67e4b97e6/packages/web-components/fast-foundation/src/progress-ring/progress-ring.template.ts
34+ // Once the determinate progress ring is available in the VSCode webview UI toolkit, we should use that instead
35+
36+ export const DeterminateProgressRing = ( {
37+ percent,
38+ label = "Loading..." ,
39+ } : Props ) => (
40+ < Circle
41+ role = "progressbar"
42+ aria-valuemin = { 0 }
43+ aria-valuemax = { 100 }
44+ aria-valuenow = { percent }
45+ >
46+ < svg className = "progress" viewBox = "0 0 16 16" >
47+ < Background cx = "8px" cy = "8px" r = "7px" />
48+ < Determinate
49+ style = { {
50+ strokeDasharray : `${
51+ ( progressSegments * percent ) / 100
52+ } px ${ progressSegments } px`,
53+ } }
54+ cx = "8px"
55+ cy = "8px"
56+ r = "7px"
57+ > </ Determinate >
58+ </ svg >
59+ </ Circle >
60+ ) ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import { AnalyzedRepoItemContent } from "./AnalyzedRepoItemContent";
2626import StarCount from "../common/StarCount" ;
2727import { LastUpdated } from "../common/LastUpdated" ;
2828import { useTelemetryOnChange } from "../common/telemetry" ;
29+ import { DeterminateProgressRing } from "../common/DeterminateProgressRing" ;
2930
3031// This will ensure that these icons have a className which we can use in the TitleContainer
3132const ExpandCollapseCodicon = styled ( Codicon ) `` ;
@@ -284,12 +285,8 @@ export const RepoRow = ({
284285 </ span >
285286 { downloadState ?. downloadStatus ===
286287 VariantAnalysisScannedRepositoryDownloadStatus . InProgress && (
287- < LoadingIcon
288- label = {
289- downloadState . downloadPercentage !== undefined
290- ? `Downloading: ${ downloadState . downloadPercentage } %`
291- : "Downloading"
292- }
288+ < DeterminateProgressRing
289+ percent = { downloadState . downloadPercentage ?? 0 }
293290 />
294291 ) }
295292 { downloadState ?. downloadStatus ===
You can’t perform that action at this time.
0 commit comments