feat(MessagesDialog, StatusBar, i18n): enhance character death notifications and UI updates
- Added support for displaying character death notifications with detailed information including age, region, and relationships in both German and English. - Updated MessagesDialog to format additional parameters such as region, spouses, children, and lovers based on the locale. - Enhanced StatusBar to show the character's name dynamically, improving user experience. - Modified i18n files to include new notification messages for character deaths, ensuring accurate translations for both languages.
This commit is contained in:
@@ -219,6 +219,8 @@ export default {
|
||||
|
||||
formatParams(params) {
|
||||
const formatted = {};
|
||||
const locale = this.$i18n?.locale || 'de';
|
||||
const isGerman = String(locale).startsWith('de');
|
||||
|
||||
// Geldbeträge formatieren
|
||||
if (params.amount !== undefined) {
|
||||
@@ -246,6 +248,26 @@ export default {
|
||||
if (params.storage_destruction_percent !== undefined) {
|
||||
formatted.destructionPercent = ` Lager zerstört: ${params.storage_destruction_percent.toFixed(1)}%.`;
|
||||
}
|
||||
if (params.regionLabel) {
|
||||
formatted.regionLabel = isGerman
|
||||
? ` Ort: ${params.regionLabel}.`
|
||||
: ` Location: ${params.regionLabel}.`;
|
||||
}
|
||||
if (params.spouses) {
|
||||
formatted.spouses = isGerman
|
||||
? ` Ehepartner: ${params.spouses}.`
|
||||
: ` Spouses: ${params.spouses}.`;
|
||||
}
|
||||
if (params.children) {
|
||||
formatted.children = isGerman
|
||||
? ` Kinder: ${params.children}.`
|
||||
: ` Children: ${params.children}.`;
|
||||
}
|
||||
if (params.lovers) {
|
||||
formatted.lovers = isGerman
|
||||
? ` Geliebte: ${params.lovers}.`
|
||||
: ` Lovers: ${params.lovers}.`;
|
||||
}
|
||||
|
||||
// Alle anderen Parameter übernehmen
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
@@ -304,6 +326,30 @@ export default {
|
||||
if (n.amount !== undefined) {
|
||||
params.amount = n.amount;
|
||||
}
|
||||
|
||||
if (n.deceased && typeof n.deceased === 'object') {
|
||||
if (n.deceased.display_name) {
|
||||
params.characterName = n.deceased.display_name;
|
||||
}
|
||||
if (n.deceased.region_label) {
|
||||
params.regionLabel = n.deceased.region_label;
|
||||
}
|
||||
if (n.deceased.age_years !== undefined && n.deceased.age_years !== null) {
|
||||
params.ageYears = n.deceased.age_years;
|
||||
}
|
||||
}
|
||||
|
||||
if (n.linked && typeof n.linked === 'object') {
|
||||
if (Array.isArray(n.linked.spouses) && n.linked.spouses.length > 0) {
|
||||
params.spouses = n.linked.spouses.join(', ');
|
||||
}
|
||||
if (Array.isArray(n.linked.children) && n.linked.children.length > 0) {
|
||||
params.children = n.linked.children.join(', ');
|
||||
}
|
||||
if (Array.isArray(n.linked.lovers) && n.linked.lovers.length > 0) {
|
||||
params.lovers = n.linked.lovers.join(', ');
|
||||
}
|
||||
}
|
||||
|
||||
return this.formatParams(params);
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
<span class="badge" v-if="unreadCount > 0">{{ unreadCount }}</span>
|
||||
<img src="/images/icons/falukant/messages24.png" class="menu-icon" />
|
||||
</div>
|
||||
<div v-if="characterName" class="status-identity" :title="characterName">
|
||||
<span class="status-identity__label">{{ $t('falukant.overview.metadata.name') }}</span>
|
||||
<strong class="status-identity__name">{{ characterName }}</strong>
|
||||
</div>
|
||||
<template v-for="item in statusItems" :key="item.key">
|
||||
<div class="status-item" v-if="item.value !== null && item.image == null">
|
||||
<span class="status-icon-wrapper">
|
||||
@@ -76,6 +80,7 @@ export default {
|
||||
active: false,
|
||||
inDebtorsPrison: false
|
||||
},
|
||||
characterName: '',
|
||||
pendingStatusRefresh: null,
|
||||
};
|
||||
},
|
||||
@@ -155,6 +160,9 @@ export default {
|
||||
const response = await apiClient.get("/api/falukant/info");
|
||||
const { money, character, events } = response.data;
|
||||
const { age, health } = character;
|
||||
const firstName = character?.definedFirstName?.name || '';
|
||||
const lastName = character?.definedLastName?.name || '';
|
||||
this.characterName = [firstName, lastName].filter(Boolean).join(' ');
|
||||
const relationship = response.data.character.relationshipsAsCharacter1[0]?.relationshipType?.tr
|
||||
|| response.data.character.relationshipsAsCharacter2[0]?.relationshipType?.tr
|
||||
|| null;
|
||||
@@ -349,6 +357,35 @@ export default {
|
||||
border: 1px solid rgba(93, 64, 55, 0.08);
|
||||
}
|
||||
|
||||
.status-identity {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 0.5rem;
|
||||
min-height: 34px;
|
||||
padding: 0.2rem 0.95rem;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(248, 241, 231, 0.98) 100%);
|
||||
border: 1px solid rgba(126, 71, 27, 0.16);
|
||||
box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
|
||||
max-width: min(100%, 26rem);
|
||||
}
|
||||
|
||||
.status-identity__label {
|
||||
font-size: 0.72rem;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: #9a7a5f;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.status-identity__name {
|
||||
font-size: 0.98rem;
|
||||
color: #5f3617;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.quick-access {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
},
|
||||
"notifications": {
|
||||
"notify_election_created": "Es wurde eine neue Wahl ausgeschrieben.",
|
||||
"director_death": "{characterName} ist im Alter von {ageYears} Jahren verstorben. Als Arbeitgeber musst du die Direktion neu besetzen.{regionLabel}{spouses}{children}{lovers}",
|
||||
"relationship_death": "{characterName} ist im Alter von {ageYears} Jahren verstorben.{regionLabel}{spouses}{children}{lovers}",
|
||||
"child_death": "Dein Kind {characterName} ist im Alter von {ageYears} Jahren verstorben.{regionLabel}",
|
||||
"production": {
|
||||
"overproduction": "Überproduktion: Deine Produktion liegt {value}% über dem Bedarf."
|
||||
},
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
},
|
||||
"notifications": {
|
||||
"notify_election_created": "A new election has been scheduled.",
|
||||
"director_death": "{characterName} died at the age of {ageYears}. As employer you need to appoint a new director.{regionLabel}{spouses}{children}{lovers}",
|
||||
"relationship_death": "{characterName} died at the age of {ageYears}.{regionLabel}{spouses}{children}{lovers}",
|
||||
"child_death": "Your child {characterName} died at the age of {ageYears}.{regionLabel}",
|
||||
"production": {
|
||||
"overproduction": "Overproduction: your production is {value}% above demand."
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user