Skip to content
Open
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
7 changes: 2 additions & 5 deletions src/scenes/Species/SpeciesCheck/NameCheckStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Box, Checkbox, Typography, useTheme } from '@mui/material';
import strings from 'src/strings';
import { Species, SpeciesProblemElement } from 'src/types/Species';

import ProjectCheckSummary, { ProjectCheckSummaryProps } from './ProjectCheckSummary';
import ProjectCheckSummary, { ProjectCheckSummaryProps, suggestionsCountLabel } from './ProjectCheckSummary';

const issueLabel = (problem: SpeciesProblemElement): string => {
switch (problem.type) {
Expand Down Expand Up @@ -54,10 +54,7 @@ const NameCheckStep = ({
borderTop: index > 0 ? `1px solid ${theme.palette.TwClrBrdrTertiary}` : undefined,
}}
>
<ProjectCheckSummary
{...summary}
updatesLabel={strings.formatString(strings.SPECIES_CHECK_SUGGESTIONS, summary.updates ?? 0)}
/>
<ProjectCheckSummary {...summary} updatesLabel={suggestionsCountLabel(summary.updates ?? 0)} />
</Box>
))}
</Box>
Expand Down
5 changes: 2 additions & 3 deletions src/scenes/Species/SpeciesCheck/NativeCheckStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import strings from 'src/strings';
import { Species } from 'src/types/Species';

import SpeciesNativityBadge from '../SpeciesNativityBadge';
import ProjectCheckSummary, { ProjectCheckSummaryProps } from './ProjectCheckSummary';
import ProjectCheckSummary, { ProjectCheckSummaryProps, suggestionsCountLabel } from './ProjectCheckSummary';
import { NATIVITY_VALUES, Nativity, OverrideEdit, getNativityLabel, projectSpeciesKey } from './types';

