-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from l3montree-dev/risk-identification
Adds Risk-Identification Page, Adds SCA Example Dialog
- Loading branch information
Showing
32 changed files
with
1,431 additions
and
76 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (C) 2024 Tim Bastin, l3montree UG (haftungsbeschränkt) | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import React, { FunctionComponent } from "react"; | ||
import { toast } from "../Toaster"; | ||
import dynamic from "next/dynamic"; | ||
const Highlighter = dynamic(() => import("./Highlighter"), { ssr: false }); | ||
|
||
interface Props { | ||
codeString: string; | ||
language: "yaml" | "shell"; | ||
} | ||
const CopyCode: FunctionComponent<Props> = (props) => { | ||
const handleCopy = () => { | ||
navigator.clipboard.writeText(props.codeString); | ||
toast({ | ||
msg: "The code has been copied to your clipboard.", | ||
intent: "info", | ||
title: "Copied to clipboard", | ||
}); | ||
}; | ||
return ( | ||
<div | ||
style={{ | ||
height: 14 /*padding*/ + props.codeString.split("\n").length * 20, | ||
}} | ||
className="relative w-full overflow-hidden rounded-lg" | ||
> | ||
<div className="absolute bottom-0 left-0 right-0 top-0 animate-pulse bg-gray-800" /> | ||
<button | ||
onClick={handleCopy} | ||
className="absolute right-1 top-1 z-10 rounded-lg bg-white/10 p-1 px-2 text-xs text-white transition-all hover:bg-white/30" | ||
> | ||
Copy | ||
</button> | ||
<div className="relative"> | ||
<Highlighter codeString={props.codeString} language={props.language} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CopyCode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { classNames } from "@/utils/common"; | ||
import { Tab as BaseTab } from "@headlessui/react"; | ||
import { Fragment, FunctionComponent, PropsWithChildren } from "react"; | ||
const CustomTab: FunctionComponent<PropsWithChildren<{}>> = (props) => { | ||
console.log(props); | ||
return ( | ||
<BaseTab as={Fragment}> | ||
{({ selected }) => ( | ||
<div | ||
className={classNames( | ||
"mr-2 inline-block cursor-pointer rounded-lg px-2 py-2 text-sm transition-all", | ||
selected | ||
? "bg-zinc-200 dark:bg-slate-800" | ||
: "hover:bg-zinc-200 dark:hover:bg-slate-800", | ||
)} | ||
> | ||
{props.children} | ||
</div> | ||
)} | ||
</BaseTab> | ||
); | ||
}; | ||
|
||
export default CustomTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (C) 2024 Tim Bastin, l3montree UG (haftungsbeschränkt) | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
import React, { FunctionComponent } from "react"; | ||
import { Light as SyntaxHighlighter } from "react-syntax-highlighter"; | ||
import yaml from "react-syntax-highlighter/dist/esm/languages/hljs/yaml"; | ||
import shell from "react-syntax-highlighter/dist/esm/languages/hljs/bash"; | ||
import docco from "react-syntax-highlighter/dist/esm/styles/hljs/an-old-hope"; | ||
|
||
SyntaxHighlighter.registerLanguage("yaml", yaml); | ||
SyntaxHighlighter.registerLanguage("shell", shell); | ||
const Highlighter: FunctionComponent<{ | ||
codeString: string; | ||
language: "yaml" | "shell"; | ||
}> = (props) => { | ||
return ( | ||
<div className="w-full bg-slate-800"> | ||
<SyntaxHighlighter | ||
showLineNumbers | ||
lineNumberStyle={{ color: "rgba(255, 255, 255, 0.3)" }} | ||
language={props.language} | ||
style={docco} | ||
> | ||
{props.codeString} | ||
</SyntaxHighlighter> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Highlighter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (C) 2024 Tim Bastin, l3montree UG (haftungsbeschränkt) | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
import React, { FunctionComponent, PropsWithChildren } from "react"; | ||
|
||
const Small: FunctionComponent<PropsWithChildren> = ({ children }) => { | ||
return ( | ||
<small className="text-sm text-zinc-600 dark:text-slate-200"> | ||
{children} | ||
</small> | ||
); | ||
}; | ||
|
||
export default Small; |
Oops, something went wrong.