-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Added Workflow visual component to grid + sidesheet (#1128)
* Added workflow visual component to grid + sidesheet * Removed old checklist status column. Added new one using domain name
- Loading branch information
1 parent
a54ef13
commit 68e83db
Showing
17 changed files
with
166 additions
and
28 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './types'; | ||
export * from './utils'; |
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 @@ | ||
export * from './workflowHelpers'; |
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,16 @@ | ||
import { BaseStatus, workflowStatusColorMap, workflowStatusTextColorMap, WorkflowStep } from "@cc-components/shared"; | ||
import { PipetestWorkflowStep } from "../types"; | ||
|
||
|
||
export const mapWorkflowStepsToStep = (workflowSteps: PipetestWorkflowStep[]): WorkflowStep[] => { | ||
return workflowSteps.map((step) => { | ||
return { | ||
color: workflowStatusColorMap[step.status as BaseStatus], | ||
textColor: workflowStatusTextColorMap[step.status as BaseStatus], | ||
circleText: step.stepValue, | ||
popoverText: `${step.stepName}, ${step.status}`, | ||
status: step.status, | ||
isActive: step.status !== 'IN', | ||
}; | ||
}); | ||
}; |
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
19 changes: 19 additions & 0 deletions
19
libs/shared/src/packages/mapping/src/lib/workflowStatusColorMap.ts
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,19 @@ | ||
import { tokens } from '@equinor/eds-tokens'; | ||
import { WorkflowStepStatus } from '@cc-components/shared'; | ||
|
||
export const workflowStatusColorMap: Record<WorkflowStepStatus, string> = { | ||
OS: tokens.colors.ui.background__medium.hex, | ||
PB: '#ffc107', | ||
PA: '#ff4081', | ||
OK: '#00c853', | ||
IN: tokens.colors.text.static_icons__primary_white.hex, | ||
} as const; | ||
|
||
|
||
export const workflowStatusTextColorMap: Record<WorkflowStepStatus, string> = { | ||
OS: tokens.colors.text.static_icons__default.hex, | ||
PB: tokens.colors.text.static_icons__default.hex, | ||
PA: tokens.colors.text.static_icons__primary_white.hex, | ||
OK: tokens.colors.text.static_icons__primary_white.hex, | ||
IN: tokens.colors.ui.background__medium.hex | ||
} as const; |
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 @@ | ||
export type WorkflowStepStatus = 'OS' | 'OK' | 'PA' | 'PB' | 'IN'; |
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 @@ | ||
export * from './src'; |
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 @@ | ||
export * from './lib'; |
49 changes: 49 additions & 0 deletions
49
libs/shared/src/packages/workflow-visual/src/lib/WorkflowDot.tsx
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,49 @@ | ||
import { tokens } from '@equinor/eds-tokens'; | ||
import { Tooltip } from '@equinor/eds-core-react'; | ||
import { useRef } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { WorkflowStep } from './workflowStep'; | ||
|
||
interface WorkflowDotProps { | ||
step: WorkflowStep; | ||
} | ||
|
||
export const WorkflowDot = (props: WorkflowDotProps) => { | ||
const { color, textColor, isActive, circleText, popoverText } = props.step; | ||
|
||
return ( | ||
<StepCircleWrapper> | ||
<Tooltip title={popoverText}> | ||
<StepCircle color={color} textColor={textColor} isActive={isActive}> | ||
{circleText} | ||
</StepCircle> | ||
</Tooltip> | ||
</StepCircleWrapper> | ||
); | ||
}; | ||
|
||
type StepCircleProps = { | ||
color: string; | ||
textColor: string; | ||
isActive: boolean; | ||
}; | ||
|
||
const StepCircleWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
|
||
const StepCircle = styled.div<StepCircleProps>` | ||
height: 16px; | ||
width: 16px; | ||
border-radius: 17px; | ||
font-size: 11px; | ||
color: ${(p) => `${p.textColor}`}; | ||
line-height: 18px; | ||
text-align: center; | ||
background: ${(p) => p.color}; | ||
outline: ${(p) => | ||
!p.isActive ? `1px dashed ${tokens.colors.ui.background__medium.hex}` : null}; | ||
cursor: ${(p) => (!p.isActive ? 'not-allowed' : 'pointer')}; | ||
`; |
36 changes: 36 additions & 0 deletions
36
libs/shared/src/packages/workflow-visual/src/lib/WorkflowVisual.tsx
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,36 @@ | ||
import styled from 'styled-components'; | ||
import { WorkflowDot } from './WorkflowDot'; | ||
import { WorkflowStep } from './workflowStep'; | ||
|
||
export interface WorkflowVisualProps { | ||
workflowSteps: WorkflowStep[]; | ||
} | ||
|
||
export const WorkflowVisual = (props: WorkflowVisualProps) => { | ||
const { workflowSteps } = props; | ||
return ( | ||
<> | ||
<WorkflowStepContainer> | ||
{workflowSteps.map((x) => { | ||
return ( | ||
<WorkflowStep> | ||
<WorkflowDot step={x} /> | ||
</WorkflowStep> | ||
); | ||
})} | ||
</WorkflowStepContainer> | ||
</> | ||
); | ||
}; | ||
|
||
const WorkflowStepContainer = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
`; | ||
|
||
const WorkflowStep = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin: 2px; | ||
`; |
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,2 @@ | ||
export * from './WorkflowVisual'; | ||
export * from './workflowStep'; |
8 changes: 8 additions & 0 deletions
8
libs/shared/src/packages/workflow-visual/src/lib/workflowStep.ts
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,8 @@ | ||
export type WorkflowStep = { | ||
color: string; | ||
textColor: string; | ||
circleText: string; | ||
popoverText: string; | ||
status: string; | ||
isActive: boolean; | ||
} |