Skip to content
Open
Show file tree
Hide file tree
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
25 changes: 23 additions & 2 deletions src/HashFS.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup vapor>
import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
import { useHashFS, useFile } from './index.js'
import ChatDemo from './chat/ChatDemo.vue'
import { version } from '../package.json'

const props = defineProps({
Expand All @@ -20,6 +21,13 @@ const fileInput = ref(null)
const zipInput = ref(null)
const progressInfo = ref(null)

// Simple chat demo toggle state
const showChatDemo = ref(false)

function openChatDemo() {
showChatDemo.value = true
}

const currentFile = computed(() =>
selectedFile.value ? useFile(selectedFile.value) : null
)
Expand Down Expand Up @@ -78,6 +86,7 @@ const statusText = computed(() => {
return '✅ Ready'
})


function formatSize(bytes) {
if (!Number.isFinite(bytes) || bytes < 0) return '0 B'
if (bytes < 1024) return `${bytes} B`
Expand Down Expand Up @@ -351,6 +360,12 @@ onBeforeUnmount(async () => {
@change="handleImportZip($event.target.files)"
)

button.px-3.py-2.rounded.border.border-stone-300.bg-white.text-stone-700.hover-bg-stone-50.transition.text-sm.font-medium(
@click="openChatDemo"
:disabled="loading"
title="Open Chat Demo"
) 💬 Chat Demo

button.px-3.py-2.rounded.border.border-stone-300.bg-white.text-stone-700.hover-bg-stone-50.transition.text-sm.font-medium(
v-if="hasFiles"
@click="handleExportZip"
Expand All @@ -368,8 +383,10 @@ onBeforeUnmount(async () => {
span Processing: {{ progressInfo.current }}
span {{ progressInfo.completed }} / {{ progressInfo.total }}

//- Chat Demo
ChatDemo(v-if="auth && showChatDemo" @close="showChatDemo = false" :namespace="'chat'" :space="'demo'" :chunkSize="200")
//- Main Content
.grid.grid-cols-2.gap-2.min-h-600px(v-if="auth")
.grid.grid-cols-2.gap-2.min-h-600px(v-if="auth && !showChatDemo")
//- Sidebar - File List
.bg-stone-50.rounded-lg.border.border-stone-200
.p-4.border-b.border-stone-200.bg-white.rounded-t-lg
Expand Down Expand Up @@ -510,7 +527,7 @@ onBeforeUnmount(async () => {
v-else-if="!currentFile?.loading.value && !loading"
)
.text-7xl.mb-4 🔒
h2.m-0.mb-3.text-xl.font-semibold.text-stone-700 Secure Vault
h2.m-0.mb-3.text-xl.font-bold.text-stone-700 Secure Vault
p.m-0.text-stone-500.mb-6.max-w-md
| Select a file from the sidebar or create a new one to get started.

Expand Down Expand Up @@ -567,4 +584,8 @@ onBeforeUnmount(async () => {
.overflow-y-auto::-webkit-scrollbar-thumb:hover {
background: #94a3b8;
}

.chat-pane {
max-height: 60svh; /* limit chat window height */
}
</style>
Loading