--- import { ObjectId } from 'mongodb'; import { getUserResources } from '../lib/utils/resourceManager'; import { getHighestWeightedLanguage, getLocales } from '../lib/lang/langDriver'; import resourceTypes from '../lib/data/resources.json'; import format from '../lib/utils/format'; const resourceLang = await getLocales(getHighestWeightedLanguage(Astro.request.headers.get('accept-language')), 'resources'); const resBarLang = await getLocales(getHighestWeightedLanguage(Astro.request.headers.get('accept-language')), 'resourcebar'); const resources = await getUserResources(new ObjectId(Astro.cookies.get('userid')?.value ?? '')); const resourceArray = []; for(const key in resources) { resourceArray.push(resources[key as never]); } ---
{resourceArray.map(res =>
x.name === res.name)?.type ?? "solid"} data-res-amount={res.amount} data-res-mining-rate={res.perHourMiningRate} style={(resourceTypes.find(x => x.name === res.name)?.type ?? "solid") === "solid" ? "" : "display: none;"} >
x.name === res.name)?.icon ?? "#"} alt={res.name} />
{resourceLang[`Label_${res.name}`]}
{Math.floor(res.amount).toString()}
{resBarLang['Label_avaliable']} - {Math.floor(res.amount).toString()}
{resBarLang['Label_production']} - {res.perHourMiningRate.toString()}
{resBarLang['Label_capacity']} - {'21372137'}
)}