Skip to content

Commit

Permalink
Fixing Progress Bar percentages
Browse files Browse the repository at this point in the history
Fixing spelling on new appeal form
Setting default settings on List view
  • Loading branch information
dr-bizz committed Aug 22, 2024
1 parent 8b4f63c commit 4e6f858
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
11 changes: 5 additions & 6 deletions src/components/Tool/Appeal/AppealProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const AppealProgressBar = ({
display="inline"
className={classes.colorYellow}
>
{givenAmount} ({`${((given / (amount || 1)) * 100).toFixed(0)}%`})
{givenAmount} ({`${Math.floor((given / (amount || 1)) * 100)}%`})
</Typography>
</Tooltip>
<Typography
Expand All @@ -88,7 +88,7 @@ const AppealProgressBar = ({
className={classes.colorOrange}
>
{receivedAmount} (
{`${(((received + given) / (amount || 1)) * 100).toFixed(0)}%`})
{`${Math.floor(((received + given) / (amount || 1)) * 100)}%`})
</Typography>
</Tooltip>
<Typography
Expand All @@ -107,10 +107,9 @@ const AppealProgressBar = ({
className={classes.colorLightGray}
>
{committedAmount} (
{`${(
((committed + received + given) / (amount || 1)) *
100
).toFixed(0)}%`}
{`${Math.floor(
((committed + received + given) / (amount || 1)) * 100,
)}%`}
)
</Typography>
</Tooltip>
Expand Down
24 changes: 21 additions & 3 deletions src/components/Tool/Appeal/AppealsContext/AppealsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,22 @@ export const AppealsProvider: React.FC<AppealsContextProps> = ({
onCompleted: ({ userOptions }) => {
if (contactId?.includes('list')) {
setViewMode(TableViewModeEnum.List);
setFilterPanelOpen(true);
setActiveFilters({
appealStatus: AppealStatusEnum.Asked,
});
} else {
setViewMode(
const defaultView =
(userOptions.find((option) => option.key === 'contacts_view')
?.value as TableViewModeEnum) || TableViewModeEnum.Flows,
);
?.value as TableViewModeEnum) || TableViewModeEnum.Flows;
setViewMode(defaultView);

if (defaultView === TableViewModeEnum.List) {
setFilterPanelOpen(true);
setActiveFilters({
appealStatus: AppealStatusEnum.Asked,
});
}
}
},
});
Expand Down Expand Up @@ -282,6 +293,13 @@ export const AppealsProvider: React.FC<AppealsContextProps> = ({
const handleViewModeChange = (_, view: string) => {
setViewMode(view as TableViewModeEnum);
updateOptions(view);
setActiveFilters({});
if (view === TableViewModeEnum.List) {
setFilterPanelOpen(true);
setActiveFilters({
appealStatus: AppealStatusEnum.Asked,
});
}
};
//#endregion

Expand Down
6 changes: 3 additions & 3 deletions src/components/Tool/Appeal/InitialPage/AddAppealForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ const AddAppealForm: React.FC<AddAppealFormProps> = ({ accountListId }) => {
{...params}
variant="outlined"
size="small"
placeholder={t('Select Some Options')}
placeholder={t('Select some options')}
/>
)}
/>
Expand Down Expand Up @@ -472,7 +472,7 @@ const AddAppealForm: React.FC<AddAppealFormProps> = ({ accountListId }) => {
{...params}
variant="outlined"
size="small"
placeholder={t('Select Some Options')}
placeholder={t('Select some options')}
/>
)}
/>
Expand All @@ -498,7 +498,7 @@ const AddAppealForm: React.FC<AddAppealFormProps> = ({ accountListId }) => {
{...params}
variant="outlined"
size="small"
placeholder={t('Select Some Options')}
placeholder={t('Select some options')}
/>
)}
/>
Expand Down

0 comments on commit 4e6f858

Please sign in to comment.