Skip to content

Commit 0476815

Browse files
authored
Merge pull request #1531 from github/koesie10/move-components-to-common
Move CodePaths and FileCodeSnippet to common directory
2 parents d69772d + 53dfd12 commit 0476815

8 files changed

Lines changed: 19 additions & 19 deletions

File tree

extensions/ql-vscode/src/stories/remote-queries/CodePaths.stories.tsx renamed to extensions/ql-vscode/src/stories/common/CodePaths.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import { ComponentStory, ComponentMeta } from '@storybook/react';
44
import { ThemeProvider } from '@primer/react';
55

6-
import CodePaths from '../../view/remote-queries/CodePaths';
6+
import { CodePaths } from '../../view/common';
77
import type { CodeFlow } from '../../remote-queries/shared/analysis-result';
88

99
export default {
@@ -112,8 +112,8 @@ PowerShell.args = {
112112
message: {
113113
tokens: [
114114
{
115-
type: 'text',
116-
t: 'This zip file may have a dangerous path'
115+
t: 'text',
116+
text: 'This zip file may have a dangerous path'
117117
}
118118
]
119119
},

extensions/ql-vscode/src/stories/remote-queries/FileCodeSnippet.stories.tsx renamed to extensions/ql-vscode/src/stories/common/FileCodeSnippet.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22

33
import { ComponentStory, ComponentMeta } from '@storybook/react';
44

5-
import FileCodeSnippet from '../../view/remote-queries/FileCodeSnippet';
5+
import { FileCodeSnippet } from '../../view/common';
66

77
export default {
88
title: 'File Code Snippet',

extensions/ql-vscode/src/view/remote-queries/CodePaths.tsx renamed to extensions/ql-vscode/src/view/common/CodePaths/CodePaths.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import { VSCodeDropdown, VSCodeLink, VSCodeOption, VSCodeTag } from '@vscode/web
44
import * as React from 'react';
55
import { ChangeEvent, useRef, useState } from 'react';
66
import styled from 'styled-components';
7-
import { CodeFlow, AnalysisMessage, ResultSeverity } from '../../remote-queries/shared/analysis-result';
8-
import { SectionTitle, VerticalSpace } from '../common';
9-
import FileCodeSnippet from './FileCodeSnippet';
7+
import { CodeFlow, AnalysisMessage, ResultSeverity } from '../../../remote-queries/shared/analysis-result';
8+
import { SectionTitle } from '../SectionTitle';
9+
import { VerticalSpace } from '../VerticalSpace';
10+
import { FileCodeSnippet } from '../FileCodeSnippet';
1011

1112
const StyledCloseButton = styled.button`
1213
position: absolute;
@@ -111,7 +112,7 @@ const Menu = ({
111112
</VSCodeDropdown>;
112113
};
113114

114-
const CodePaths = ({
115+
export const CodePaths = ({
115116
codeFlows,
116117
ruleDescription,
117118
message,
@@ -173,5 +174,3 @@ const CodePaths = ({
173174
</div>
174175
);
175176
};
176-
177-
export default CodePaths;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './CodePaths';

extensions/ql-vscode/src/view/remote-queries/FileCodeSnippet.tsx renamed to extensions/ql-vscode/src/view/common/FileCodeSnippet/FileCodeSnippet.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as React from 'react';
22
import styled from 'styled-components';
3-
import { CodeSnippet, FileLink, HighlightedRegion, AnalysisMessage, ResultSeverity } from '../../remote-queries/shared/analysis-result';
4-
import { createRemoteFileRef } from '../../pure/location-link-utils';
5-
import { parseHighlightedLine, shouldHighlightLine } from '../../pure/sarif-utils';
3+
import { CodeSnippet, FileLink, HighlightedRegion, AnalysisMessage, ResultSeverity } from '../../../remote-queries/shared/analysis-result';
4+
import { createRemoteFileRef } from '../../../pure/location-link-utils';
5+
import { parseHighlightedLine, shouldHighlightLine } from '../../../pure/sarif-utils';
66
import { VSCodeLink } from '@vscode/webview-ui-toolkit/react';
7-
import { VerticalSpace } from '../common';
7+
import { VerticalSpace } from '../VerticalSpace';
88

99
const borderColor = 'var(--vscode-editor-snippetFinalTabstopHighlightBorder)';
1010
const warningColor = '#966C23';
@@ -193,7 +193,7 @@ const Line = ({
193193
</div>;
194194
};
195195

196-
const FileCodeSnippet = ({
196+
export const FileCodeSnippet = ({
197197
fileLink,
198198
codeSnippet,
199199
highlightedRegion,
@@ -257,5 +257,3 @@ const FileCodeSnippet = ({
257257
</Container>
258258
);
259259
};
260-
261-
export default FileCodeSnippet;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './FileCodeSnippet';

extensions/ql-vscode/src/view/common/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export * from './icon';
2+
export * from './CodePaths';
3+
export * from './FileCodeSnippet';
24
export * from './HorizontalSpace';
35
export * from './SectionTitle';
46
export * from './VerticalSpace';

extensions/ql-vscode/src/view/remote-queries/AnalysisAlertResult.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react';
22
import { AnalysisAlert } from '../../remote-queries/shared/analysis-result';
3-
import CodePaths from './CodePaths';
4-
import FileCodeSnippet from './FileCodeSnippet';
3+
import { CodePaths, FileCodeSnippet } from '../common';
54

65
const AnalysisAlertResult = ({ alert }: { alert: AnalysisAlert }) => {
76
const showPathsLink = alert.codeFlows.length > 0;

0 commit comments

Comments
 (0)