Skip to content

Commit

Permalink
feat: add risk icons
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Jan 16, 2024
1 parent 76bd0c1 commit e65a6e0
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
8 changes: 8 additions & 0 deletions packages/app/src/components/high_risk_icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { PropsWithChildren } from 'react'
import { GoXCircle } from 'react-icons/go'

export type HighRiskProps = {}

export function HighRiskIcon({ ...props }: PropsWithChildren<HighRiskProps>) {
return <GoXCircle {...props} />
}
8 changes: 8 additions & 0 deletions packages/app/src/components/low_risk_icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { PropsWithChildren } from 'react'
import { GoBug } from 'react-icons/go'

export type LowRiskProps = {}

export function LowRisk({ ...props }: PropsWithChildren<LowRiskProps>) {
return <GoBug {...props} />
}
8 changes: 8 additions & 0 deletions packages/app/src/components/medium_risk_icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { PropsWithChildren } from 'react'
import { GoAlert } from 'react-icons/go'

export type MediumRiskProps = {}

export function MediumRisk({ ...props }: PropsWithChildren<MediumRiskProps>) {
return <GoAlert {...props} />
}
28 changes: 28 additions & 0 deletions packages/app/src/components/risk_icon.tsx
Original file line number Diff line number Diff line change
@@ -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<RiskIconProps>) {
if (risk === QuestionRisk.High) {
return <HighRiskIcon {...props} />
}

if (risk === QuestionRisk.Medium) {
return <MediumRisk {...props} />
}

if (risk === QuestionRisk.Low) {
return <LowRisk {...props} />
}

return <></>
}
4 changes: 2 additions & 2 deletions packages/app/src/db/models/workload-lenses-answers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e65a6e0

Please sign in to comment.