Refactor DashboardWidget and LoggedInView: Update DashboardWidget to display a single news article instead of a list, enhancing user experience. Remove logout button and related functionality from LoggedInView to streamline the interface.
This commit is contained in:
@@ -14,15 +14,13 @@
|
||||
<div v-else-if="error" class="dashboard-widget__state dashboard-widget__error">{{ error }}</div>
|
||||
<div v-else class="dashboard-widget__body">
|
||||
<slot :data="data">
|
||||
<template v-if="newsDataResults.length">
|
||||
<ul class="dashboard-widget__list">
|
||||
<li v-for="(item, i) in newsDataResults" :key="item.article_id || i" class="dashboard-widget__list-item">
|
||||
<a v-if="item.link" :href="item.link" target="_blank" rel="noopener noreferrer" class="dashboard-widget__news-title">{{ item.title || '—' }}</a>
|
||||
<span v-else class="dashboard-widget__title-text">{{ item.title || '—' }}</span>
|
||||
<span v-if="item.pubDate" class="dashboard-widget__date">{{ formatNewsDate(item.pubDate) }}</span>
|
||||
<p v-if="item.description" class="dashboard-widget__desc">{{ item.description }}</p>
|
||||
</li>
|
||||
</ul>
|
||||
<template v-if="newsDataSingleItem">
|
||||
<article class="dashboard-widget__news-single">
|
||||
<a v-if="newsDataSingleItem.link" :href="newsDataSingleItem.link" target="_blank" rel="noopener noreferrer" class="dashboard-widget__news-title">{{ newsDataSingleItem.title || '—' }}</a>
|
||||
<span v-else class="dashboard-widget__title-text">{{ newsDataSingleItem.title || '—' }}</span>
|
||||
<span v-if="newsDataSingleItem.pubDate" class="dashboard-widget__date">{{ formatNewsDate(newsDataSingleItem.pubDate) }}</span>
|
||||
<p v-if="newsDataSingleItem.description" class="dashboard-widget__desc">{{ newsDataSingleItem.description }}</p>
|
||||
</article>
|
||||
</template>
|
||||
<template v-else-if="falukantData">
|
||||
<dl class="dashboard-widget__falukant">
|
||||
@@ -86,6 +84,11 @@ export default {
|
||||
if (d && typeof d === 'object' && Array.isArray(d.results)) return d.results;
|
||||
return [];
|
||||
},
|
||||
/** Pro News-Widget wird nur ein Artikel angezeigt (erster der Seite; Counter sorgt für unterschiedliche Seiten). */
|
||||
newsDataSingleItem() {
|
||||
const list = this.newsDataResults;
|
||||
return list.length ? list[0] : null;
|
||||
},
|
||||
falukantData() {
|
||||
const d = this.data;
|
||||
if (d && typeof d === 'object' && 'characterName' in d && 'money' in d) return d;
|
||||
@@ -203,11 +206,11 @@ export default {
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
background: var(--dashboard-widget-title-bg, #f1f3f5);
|
||||
border-bottom: 1px solid var(--dashboard-widget-border, #dee2e6);
|
||||
background: var(--color-primary-orange-light, #fff8e1);
|
||||
border-bottom: 1px solid var(--color-text-secondary, #dee2e6);
|
||||
font-weight: 600;
|
||||
font-size: 0.95rem;
|
||||
color: var(--dashboard-widget-title-color, #333);
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.dashboard-widget__drag-handle {
|
||||
@@ -227,6 +230,7 @@ export default {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.dashboard-widget__frame {
|
||||
@@ -276,13 +280,18 @@ export default {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.dashboard-widget__news-single {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.dashboard-widget__news-title {
|
||||
font-weight: 600;
|
||||
color: #0d6efd;
|
||||
color: var(--color-primary-orange);
|
||||
text-decoration: none;
|
||||
}
|
||||
.dashboard-widget__news-title:hover {
|
||||
text-decoration: underline;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.dashboard-widget__desc {
|
||||
|
||||
Reference in New Issue
Block a user