viossa.net/apps/vdn-static/src/pages/admin/index.vue
BarnacleBoy 90c7e0cddb
Some checks failed
Deploy to Production / deploy (push) Failing after 33s
feat(i18n,drupal): consolidate locale codes and add Drupal infrastructure
i18n changes:
- Remove qpv locale code, standardize on vp-VL for Viossa
- Remove wp-VL duplicate, keep locale structure clean
- Update langcode types in DrupalService from 'qpv' to 'vp-VL'

Drupal integration additions:
- Add PreviewDrupalService for viewing unpublished content
- Add authentication system with Pinia store and composables
- Add meta tag management system (SEO, OpenGraph, Twitter)
- Add route guards for protected admin routes
- Add login/preview/admin pages

Locale file changes:
- Deleted: qpv.ftl (duplicate of vp-VL.ftl)
- Kept: en_US.ftl, es_LA.ftl, vp_VL.ftl, wp_VL.ftl
2026-05-15 07:07:28 +00:00

257 lines
No EOL
5.2 KiB
Vue

<script setup lang="ts">
import { definePage } from 'vue-router/auto-routes'
import { useAuth } from '../../composables/useAuth'
import { usePreviewMode } from '../../composables/usePreviewMode'
import PreviewModeToggle from '@/components/molecules/PreviewModeToggle.vue'
// Mark this page as requiring authentication
definePage({
meta: {
requiresAuth: true,
},
})
const { currentUser, isAdmin, logout } = useAuth()
const { isInPreviewMode, togglePreviewMode } = usePreviewMode()
</script>
<template>
<div class="admin-page">
<div class="admin-header">
<div class="header-left">
<h1>Admin Dashboard</h1>
<div class="header-actions">
<PreviewModeToggle />
</div>
</div>
<button @click="logout" class="logout-button">Sign Out</button>
</div>
<div class="admin-content">
<div class="user-info">
<h2>Welcome, {{ currentUser?.name }}</h2>
<p class="user-email">{{ currentUser?.mail }}</p>
<p v-if="isAdmin" class="admin-badge">Administrator</p>
<p v-else class="editor-badge">Content Editor</p>
<div v-if="isInPreviewMode" class="preview-status">
<span class="preview-badge">Preview Mode Active</span>
<p class="preview-description">You can view unpublished content in this mode</p>
</div>
</div>
<div class="admin-section">
<h3>Quick Actions</h3>
<div class="action-grid">
<RouterLink to="/admin/content" class="action-card">
<h4>Manage Content</h4>
<p>Create, edit, and delete content</p>
</RouterLink>
<RouterLink to="/" class="action-card">
<h4>View Site</h4>
<p>Preview your changes on the live site</p>
</RouterLink>
<RouterLink v-if="isAdmin" to="/admin/users" class="action-card">
<h4>Manage Users</h4>
<p>Add and edit user accounts</p>
</RouterLink>
<RouterLink v-if="isAdmin" to="/admin/settings" class="action-card">
<h4>Site Settings</h4>
<p>Configure site options</p>
</RouterLink>
<RouterLink to="/preview" class="action-card">
<h4>Content Preview</h4>
<p>View unpublished content in preview mode</p>
</RouterLink>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.admin-page {
min-height: 100vh;
background: #f5f5f5;
}
.admin-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 1.5rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.header-left {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.header-left h1 {
margin: 0;
font-size: 1.75rem;
font-weight: 600;
}
.header-actions {
margin-left: 2rem;
}
.logout-button {
padding: 0.5rem 1.25rem;
background: rgba(255, 255, 255, 0.2);
color: white;
border: 2px solid white;
border-radius: 6px;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}
.logout-button:hover {
background: rgba(255, 255, 255, 0.3);
}
.admin-content {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
.user-info {
background: white;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
margin-bottom: 2rem;
}
.user-info h2 {
margin: 0 0 0.5rem 0;
font-size: 1.5rem;
}
.user-email {
margin: 0 0 1rem 0;
color: #666;
}
.admin-badge,
.editor-badge {
display: inline-block;
padding: 0.25rem 0.75rem;
border-radius: 12px;
font-size: 0.85rem;
font-weight: 500;
}
.admin-badge {
background: #e3f2fd;
color: #1976d2;
}
.editor-badge {
background: #f3e5f5;
color: #7b1fa2;
}
.preview-status {
margin-top: 1rem;
padding: 1rem;
background: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 8px;
}
.preview-badge {
display: inline-block;
padding: 0.25rem 0.75rem;
background: #ffc107;
color: #212529;
border-radius: 12px;
font-size: 0.85rem;
font-weight: 500;
margin-bottom: 0.5rem;
}
.preview-description {
margin: 0;
color: #856404;
font-size: 0.9rem;
}
.admin-section {
background: white;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.admin-section h3 {
margin: 0 0 1.5rem 0;
font-size: 1.25rem;
}
.action-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1rem;
}
.action-card {
padding: 1.5rem;
background: #f9f9f9;
border: 2px solid #e0e0e0;
border-radius: 8px;
text-decoration: none;
color: inherit;
transition: all 0.2s;
}
.action-card:hover {
background: #fff;
border-color: #667eea;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}
.action-card h4 {
margin: 0 0 0.5rem 0;
font-size: 1.1rem;
}
.action-card p {
margin: 0;
color: #666;
font-size: 0.9rem;
}
@media (max-width: 768px) {
.admin-header {
flex-direction: column;
gap: 1rem;
text-align: center;
}
.header-left {
flex-direction: column;
gap: 1rem;
}
.header-actions {
margin-left: 0;
}
.admin-content {
padding: 1rem;
}
}
</style>