From e5b9f1ef569740b1aef3cf322a1e86c7c9a20673 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Mon, 2 Feb 2026 18:39:43 -0700 Subject: [PATCH] Fixes --- .../game/berry-dash/icon-marketplace/page.tsx | 45 ++++++++++++++++++- src/app/game/berry-dash/page.tsx | 2 +- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/app/game/berry-dash/icon-marketplace/page.tsx b/src/app/game/berry-dash/icon-marketplace/page.tsx index e1672c7..1fd072c 100644 --- a/src/app/game/berry-dash/icon-marketplace/page.tsx +++ b/src/app/game/berry-dash/icon-marketplace/page.tsx @@ -5,6 +5,7 @@ import axios from 'axios' import { BackButton } from '@/app/components/BackButton' import { ReloadButton } from '@/app/components/ReloadButton' import { UploadButton } from '@/app/components/UploadButton' +import { CustomIconEntry } from '../chatroom/page' interface MarketplaceIcon { username: string @@ -19,6 +20,7 @@ interface MarketplaceIcon { export default function BerryDashIconMarketplace () { const [response, setResponse] = useState(null) + const [customIconCache, setCustomIconCache] = useState([]) async function Refresh () { try { @@ -34,6 +36,42 @@ export default function BerryDashIconMarketplace () { Refresh() }, []) + useEffect(() => { + if (response == null || response == -1) return + const all = customIconCache.map(icon => icon.id) + const allFromMessages = Array.from( + new Set(response.filter(icon => icon.id != null).map(icon => icon.id)) + ) + const notInAllIds = allFromMessages + .filter(id => !all.includes(id)) + .map(id => `"${id}"`) + .join(',') + + if (notInAllIds.length != 0) { + ;(async () => { + const result = await axios.get( + `/api/berrydash/icon-marketplace/icon?ids=[${notInAllIds}]` + ) + if (result.data.success) { + const add: CustomIconEntry[] = [] + for (const item of result.data.data) { + add.push({ + data: item.data, + id: item.id + }) + } + setCustomIconCache(prev => [ + ...prev, + ...result.data.data.map((item: CustomIconEntry) => ({ + data: item.data, + id: item.id + })) + ]) + } + })() + } + }, [response]) + return (
@@ -56,7 +94,12 @@ export default function BerryDashIconMarketplace () {
i.id === icon.id) + ? 'data:image/png;base64,' + + customIconCache.find(i => i.id === icon.id)?.data + : 'https://games-r2.lncvrt.xyz/game-assets/berrydash/other/loading.png' + } width={96} height={96} draggable={false} diff --git a/src/app/game/berry-dash/page.tsx b/src/app/game/berry-dash/page.tsx index 9312c4e..74898d2 100644 --- a/src/app/game/berry-dash/page.tsx +++ b/src/app/game/berry-dash/page.tsx @@ -114,7 +114,7 @@ export default function BerryDashGameInfo () { View & interact with the Chatroom! - View the Leaderboards + View the Leaderboards!

Downloads