Skip to content

Commit

Permalink
fix: article list view page
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Jan 14, 2025
1 parent 7858d30 commit c3f9fab
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 11 deletions.
11 changes: 8 additions & 3 deletions desk/src/components/knowledge-base/CategoryFolder.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<template>
<div
<router-link
class="flex flex-col gap-2 rounded-lg border p-3 w-[162px] sm:w-[172px] border-gray-200 cursor-pointer hover:shadow-xl"
@click="console.log('a')"
:to="{
name: 'Articles',
params: {
categoryId: category.name,
},
}"
>
<Tooltip :text="category.category_name">
<div>
Expand All @@ -19,7 +24,7 @@
</span>
</div>
</Tooltip>
</div>
</router-link>
</template>

<script setup lang="ts">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { createListResource } from "frappe-ui";
const categories = createListResource({
doctype: "HD Article Category",
fields: ["name", "category_name", "modified", "creation"],
fields: ["name", "category_name", "modified"],
auto: true,
});
</script>
Expand Down
38 changes: 38 additions & 0 deletions desk/src/pages/knowledge-base/Articles.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<template>
<div class="p-5 px-10 w-full overflow-scroll items-center">
<LayoutHeader>
<template #left-header>
<div class="text-lg font-medium text-gray-900">Knowledge base</div>
</template>
</LayoutHeader>
<div class="max-w-4xl pt-4 sm:px-5 w-full flex flex-col gap-2">
{{ categoryId }}
</div>
<div v-if="articles.data" class="text-wrap flex-1">
{{ articles.data }}
</div>
</div>
</template>

<script setup lang="ts">
import { createListResource } from "frappe-ui";
import LayoutHeader from "@/components/LayoutHeader.vue";
const props = defineProps({
categoryId: {
required: true,
type: String,
},
});
const articles = createListResource({
doctype: "HD Article",
fields: ["author", "title", "modified"],
filters: {
category: props.categoryId,
status: "Published",
},
auto: true,
});
</script>

<style scoped></style>
4 changes: 2 additions & 2 deletions desk/src/pages/ticket/TicketNewArticles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RouterLink
class="group cursor-pointer space-x-1 hover:text-gray-900"
:to="{
name: 'KnowledgeBasePublicNew',
name: 'CustomerKnowledgeBase',
}"
target="_blank"
>
Expand All @@ -24,7 +24,7 @@
<RouterLink
class="group cursor-pointer hover:text-gray-900 flex flex-col gap-2"
:to="{
name: 'KBArticlePublicNew',
name: 'ArticlePublic',
params: {
articleId: a.name.split('#')[0],
},
Expand Down
10 changes: 5 additions & 5 deletions desk/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ const routes = [
},
{
path: "kb-public/:categoryId",
name: "CustomerKnowledgeBaseArticles",
component: () =>
import("@/pages/knowledge-base/KnowledgeBaseCustomer.vue"),
name: "Articles",
component: () => import("@/pages/knowledge-base/Articles.vue"),
props: true,
},
{
path: "kb/articles/:articleId",
name: "Article",
path: "kb-public/articles/:articleId",
name: "ArticlePublic",
component: () => import("@/pages/knowledge-base/Article.vue"),
props: true,
},
Expand Down

0 comments on commit c3f9fab

Please sign in to comment.