Implemented full-screen layout

This commit is contained in:
Atharva Sawant
2024-03-28 15:42:19 +05:30
parent f16d7e4788
commit 5462b2e795
4 changed files with 69 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="border-b border-gray-200 bg-white"> <div class="flex space-x-1 overflow-x-auto">
<nav class="flex space-x-1 overflow-x-auto"> <nav class="flex space-x-1">
<button <button
v-for="file in files" v-for="file in files"
:key="file.id" :key="file.id"

View File

@@ -12,8 +12,8 @@
<div class="space-y-3"> <div class="space-y-3">
<p class="text-lg text-gray-600">Drop org files or folders here</p> <p class="text-lg text-gray-600">Drop org files or folders here</p>
<p class="text-sm text-gray-400">or</p> <p class="text-sm text-gray-400">or</p>
<div class="flex gap-3 justify-center"> <div class="flex gap-3 justify-center items-center">
<label class="inline-block"> <label>
<input <input
type="file" type="file"
multiple multiple
@@ -21,13 +21,13 @@
@change="handleFileSelect" @change="handleFileSelect"
class="hidden" class="hidden"
/> />
<span class="bg-blue-600 text-white px-4 py-2 rounded cursor-pointer hover:bg-blue-700"> <span class="inline-block bg-blue-600 text-white px-4 py-2 rounded cursor-pointer hover:bg-blue-700 transition-colors">
Browse Files Browse Files
</span> </span>
</label> </label>
<button <button
@click="loadExampleFiles" @click="loadExampleFiles"
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700" class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition-colors"
> >
Use Example Files Use Example Files
</button> </button>

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="bg-white rounded-lg shadow p-6"> <div :class="fullScreen ? 'h-full' : 'bg-white rounded-lg shadow p-6'">
<div class="flex justify-between items-center mb-6"> <div v-if="!fullScreen" class="flex justify-between items-center mb-6">
<h2 class="text-xl font-semibold">{{ file.name }}</h2> <h2 class="text-xl font-semibold">{{ file.name }}</h2>
<div class="flex gap-3"> <div class="flex gap-3">
<button <button
@@ -18,7 +18,23 @@
</div> </div>
</div> </div>
<div class="org-tree-2d h-96 border rounded-lg"> <!-- Floating controls for full-screen mode -->
<div v-if="fullScreen" class="absolute top-4 right-4 z-10 flex gap-2">
<button
@click="resetLayout"
class="bg-blue-600 text-white px-3 py-2 rounded shadow-lg hover:bg-blue-700 text-sm"
>
Reset Layout
</button>
<button
@click="exportFile"
class="bg-green-600 text-white px-3 py-2 rounded shadow-lg hover:bg-green-700 text-sm"
>
Export
</button>
</div>
<div :class="fullScreen ? 'h-full' : 'org-tree-2d h-96 border rounded-lg'">
<VueFlow <VueFlow
:nodes="flowNodes" :nodes="flowNodes"
:edges="flowEdges" :edges="flowEdges"
@@ -49,6 +65,7 @@ import type { FlowNode, FlowEdge } from '@/utils/nodeLayoutGenerator'
const props = defineProps<{ const props = defineProps<{
file: OrgFile file: OrgFile
fullScreen?: boolean
}>() }>()
const nodeTypes = { const nodeTypes = {

View File

@@ -1,15 +1,43 @@
<template> <template>
<div class="container mx-auto p-6"> <!-- Upload View - Full Screen -->
<div class="max-w-4xl mx-auto"> <div v-if="!files.length" class="min-h-screen flex items-center justify-center bg-gray-50">
<FileUploader @files-selected="handleFiles" /> <div class="w-full max-w-2xl px-6">
<div v-if="files.length" class="mt-8"> <div class="text-center mb-8">
<FileTabs <h1 class="text-4xl font-bold text-gray-900 mb-4">OrgTree</h1>
:files="files" <p class="text-xl text-gray-600">Visualize your org-mode files as interactive brain maps</p>
:active-file="activeFile"
@file-selected="setActiveFile"
/>
<OrgTreeView v-if="activeFile" :file="activeFile" />
</div> </div>
<FileUploader @files-selected="handleFiles" />
</div>
</div>
<!-- Map View - Full Screen -->
<div v-else class="h-screen flex flex-col bg-gray-50">
<!-- Header with tabs -->
<div class="bg-white shadow-sm border-b">
<div class="px-4 py-3">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-4">
<button
@click="showUploader"
class="text-gray-500 hover:text-gray-700 px-3 py-1 rounded border border-gray-300 hover:border-gray-400 transition-colors"
>
Back to Upload
</button>
<div class="text-lg font-semibold text-gray-900">OrgTree</div>
</div>
<FileTabs
:files="files"
:active-file="activeFile"
@file-selected="setActiveFile"
class="flex-1 max-w-2xl mx-4"
/>
</div>
</div>
</div>
<!-- Full screen map -->
<div class="flex-1 bg-white">
<OrgTreeView v-if="activeFile" :file="activeFile" :full-screen="true" />
</div> </div>
</div> </div>
</template> </template>
@@ -34,4 +62,9 @@ function handleFiles(uploadedFiles: OrgFile[]) {
function setActiveFile(file: OrgFile) { function setActiveFile(file: OrgFile) {
activeFile.value = file activeFile.value = file
} }
function showUploader() {
files.value = []
activeFile.value = null
}
</script> </script>