feat: Archivum skeleton — Go/GraphQL backend + Vue 3 PWA frontend
Full project scaffold: multi-stage Dockerfile (ARM64/AMD64), AsciiDoc↔TipTap bridge, Setup Wizard, CodeMirror source editor, Git-backed storage layer, LDAP+JWT auth skeleton, Tailwind mobile-first layout, and VS Code build/push tasks targeting registry at 192.168.0.19:5000. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
76
frontend/src/views/DocumentView.vue
Normal file
76
frontend/src/views/DocumentView.vue
Normal file
@@ -0,0 +1,76 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { gql } from '@/lib/gql'
|
||||
import VisualEditor from '@/components/editor/VisualEditor.vue'
|
||||
import SourceEditor from '@/components/editor/SourceEditor.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const slug = computed(() => route.params.slug as string)
|
||||
|
||||
const content = ref('')
|
||||
const editorMode = ref<'visual' | 'source'>('visual')
|
||||
const loading = ref(true)
|
||||
const saving = ref(false)
|
||||
const commitMsg = ref('Update document')
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const data = await gql<{ document: { content: string } }>(
|
||||
`query Doc($s: String!) { document(slug: $s) { content } }`,
|
||||
{ s: slug.value },
|
||||
)
|
||||
content.value = data.document?.content ?? ''
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
async function save() {
|
||||
saving.value = true
|
||||
try {
|
||||
await gql(
|
||||
`mutation Save($i: SaveDocumentInput!) { saveDocument(input: $i) { slug } }`,
|
||||
{ i: { slug: slug.value, content: content.value, commitMessage: commitMsg.value } },
|
||||
)
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col h-full">
|
||||
<!-- Toolbar -->
|
||||
<div class="flex items-center gap-2 p-3 border-b border-slate-700 bg-surface-800 flex-wrap">
|
||||
<button
|
||||
:class="['px-3 py-1 rounded text-sm', editorMode === 'visual' ? 'bg-blue-600' : 'bg-surface-900 hover:bg-surface-700']"
|
||||
@click="editorMode = 'visual'"
|
||||
>Visual</button>
|
||||
<button
|
||||
:class="['px-3 py-1 rounded text-sm', editorMode === 'source' ? 'bg-blue-600' : 'bg-surface-900 hover:bg-surface-700']"
|
||||
@click="editorMode = 'source'"
|
||||
>Source</button>
|
||||
|
||||
<div class="flex-1" />
|
||||
|
||||
<input
|
||||
v-model="commitMsg"
|
||||
class="bg-surface-900 border border-slate-600 rounded px-2 py-1 text-sm w-64"
|
||||
placeholder="Commit message"
|
||||
/>
|
||||
<button
|
||||
class="px-4 py-1 bg-green-700 hover:bg-green-600 rounded text-sm disabled:opacity-50"
|
||||
:disabled="saving"
|
||||
@click="save"
|
||||
>{{ saving ? 'Saving…' : 'Save' }}</button>
|
||||
</div>
|
||||
|
||||
<!-- Editor -->
|
||||
<div class="flex-1 overflow-auto">
|
||||
<div v-if="loading" class="p-6 text-slate-400 animate-pulse">Loading…</div>
|
||||
<VisualEditor v-else-if="editorMode === 'visual'" v-model="content" />
|
||||
<SourceEditor v-else v-model="content" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user