Skip to content

Commit

Permalink
Add progress basis enum
Browse files Browse the repository at this point in the history
  • Loading branch information
woodwoerk committed Sep 28, 2023
1 parent afbc9ee commit c378345
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 38 deletions.
36 changes: 2 additions & 34 deletions common/__generated__/graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions components/common/CategoryPageStreamField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ type OmitUnion<T, K extends keyof any> = T extends any ? Omit<T, K> : never;

type OmitFields<T> = OmitUnion<T, 'blockType' | 'field' | 'rawValue'>;

enum ProgressBasis {
PHASE = 'implementation_phase',
STATUS = 'status',
}

interface WrapperProps {
children: React.ReactNode;
withContainer?: boolean;
Expand Down Expand Up @@ -133,8 +138,11 @@ export const CategoryPageStreamField = ({
return null;
}

// The editor specifies whether to visualise action progress by implementation phase or status
const progressDataset = block.blocks[0].value || 'implementation_phase';
/**
* CategoryPageProgressBlock contains a single dropdown allowing allows the editor to
* specify whether to visualise action progress by implementation phase or status.
*/
const progressBasis = block.blocks[0]?.value || ProgressBasis.PHASE;

return (
<Wrapper withContainer={context === 'main'}>
Expand All @@ -143,8 +151,8 @@ export const CategoryPageStreamField = ({
categoryId={page.category.id}
chart={ChartType.BAR}
shownDatasets={{
progress: progressDataset !== 'implementation_phase', // TODO get proper types
phase: progressDataset === 'implementation_phase',
progress: progressBasis === ProgressBasis.STATUS,
phase: progressBasis === ProgressBasis.PHASE,
}}
columnProps={{ md: 12, lg: 12, xl: 12 }}
/>
Expand Down

0 comments on commit c378345

Please sign in to comment.