+
+
+
+
+ {/* Bounty Type Filter */}
+
+
+
+
+
+
+
handleSortChange(opt.value)}
diff --git a/components/Bounty/BountyForm.tsx b/components/Bounty/BountyForm.tsx
index dd5fa1578..8710c8d9e 100644
--- a/components/Bounty/BountyForm.tsx
+++ b/components/Bounty/BountyForm.tsx
@@ -404,7 +404,9 @@ export function BountyForm({ workId, onSubmitSuccess, className }: BountyFormPro
const getFormattedInputValue = () => {
if (inputAmount === 0) return '';
- return inputAmount.toLocaleString();
+ return inputAmount.toLocaleString(undefined, {
+ maximumFractionDigits: currency === 'USD' ? 2 : 0,
+ });
};
const toggleCurrency = () => {
@@ -413,7 +415,13 @@ export function BountyForm({ workId, onSubmitSuccess, className }: BountyFormPro
toast.error('Exchange rate is loading. Please wait before switching to USD.');
return;
}
- setCurrency(currency === 'RSC' ? 'USD' : 'RSC');
+
+ const nextCurrency = currency === 'RSC' ? 'USD' : 'RSC';
+ const nextAmount =
+ nextCurrency === 'USD' ? inputAmount * exchangeRate : inputAmount / exchangeRate;
+
+ setCurrency(nextCurrency);
+ setInputAmount(nextCurrency === 'USD' ? Number(nextAmount.toFixed(2)) : Math.round(nextAmount));
};
const getConvertedAmount = () => {
@@ -421,13 +429,14 @@ export function BountyForm({ workId, onSubmitSuccess, className }: BountyFormPro
if (isExchangeRateLoading) return '';
return currency === 'RSC'
- ? `≈ $${(inputAmount * exchangeRate).toLocaleString()} USD`
- : `≈ ${(inputAmount / exchangeRate).toLocaleString()} RSC`;
+ ? `≈ $${(inputAmount * exchangeRate).toLocaleString(undefined, { maximumFractionDigits: 2 })} USD`
+ : `≈ ${Math.round(inputAmount / exchangeRate).toLocaleString()} RSC`;
};
const getRscAmount = () => {
if (isExchangeRateLoading) return currency === 'RSC' ? inputAmount : 0;
- return currency === 'RSC' ? inputAmount : inputAmount / exchangeRate;
+ const amount = currency === 'RSC' ? inputAmount : inputAmount / exchangeRate;
+ return Math.round(amount);
};
const handleEditorContent = (content: any) => {
diff --git a/components/Bounty/BountyInfo.tsx b/components/Bounty/BountyInfo.tsx
index 3b243d033..8d50212a6 100644
--- a/components/Bounty/BountyInfo.tsx
+++ b/components/Bounty/BountyInfo.tsx
@@ -190,7 +190,7 @@ export const BountyInfo: FC = ({
};
// Get display amount (handles Foundation bounties with flat $150 USD)
- const { amount: displayAmount } = useMemo(
+ const { amount: displayAmount, isFoundation } = useMemo(
() => getBountyDisplayAmount(bounty, exchangeRate, showUSD),
[bounty, exchangeRate, showUSD]
);
@@ -231,7 +231,7 @@ export const BountyInfo: FC = ({
variant="text"
size="md"
showText={true}
- currency={showUSD ? 'USD' : 'RSC'}
+ currency={isFoundation ? 'USD' : showUSD ? 'USD' : 'RSC'}
className="p-0 gap-0"
textColor={isActive ? 'text-orange-700' : 'text-gray-600'}
fontWeight="font-bold"
@@ -239,7 +239,7 @@ export const BountyInfo: FC = ({
iconColor={isActive ? '#ea580c' : colors.gray[500]}
iconSize={18}
shorten
- skipConversion={showUSD}
+ skipConversion={isFoundation || showUSD}
/>
diff --git a/components/Bounty/BountyInfoSummary.tsx b/components/Bounty/BountyInfoSummary.tsx
index e7fc6fbc8..42af20fbf 100644
--- a/components/Bounty/BountyInfoSummary.tsx
+++ b/components/Bounty/BountyInfoSummary.tsx
@@ -31,11 +31,13 @@ export const BountyInfoSummary: FC
= ({
);
// Calculate display amount (handles Foundation bounties with flat $150 USD)
- const { amount: totalAmount } = useMemo(
+ const { amount: totalAmount, foundationBountyCount } = useMemo(
() => getTotalBountyDisplayAmount(openBounties, exchangeRate, showUSD),
[openBounties, exchangeRate, showUSD]
);
+ const isAllFoundation = foundationBountyCount > 0 && foundationBountyCount === openBounties.length;
+
// If no open bounties, don't render anything
if (openBounties.length === 0) {
return null;
@@ -60,14 +62,14 @@ export const BountyInfoSummary: FC = ({
variant="text"
size="xl"
showText={true}
- currency={showUSD ? 'USD' : 'RSC'}
+ currency={isAllFoundation ? 'USD' : showUSD ? 'USD' : 'RSC'}
className="p-0 gap-0"
textColor="text-gray-700"
showExchangeRate={false}
iconColor={colors.gray[700]}
iconSize={24}
shorten
- skipConversion={showUSD}
+ skipConversion={isAllFoundation || showUSD}
/>