Skip to content

Commit

Permalink
icon as button
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-justin committed Dec 11, 2023
1 parent cd347ab commit 015b60f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/pages/Admin/Charity/PayoutMethods/List/Table.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BankingApplicationStatus, PayoutMethod } from "types/aws";
import { useUpdateBankingApplicationMutation } from "services/aws/banking-applications";
import Icon from "components/Icon";
import TableSection, { Cells } from "components/TableSection";

type Props = {
Expand Down Expand Up @@ -61,21 +62,30 @@ function SetDefaultBtn({
topPriorityNum,
}: PayoutMethod) {
const APPROVED_PRIORITY_NUM = 2;
const [update] = useUpdateBankingApplicationMutation();
const [update, { isLoading }] = useUpdateBankingApplicationMutation();

if (status !== "approved") return <></>;
if (
topPriorityNum === thisPriorityNum &&
topPriorityNum !== APPROVED_PRIORITY_NUM
)
return <>default</>;
topPriorityNum > APPROVED_PRIORITY_NUM
) {
return <Icon type="CheckCircle" size={18} className="text-green-d1" />;
}

if (isLoading) {
return <Icon type="Loading" className="animate-spin" />;
}

return (
<button
type="button"
onClick={() => update({ type: "prioritize", uuid: wiseRecipientID })}
>
set default
<Icon
type="CheckCircle"
size={18}
className="text-gray hover:text-green active:text-green-d1"
/>
</button>
);
}
Expand Down

0 comments on commit 015b60f

Please sign in to comment.