Skip to content

Commit

Permalink
fix: remove dev button and disable edit-save for cus and upt (#1557)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigyu authored Aug 28, 2024
1 parent 1a7cb24 commit 1371338
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
31 changes: 19 additions & 12 deletions frontend/src/views/Seedlot/SeedlotReview/SeedlotReviewContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Edit, Save, Pending, Checkmark, Warning
} from '@carbon/icons-react';
import { Beforeunload } from 'react-beforeunload';
import { DateTime as luxon } from 'luxon';

import { getSeedlotById, putAClassSeedlotProgress } from '../../../api-service/seedlotAPI';
import { THREE_HALF_HOURS, THREE_HOURS } from '../../../config/TimeUnits';
Expand Down Expand Up @@ -70,7 +69,7 @@ import {
validateGeneticWorth
} from './utils';
import { GenWorthValType } from './definitions';
import { SaveStatusModalText } from './constants';
import { IS_DEV_FEATURE_ENABLED, SaveStatusModalText } from './constants';
import { completeProgressConfig, emptyOwnershipStep, initialProgressConfig } from '../ContextContainerClassA/constants';
import { AllStepData } from '../ContextContainerClassA/definitions';

Expand Down Expand Up @@ -512,15 +511,23 @@ const SeedlotReviewContent = () => {
|| isFetchingData
}
/>
<Button
kind="secondary"
size="md"
className="edit-save-btn"
renderIcon={isReadMode ? Edit : Save}
onClick={handleEditSaveBtn}
>
{isReadMode ? 'Edit seedlot' : 'Save edit'}
</Button>

{
// Seedlots that have 'CUS' or 'UPT' as source should not be edited.
seedlotData?.seedlotSource.seedlotSourceCode === 'TPT'
? (
<Button
kind="secondary"
size="md"
className="edit-save-btn"
renderIcon={isReadMode ? Edit : Save}
onClick={handleEditSaveBtn}
>
{isReadMode ? 'Edit seedlot' : 'Save edit'}
</Button>
)
: null
}

<Breadcrumbs
crumbs={
Expand Down Expand Up @@ -747,7 +754,7 @@ const SeedlotReviewContent = () => {
{
// this and its related code such as createDraftForPendMutation
// needs to be deleted in the future
(luxon.local().setZone('America/Vancouver').toISODate() ?? '' < '2024-08-17')
IS_DEV_FEATURE_ENABLED
? (
<Row className="action-button-row">
<Column className="action-button-col" sm={4} md={4} lg={8}>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/Seedlot/SeedlotReview/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,5 @@ export const SaveStatusModalText = {
</h5>
)
};

export const IS_DEV_FEATURE_ENABLED = false;

0 comments on commit 1371338

Please sign in to comment.