diff --git a/app/kkuko/profile/components/ItemModal.tsx b/app/kkuko/profile/components/ItemModal.tsx index 4e6e5cd..ee49287 100644 --- a/app/kkuko/profile/components/ItemModal.tsx +++ b/app/kkuko/profile/components/ItemModal.tsx @@ -17,7 +17,7 @@ export default function ItemModal({ itemsData, profileData, onClose }: ItemModal const itemOptionUI = (key: string, value: number) => (
{getOptionName(key)}: - {value > 0 ? '+' : ''}{formatNumber(value * 1000)}{key[0] === 'g' ? '%p' : ''} + {value > 0 ? '+' : ''}{formatNumber(value * (key[0] === 'g' ? 100000 : 1000))}{key[0] === 'g' ? '%p' : ''}
) diff --git a/app/kkuko/profile/utils/profileHelper.ts b/app/kkuko/profile/utils/profileHelper.ts index fd3e774..8670ab7 100644 --- a/app/kkuko/profile/utils/profileHelper.ts +++ b/app/kkuko/profile/utils/profileHelper.ts @@ -21,7 +21,7 @@ export const extractColorFromLabel = (description: string, isDarkTheme: boolean) }; export const formatNumber = (num: number): string => { - return (num / 10).toString(); + return (num / 1000).toString(); }; export const calculateTotalOptions = (itemsData: ItemInfo[]) => { @@ -32,13 +32,13 @@ export const calculateTotalOptions = (itemsData: ItemInfo[]) => { const relevantOptions = Date.now() >= item.options.date ? item.options.after : item.options.before; Object.entries(relevantOptions).forEach(([key, value]) => { if (value !== undefined && typeof value === 'number' && !isNaN(value)) { - totals[key] = (totals[key] || 0) + Number(value) * 1000; + totals[key] = (totals[key] || 0) + Number(value) * (key[0] === 'g' ? 100000 : 1000); } }); } else { Object.entries(item.options).forEach(([key, value]) => { if (value !== undefined && typeof value === 'number' && !isNaN(value)) { - totals[key] = (totals[key] || 0) + Number(value) * 1000; + totals[key] = (totals[key] || 0) + Number(value) * (key[0] === 'g' ? 100000 : 1000); } }); } diff --git a/app/kkuko/shared/lib/api.ts b/app/kkuko/shared/lib/api.ts index 5b65c88..3950404 100644 --- a/app/kkuko/shared/lib/api.ts +++ b/app/kkuko/shared/lib/api.ts @@ -1,5 +1,6 @@ import axios from "axios"; import axiosRetry from "axios-retry"; +import type { Mode, ItemInfo } from "@/types/kkuko.types"; axiosRetry(axios, { retries: 5, @@ -17,7 +18,7 @@ const client = axios.create({ }); export async function fetchModes() { - return await client.get('/mode') + return await client.get<{data: Mode[], status: number}>('/mode') } export async function fetchTotalUsers() { @@ -31,7 +32,7 @@ export async function fetchProfile(query: string, type: 'nick' | 'id') { } export async function fetchItems(itemsIds: string) { - return await client.get(`/item?query=${encodeURIComponent(itemsIds)}`); + return await client.get<{data: ItemInfo[], status: number}>(`/item?query=${encodeURIComponent(itemsIds)}`); } export async function fetchExpRank(userId: string) {