Bereinigen und Entfernen von nicht mehr benötigten TinyMCE-Dateien und -Plugins; Aktualisierung der Internationalisierung für Deutsch und Englisch in den Falukant- und Navigationsmodulen; Verbesserung der Statusleiste und Router-Implementierung.
This commit is contained in:
@@ -1,8 +1,20 @@
|
||||
<template>
|
||||
<div class="statusbar">
|
||||
<div class="status-item messages" @click="openMessages" :title="$t('falukant.messages.tooltip')">
|
||||
<span class="badge" v-if="unreadCount > 0">{{ unreadCount }}</span>
|
||||
<img src="/images/icons/falukant/messages24.png" class="menu-icon" />
|
||||
</div>
|
||||
<template v-for="item in statusItems" :key="item.key">
|
||||
<div class="status-item" v-if="item.value !== null && item.image == null" :title="$t(`falukant.statusbar.${item.key}`)">
|
||||
<span class="status-icon">{{ item.icon }}: {{ item.value }}</span>
|
||||
<span class="status-icon">
|
||||
<template v-if="item.iconImage">
|
||||
<img :src="'/images/icons/' + item.iconImage" class="inline-icon" width="16" height="16" />:
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.icon }}:
|
||||
</template>
|
||||
{{ item.value }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="status-item" v-else-if="item.image !== null" :title="$t(`falukant.statusbar.${item.key}`)">
|
||||
<span class="status-icon">{{ item.icon }}:</span> <img :src="'/images/icons/falukant/relationship-' + item.image + '.png'" class="relationship-icon" />
|
||||
@@ -13,24 +25,29 @@
|
||||
<img :src="'/images/icons/falukant/shortmap/' + key + '.png'" class="menu-icon" @click="openPage(menuItem)" :title="$t(`navigation.m-falukant.${key}`)" />
|
||||
</template>
|
||||
</span>
|
||||
<MessagesDialog ref="msgs" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from "vuex";
|
||||
import apiClient from "@/utils/axios.js";
|
||||
import MessagesDialog from './MessagesDialog.vue';
|
||||
|
||||
export default {
|
||||
name: "StatusBar",
|
||||
components: { MessagesDialog },
|
||||
data() {
|
||||
return {
|
||||
statusItems: [
|
||||
{ key: "age", icon: "👶", value: 0 },
|
||||
{ key: "age", icon: null, iconImage: 'falukant/age.png', value: 0 },
|
||||
{ key: "relationship", icon: "💑", image: null },
|
||||
{ key: "wealth", icon: "💰", value: 0 },
|
||||
{ key: "health", icon: "❤️", value: "Good" },
|
||||
{ key: "events", icon: "📰", value: null, image: null },
|
||||
{ key: "children", icon: "👶", value: null },
|
||||
],
|
||||
unreadCount: 0,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -38,7 +55,7 @@ export default {
|
||||
...mapGetters(['menu']),
|
||||
},
|
||||
async mounted() {
|
||||
await this.fetchStatus();
|
||||
await this.fetchStatus();
|
||||
if (this.socket) {
|
||||
this.socket.on("falukantUpdateStatus", this.fetchStatus);
|
||||
}
|
||||
@@ -63,6 +80,11 @@ export default {
|
||||
const relationship = response.data.character.relationshipsAsCharacter1[0]?.relationshipType?.tr
|
||||
|| response.data.character.relationshipsAsCharacter2[0]?.relationshipType?.tr
|
||||
|| null;
|
||||
// Children counts and unread notifications are now part of /info
|
||||
const childCount = Number(response.data.childrenCount) || 0;
|
||||
const unbaptisedCount = Number(response.data.unbaptisedChildrenCount) || 0;
|
||||
this.unreadCount = Number(response.data.unreadNotifications) || 0;
|
||||
const childrenDisplay = `${childCount}${unbaptisedCount > 0 ? `(${unbaptisedCount})` : ''}`;
|
||||
let healthStatus = '';
|
||||
if (health > 90) {
|
||||
healthStatus = this.$t("falukant.health.amazing");
|
||||
@@ -76,11 +98,12 @@ export default {
|
||||
healthStatus = this.$t("falukant.health.very_bad");
|
||||
}
|
||||
this.statusItems = [
|
||||
{ key: "age", icon: "👶", value: age },
|
||||
{ key: "age", icon: null, iconImage: 'falukant/age.png', value: age },
|
||||
{ key: "relationship", icon: "💑", image: relationship },
|
||||
{ key: "wealth", icon: "💰", value: Intl.NumberFormat(navigator.language, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(money) },
|
||||
{ key: "health", icon: "❤️", value: healthStatus },
|
||||
{ key: "events", icon: "📰", value: events || null, image: null },
|
||||
{ key: "children", icon: "👶", value: childrenDisplay },
|
||||
];
|
||||
} catch (error) {
|
||||
console.error("Error fetching status:", error);
|
||||
@@ -95,6 +118,9 @@ export default {
|
||||
if (data.event === "falukantUpdateStatus") {
|
||||
this.fetchStatus();
|
||||
}
|
||||
if (data.event === 'stock_change' || data.event === 'familychanged') {
|
||||
this.fetchStatus();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error parsing daemonSocket message:", error, event.data);
|
||||
}
|
||||
@@ -107,6 +133,11 @@ export default {
|
||||
this.$router.push(url);
|
||||
}
|
||||
},
|
||||
openMessages() {
|
||||
this.$refs.msgs.open();
|
||||
// After opening, refresh unread count after a short delay (server marks them shown)
|
||||
setTimeout(() => this.fetchStatus(), 500);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -147,4 +178,26 @@ export default {
|
||||
max-width: 24px;
|
||||
max-height: 24px;
|
||||
}
|
||||
|
||||
.messages { position: relative; }
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
right: -2px;
|
||||
background: #e53935;
|
||||
color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 0 6px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
min-width: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.inline-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
vertical-align: middle;
|
||||
margin-right: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user