Skip to content

Commit

Permalink
move sources to a new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Aug 17, 2024
1 parent 049b604 commit 172e69a
Show file tree
Hide file tree
Showing 4 changed files with 260 additions and 145 deletions.
36 changes: 33 additions & 3 deletions resources/js/Pages/Collection/Components/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@
<NavButton
name="collections.show"
:href="route('collections.show', {collection: collection.id})"
>Collection</NavButton>
>
<div class="tooltip tooltip-info"
data-tip="This is your context for all your chat interactions and automations">
<div class="flex gap-2 items-center">
Collection
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4">
<path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0Zm-6 3.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM7.293 5.293a1 1 0 1 1 .99 1.667c-.459.134-1.033.566-1.033 1.29v.25a.75.75 0 1 0 1.5 0v-.115a2.5 2.5 0 1 0-2.518-4.153.75.75 0 1 0 1.061 1.06Z" clip-rule="evenodd" />
</svg>
</div>
</div>
</NavButton>

<NavButton v-if="chat?.id"
name="chats.collection.show"
Expand All @@ -27,14 +37,34 @@
:href="route('collections.sources.index', {
collection: collection.id
})"
>Sources</NavButton>
>
<div class="tooltip tooltip-info"
data-tip="Upload files or use our Sources to get content from Emails, Web Pages etc.">
<div class="flex gap-2 items-center">
Add Content to Collection
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4">
<path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0Zm-6 3.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM7.293 5.293a1 1 0 1 1 .99 1.667c-.459.134-1.033.566-1.033 1.29v.25a.75.75 0 1 0 1.5 0v-.115a2.5 2.5 0 1 0-2.518-4.153.75.75 0 1 0 1.061 1.06Z" clip-rule="evenodd" />
</svg>
</div>
</div>
</NavButton>

<NavButton
name="collections.outputs.index"
:href="route('collections.outputs.index', {
collection: collection.id
})"
>Outputs</NavButton>
>
<div class="tooltip tooltip-info"
data-tip="Numerous way to share your collection with other systems like Email, Webhooks, APIs and more">
<div class="flex gap-2 items-center">
Share Collection
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4">
<path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0Zm-6 3.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM7.293 5.293a1 1 0 1 1 .99 1.667c-.459.134-1.033.566-1.033 1.29v.25a.75.75 0 1 0 1.5 0v-.115a2.5 2.5 0 1 0-2.518-4.153.75.75 0 1 0 1.061 1.06Z" clip-rule="evenodd" />
</svg>
</div>
</div>
</NavButton>
</div>

</template>
Expand Down
52 changes: 2 additions & 50 deletions resources/js/Pages/Collection/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@ const toast = useToast();
const showReindexCollection = ref(false);
const showSlideOut = ref(null);
const toggleShowSlideOut = (slideOut) => {
showSlideOut.value = slideOut;
};
const closeSlideOut = () => {
showSlideOut.value = null;
};
const sourceView = ref('file_upload');
const changeSourceView = (view) => {
sourceView.value = view;
};
const toggleReindexCollection = () => {
showReindexCollection.value = !showReindexCollection.value;
Expand Down Expand Up @@ -91,38 +75,7 @@ const reset = () => {
:chat="chat?.data"
:collection="collection.data"></CollectionHeader>

<!-- Files upload -->

<div class="mx-auto max-7xl flex justify-center">
<div role="tablist" class="tabs tabs-bordered gap-4">
<button @click="changeSourceView('file_upload')" type="button" role="tab" class="tab"
:class="{ 'tab-active font-bold': sourceView === 'file_upload' }">Upload
Files</button>
<button @click="changeSourceView('text')" type="button" role="tab" class="tab"
:class="{ 'tab-active font-bold': sourceView === 'text' }">
Other Integrations
</button>
</div>
</div>

<FileUploader :collection="collection" v-show="sourceView === 'file_upload'" />

<div v-show="sourceView === 'text'" class="grid grid-cols-3 max-w-4xl mt-10 mb-10 mx-auto">
<div class="card w-96 bg-base-100 shadow-xl">
<div class="card-body">
<button class="btn btn-ghost" type="button"
@click="toggleShowSlideOut('textDocument')"
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-10 h-10">
<path stroke-linecap="round" stroke-linejoin="round"
d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
</svg>
Add Document using Text Editor
</button>
</div>
</div>
</div>


<!-- show related files -->
<Documents
Expand Down Expand Up @@ -154,7 +107,6 @@ const reset = () => {
</template>
</ConfirmationModal>

<TextDocumentCreate :collection="collection.data" :open="showSlideOut === 'textDocument'"
@closing="closeSlideOut" />

</AppLayout>
</template>
59 changes: 59 additions & 0 deletions resources/js/Pages/Sources/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import FeedSource from "@/Pages/Sources/FeedSource/Components/Card.vue";
import WebPageSource from "@/Pages/Sources/WebPageSource/Components/Card.vue";
import SiteMapSource from "@/Pages/Sources/SiteMapSource/Components/Card.vue";
import GoogleSheetSource from "@/Pages/Sources/GoogleSheetSource/Components/Card.vue";
import FileUploader from "@/Pages/Collection/Components/FileUploader.vue";
import TextDocumentCreate from "@/Pages/Collection/Components/TextDocumentCreate.vue";
const toast = useToast();
Expand All @@ -41,6 +43,24 @@ const props = defineProps({
});
const sourceView = ref('file_upload');
const changeSourceView = (view) => {
sourceView.value = view;
};
const showSlideOut = ref(null);
const toggleShowSlideOut = (slideOut) => {
showSlideOut.value = slideOut;
};
const closeSlideOut = () => {
showSlideOut.value = null;
};
</script>

<template>
Expand Down Expand Up @@ -98,6 +118,42 @@ const props = defineProps({
</div>
</div>

<div>
<h2>Upload Files or use our Text Editor to add content</h2>
<!-- Files upload -->

<div class="mx-auto max-7xl flex justify-center">
<div role="tablist" class="tabs tabs-bordered gap-4">
<button @click="changeSourceView('file_upload')" type="button" role="tab" class="tab"
:class="{ 'tab-active font-bold': sourceView === 'file_upload' }">Upload
Files</button>
<button @click="changeSourceView('text')" type="button" role="tab" class="tab"
:class="{ 'tab-active font-bold': sourceView === 'text' }">
Other Integrations
</button>
</div>
</div>

<FileUploader :collection="collection" v-show="sourceView === 'file_upload'" />

<div v-show="sourceView === 'text'" class="grid grid-cols-3 max-w-4xl mt-10 mb-10 mx-auto">
<div class="card w-96 bg-base-100 shadow-xl">
<div class="card-body">
<button class="btn btn-ghost" type="button"
@click="toggleShowSlideOut('textDocument')"
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-10 h-10">
<path stroke-linecap="round" stroke-linejoin="round"
d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
</svg>
Add Document using Text Editor
</button>
</div>
</div>
</div>
</div>

<div class="mt-10">
<Documents :collection="collection.data"
:documents="documents"></Documents>
Expand All @@ -107,5 +163,8 @@ const props = defineProps({
</div>

</div>

<TextDocumentCreate :collection="collection.data" :open="showSlideOut === 'textDocument'"
@closing="closeSlideOut" />
</AppLayout>
</template>
Loading

0 comments on commit 172e69a

Please sign in to comment.