Skip to content

Commit c8c2d85

Browse files
authored
Merge pull request #122 from SolidLoop-studio/dev
fix: 분당 아이템 옵션 버그 수정
2 parents 33a32ed + c472882 commit c8c2d85

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

app/kkuko/profile/components/ItemModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function ItemModal({ itemsData, profileData, onClose }: ItemModal
1717
const itemOptionUI = (key: string, value: number) => (
1818
<div key={key} className="bg-gray-50 dark:bg-gray-700 rounded px-3 py-2">
1919
<span className="text-sm text-gray-600 dark:text-gray-400">{getOptionName(key)}: </span>
20-
<span className="font-semibold text-gray-900 dark:text-gray-100">{value > 0 ? '+' : ''}{formatNumber(value * 1000)}{key[0] === 'g' ? '%p' : ''}</span>
20+
<span className="font-semibold text-gray-900 dark:text-gray-100">{value > 0 ? '+' : ''}{formatNumber(value * (key[0] === 'g' ? 100000 : 1000))}{key[0] === 'g' ? '%p' : ''}</span>
2121
</div>
2222
)
2323

app/kkuko/profile/utils/profileHelper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const extractColorFromLabel = (description: string, isDarkTheme: boolean)
2121
};
2222

2323
export const formatNumber = (num: number): string => {
24-
return (num / 10).toString();
24+
return (num / 1000).toString();
2525
};
2626

2727
export const calculateTotalOptions = (itemsData: ItemInfo[]) => {
@@ -32,13 +32,13 @@ export const calculateTotalOptions = (itemsData: ItemInfo[]) => {
3232
const relevantOptions = Date.now() >= item.options.date ? item.options.after : item.options.before;
3333
Object.entries(relevantOptions).forEach(([key, value]) => {
3434
if (value !== undefined && typeof value === 'number' && !isNaN(value)) {
35-
totals[key] = (totals[key] || 0) + Number(value) * 1000;
35+
totals[key] = (totals[key] || 0) + Number(value) * (key[0] === 'g' ? 100000 : 1000);
3636
}
3737
});
3838
} else {
3939
Object.entries(item.options).forEach(([key, value]) => {
4040
if (value !== undefined && typeof value === 'number' && !isNaN(value)) {
41-
totals[key] = (totals[key] || 0) + Number(value) * 1000;
41+
totals[key] = (totals[key] || 0) + Number(value) * (key[0] === 'g' ? 100000 : 1000);
4242
}
4343
});
4444
}

app/kkuko/shared/lib/api.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import axios from "axios";
22
import axiosRetry from "axios-retry";
3+
import type { Mode, ItemInfo } from "@/types/kkuko.types";
34

45
axiosRetry(axios, {
56
retries: 5,
@@ -17,7 +18,7 @@ const client = axios.create({
1718
});
1819

1920
export async function fetchModes() {
20-
return await client.get('/mode')
21+
return await client.get<{data: Mode[], status: number}>('/mode')
2122
}
2223

2324
export async function fetchTotalUsers() {
@@ -31,7 +32,7 @@ export async function fetchProfile(query: string, type: 'nick' | 'id') {
3132
}
3233

3334
export async function fetchItems(itemsIds: string) {
34-
return await client.get(`/item?query=${encodeURIComponent(itemsIds)}`);
35+
return await client.get<{data: ItemInfo[], status: number}>(`/item?query=${encodeURIComponent(itemsIds)}`);
3536
}
3637

3738
export async function fetchExpRank(userId: string) {

0 commit comments

Comments
 (0)