export interface NewsData { date: string; identifier: string; type: string | null; timestamp: number; headline: string | null; content: string; url: string | null; images: Array<{ image: string; link: string | null; }>; } interface NewsFeedProps { newsItems: NewsData[]; } export const NewsFeed: React.FC = ({ newsItems }) => { return (
{newsItems.map((news) => { const formattedDate = new Date(news.timestamp * 1000).toLocaleDateString("ja-JP", { year: "numeric", month: "2-digit", day: "2-digit", }); const gameId = news.identifier; return (
{/* Header (Game Icon + Info) */}
{/* Game Icon */}
{gameId.substring(0, 1)}
{getGameName(news.identifier)} {formattedDate} {/* Display News Type */} {news.type && ( {news.type} )}
{/* Content Area */}
{/* Headline */} {news.headline && (

{news.headline}

)} {/* Content */}

{news.content}

{/* Post Image(s) */}
{news.images.map((img, i) => ( img.link ? ( news visual ) : (
news visual
) ))}
{/* Footer with Read More Link */} {news.url && (
READ MORE
)}
); })}
); }; function getGameName(identifier: string): string | null { if(identifier.startsWith("SOUND_VOLTEX")){ return "SOUND VOLTEX"; } else if(identifier.startsWith("IIDX")){ return "beatmania IIDX"; } else if(identifier.startsWith("CHUNITHM_JP")){ return "CHUNITHM (JAPAN)"; } return null; }