Skip to content

Commit

Permalink
feat: remove status and publishbuttons
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Nov 1, 2023
1 parent 2320f22 commit c561647
Showing 1 changed file with 0 additions and 88 deletions.
88 changes: 0 additions & 88 deletions src/components/form-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
patchConceptFromForm,
postConceptFromForm
} from '../../lib/patchConceptForm';
import { publishConceptFromForm } from '../../lib/publishConceptFromForm';

import SC from './styled';

Expand All @@ -26,7 +25,6 @@ const FormControl = <V,>({
isFormDirty,
onNewConceptRevision,
onSave,
isInitialInValidForm,
lastPatchedResponse,
values
}: Props<V>) => {
Expand Down Expand Up @@ -63,7 +61,6 @@ const FormControl = <V,>({
const { concept } = conceptForm;
const erSistPublisert = concept?.erSistPublisert ?? false;
const published = concept?.erPublisert ?? false;
const validationError = conceptForm.isValidationError || isInitialInValidForm;
const isSaving = conceptForm.isSaving ?? false;
const justChangedStatus = conceptForm.justChangedStatus ?? false;
const errorSaving = conceptForm.error ?? false;
Expand Down Expand Up @@ -144,91 +141,6 @@ const FormControl = <V,>({
{localization.save}
</SC.Button>
)}
{!published && (
<SC.StatusButton
$active={concept?.status === ConceptStatus.HOERING}
disabled={
validationError ||
(!!concept.revisjonAv && !concept.revisjonAvSistPublisert) ||
isFormDirty
}
onClick={() => {
setSaveCalled(true);
patchConceptFromForm(
{
status: ConceptStatus.HOERING,
...(concept.versjonsnr?.major === 0 &&
concept.versjonsnr?.minor === 0 &&
concept.versjonsnr?.patch === 1 && {
versjonsnr: { major: 1, minor: 0, patch: 0 }
})
},
{
concept,
dispatch,
lastPatchedResponse: concept,
isSaving
}
);
}}
>
<SC.StatusHearingIcon />
{localization.setToHoering}
</SC.StatusButton>
)}
{!published && (
<SC.StatusButton
$active={concept?.status === ConceptStatus.GODKJENT}
disabled={
validationError ||
(!!concept.revisjonAv && !concept.revisjonAvSistPublisert) ||
isFormDirty
}
onClick={() => {
setSaveCalled(true);
patchConceptFromForm(
{
status: ConceptStatus.GODKJENT,
...(concept.versjonsnr?.major === 0 &&
concept.versjonsnr?.minor === 0 &&
concept.versjonsnr?.patch === 1 && {
versjonsnr: { major: 1, minor: 0, patch: 0 }
})
},
{
concept,
dispatch,
lastPatchedResponse: concept,
isSaving
}
);
}}
>
<SC.StatusApprovedIcon />
{localization.setToApproval}
</SC.StatusButton>
)}
{!published && (
<SC.StatusButton
disabled={
validationError ||
(!!concept.revisjonAv && !concept.revisjonAvSistPublisert) ||
isFormDirty
}
onClick={() => {
setSaveCalled(true);
publishConceptFromForm({
concept,
dispatch,
lastPatchedResponse: concept,
isSaving
});
}}
>
<SC.StatusPublishedIcon />
{localization.publish}
</SC.StatusButton>
)}
<div>
<span>{createMessage()}</span>
</div>
Expand Down

0 comments on commit c561647

Please sign in to comment.