Skip to content

Commit

Permalink
fix: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Jan 20, 2025
1 parent d7f8d8b commit c176330
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 79 deletions.
49 changes: 20 additions & 29 deletions desk/src/components/knowledge-base/ArticleCard.vue
Original file line number Diff line number Diff line change
@@ -1,56 +1,47 @@
<template>
<router-link
class="flex flex-col gap-3 border border-gray-200 rounded p-4 pb-2 cursor-pointer h-30 hover:bg-surface-gray-2 transition-all"
:to="{
name: 'ArticlePublic',
params: {
articleId: article.name,
},
}"
>
<div class="flex justify-between items-center cursor-pointer w-full">
<!-- Left Side -->
<div class="flex p-2 gap-3 flex-1 max-w-[50%]">
<div class="flex flex-col gap-1.5 w-full">
<h5 class="text-lg font-semibold text-gray-800 truncate max-w-[70%]">
{{ article.title }}
</h5>
<div class="text-sm text-gray-600 truncate max-w-[70%]">
{{ articleSubTitle }}
</div>
<!-- Title and sub content -->
<div class="flex gap-3 flex-1">
<div class="flex flex-col gap-1.5 w-full">
<h5 class="text-base font-medium text-gray-800 truncate">
{{ article.title }}
</h5>
<div class="text-p-sm text-gray-600 line-clamp-2">
{{ article.content }}
</div>
</div>

<!-- Right Side -->
<div class="flex flex-1 justify-between p-2 items-center gap-10">
<div class="flex gap-2 items-center">
<Avatar :label="article.author.name" :image="article.author.image" />
<span class="text-sm text-gray-600 flex-1 truncate">{{
article.author.name
}}</span>
</div>
<span class="text-sm text-gray-600">{{
dayjs.tz(article.published_on).format("DD, MMM YYYY")
</div>
<!-- Avatar and published date -->
<div class="flex justify-between items-center">
<div class="flex gap-2 items-center">
<Avatar :label="article.author.name" :image="article.author.image" />
<span class="text-sm text-gray-600 flex-1 truncate">{{
article.author.name
}}</span>
</div>
<span class="text-sm text-gray-600">{{
dayjs.tz(article.modified).fromNow()
}}</span>
</div>
</router-link>
</template>

<script setup lang="ts">
import { computed } from "vue";
import { Avatar } from "frappe-ui";
import { dayjs } from "@/dayjs";
import { Article } from "@/types";
import { dayjs } from "@/dayjs";
const props = defineProps<{
article: Article;
}>();
const articleSubTitle = computed(
() =>
props.article.content ||
"This article helps you understand the topic effectively."
);
</script>

<style scoped></style>
47 changes: 0 additions & 47 deletions desk/src/components/knowledge-base/ArticleCard2.vue

This file was deleted.

6 changes: 3 additions & 3 deletions desk/src/pages/knowledge-base/Articles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
>
<div
v-if="articles.data"
class="grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-6"
class="grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-5"
>
<ArticleCard2
<ArticleCard
v-for="article in articles.data"
:article="article"
:key="article.name"
Expand All @@ -27,7 +27,7 @@ import { onMounted, computed } from "vue";
import { categoryName } from "@/stores/knowledgeBase";
import { Breadcrumbs, createResource } from "frappe-ui";
import LayoutHeader from "@/components/LayoutHeader.vue";
import ArticleCard2 from "@/components/knowledge-base/ArticleCard2.vue";
import ArticleCard from "@/components/knowledge-base/ArticleCard.vue";
const props = defineProps({
categoryId: {
Expand Down

0 comments on commit c176330

Please sign in to comment.