Add links to wiki articles in building/research/ship cards

This commit is contained in:
Aelita4 2024-11-08 12:44:26 +01:00
parent 3e50e84b0e
commit d0993a427f
Signed by: Aelita4
GPG Key ID: E44490C2025906C1
4 changed files with 7 additions and 3 deletions

View File

@ -2,6 +2,7 @@
import { getHighestWeightedLanguage, getLocales, getName } from '../lib/utils/langDriver';
interface Props {
category: string;
id: string;
level: string;
name: string;
@ -17,7 +18,7 @@ const lang = await getLocales(Astro.cookies.get('language')?.value ?? await getH
<img class="item-card-image" src={Astro.props.image} />
<div class="item-card-main-field">
<div class="item-card-name">{Astro.props.name} | {Astro.props.level}</div>
<div class="item-card-description">{Astro.props.description}</div>
<div class="item-card-description">{Astro.props.description} <a href={`/wiki/${Astro.props.category}/${Astro.props.id}`}>[more]</a></div>
<form method="post"><input type="hidden" name="id" value={Astro.props.id} /><input type="submit" class="item-card-build" value={getName(lang, Astro.props.button_type, Astro.props.button_name)} /></form>
<div class="item-card-info-button">i</div>
</div>

View File

@ -1,7 +1,7 @@
---
import Layout from '../../layouts/Layout.astro';
import NavBar from '../../components/NavBar.astro';
import BuildingCard from '../../components/ItemCard.astro';
import ItemCard from '../../components/ItemCard.astro';
import { getUserByAccessToken } from '../../lib/db/users';
import { getHighestWeightedLanguage, getLocales, getName, getObj } from '../../lib/utils/langDriver';
import ResourceBar from '../../components/ResourceBar.astro';
@ -89,7 +89,8 @@ const buildingsByCategory = buildingsList.reduce((acc: { [key: string]: Array<DB
<h1>{getName(lang, 'buildings', `cat-${category}`)}</h1>
<div class="building-cat">
{buildings.map(building => (
<BuildingCard
<ItemCard
category="buildings"
id={building.id}
level={building.level.toString()}
name={getObj(lang, "buildings", building.id).name}

View File

@ -71,6 +71,7 @@ for(const research of researchList) {
<div class="research-cards">
{researchList.map(research => <>
<ItemCard
category="research"
id={research.id}
name={getObj(lang, "research", research.id).name}
level={checkUser.research.find(x => x.id === research.id)?.level.toString() ?? "0"}

View File

@ -62,6 +62,7 @@ for(const ship of ships) {
<div class="ship-cards">
{ships.map(ship => <>
<ItemCard
category="ships"
id={ship.id}
name={getObj(lang, "ships", ship.id).name}
level={planet.ships.getShipById(ship.id)?.amount.toString() ?? "0"}