Add functionality to upload and display articles with associated images

Update article page to handle image uploads and display articles from text files. Refactor currency and date formatting, and add a method to fetch prediction markets by ID.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 0fb68265-c270-4198-9584-3d9be9bddb41
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/0fb68265-c270-4198-9584-3d9be9bddb41/rOJiPGe
This commit is contained in:
kimjaehyeon0101
2025-09-30 04:12:43 +00:00
parent 117f2e468d
commit 6c4d4dcadf
16 changed files with 87 additions and 12 deletions

View File

@ -29,10 +29,7 @@ export default function Article() {
const placeBetMutation = useMutation({
mutationFn: async ({ marketId, side, amount }: { marketId: string; side: "yes" | "no"; amount: number }) => {
return apiRequest(`/api/prediction-markets/${marketId}/bets`, {
method: "POST",
body: { side, amount }
});
return apiRequest("POST", `/api/prediction-markets/${marketId}/bets`, { side, amount });
},
onSuccess: () => {
toast({
@ -51,18 +48,21 @@ export default function Article() {
}
});
const formatCurrency = (amount: string | number) => {
const formatCurrency = (amount: string | number | null) => {
if (!amount) return '₩0';
return new Intl.NumberFormat('ko-KR', {
style: 'currency',
currency: 'KRW'
}).format(Number(amount));
};
const formatPercentage = (value: number) => {
return `${(value * 100).toFixed(1)}%`;
const formatPercentage = (value: string | number | null) => {
if (!value) return '0.0%';
return `${(Number(value) * 100).toFixed(1)}%`;
};
const formatDate = (dateString: string) => {
const formatDate = (dateString: string | Date | null) => {
if (!dateString) return '미정';
return new Intl.DateTimeFormat('ko-KR', {
year: 'numeric',
month: 'long',