aboutsummaryrefslogtreecommitdiffstats
path: root/site
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-06-30 23:52:06 -0700
committerPinapelz <yukais@pinapelz.com>2025-06-30 23:52:06 -0700
commit89550dc39da5ccdb7e729c1dc2b68e5075980bd4 (patch)
tree661358270b8bded2c2f9a620d43e3e7278db87ee /site
parentfc98ffbe8feb184ba88fb805a4c3b9ad018a6167 (diff)
adjust newsId to map non-ascii characters
vercel limitation
Diffstat (limited to 'site')
-rw-r--r--site/src/components/NewsFeed.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/site/src/components/NewsFeed.tsx b/site/src/components/NewsFeed.tsx
index 881beaa..fe81148 100644
--- a/site/src/components/NewsFeed.tsx
+++ b/site/src/components/NewsFeed.tsx
@@ -46,7 +46,8 @@ export const NewsFeed: React.FC<NewsFeedProps> = ({ newsItems }) => {
const initialImageIndex: Record<string, number> = {};
newsItems.forEach((news) => {
const contentHash = news.content.split('').reduce((hash, char) => ((hash << 5) + hash) + char.charCodeAt(0), 5381) >>> 0;
- const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${news.headline}`;
+ const headlineHash = (news.headline || 'null').split('').reduce((hash, char) => ((hash << 5) + hash) + char.charCodeAt(0), 5381) >>> 0;
+ const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${headlineHash.toString(16)}`;
initialImageIndex[newsId] = 0;
});
setCurrentImageIndex(initialImageIndex);
@@ -70,7 +71,8 @@ export const NewsFeed: React.FC<NewsFeedProps> = ({ newsItems }) => {
{newsItems.map((news) => {
const date = new Date(news.timestamp * 1000).toLocaleDateString("ja-JP", { year: "numeric", month: "2-digit", day: "2-digit" });
const contentHash = news.content.split('').reduce((hash, char) => ((hash << 5) + hash) + char.charCodeAt(0), 5381) >>> 0;
- const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${news.headline}`;
+ const headlineHash = (news.headline || 'null').split('').reduce((hash, char) => ((hash << 5) + hash) + char.charCodeAt(0), 5381) >>> 0;
+ const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${headlineHash.toString(16)}`;
const isEnglish = !!showEnglish[newsId];
const hasTranslation = news.en_headline || news.en_content;
const displayHeadline = isEnglish && news.en_headline ? news.en_headline : news.headline;
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage