Skip to content

Commit

Permalink
2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey committed Dec 3, 2024
1 parent 87d391f commit e9fbb4d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pearl",
"version": "2.5.0",
"version": "2.5.1",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.1",
Expand Down
16 changes: 7 additions & 9 deletions src/pages/StatsTracking.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Box, Card, CardContent, Stack, Typography, Grid, SelectChangeEvent } from '@mui/material';
import { useState, useMemo, SetStateAction } from 'react';
import { Box, Card, CardContent, Grid, SelectChangeEvent, Stack, Typography } from '@mui/material';
import D from 'i18n';
import { useMemo, useState } from 'react';
import { SurveyUnit } from 'types/pearl';
import { ScrollableBox } from 'ui/ScrollableBox';
import { Select } from 'ui/Select';
import { CampaignProgress } from 'ui/Stats/CampaignProgress';
import { CampaignProgressPieChart } from 'ui/Stats/CampaignProgressPieChart';
import { daysLeftForSurveyUnit } from 'utils/functions';
import { groupBy } from 'utils/functions/array';
import D from 'i18n';
import { SurveyUnit } from 'types/pearl';
import { Select } from 'ui/Select';
import { ScrollableBox } from 'ui/ScrollableBox';

type SortDirection = 'asc' | 'desc' | 'deadlineDesc' | 'deadlineAsc';

Expand Down Expand Up @@ -78,9 +78,7 @@ export function StatsTracking({ surveyUnits }: Readonly<StatsTrackingProps>) {
<Select
options={sortOptions}
value={sortDirection}
onChange={(e: SelectChangeEvent<SortDirection>) =>
setSortDirection(e.target.value as SortDirection)
}
onChange={e => setSortDirection(e.target.value as SortDirection)}
placeholder={D.noSorting}
allowEmpty
sx={{ width: '210px' }}
Expand Down
4 changes: 1 addition & 3 deletions src/pages/TrackingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ export const Component = () => {
<>
{' | '}
<Select
onChange={(e: SelectChangeEvent<unknown>) =>
setCampaign(e.target.value as string)
}
onChange={e => setCampaign(e.target.value as string)}
sx={{ minWidth: 210 }}
value={campaign}
placeholder={D.trackingSelect}
Expand Down
7 changes: 2 additions & 5 deletions src/ui/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import MenuItem from '@mui/material/MenuItem';
import SelectMaterial, { SelectChangeEvent } from '@mui/material/Select';
import React, { ReactNode } from 'react';
import SelectMaterial, { SelectProps as MaterialSelectProps } from '@mui/material/Select';

// extends React.ComponentProps<typeof SelectMaterial>
interface SelectProps extends React.ComponentProps<typeof SelectMaterial> {
interface SelectProps extends MaterialSelectProps {
options: { value: string | number; label: string }[];
placeholder: string;
allowEmpty: boolean;
onChange: (e: SelectChangeEvent<any>, child: ReactNode) => void;
}

export function Select({ options, placeholder, allowEmpty, ...props }: Readonly<SelectProps>) {
Expand Down

0 comments on commit e9fbb4d

Please sign in to comment.