-
Notifications
You must be signed in to change notification settings - Fork 229
Expand file tree
/
Copy pathThreadPath.tsx
More file actions
77 lines (69 loc) · 1.54 KB
/
ThreadPath.tsx
File metadata and controls
77 lines (69 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { styled } from "styled-components";
import { Tag } from "../Tag";
import type {
AnalysisMessage,
ResultSeverity,
ThreadFlow,
} from "../../../variant-analysis/shared/analysis-result";
import { SectionTitle } from "../SectionTitle";
import { FileCodeSnippet } from "../FileCodeSnippet";
const Container = styled.div`
max-width: 55em;
margin-bottom: 1.5em;
`;
const HeaderContainer = styled.div`
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 1em;
`;
const TitleContainer = styled.div`
flex-grow: 1;
padding: 0;
border: none;
`;
const TagContainer = styled.div`
padding: 0;
border: none;
`;
type ThreadPathProps = {
threadFlow: ThreadFlow;
step: number;
message: AnalysisMessage;
severity: ResultSeverity;
isSource?: boolean;
isSink?: boolean;
};
export const ThreadPath = ({
threadFlow,
step,
message,
severity,
isSource,
isSink,
}: ThreadPathProps) => (
<Container>
<HeaderContainer>
<TitleContainer>
<SectionTitle>Step {step}</SectionTitle>
</TitleContainer>
{isSource && (
<TagContainer>
<Tag>Source</Tag>
</TagContainer>
)}
{isSink && (
<TagContainer>
<Tag>Sink</Tag>
</TagContainer>
)}
</HeaderContainer>
<FileCodeSnippet
fileLink={threadFlow.fileLink}
codeSnippet={threadFlow.codeSnippet}
highlightedRegion={threadFlow.highlightedRegion}
severity={severity}
message={isSink ? message : threadFlow.message}
/>
</Container>
);