Initial project scaffold
Full-stack homeschool web app with FastAPI backend, Vue 3 frontend, MySQL database, and Docker Compose orchestration. Includes JWT auth, WebSocket real-time TV dashboard, schedule builder, activity logging, and multi-child support. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
93e0494864
commit
417b3adfe8
68 files changed
+3919
No files matched your search
@@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<NavBar />
|
||||
<main class="container">
|
||||
<h1>Admin</h1>
|
||||
|
||||
<!-- Children section -->
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>Children</h2>
|
||||
<button class="btn-primary btn-sm" @click="showChildForm = !showChildForm">+ Add</button>
|
||||
</div>
|
||||
|
||||
<form v-if="showChildForm" @submit.prevent="createChild" class="inline-form">
|
||||
<input v-model="newChild.name" placeholder="Name" required />
|
||||
<input v-model="newChild.color" type="color" title="Color" />
|
||||
<button type="submit" class="btn-primary btn-sm">Save</button>
|
||||
<button type="button" @click="showChildForm = false">Cancel</button>
|
||||
</form>
|
||||
|
||||
<div class="item-list">
|
||||
<div v-for="child in childrenStore.children" :key="child.id" class="item-row">
|
||||
<div class="item-color" :style="{ background: child.color }"></div>
|
||||
<span class="item-name">{{ child.name }}</span>
|
||||
<span class="item-meta">{{ child.is_active ? 'Active' : 'Inactive' }}</span>
|
||||
<div class="item-actions">
|
||||
<button class="btn-sm" @click="toggleChild(child)">
|
||||
{{ child.is_active ? 'Deactivate' : 'Activate' }}
|
||||
</button>
|
||||
<button class="btn-sm btn-danger" @click="deleteChild(child.id)">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="childrenStore.children.length === 0" class="empty-small">No children added yet.</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Subjects section -->
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>Subjects</h2>
|
||||
<button class="btn-primary btn-sm" @click="showSubjectForm = !showSubjectForm">+ Add</button>
|
||||
</div>
|
||||
|
||||
<form v-if="showSubjectForm" @submit.prevent="createSubject" class="inline-form">
|
||||
<input v-model="newSubject.name" placeholder="Subject name" required />
|
||||
<input v-model="newSubject.icon" placeholder="Icon (emoji)" maxlength="4" style="width:60px" />
|
||||
<input v-model="newSubject.color" type="color" title="Color" />
|
||||
<button type="submit" class="btn-primary btn-sm">Save</button>
|
||||
<button type="button" @click="showSubjectForm = false">Cancel</button>
|
||||
</form>
|
||||
|
||||
<div class="item-list">
|
||||
<div v-for="subject in subjects" :key="subject.id" class="item-row">
|
||||
<div class="item-color" :style="{ background: subject.color }"></div>
|
||||
<span class="item-icon">{{ subject.icon }}</span>
|
||||
<span class="item-name">{{ subject.name }}</span>
|
||||
<div class="item-actions">
|
||||
<button class="btn-sm btn-danger" @click="deleteSubject(subject.id)">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="subjects.length === 0" class="empty-small">No subjects added yet.</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useChildrenStore } from '@/stores/children'
|
||||
import api from '@/composables/useApi'
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
|
||||
const childrenStore = useChildrenStore()
|
||||
const subjects = ref([])
|
||||
|
||||
const showChildForm = ref(false)
|
||||
const showSubjectForm = ref(false)
|
||||
const newChild = ref({ name: '', color: '#4F46E5' })
|
||||
const newSubject = ref({ name: '', icon: '📚', color: '#10B981' })
|
||||
|
||||
async function createChild() {
|
||||
await childrenStore.createChild(newChild.value)
|
||||
newChild.value = { name: '', color: '#4F46E5' }
|
||||
showChildForm.value = false
|
||||
}
|
||||
|
||||
async function toggleChild(child) {
|
||||
await childrenStore.updateChild(child.id, { is_active: !child.is_active })
|
||||
}
|
||||
|
||||
async function deleteChild(id) {
|
||||
if (confirm('Delete this child? All associated data will be removed.')) {
|
||||
await childrenStore.deleteChild(id)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSubjects() {
|
||||
const res = await api.get('/api/subjects')
|
||||
subjects.value = res.data
|
||||
}
|
||||
|
||||
async function createSubject() {
|
||||
const res = await api.post('/api/subjects', newSubject.value)
|
||||
subjects.value.push(res.data)
|
||||
newSubject.value = { name: '', icon: '📚', color: '#10B981' }
|
||||
showSubjectForm.value = false
|
||||
}
|
||||
|
||||
async function deleteSubject(id) {
|
||||
if (confirm('Delete this subject?')) {
|
||||
await api.delete(`/api/subjects/${id}`)
|
||||
subjects.value = subjects.value.filter((s) => s.id !== id)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await childrenStore.fetchChildren()
|
||||
await loadSubjects()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { min-height: 100vh; background: #0f172a; }
|
||||
.container { max-width: 800px; margin: 0 auto; padding: 2rem; }
|
||||
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 2rem; }
|
||||
|
||||
.section { margin-bottom: 3rem; }
|
||||
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
|
||||
h2 { font-size: 1.1rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
|
||||
|
||||
.inline-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: #1e293b;
|
||||
padding: 1rem;
|
||||
border-radius: 0.75rem;
|
||||
margin-bottom: 1rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.inline-form input[type="text"],
|
||||
.inline-form input:not([type="color"]) {
|
||||
padding: 0.5rem 0.75rem;
|
||||
background: #0f172a;
|
||||
border: 1px solid #334155;
|
||||
border-radius: 0.5rem;
|
||||
color: #f1f5f9;
|
||||
font-size: 0.9rem;
|
||||
flex: 1;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.item-list { display: flex; flex-direction: column; gap: 0.5rem; }
|
||||
|
||||
.item-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
background: #1e293b;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 0.75rem;
|
||||
}
|
||||
|
||||
.item-color { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
|
||||
.item-icon { font-size: 1.2rem; }
|
||||
.item-name { flex: 1; font-weight: 500; }
|
||||
.item-meta { font-size: 0.8rem; color: #64748b; }
|
||||
.item-actions { display: flex; gap: 0.4rem; }
|
||||
|
||||
.empty-small { color: #64748b; font-size: 0.9rem; padding: 1rem 0; }
|
||||
|
||||
.btn-primary {
|
||||
padding: 0.5rem 1rem;
|
||||
background: #4f46e5;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.btn-primary:hover { background: #4338ca; }
|
||||
|
||||
.btn-sm {
|
||||
padding: 0.35rem 0.75rem;
|
||||
border: 1px solid #334155;
|
||||
background: transparent;
|
||||
color: #94a3b8;
|
||||
border-radius: 0.5rem;
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-sm:hover { background: #334155; }
|
||||
.btn-sm.btn-danger { border-color: #7f1d1d; color: #fca5a5; }
|
||||
.btn-sm.btn-danger:hover { background: #7f1d1d; }
|
||||
</style>
|
||||
Reference in new issue
Block a user