Skip to content

Commit 735b2d0

Browse files
committed
added risk banner to viewer
1 parent af85195 commit 735b2d0

4 files changed

Lines changed: 20 additions & 5 deletions

File tree

ui/packages/db/src/SharedComponents/Warning.tsx renamed to ui/packages/components/src/common/gcsim/Warning.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import {Button} from '@blueprintjs/core';
2-
import tanuki from 'images/tanuki.png';
2+
import tanuki from '../../images/tanuki.png'
33
import React from 'react';
4-
import {Trans, TransProps, useTranslation} from 'react-i18next';
4+
import {Trans, useTranslation} from 'react-i18next';
55

66
interface WarningProps {
77
hideKey: string;
88
headerKey: string;
99
bodyKey: string;
10+
showButton?: boolean;
1011
className?: string;
11-
backgroundColor?: string;
12-
borderColor?: string;
1312
}
1413

1514
export function Warning({
1615
hideKey,
1716
headerKey,
1817
bodyKey,
18+
showButton = true,
1919
className = "bg-slate-900 border-blue-800",
2020
}: WarningProps) {
2121
const { t } = useTranslation();
@@ -27,6 +27,9 @@ export function Warning({
2727
}, [hide, hideKey]);
2828

2929
if (hide) {
30+
if (!showButton) {
31+
return <></>;
32+
}
3033
return (
3134
<div className="flex flex-col py-0 min-[1300px]:w-[1100px]">
3235
<div className="ml-auto">

ui/packages/components/src/common/gcsim/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export * from "./GraphComponents/OuterLabelPie/Tooltip";
1010
export * from "./NoData";
1111
export * from "./Refresh";
1212
export * from "./LatestVersion";
13+
export * from "./Warning";
1314
export { OuterLabelPie, CardTitle, FloatStatTooltipContent };

ui/packages/db/src/Pages/Database/DBVIew.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import eula from 'images/eula.png';
33
import {useTranslation} from 'react-i18next';
44
import InfiniteScroll from 'react-infinite-scroll-component';
55
import {ActionBar} from 'SharedComponents/ActionBar';
6-
import {Warning} from 'SharedComponents/Warning';
6+
import {Warning} from '@gcsim/components';
77
import {ListView} from '../../SharedComponents/ListView';
88

99
type Props = {
@@ -22,6 +22,7 @@ export const DBView = (props: Props) => {
2222
headerKey="warnings.gcsim_risk_title"
2323
bodyKey="warnings.gcsim_risk_body"
2424
className="bg-red-950 border-red-800"
25+
showButton={false}
2526
/>
2627
<Warning
2728
hideKey="hide-warning-db"

ui/packages/ui/src/Pages/Viewer/Viewer.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { RootState, useAppSelector } from "@ui/Stores/store";
1515
import CopyToClipboard from "@ui/Components/Buttons/CopyToClipboard";
1616
import SendToSimulator from "@ui/Components/Buttons/SendToSimulator";
1717
import { useTranslation } from "react-i18next";
18+
import { Warning } from "@gcsim/components";
1819

1920
type ViewerProps = {
2021
running: boolean;
@@ -61,6 +62,15 @@ export default ({ running, data, hash = "", recoveryConfig, error, src, redirect
6162

6263
return (
6364
<div className="flex flex-col flex-grow w-full pb-6">
65+
<div className="flex flex-col px-2 pt-4 empty:pt-0 2xl:mx-auto items-center justify-center">
66+
<Warning
67+
hideKey="hide-warning-risk"
68+
headerKey="warnings.gcsim_risk_title"
69+
bodyKey="warnings.gcsim_risk_body"
70+
className="bg-red-950 border-red-800"
71+
showButton={false}
72+
/>
73+
</div>
6474
<Warnings data={data} />
6575
<div className="px-2 py-4 w-full 2xl:mx-auto 2xl:container">
6676
<ViewerNav

0 commit comments

Comments
 (0)