From e65a6e0d7183facd09a455eb250146ba449d2262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20D=C3=B6ll?= Date: Tue, 16 Jan 2024 14:50:01 +0000 Subject: [PATCH] feat: add risk icons --- .../app/src/components/high_risk_icon.tsx | 8 ++++++ packages/app/src/components/low_risk_icon.tsx | 8 ++++++ .../app/src/components/medium_risk_icon.tsx | 8 ++++++ packages/app/src/components/risk_icon.tsx | 28 +++++++++++++++++++ .../src/db/models/workload-lenses-answers.ts | 4 +-- 5 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 packages/app/src/components/high_risk_icon.tsx create mode 100644 packages/app/src/components/low_risk_icon.tsx create mode 100644 packages/app/src/components/medium_risk_icon.tsx create mode 100644 packages/app/src/components/risk_icon.tsx diff --git a/packages/app/src/components/high_risk_icon.tsx b/packages/app/src/components/high_risk_icon.tsx new file mode 100644 index 00000000..4d0a5420 --- /dev/null +++ b/packages/app/src/components/high_risk_icon.tsx @@ -0,0 +1,8 @@ +import { PropsWithChildren } from 'react' +import { GoXCircle } from 'react-icons/go' + +export type HighRiskProps = {} + +export function HighRiskIcon({ ...props }: PropsWithChildren) { + return +} diff --git a/packages/app/src/components/low_risk_icon.tsx b/packages/app/src/components/low_risk_icon.tsx new file mode 100644 index 00000000..9419818b --- /dev/null +++ b/packages/app/src/components/low_risk_icon.tsx @@ -0,0 +1,8 @@ +import { PropsWithChildren } from 'react' +import { GoBug } from 'react-icons/go' + +export type LowRiskProps = {} + +export function LowRisk({ ...props }: PropsWithChildren) { + return +} diff --git a/packages/app/src/components/medium_risk_icon.tsx b/packages/app/src/components/medium_risk_icon.tsx new file mode 100644 index 00000000..22549e3a --- /dev/null +++ b/packages/app/src/components/medium_risk_icon.tsx @@ -0,0 +1,8 @@ +import { PropsWithChildren } from 'react' +import { GoAlert } from 'react-icons/go' + +export type MediumRiskProps = {} + +export function MediumRisk({ ...props }: PropsWithChildren) { + return +} diff --git a/packages/app/src/components/risk_icon.tsx b/packages/app/src/components/risk_icon.tsx new file mode 100644 index 00000000..91863fee --- /dev/null +++ b/packages/app/src/components/risk_icon.tsx @@ -0,0 +1,28 @@ +import { PropsWithChildren } from 'react' +import { QuestionRisk } from '@/db/models/lens-pillar-risks' +import { HighRiskIcon } from '@/components/high_risk_icon' +import { MediumRisk } from '@/components/medium_risk_icon' +import { LowRisk } from '@/components/low_risk_icon' + +export type RiskIconProps = { + risk?: QuestionRisk +} + +export function RiskIcon({ + risk = QuestionRisk.None, + ...props +}: PropsWithChildren) { + if (risk === QuestionRisk.High) { + return + } + + if (risk === QuestionRisk.Medium) { + return + } + + if (risk === QuestionRisk.Low) { + return + } + + return <> +} diff --git a/packages/app/src/db/models/workload-lenses-answers.ts b/packages/app/src/db/models/workload-lenses-answers.ts index 7613cb86..cee17f23 100644 --- a/packages/app/src/db/models/workload-lenses-answers.ts +++ b/packages/app/src/db/models/workload-lenses-answers.ts @@ -58,12 +58,12 @@ export class WorkloadLensAnswer extends Model< @ForeignKey(() => Workload) @Unique('workload-lens-pillar-question') @Column(DataType.UUID) - workloadId?: string + workloadId!: string @ForeignKey(() => LensPillarQuestion) @Unique('workload-lens-pillar-question') @Column - lensPillarQuestionId?: bigint + lensPillarQuestionId!: bigint @AllowNull @Min(12)