Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes in ARY from feedback document #2831

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/components/general/AddStakeholderButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import _ts from '#ts';
type Props<T> = Omit<AddStakeholderModalProps<T>, 'onModalClose'> & {
className?: string;
disabled?: boolean;
label?: string;
}

function AddStakeholderButton<T extends string>(props: Props<T>) {
const {
className,
disabled,
label,
...stakeholderModalProps
} = props;

Expand All @@ -40,6 +42,7 @@ function AddStakeholderButton<T extends string>(props: Props<T>) {
<AddStakeholderModal
{...stakeholderModalProps}
onModalClose={hideModal}
label={label}
/>
)}
</>
Expand Down
4 changes: 3 additions & 1 deletion app/components/general/AddStakeholderModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export interface Props<T> {
onOptionsChange: (value: BasicOrganization[]) => void;
value?: BasicProjectOrganization[] | null;
onModalClose: () => void;
label?: string;
}

const defaultFormValues: FormType = {};
Expand All @@ -126,6 +127,7 @@ function AddStakeholderModal<T extends string>(props: Props<T>) {
options,
onOptionsChange,
onModalClose,
label,
} = props;

const groupOrganizations = useCallback(
Expand Down Expand Up @@ -209,7 +211,7 @@ function AddStakeholderModal<T extends string>(props: Props<T>) {
onOptionsChange={onOptionsChange}
name="LEAD_ORGANIZATION"
value={value.LEAD_ORGANIZATION}
label={_ts('project.detail.stakeholders', 'leadOrganization')}
label={label ?? _ts('project.detail.stakeholders', 'leadOrganization')}
/>
<StakeholderList
onChange={handleChange}
Expand Down
2 changes: 1 addition & 1 deletion app/gqlFragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ export const ASSESSMENT_REGISTRY_FRAGMENT = gql`
bgPreparedness
clientId
confidentiality
costEstimatesUsd
coordinatedJoint
dataCollectionEndDate
dataCollectionStartDate
status
detailsType
family
externalSupport
Expand Down
3 changes: 1 addition & 2 deletions app/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { memo, ReactElement } from 'react';

import {
isDefined,
capitalize,
isNotDefined,
compareNumber,
listToMap,
Expand Down Expand Up @@ -134,7 +133,7 @@ export const enumKeySelector = <T>(d: EnumEntity<T>) => (

export const enumLabelSelector = <T extends string | number>(d: EnumEntity<T>) => (
// FIXME: why are we doing this
capitalize(d.description ?? String(d.name))
(d.description ?? String(d.name))
);

interface Options {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function StakeholderForm(props: Props) {
onChange={setFieldValue}
onOptionsChange={setStakeholderOptions}
options={stakeholderOptions}
label="Assessment Lead"
/>
)}
>
Expand Down
26 changes: 19 additions & 7 deletions app/views/EditAry/AssessmentRegistryForm/MetadataForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { EnumOptions } from '#types/common';
import {
GetOptionsQuery,
GetOptionsQueryVariables,
AssessmentRegistryStatusTypeEnum,
AssessmentRegistryCrisisTypeEnum,
AssessmentRegistryPreparednessTypeEnum,
AssessmentRegistryExternalTypeEnum,
Expand All @@ -42,6 +43,12 @@ import styles from './styles.css';

const GET_METADATA_OPTIONS = gql`
query GetOptions {
statusOptions: __type(name: "AssessmentRegistryStatusTypeEnum") {
enumValues {
name
description
}
}
crisisOptions: __type(name: "AssessmentRegistryCrisisTypeEnum") {
enumValues {
name
Expand Down Expand Up @@ -132,6 +139,7 @@ function MetadataForm(props: Props) {
);

const [
statusOptions,
crisisOptions,
preparednessOptions,
externalOptions,
Expand All @@ -142,6 +150,7 @@ function MetadataForm(props: Props) {
confidentialityOptions,
languageOptions,
] = useMemo(() => ([
data?.statusOptions?.enumValues as EnumOptions<AssessmentRegistryStatusTypeEnum>,
data?.crisisOptions?.enumValues as EnumOptions<AssessmentRegistryCrisisTypeEnum>,
data?.preparednessOptions?.enumValues as EnumOptions<
AssessmentRegistryPreparednessTypeEnum
Expand Down Expand Up @@ -227,18 +236,21 @@ function MetadataForm(props: Props) {
labelSelector={enumLabelSelector}
options={coordinationJointOptions}
/>
<NumberInput
label="Cost Estimates in USD"
name="costEstimatesUsd"
value={value.costEstimatesUsd}
onChange={setFieldValue}
error={error?.costEstimatesUsd}
/>
</div>
</div>
<div className={styles.formElement}>
<Header title="Details" />
<div className={styles.inputs}>
<SelectInput
label="Status"
name="status"
value={value.status}
onChange={setFieldValue}
error={error?.status}
keySelector={enumKeySelector}
labelSelector={enumLabelSelector}
options={statusOptions}
/>
<SelectInput
label="Type"
name="detailsType"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function AnalyticalDensityInput(props: Props) {
heading={(
<>
<div>
Analysis Levels Covered by the Assessment:
Analysis levels covered by the assessment:
</div>
<div>
{analysisLevelValue}
Expand Down Expand Up @@ -130,7 +130,7 @@ function AnalyticalDensityInput(props: Props) {
heading={(
<>
<div>
Figures Provided by the Assessment:
Figures provided by the assessment:
</div>
<div>
{figureProvidedValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ function ScoreForm(props: Props) {
data={scoreStatsValue}
keySelector={keySelector}
renderer={KeyFigure}
rendererClassName={styles.scoreBox}
rendererParams={scoreStatsValueParams}
pending={false}
filtered={false}
Expand Down
6 changes: 6 additions & 0 deletions app/views/EditAry/AssessmentRegistryForm/ScoreForm/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
flex-wrap: wrap;
padding: var(--dui-spacing-small);
gap: var(--dui-spacing-small);

.score-box {
&:last-child {
margin-left: auto;
}
}
}

.tab-panel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function SummaryDimensionMetaInput(props: Props) {
className={styles.inputMetadata}
inputSectionClassName={styles.inputSection}
label="Total people affected"
placeholder="Any"
placeholder="write your number here"
name="totalPeopleAffected"
onChange={onValueChange}
value={value?.totalPeopleAffected}
Expand All @@ -59,7 +59,7 @@ function SummaryDimensionMetaInput(props: Props) {
className={styles.inputMetadata}
inputSectionClassName={styles.inputSection}
label="Total Moderate"
placeholder="Any"
placeholder="write your number here"
name="totalModerate"
onChange={onValueChange}
error={error?.totalModerate}
Expand All @@ -69,7 +69,7 @@ function SummaryDimensionMetaInput(props: Props) {
<NumberInput
className={styles.inputMetadata}
inputSectionClassName={styles.inputSection}
placeholder="Any"
placeholder="write your number here"
label="Total Severe"
name="totalSevere"
onChange={onValueChange}
Expand All @@ -80,7 +80,7 @@ function SummaryDimensionMetaInput(props: Props) {
<NumberInput
className={styles.inputMetadata}
inputSectionClassName={styles.inputSection}
placeholder="Any"
placeholder="write your number here"
label="Total Critical"
name="totalCritical"
onChange={onValueChange}
Expand All @@ -92,7 +92,7 @@ function SummaryDimensionMetaInput(props: Props) {
className={styles.inputMetadata}
inputSectionClassName={styles.inputSection}
label="Total in need"
placeholder="Any"
placeholder="write your number here"
name="totalInNeed"
onChange={onValueChange}
value={value?.totalInNeed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function DimensionTabPanel(props: Props) {
rendererParams={dimensionRendererParams}
/>
<ExpandableContainer
heading="Summary"
heading="Key figures"
headingSize="extraSmall"
withoutBorder
contentClassName={styles.summaryContent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function PillarItem(props: Props) {
className={styles.inputMetadata}
inputSectionClassName={styles.inputSection}
label="Total people assessed"
placeholder="Any"
placeholder="write your number here"
name="totalPeopleAssessed"
onChange={onPillarMetaChange}
value={value?.summaryPillarMeta?.totalPeopleAssessed}
Expand All @@ -110,8 +110,8 @@ function PillarItem(props: Props) {
className={styles.inputMetadata}
inputSectionClassName={styles.inputSection}
name="totalDead"
label="Total death"
placeholder="Any"
label="Total deaths"
placeholder="write your number here"
value={value?.summaryPillarMeta?.totalDead}
onChange={onPillarMetaChange}
error={summaryPillarMetaError?.totalDead}
Expand All @@ -122,7 +122,7 @@ function PillarItem(props: Props) {
inputSectionClassName={styles.inputSection}
name="totalInjured"
label="Total injured"
placeholder="Any"
placeholder="write your number here"
value={value?.summaryPillarMeta?.totalInjured}
onChange={onPillarMetaChange}
error={summaryPillarMetaError?.totalInjured}
Expand All @@ -133,7 +133,7 @@ function PillarItem(props: Props) {
inputSectionClassName={styles.inputSection}
name="totalMissing"
label="Total missing"
placeholder="Any"
placeholder="write your number here"
value={value?.summaryPillarMeta?.totalMissing}
onChange={onPillarMetaChange}
error={summaryPillarMetaError?.totalMissing}
Expand All @@ -148,23 +148,27 @@ function PillarItem(props: Props) {
inputSectionClassName={styles.inputSection}
name="totalPeopleFacingHumAccessCons"
label="People facing humanitarian access constraints"
placeholder="Any"
placeholder="write your number here"
value={value?.summaryPillarMeta?.totalPeopleFacingHumAccessCons}
onChange={onPillarMetaChange}
error={summaryPillarMetaError?.totalPeopleFacingHumAccessCons}
disabled={disabled}
/>
{/*
NOTE: This can be uncommented after we write
logic to calculate this on totalPeopleFacingHumAccessCons change
<NumberInput
className={styles.inputMetadata}
inputSectionClassName={styles.inputSection}
name="percentageOfPeopleFacingHumAccessCons"
label="% of people facing humanitarian access constraints"
placeholder="Any"
placeholder="write your number here"
value={value?.summaryPillarMeta?.percentageOfPeopleFacingHumAccessCons}
onChange={onPillarMetaChange}
error={summaryPillarMetaError?.percentageOfPeopleFacingHumAccessCons}
disabled={disabled}
/>
*/}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

.header-actions {
display: flex;
gap: var(--dui-spacing-super-small);
}
}

Expand Down
Loading
Loading