Skip to content

Commit

Permalink
Dogfooding Fixes: Microcredit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Marques authored and Hugo Marques committed Jul 27, 2023
1 parent e7244fd commit c447d37
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
13 changes: 2 additions & 11 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { getUserMenu } from './UserMenu';
import { getUserName } from '../utils/users';
import { languagesOptions } from 'src/utils/languages';
import { selectCurrentUser } from '../state/slices/auth';
import { useNotifications } from 'src/hooks/useNotifications';
import { usePrismicData } from '../libs/Prismic/components/PrismicDataProvider';
import { useRouter } from 'next/router';
import { useSelector } from 'react-redux';
Expand Down Expand Up @@ -248,11 +247,6 @@ const Sidebar = () => {
const { user } = useSelector(selectCurrentUser);
const { address } = useWallet();

const { notifications, mutate } = useNotifications([
`unreadOnly=true`,
`isWebApp=true`
]);

const [data, setData] = useState<MenusState | undefined>();

const { userConfig, extractFromConfig } = usePrismicData();
Expand Down Expand Up @@ -300,21 +294,18 @@ const Sidebar = () => {

const footerMenu = [...footerCommonMenu, ...footerUserMenu];

// Mutate Notifications
mutate();

setData({
commonMenu,
flags: [
{
key: 'notifications',
value: notifications?.count
value: user?.notificationsCount
}
],
footerMenu,
menus
});
}, [asPath, user, notifications, locale, address, mutate]);
}, [asPath, user, locale, address]);

const footerMenu = () => {
const userBeneficiary = user?.roles?.includes('beneficiary');
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/handleKnownErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export const handleKnownErrors = (error: any) => {
);
} else if (errorMessage.includes("don't have enough funds to borrow")) {
toast.error(`You don't have enough funds to borrow this amount.`);
} else if (errorMessage.includes('user already has an active loan')) {
toast.error(
`You can't approve this loan because you already have an active loan.`
);
} else {
toast.error('An error has ocurred. Please try again later.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ const loanStatus = (status: any) => {
case 3: // Requested Changes
badgeContent = (
<>
<Icon icon={'menu'} p700 mr={0.2} />
<Icon icon={'edit'} p700 mr={0.2} />
<Text g900 extrasmall medium>
In Revision
Revise
</Text>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/views/MicrocreditManager/ApproveRejectTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const ApproveRejectTab: React.FC<{}> = () => {
{
number: countReqChanges || 0,
onClick: () => update({ page: 1, status: '3' }),
title: 'In Revision'
title: 'Revise'
}
];

Expand Down

0 comments on commit c447d37

Please sign in to comment.