type PendingRow = {
Expand Down Expand Up @@ -36,8 +36,7 @@ type NativeCheckStepProps = {
// summaries are grouped together).
const SummaryBox = (props: ProjectCheckSummaryProps): JSX.Element => {
const theme = useTheme();
const updatesLabel =
props.updates !== undefined ? strings.formatString(strings.SPECIES_CHECK_SUGGESTIONS, props.updates) : undefined;
const updatesLabel = props.updates !== undefined ? suggestionsCountLabel(props.updates) : undefined;

return (
<Box
Expand Down
6 changes: 6 additions & 0 deletions src/scenes/Species/SpeciesCheck/ProjectCheckSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export type ProjectCheckSummaryProps = {
speciesChecked?: number;
};

export const suggestionsCountLabel = (suggestions: number): React.ReactNode =>
strings.formatString(
suggestions === 1 ? strings.SPECIES_CHECK_SUGGESTION : strings.SPECIES_CHECK_SUGGESTIONS,
suggestions
);

const ProjectCheckSummary = ({
projectName,
countryName,
Expand Down
5 changes: 2 additions & 3 deletions src/scenes/Species/SpeciesProjectsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type ProjectRow = {

const columns = (): TableColumnType[] => [
{ key: 'projectName', name: strings.PROJECT, type: 'string', sx: { width: '34%' } },
{ key: 'status', name: strings.NATIVE_STATUS, type: 'string', sx: { width: '44%' } },
{ key: 'status', name: strings.NATIVE_STATUS, type: 'string' },
{ key: 'actions', name: '', type: 'string', alignment: 'right', sx: { width: '180px' } },
];

Expand Down Expand Up @@ -145,15 +145,14 @@ export default function SpeciesProjectsSection({
const projectRow = row as ProjectRow;

if (column.key === 'projectName') {
return <CellRenderer {...props} index={index} style={{ width: '34%' }} />;
return <CellRenderer {...props} index={index} />;
}

if (column.key === 'status') {
return (
<CellRenderer
{...props}
component='div'
style={{ width: '44%' }}
sx={{ '& > div': { maxWidth: 'none', overflow: 'visible' } }}
value={
<Box sx={{ alignItems: 'center', display: 'flex', flexWrap: 'nowrap', gap: theme.spacing(1) }}>
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/Species/SpeciesProjectsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import RemoveProjectsDialog from './RemoveProjectsDialog';
import SpeciesProjectsCellRenderer from './SpeciesProjectsCellRenderer';

const columns = (): TableColumnType[] => [
{ key: 'projectName', name: strings.PROJECT, type: 'string' },
{ key: 'projectName', name: strings.PROJECT, type: 'string', sx: { width: '34%' } },
{ key: 'participantProjectSpeciesNativeCategory', name: strings.NATIVE_NON_NATIVE, type: 'string' },
{ key: 'participantProjectSpeciesSubmissionStatus', name: strings.STATUS, type: 'string' },
];
Expand Down
1 change: 1 addition & 0 deletions src/strings/csv/en.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2235,6 +2235,7 @@ SPECIES_CHECK_SET_LOCATION_BANNER,"To check which species are native, introduced
SPECIES_CHECK_SET_LOCATION_HINT,Select a Country and Botanical Country to set the location.,
SPECIES_CHECK_SET_LOCATION_HINT_PROJECTS,Select a Country and Botanical Country to set the location of each Project.,
SPECIES_CHECK_SPECIES_CHECKED,{0} species checked,
SPECIES_CHECK_SUGGESTION,{0} suggestion,
SPECIES_CHECK_SUGGESTIONS,{0} suggestions,
SPECIES_CHECK_UPDATE_HINT,"Select species to update, or continue without any updates. Updates will override pre-existing data."
SPECIES_CHECK_UPDATES,{0} updates,
Expand Down
1 change: 1 addition & 0 deletions src/strings/csv/es.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,7 @@ SPECIES_CHECK_SET_LOCATION_BANNER,"Para verificar qué especies son nativas, int
SPECIES_CHECK_SET_LOCATION_HINT,Seleccione un país y un país botánico para establecer la ubicación.,e7b413a8
SPECIES_CHECK_SET_LOCATION_HINT_PROJECTS,Seleccione un país y un país botánico para establecer la ubicación de cada proyecto.,8070772f
SPECIES_CHECK_SPECIES_CHECKED,{0} especies verificadas,3a3237db
SPECIES_CHECK_SUGGESTION,{0} sugerencia,5afe0690
SPECIES_CHECK_SUGGESTIONS,{0} sugerencias,9154c212
SPECIES_CHECK_UPDATE_HINT,Seleccione las especies que desea actualizar o continúe sin realizar actualizaciones. Las actualizaciones sobrescribirán los datos existentes.,6cfa3ed4
SPECIES_CHECK_UPDATES,{0} actualizaciones,a1d89ade
Expand Down
1 change: 1 addition & 0 deletions src/strings/csv/fr.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2233,6 +2233,7 @@ SPECIES_CHECK_SET_LOCATION_BANNER,"Pour vérifier quelles espèces sont indigèn
SPECIES_CHECK_SET_LOCATION_HINT,Sélectionnez un pays et un pays botanique pour définir l’emplacement.,e7b413a8
SPECIES_CHECK_SET_LOCATION_HINT_PROJECTS,Sélectionnez un pays et un pays botanique pour définir l’emplacement de chaque projet.,8070772f
SPECIES_CHECK_SPECIES_CHECKED,{0} espèces vérifiées,3a3237db
SPECIES_CHECK_SUGGESTION,{0} suggestion,5afe0690
SPECIES_CHECK_SUGGESTIONS,{0} suggestions,9154c212
SPECIES_CHECK_UPDATE_HINT,"Sélectionnez les espèces à mettre à jour, ou continuez sans effectuer de mise à jour. Les mises à jour remplaceront les données existantes.",6cfa3ed4
SPECIES_CHECK_UPDATES,{0} mises à jour,a1d89ade
Expand Down