Enhance usability and localization across components: Update USABILITY_CONCEPT.md with new focus areas, improve user feedback in AppFooter and FamilyView components, and refine text in various UI elements for better clarity and consistency. Replace console logs with user-friendly messages, correct German translations, and streamline interaction logic in multiple components.
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
<div>
|
||||
<span class="forum-kicker">Community-Forum</span>
|
||||
<h2>{{ $t('socialnetwork.forum.title') }} {{ forumName }}</h2>
|
||||
<p>Themen, Diskussionen und neue Beitraege an einem strukturierten Ort.</p>
|
||||
<p>Themen, Diskussionen und neue Beiträge an einem strukturierten Ort.</p>
|
||||
</div>
|
||||
<div class="creationtoggler">
|
||||
<button @click="createNewTopic">
|
||||
<button @click="toggleCreation">
|
||||
{{ $t(!inCreation
|
||||
? 'socialnetwork.forum.showNewTopic'
|
||||
: 'socialnetwork.forum.hideNewTopic') }}
|
||||
@@ -16,16 +16,26 @@
|
||||
</section>
|
||||
|
||||
<section v-if="inCreation" class="forum-creation surface-card">
|
||||
<div class="forum-creation__header">
|
||||
<div>
|
||||
<h3>Neues Thema verfassen</h3>
|
||||
<p>Erst Titel setzen, dann den Beitrag schreiben und anschließend direkt veröffentlichen.</p>
|
||||
</div>
|
||||
<button type="button" class="button-secondary" @click="cancelCreation">Abbrechen</button>
|
||||
</div>
|
||||
<label class="newtitle">
|
||||
<span>{{ $t('socialnetwork.forum.topic') }}</span>
|
||||
<input type="text" v-model="newTitle" />
|
||||
<input ref="titleInput" type="text" v-model="newTitle" />
|
||||
</label>
|
||||
<div class="editor-container">
|
||||
<EditorContent v-if="editor" :editor="editor" class="editor" />
|
||||
</div>
|
||||
<button @click="saveNewTopic">
|
||||
{{ $t('socialnetwork.forum.createNewTopic') }}
|
||||
</button>
|
||||
<div class="forum-creation__actions">
|
||||
<button :disabled="!canSaveTopic" @click="saveNewTopic">
|
||||
{{ $t('socialnetwork.forum.createNewTopic') }}
|
||||
</button>
|
||||
<span class="forum-creation__hint">Titel und Inhalt müssen beide ausgefüllt sein.</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-else-if="titles.length > 0" class="forum-topics surface-card">
|
||||
@@ -47,7 +57,8 @@
|
||||
</section>
|
||||
|
||||
<div v-else class="forum-empty surface-card">
|
||||
{{ $t('socialnetwork.forum.noTitles') }}
|
||||
<p>{{ $t('socialnetwork.forum.noTitles') }}</p>
|
||||
<button type="button" @click="toggleCreation">{{ $t('socialnetwork.forum.createNewTopic') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -56,6 +67,7 @@
|
||||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||||
import StarterKit from '@tiptap/starter-kit'
|
||||
import apiClient from '../../utils/axios'
|
||||
import { showApiError, showSuccess } from '@/utils/feedback.js';
|
||||
|
||||
export default {
|
||||
name: 'ForumView',
|
||||
@@ -78,6 +90,10 @@ export default {
|
||||
},
|
||||
totalPages() {
|
||||
return Math.ceil(this.numberOfItems / 25)
|
||||
},
|
||||
canSaveTopic() {
|
||||
const content = this.editor ? this.editor.getText().trim() : '';
|
||||
return this.newTitle.trim().length >= 3 && content.length > 0;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -109,6 +125,24 @@ export default {
|
||||
if (this.editor) this.editor.destroy()
|
||||
},
|
||||
methods: {
|
||||
focusTitleInput() {
|
||||
this.$nextTick(() => this.$refs.titleInput?.focus?.());
|
||||
},
|
||||
toggleCreation() {
|
||||
this.inCreation = !this.inCreation;
|
||||
if (this.inCreation && this.editor) {
|
||||
this.editor.commands.setContent('');
|
||||
this.newTitle = '';
|
||||
this.focusTitleInput();
|
||||
}
|
||||
},
|
||||
cancelCreation() {
|
||||
this.inCreation = false;
|
||||
this.newTitle = '';
|
||||
if (this.editor) {
|
||||
this.editor.commands.setContent('');
|
||||
}
|
||||
},
|
||||
async loadForum() {
|
||||
try {
|
||||
const { data } = await apiClient.get(
|
||||
@@ -121,16 +155,9 @@ export default {
|
||||
console.error('Fehler beim Laden des Forums', err)
|
||||
}
|
||||
},
|
||||
createNewTopic() {
|
||||
this.inCreation = !this.inCreation
|
||||
if (this.inCreation && this.editor) {
|
||||
this.editor.commands.setContent('')
|
||||
this.$nextTick(() => this.editor?.commands.focus('end'))
|
||||
}
|
||||
},
|
||||
async saveNewTopic() {
|
||||
const content = this.editor ? this.editor.getHTML() : ''
|
||||
if (!this.newTitle.trim() || !content.trim()) return
|
||||
if (!this.canSaveTopic) return
|
||||
try {
|
||||
const { data } = await apiClient.post(
|
||||
'/api/forum/topic',
|
||||
@@ -147,8 +174,11 @@ export default {
|
||||
this.page = data.page
|
||||
this.inCreation = false
|
||||
this.newTitle = ''
|
||||
this.editor?.commands.setContent('')
|
||||
showSuccess(this, 'Thema erfolgreich erstellt.')
|
||||
} catch (err) {
|
||||
console.error('Fehler beim Erstellen des Themas', err)
|
||||
showApiError(this, err, 'Fehler beim Erstellen des Themas')
|
||||
}
|
||||
},
|
||||
goToPage(page) {
|
||||
@@ -211,6 +241,30 @@ export default {
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.forum-creation__header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.forum-creation__header h3 {
|
||||
margin: 0 0 6px;
|
||||
}
|
||||
|
||||
.forum-creation__header p,
|
||||
.forum-creation__hint {
|
||||
margin: 0;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.forum-creation__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.newtitle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -289,12 +343,20 @@ export default {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.forum-empty p {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.forum-hero {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.forum-creation__header {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.topic-card__main {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user