Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance UX for Category Edit Dialog in Knowledge Base Section of Helpdesk Portal #1956

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions desk/src/pages/knowledge-base/KnowledgeBaseCategory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
<div class="text-xs text-gray-700">Title</div>
<div class="flex items-center gap-2">
<KnowledgeBaseIconSelector
:icon="newCategoryIcon || category.doc?.icon"
:icon="newCategoryIcon"
@select="(icon) => (newCategoryIcon = icon)"
/>
<FormControl
v-model="category.doc.category_name"
v-model="newCategoryName"
placeholder="A brief guide"
type="text"
/>
Expand All @@ -70,7 +70,7 @@
<div class="space-y-2">
<div class="text-xs text-gray-700">Description</div>
<FormControl
v-model="category.doc.description"
v-model="newCategoryDescription"
placeholder="A short description"
type="textarea"
/>
Expand Down Expand Up @@ -118,7 +118,7 @@
</div>
</template>
<script setup lang="ts">
import { ref, toRef } from "vue";
import { ref, toRef, watch } from "vue";
import { useRouter } from "vue-router";
import {
createResource,
Expand Down Expand Up @@ -168,11 +168,20 @@ const category = createDocumentResource({
icon: "check",
iconClasses: "text-green-500",
});
showEdit.value = false;
},
onError: useError({ title: "Error updating category" }),
},
});

watch(showEdit, (newValue) => {
if (newValue) {
newCategoryName.value = category.doc.category_name || "";
newCategoryDescription.value = category.doc.description || "";
newCategoryIcon.value = category.doc.icon || "";
}
});

const saveCategory = debounce(
() =>
category.setValue.submit({
Expand Down
Loading