Skip to content

Commit

Permalink
feat(kb): Empty state for documents
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed Sep 10, 2024
1 parent 01c2628 commit 96c8bb0
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 5 deletions.
Binary file added public/assets/empty-states/knowledge-document.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/components/EmptyState.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<div class="tw-mx-auto tw-mt-10 tw-w-fit">
<img :alt="alt" :src="imageLink" />
<p class="tw-text-lg text-purple-700 tw-w-fit tw-mx-auto">{{ title }}</p>
<p class="text-primary tw-w-fit tw-mx-auto">{{ description }}</p>
</div>
</template>

<script lang="ts" setup>
const {
imageLink,
imageAlt: alt,
title,
description,
} = defineProps({
imageLink: {
type: String,
required: true,
},
imageAlt: {
type: String,
required: true,
},
title: {
type: String,
required: true,
},
description: {
type: String,
required: true,
},
});
</script>
9 changes: 9 additions & 0 deletions src/pages/KnowledgeBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
</div>
</div>

<empty-state
v-if="knowledgeBaseRef.documents.length === 0"
description="Upload a document to get started"
image-alt="No document"
image-link="/assets/empty-states/knowledge-document.png"
title="No documents uploaded"
/>

<div class="tw-space-y-4">
<div
v-for="document of knowledgeBaseRef.documents"
Expand Down Expand Up @@ -172,6 +180,7 @@ import { decryptFile, encryptFile } from 'src/utils/encryption';
import KnowledgeBaseRenameDialog from 'components/dialog/KnowledgeBaseRenameDialog.vue';
import { supportedInputFiles } from 'src/utils/knowledge/parsing';
import { MAX_ATTACHMENT_SIZE } from 'src/utils/knowledge/attachments';
import EmptyState from 'components/EmptyState.vue';
const $q = useQuasar();
const route = useRoute();
Expand Down
13 changes: 8 additions & 5 deletions src/pages/KnowledgeBasesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
<knowledge-base-creation-dialog v-model="createKnowledgeDialog" @create="createKnowledgeBase" />
</div>

<div v-if="knowledgeStore.knowledgeBases.length === 0" class="tw-mx-auto tw-mt-10 tw-w-fit">
<img alt="No knowledge base" src="/assets/empty-states/knowledge-base.png" />
<p class="tw-text-lg text-purple-700 tw-w-fit tw-mx-auto">No Knowledge Base created</p>
<p class="text-primary tw-w-fit tw-mx-auto">Create a Knowledge Base to get started</p>
</div>
<empty-state
v-if="knowledgeStore.knowledgeBases.length === 0"
description="Create a Knowledge Base to get started"
image-alt="No knowledge base"
image-link="/assets/empty-states/knowledge-base.png"
title="No Knowledge Base created"
/>
<div v-else class="tw-space-y-4">
<RouterLink
v-for="knowledgeBase of knowledgeStore.knowledgeBases"
Expand Down Expand Up @@ -51,6 +53,7 @@ import dayjs from 'dayjs';
import { useAccount } from '@wagmi/vue';
import { useQuasar } from 'quasar';
import { useRouter } from 'vue-router';
import EmptyState from 'components/EmptyState.vue';
const $q = useQuasar();
const router = useRouter();
Expand Down

0 comments on commit 96c8bb0

Please sign in to comment.