Skip to content

Commit 5289ecd

Browse files
committed
Explain violations
1 parent 9dbe303 commit 5289ecd

File tree

2 files changed

+368
-90
lines changed

2 files changed

+368
-90
lines changed

apps/web/src/components/IssueModal/index.tsx

+51-47
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ const IssueModal = ({
166166
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
167167
>
168168
<div
169-
className={`sm:my-8 sm:p-6 sm:align-middle inline-block h-screen w-screen transform overflow-hidden overflow-y-auto rounded-lg bg-white px-4 pb-4 pt-4 text-left align-bottom shadow-xl transition-all md:h-[80vh] md:w-[75vw] md:max-w-[1200px]`}
169+
className={`sm:my-8 sm:p-6 sm:align-middle flex h-screen w-screen transform flex-col overflow-hidden overflow-y-auto rounded-lg bg-white px-4 pb-4 pt-4 text-left align-bottom shadow-xl transition-all md:h-[80vh] md:w-[75vw] md:max-w-[1200px]`}
170170
>
171-
<div className="sm:block z-40 -mr-2 -mt-4 inline-flex w-full justify-end">
171+
<div className="sm:block z-40 -mr-2 inline-flex w-full justify-end">
172172
<button
173173
type="button"
174174
className={`z-40 rounded-md text-gray-400 hover:text-gray-500`}
@@ -181,27 +181,32 @@ const IssueModal = ({
181181
<div className="-mt-2 flex w-fit flex-col">
182182
<div className="font-bold md:text-lg">{issue.message}</div>
183183
<div className="text-xs text-gray-400">Code: {issue.code}</div>
184-
<div className="mb-4 mt-2">
185-
{"urlPathFragment" in ruleData ? (
186-
<div className="flex items-center text-blue-500 hover:text-blue-700">
187-
<a
188-
target="_blank"
189-
className="w-fit"
190-
href={`https://quobix.com/vacuum/rules/${ruleData.urlPathFragment}/${issue.code}`}
191-
>
192-
Additional details
193-
</a>
194-
<ArrowUpRightIcon height={12} strokeWidth={3} />
184+
<div className="mb-4 mt-2 flex flex-col gap-y-2">
185+
<div className="flex flex-col">
186+
<span className="font-bold">Why is this important?</span>
187+
{ruleData.description}
188+
</div>
189+
{ruleData.violationExplanation && (
190+
<div className="flex flex-col">
191+
<span className="font-bold">
192+
Why did this violation appear?
193+
</span>
194+
{ruleData.violationExplanation}
195195
</div>
196-
) : (
197-
<div>{ruleData.description}</div>
198196
)}
197+
<a
198+
target="_blank"
199+
className="flex w-fit items-center text-blue-500 hover:text-blue-700"
200+
href={ruleData.url}
201+
>
202+
Learn more <ArrowUpRightIcon height={12} strokeWidth={3} />
203+
</a>
199204
</div>
200205
</div>
201206
<div
202-
className={`flex ${
207+
className={` ${
203208
selectedTab === "AI" ? "h-fit" : "h-full"
204-
} w-full flex-col`}
209+
} w-full`}
205210
>
206211
<div className="flex w-fit rounded-md rounded-b-none border">
207212
<div
@@ -329,36 +334,35 @@ const IssueModal = ({
329334
</div>
330335
) : null}
331336
{selectedTab === "CODE" ? (
332-
<div className="flex h-full w-full">
333-
<Editor
334-
className="my-2 h-full"
335-
width="100%"
336-
language={fileExtension === "json" ? "json" : "yaml"}
337-
value={openapi}
338-
options={{
339-
automaticLayout: true,
340-
readOnly: true,
341-
selectionHighlight: true,
342-
renderLineHighlight: "line",
343-
scrollBeyondLastLine: false,
344-
glyphMargin: true,
345-
minimap: windowSize.isMobile
346-
? {
347-
enabled: false,
348-
}
349-
: undefined,
350-
fontSize: windowSize.isMobile ? 10 : undefined,
351-
lineNumbers: windowSize.isMobile ? "off" : undefined,
352-
// @ts-ignore - this is a valid option, but the types don't know about it
353-
renderIndentGuides: windowSize.isMobile
354-
? false
355-
: undefined,
356-
folding: windowSize.isMobile ? false : undefined,
357-
}}
358-
onMount={onEditorDidMount}
359-
line={issue.range.start.line}
360-
/>
361-
</div>
337+
<Editor
338+
className="my-2 h-full"
339+
width="100%"
340+
height="calc(100% - 75px)"
341+
language={fileExtension === "json" ? "json" : "yaml"}
342+
value={openapi}
343+
options={{
344+
automaticLayout: true,
345+
readOnly: true,
346+
selectionHighlight: true,
347+
renderLineHighlight: "line",
348+
scrollBeyondLastLine: false,
349+
glyphMargin: true,
350+
minimap: windowSize.isMobile
351+
? {
352+
enabled: false,
353+
}
354+
: undefined,
355+
fontSize: windowSize.isMobile ? 10 : undefined,
356+
lineNumbers: windowSize.isMobile ? "off" : undefined,
357+
// @ts-ignore - this is a valid option, but the types don't know about it
358+
renderIndentGuides: windowSize.isMobile
359+
? false
360+
: undefined,
361+
folding: windowSize.isMobile ? false : undefined,
362+
}}
363+
onMount={onEditorDidMount}
364+
line={issue.range.start.line}
365+
/>
362366
) : null}
363367
</div>
364368
</div>

0 commit comments

Comments
 (0)