<commit_before>import React from 'react'
import styled from 'styled-components'

import { InsetText, H4 } from 'govuk-react'
import { SPACING } from '@govuk-react/constants'
import LocalHeader from '../../../../../client/components/LocalHeader/LocalHeader.jsx'
import { Main, FieldRadios } from '../../../../../client/components'
import { TASK_UPDATE_STAGE } from './state'
import urls from '../../../../../lib/urls'

import TaskForm from '../../../../../client/components/Task/Form'

const StyledP = styled('p')`
  margin-bottom: ${SPACING.SCALE_2};
`

const InvestmentProjectAdmin = ({
  projectId,
  projectName,
  projectStage,
  stages,
}) => {
  const newStageOptions = stages.filter(
    (stage) => stage.value != projectStage.id
  )
  return (
    <>
      <LocalHeader
        heading={'Change the project stage'}
        breadcrumbs={[
          { link: urls.dashboard(), text: 'Home' },
          { link: urls.investments.index(), text: 'Investments' },
          { link: urls.investments.projects.index(), text: 'Projects' },
          {
            link: urls.investments.projects.project(projectId),
            text: projectName,
          },
          { text: 'Admin' },
        ]}
      />
      <Main>
        <H4 as="h2">Project details</H4>
        <InsetText>
          <p>Project name: {projectName}</p>
          <StyledP>Current stage: {projectStage.name}</StyledP>
        </InsetText>
        <TaskForm
          actionLinks={[
            {
              children: 'Cancel',
              href: urls.investments.projects.project(projectId),
            },
          ]}
          analyticsFormName="investmentProjectAdmin"
          flashMessage={() => 'Project stage saved'}
          id={'investmentProjectAdmin'}
          redirectTo={() => urls.investments.projects.project(projectId)}
          submissionTaskName={TASK_UPDATE_STAGE}
          transformPayload={(values) => ({ ...values, projectId })}
        >
          <H4 as="h2">Change the stage to</H4>
          <FieldRadios
            name="projectStageId"
            required="Select a new stage"
            options={newStageOptions}
          />
        </TaskForm>
      </Main>
    </>
  )
}

export default InvestmentProjectAdmin<commit_msg>do not spread values while passing to payload<commit_after>import React from 'react'
import styled from 'styled-components'

import { InsetText, H4 } from 'govuk-react'
import { SPACING } from '@govuk-react/constants'
import LocalHeader from '../../../../../client/components/LocalHeader/LocalHeader.jsx'
import { Main, FieldRadios } from '../../../../../client/components'
import { TASK_UPDATE_STAGE } from './state'
import urls from '../../../../../lib/urls'

import TaskForm from '../../../../../client/components/Task/Form'

const StyledP = styled('p')`
  margin-bottom: ${SPACING.SCALE_2};
`

const InvestmentProjectAdmin = ({
  projectId,
  projectName,
  projectStage,
  stages,
}) => {
  const newStageOptions = stages.filter(
    (stage) => stage.value != projectStage.id
  )
  return (
    <>
      <LocalHeader
        heading={'Change the project stage'}
        breadcrumbs={[
          { link: urls.dashboard(), text: 'Home' },
          { link: urls.investments.index(), text: 'Investments' },
          { link: urls.investments.projects.index(), text: 'Projects' },
          {
            link: urls.investments.projects.project(projectId),
            text: projectName,
          },
          { text: 'Admin' },
        ]}
      />
      <Main>
        <H4 as="h2">Project details</H4>
        <InsetText>
          <p>Project name: {projectName}</p>
          <StyledP>Current stage: {projectStage.name}</StyledP>
        </InsetText>
        <TaskForm
          actionLinks={[
            {
              children: 'Cancel',
              href: urls.investments.projects.project(projectId),
            },
          ]}
          analyticsFormName="investmentProjectAdmin"
          flashMessage={() => 'Project stage saved'}
          id={'investmentProjectAdmin'}
          redirectTo={() => urls.investments.projects.project(projectId)}
          submissionTaskName={TASK_UPDATE_STAGE}
          transformPayload={(values) => ({ values, projectId })}
        >
          <H4 as="h2">Change the stage to</H4>
          <FieldRadios
            name="projectStageId"
            required="Select a new stage"
            options={newStageOptions}
          />
        </TaskForm>
      </Main>
    </>
  )
}

export default InvestmentProjectAdmin
{'fraction_non_alphanumeric': 0.15294117647058825, 'fraction_numerical': 0.003551609322974473, 'mean_word_length': 2.1444521981856246, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '375181', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1302, 'n_words': 260}