Refactor RecentTransactionsSection

Further refactors RecentTransactionsSection to separate remaining logic. Creates additional hooks and utility files as needed.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-22 13:22:33 +00:00
parent ff4afb0880
commit 78da23abe6
5 changed files with 90 additions and 14 deletions

View File

@@ -0,0 +1,29 @@
/**
* 숫자를 한국 통화 형식으로 변환합니다.
* 1000 -> 1,000원
*/
export const formatCurrency = (amount: number): string => {
return amount.toLocaleString('ko-KR') + '원';
};
/**
* 문자열에서 숫자만 추출합니다.
* "1,000원" -> 1000
*/
export const extractNumber = (value: string): number => {
const numericValue = value.replace(/[^\d]/g, '');
return numericValue ? parseInt(numericValue, 10) : 0;
};
/**
* 입력값을 통화 형식으로 변환합니다. (입력 필드용)
* 1000 -> "1,000"
*/
export const formatInputCurrency = (value: string): string => {
const numericValue = value.replace(/[^\d]/g, '');
if (!numericValue) return '';
const number = parseInt(numericValue, 10);
return number.toLocaleString('ko-KR');
};