260304调整

This commit is contained in:
super committed 2026-03-04 22:48:05 +08:00
1 parent b48f1e592a
commit a0c8721fbb
16 files changed
+1382 -291

No files matched your search

+353 -69
View File
@@ -7,6 +7,7 @@
import { ref, onMounted, computed } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { config } from '../config';
import {
Settings,
LayoutGrid,
@@ -16,7 +17,13 @@ import {
Trash2,
Edit,
ExternalLink,
Bot
Bot,
User,
LogOut,
Megaphone,
X,
ChevronDown,
ChevronUp
} from 'lucide-vue-next';
const { t, locale } = useI18n();
@@ -46,30 +53,78 @@ interface EmbeddedAgent {
interface LayoutSection {
id: string;
visible: boolean;
collapsed?: boolean;
title?: string;
}
interface Announcement {
id: number;
title: string;
content: string;
created_at: string;
}
// State
const isLoading = ref(true);
const currentUser = ref<{ id: number; username: string; role: string; default_agent_id?: number | null } | null>(null);
const agents = ref<Agent[]>([]);
const publicAgents = ref<Agent[]>([]);
const announcements = ref<Announcement[]>([]);
const quickQuestions = ref<QuickQuestion[]>([]);
const favoriteAgentIds = ref<number[]>([]);
const embeddedAgents = ref<EmbeddedAgent[]>([]);
const layoutSections = ref<LayoutSection[]>([
{ id: 'favorites', visible: true, title: 'workspace.favorites' },
{ id: 'quick_questions', visible: true, title: 'workspace.quickQuestions.title' },
{ id: 'embedded', visible: true, title: 'workspace.embedded' },
{ id: 'all_agents', visible: true, title: 'workspace.availableAgents' },
{ id: 'favorites', visible: true, collapsed: false, title: 'workspace.favorites' },
{ id: 'quick_questions', visible: true, collapsed: false, title: 'workspace.quickQuestions.title' },
{ id: 'embedded', visible: true, collapsed: false, title: 'workspace.embedded' },
{ id: 'all_agents', visible: true, collapsed: false, title: 'workspace.availableAgents' },
]);
const searchQuery = ref('');
const loginUsername = ref('');
const loginPassword = ref('');
const rememberMe = ref(false);
const showRegisterModal = ref(false);
const showForgotPasswordModal = ref(false);
const showAnnouncementModal = ref(false);
const selectedAnnouncement = ref<Announcement | null>(null);
const registerForm = ref({ username: '', password: '', email: '', real_name: '', employee_id: '', phone_number: '' });
const forgotPasswordForm = ref({ email: '' });
const pendingAgentId = ref<number | null>(null);
const handleForgotPassword = async () => {
if (!forgotPasswordForm.value.email) {
alert(t('register.email') + ' is required');
return;
}
try {
const res = await fetch('/api/user/reset-password-by-email', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(forgotPasswordForm.value)
});
const data = await res.json();
if (res.ok) {
alert(t('login.passwordResetEmailSent') || 'If the account exists, a reset link has been sent to your email.');
showForgotPasswordModal.value = false;
forgotPasswordForm.value = { email: '' };
} else {
alert(data.error || 'Failed to request password reset');
}
} catch (e) {
console.error('Password reset error', e);
alert('An error occurred');
}
};
/*
const showLoginTip = () => {
alert(t('login.pleaseLoginFirst') || 'Please login to access this agent.');
};
*/
const userReport = ref<any>(null);
// Quick Question Form State
@@ -92,11 +147,6 @@ const favoriteAgents = computed(() => {
});
const otherAgents = computed(() => {
// If we want to show ALL agents in the bottom list, just return filtered agents.
// Or if we want to exclude favorites, we can filter them out.
// Usually "All Applications" includes favorites too, or separates them.
// Let's keep all agents in the main list for completeness, or just non-favorites if preferred.
// For now, let's show all matching search.
if (!searchQuery.value.trim()) return agents.value;
const q = searchQuery.value.toLowerCase();
return agents.value.filter(
@@ -114,17 +164,26 @@ const filteredQuickQuestions = computed(() => {
// Methods
const getAuthHeaders = () => {
const stored = localStorage.getItem('hxops_user');
let stored = localStorage.getItem('hxops_user');
if (!stored) stored = sessionStorage.getItem('hxops_user');
if (!stored) return {};
const user = JSON.parse(stored) as { id?: number; username: string; role: string };
const headers: Record<string, string> = {
'X-Username': user.username,
'X-Role': user.role,
};
if (user.id) {
headers['X-User-Id'] = String(user.id);
try {
const data = JSON.parse(stored);
const user = data.user || data; // Handle both wrapped and unwrapped format
const headers: Record<string, string> = {
'X-Username': user.username,
'X-Role': user.role,
};
if (user.id) {
headers['X-User-Id'] = String(user.id);
}
return headers;
} catch (e) {
return {};
}
return headers;
};
const fetchHome = async () => {
@@ -146,9 +205,7 @@ const fetchHome = async () => {
favoriteAgentIds.value = data.favorite_agent_ids || [];
embeddedAgents.value = data.embedded_agents || [];
// Merge layout from backend if exists
if (data.layout && data.layout.sections) {
// Ensure all required sections exist even if backend layout is old
const backendSections = data.layout.sections as LayoutSection[];
const defaultSections = [
{ id: 'favorites', visible: true },
@@ -157,24 +214,50 @@ const fetchHome = async () => {
{ id: 'all_agents', visible: true },
];
// Update local layout, preserving order from backend but ensuring all keys exist
const merged: LayoutSection[] = [];
const backendIds = new Set(backendSections.map(s => s.id));
const mapKey = (id: string) => (id === 'quick_questions' ? 'quickQuestions' : id === 'all_agents' ? 'allAgents' : id);
// Add backend sections
backendSections.forEach(s => {
const def = defaultSections.find(d => d.id === s.id);
if (config.workspace.modules[mapKey(s.id) as keyof typeof config.workspace.modules] === false) {
return;
}
merged.push({ ...def, ...s });
});
// Add missing sections
defaultSections.forEach(d => {
if (!backendIds.has(d.id)) {
if (config.workspace.modules[mapKey(d.id) as keyof typeof config.workspace.modules] === false) {
return;
}
merged.push(d);
}
});
layoutSections.value = merged;
// Filter out sections disabled in config
const filteredSections = merged.filter(s => {
const key = mapKey(s.id) as keyof typeof config.workspace.modules;
if (config.workspace.modules[key] === false) {
return false;
}
return true;
});
layoutSections.value = filteredSections;
} else {
// Fallback for no layout data
const defaultSections = [
{ id: 'favorites', visible: true, collapsed: false },
{ id: 'quick_questions', visible: true, collapsed: false },
{ id: 'embedded', visible: true, collapsed: false },
{ id: 'all_agents', visible: true, collapsed: false },
];
layoutSections.value = defaultSections.filter(s => {
const key = (s.id === 'quick_questions' ? 'quickQuestions' : s.id === 'all_agents' ? 'allAgents' : s.id) as keyof typeof config.workspace.modules;
return config.workspace.modules[key] !== false;
});
}
} catch (e) {
console.error('Failed to load user home', e);
@@ -185,18 +268,54 @@ const fetchHome = async () => {
const fetchPublicAgents = async () => {
try {
const res = await fetch('/api/user/public-agents');
publicAgents.value = await res.json();
const res = await fetch('/api/agents/public');
if (res.ok) {
publicAgents.value = await res.json();
} else {
publicAgents.value = [];
}
} catch (e) {
console.error('Failed to load public agents', e);
publicAgents.value = [];
}
};
const fetchAnnouncements = async () => {
try {
const res = await fetch('/api/user/announcements');
if (res.ok) {
announcements.value = await res.json();
}
} catch (e) {
console.error('Failed to load announcements', e);
}
};
const loadAuthUser = () => {
const stored = localStorage.getItem('hxops_user');
let stored = localStorage.getItem('hxops_user');
// Check if expired
if (stored) {
try {
const parsed = JSON.parse(stored);
if (parsed.expiry && new Date().getTime() > parsed.expiry) {
localStorage.removeItem('hxops_user');
stored = null;
}
} catch (e) {
// ignore
}
}
// Try session storage if local is empty
if (!stored) {
stored = sessionStorage.getItem('hxops_user');
}
if (!stored) return;
try {
const user = JSON.parse(stored) as { id?: number; username: string; role: string };
const data = JSON.parse(stored);
const user = data.user || data; // Handle both wrapped and unwrapped format
currentUser.value = {
id: user.id || 0,
username: user.username,
@@ -204,6 +323,7 @@ const loadAuthUser = () => {
};
} catch (e) {
localStorage.removeItem('hxops_user');
sessionStorage.removeItem('hxops_user');
}
};
@@ -225,12 +345,29 @@ const handleLogin = async () => {
if (!res.ok) {
const err = await res.json();
alert(err.error || t('login.failed'));
// Handle specific error messages if needed, or just alert
let msg = err.error || t('login.failed');
if (err.error === 'User not found') msg = t('login.userNotFound') || 'User not found';
if (err.error === 'Incorrect password') msg = t('login.incorrectPassword') || 'Incorrect password';
if (err.error === 'Account is disabled') msg = t('login.accountDisabled') || 'Account is disabled';
if (err.error === 'Database connection failed') msg = t('login.dbConnectionFailed') || 'Database connection failed';
if (err.error === 'Internal server error') msg = t('login.internalError') || 'Internal server error';
alert(msg);
return;
}
const user = await res.json();
localStorage.setItem('hxops_user', JSON.stringify(user));
if (rememberMe.value) {
// Store in localStorage with 30 days expiry
const expiry = new Date().getTime() + 30 * 24 * 60 * 60 * 1000;
localStorage.setItem('hxops_user', JSON.stringify({ user, expiry }));
} else {
// Store in sessionStorage (cleared when tab closed)
sessionStorage.setItem('hxops_user', JSON.stringify({ user }));
}
await fetchHome();
if (pendingAgentId.value) {
@@ -244,7 +381,7 @@ const handleLogin = async () => {
}
} catch (e) {
console.error(e);
alert(t('login.requestFailed'));
alert(t('login.requestFailed') || 'Login request failed. Please check your network or server status.');
}
};
@@ -275,6 +412,9 @@ const handleRegister = async () => {
}
};
// Header Dropdown State
const showUserDropdown = ref(false);
const handleLogout = () => {
localStorage.removeItem('hxops_user');
currentUser.value = null;
@@ -284,6 +424,11 @@ const handleLogout = () => {
embeddedAgents.value = [];
userReport.value = null;
fetchPublicAgents();
router.push('/');
};
const navigateToProfile = () => {
router.push('/profile');
};
const navigateToChat = (id: number) => {
@@ -384,6 +529,17 @@ const removeQuickQuestion = async (id: number) => {
};
// Drag & Drop
const toggleSectionCollapse = async (section: LayoutSection) => {
section.collapsed = !section.collapsed;
// Save layout state
await fetch('/api/user/homepage-layout', {
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
body: JSON.stringify({ layout: { sections: layoutSections.value } })
});
};
const onDragStart = (index: number) => {
draggedSectionIndex.value = index;
};
@@ -408,8 +564,14 @@ const onDrop = async (index: number) => {
});
};
const openAnnouncement = (ann: Announcement) => {
selectedAnnouncement.value = ann;
showAnnouncementModal.value = true;
};
onMounted(async () => {
loadAuthUser();
fetchAnnouncements();
if (currentUser.value && currentUser.value.role !== 'guest') {
await fetchHome();
} else {
@@ -421,6 +583,16 @@ onMounted(async () => {
<template>
<div class="min-h-screen bg-gray-50 font-sans text-slate-800">
<!-- Top Global Language Selector (Always visible) -->
<div class="fixed top-4 right-4 z-50">
<select v-model="locale" class="bg-white/80 backdrop-blur-md shadow-sm border border-slate-200 text-xs font-medium text-slate-600 hover:text-slate-800 cursor-pointer outline-none rounded-full px-3 py-1.5 transition-all hover:shadow-md">
<option value="en">English</option>
<option value="zh-CN">简体中文</option>
<option value="zh-TW">繁體中文</option>
<option value="th">ไทย</option>
</select>
</div>
<!-- Header (Logged In) -->
<header v-if="isLoggedIn" class="sticky top-0 z-30 bg-white/80 backdrop-blur-md border-b border-gray-100 px-4 md:px-8 py-4 mb-8 transition-all duration-300">
<div class="max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center gap-4">
@@ -436,18 +608,46 @@ onMounted(async () => {
</div>
</div>
<div class="flex items-center gap-3">
<select v-model="locale" class="bg-white border border-slate-200 rounded-xl px-3 py-2 text-sm font-medium text-slate-600 outline-none focus:ring-2 focus:ring-brand-500/20 focus:border-brand-500 transition-all cursor-pointer hover:bg-slate-50">
<option value="en">English</option>
<option value="zh-CN">简体中文</option>
<option value="zh-TW">繁體中文</option>
<option value="th">ไทย</option>
</select>
<button v-if="currentUser?.role === 'admin'" @click="router.push('/admin')" class="btn-secondary">
<Settings class="w-4 h-4 mr-2" /> {{ $t('admin.title') }}
</button>
<button @click="handleLogout" class="btn-ghost hover:text-red-600 hover:bg-red-50">{{ $t('workspace.logout') }}</button>
<div class="flex items-center gap-4">
<!-- User Profile Dropdown -->
<div class="relative">
<button @click="showUserDropdown = !showUserDropdown" class="flex items-center gap-3 pl-3 pr-2 py-1.5 rounded-full hover:bg-slate-50 transition-colors border border-transparent hover:border-slate-200">
<div class="text-right hidden sm:block">
<div class="text-sm font-bold text-slate-900 leading-tight">{{ currentUser?.username }}</div>
<div class="text-[10px] font-medium text-slate-500 uppercase tracking-wide">{{ currentUser?.role === 'admin' ? 'Admin' : 'User' }}</div>
</div>
<div class="w-9 h-9 bg-brand-100 rounded-full flex items-center justify-center text-brand-600 font-bold border-2 border-white shadow-sm">
{{ (currentUser?.username || 'U').charAt(0).toUpperCase() }}
</div>
</button>
<!-- Dropdown Menu -->
<div v-if="showUserDropdown"
class="absolute right-0 top-full mt-2 w-48 bg-white rounded-xl shadow-xl border border-slate-100 py-1 z-50 animate-fade-in"
@click.away="showUserDropdown = false">
<div class="px-4 py-3 border-b border-slate-50 md:hidden">
<div class="text-sm font-bold text-slate-900">{{ currentUser?.username }}</div>
<div class="text-xs text-slate-500">{{ currentUser?.role }}</div>
</div>
<button @click="navigateToProfile" class="w-full text-left px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 hover:text-brand-600 flex items-center gap-2">
<User class="w-4 h-4" />
{{ $t('profile.title') || 'My Profile' }}
</button>
<button v-if="currentUser?.role === 'admin'" @click="router.push('/admin')" class="w-full text-left px-4 py-2 text-sm text-slate-700 hover:bg-slate-50 hover:text-brand-600 flex items-center gap-2">
<Settings class="w-4 h-4" />
{{ $t('admin.title') }}
</button>
<div class="border-t border-slate-50 my-1"></div>
<button @click="handleLogout" class="w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-red-50 flex items-center gap-2">
<LogOut class="w-4 h-4" />
{{ $t('workspace.logout') }}
</button>
</div>
</div>
</div>
</div>
</header>
@@ -482,6 +682,25 @@ onMounted(async () => {
Access a suite of powerful AI agents tailored for your enterprise needs. Secure, scalable, and intelligent.
</p>
<!-- Announcements List -->
<div v-if="announcements.length > 0" class="bg-white/60 backdrop-blur-sm rounded-2xl border border-slate-100 p-6 shadow-sm">
<h3 class="text-sm font-bold text-slate-900 mb-4 flex items-center gap-2">
<Megaphone class="w-4 h-4 text-brand-600" />
{{ $t('login.announcements') || 'Announcements' }}
</h3>
<div class="space-y-3">
<div v-for="ann in announcements.slice(0, 3)" :key="ann.id"
class="group cursor-pointer hover:bg-white/50 p-2 rounded-lg transition-colors"
@click="openAnnouncement(ann)">
<div class="flex justify-between items-start gap-2">
<h4 class="text-sm font-medium text-slate-800 group-hover:text-brand-700 line-clamp-1">{{ ann.title }}</h4>
<span class="text-[10px] text-slate-400 whitespace-nowrap">{{ new Date(ann.created_at).toLocaleDateString() }}</span>
</div>
<p class="text-xs text-slate-500 line-clamp-2 mt-1">{{ ann.content }}</p>
</div>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div v-for="agent in publicAgents.slice(0, 4)" :key="agent.id"
class="bg-white p-4 rounded-xl border border-slate-100 shadow-sm flex items-center gap-3">
@@ -491,50 +710,64 @@ onMounted(async () => {
<div class="truncate">
<div class="font-semibold text-slate-900 text-sm truncate">{{ agent.name }}</div>
<div class="text-xs text-slate-500 truncate">AI Assistant</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Login Card -->
<div class="w-full max-w-md mx-auto">
<div class="bg-white rounded-3xl border border-slate-100 shadow-xl shadow-brand-900/5 p-8 md:p-10 animate-fade-in">
<div class="bg-white/90 backdrop-blur-xl rounded-3xl border border-white/20 shadow-2xl shadow-brand-900/10 p-8 md:p-10 animate-fade-in relative overflow-hidden">
<div class="absolute top-0 left-0 w-full h-1.5 bg-gradient-to-r from-brand-500 to-purple-600"></div>
<div class="text-center mb-8">
<div class="w-12 h-12 bg-brand-600 rounded-xl mx-auto flex items-center justify-center text-white shadow-lg shadow-brand-600/30 mb-4 lg:hidden">
<Bot class="w-7 h-7" />
</div>
<h2 class="text-2xl font-bold text-slate-900">{{ $t('login.submit') }}</h2>
<p class="text-slate-500 text-sm mt-2">Welcome back! Please enter your details.</p>
<p class="text-slate-500 text-sm mt-2">{{ $t('login.subtitle') }}</p>
</div>
<div class="space-y-5">
<div class="space-y-1.5">
<label class="text-xs font-semibold text-slate-700 uppercase ml-1">{{ $t('login.username') }}</label>
<input v-model="loginUsername" type="text" class="input-field" placeholder="Enter your username" />
<input v-model="loginUsername" type="text" class="input-field" :placeholder="$t('login.placeholder.username')" @keyup.enter="handleLogin" />
</div>
<div class="space-y-1.5">
<label class="text-xs font-semibold text-slate-700 uppercase ml-1">{{ $t('login.password') }}</label>
<input v-model="loginPassword" type="password" class="input-field" placeholder="••••••••" />
<input v-model="loginPassword" type="password" class="input-field" :placeholder="$t('login.placeholder.password')" @keyup.enter="handleLogin" />
</div>
<button @click="handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all">
<div class="flex items-center gap-2 mt-2">
<input type="checkbox" id="rememberMe" v-model="rememberMe" class="rounded border-slate-300 text-brand-600 focus:ring-brand-500 w-4 h-4" />
<label for="rememberMe" class="text-sm text-slate-600 cursor-pointer select-none">{{ $t('login.rememberMe') || 'Remember me for 30 days' }}</label>
</div>
<button @click="handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all mt-4">
{{ $t('login.submit') }}
</button>
<div class="text-center pt-2">
<span class="text-sm text-slate-500">Don't have an account? </span>
<button @click="showRegisterModal = true" class="text-sm font-semibold text-brand-600 hover:text-brand-700 hover:underline transition-colors">{{ $t('login.register') }}</button>
<div class="flex justify-between items-center pt-4 mt-2 border-t border-slate-100/50">
<button @click="showForgotPasswordModal = true" class="text-sm text-slate-500 hover:text-brand-600 transition-colors">
{{ $t('login.forgotPassword') }}
</button>
<button @click="showRegisterModal = true" class="text-sm font-semibold text-brand-600 hover:text-brand-700 hover:underline transition-colors">
{{ $t('login.registerLink') }}
</button>
</div>
</div>
<!-- Language Selector for Login -->
<div class="mt-8 pt-6 border-t border-slate-100 flex justify-center">
<select v-model="locale" class="bg-transparent text-xs font-medium text-slate-400 hover:text-slate-600 cursor-pointer outline-none text-center">
<option value="en">English</option>
<option value="zh-CN">简体中文</option>
<option value="zh-TW">繁體中文</option>
<option value="th">ไทย</option>
</select>
<!-- Public Agents Showcase Mobile -->
<div v-if="publicAgents.length > 0" class="mt-8 pt-6 border-t border-slate-100 lg:hidden">
<div class="grid grid-cols-4 gap-3">
<div v-for="agent in publicAgents.slice(0, 4)" :key="agent.id"
class="flex flex-col items-center">
<div class="w-8 h-8 bg-slate-50 rounded-lg flex items-center justify-center text-slate-400">
<Bot class="w-4 h-4" />
</div>
</div>
</div>
</div>
</div>
</div>
@@ -563,7 +796,7 @@ onMounted(async () => {
<div class="md:pl-6">
<!-- Header -->
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-slate-800 flex items-center gap-2.5">
<h2 class="text-xl font-bold text-slate-800 flex items-center gap-2.5 cursor-pointer select-none" @click="toggleSectionCollapse(section)">
<div class="p-2 rounded-lg" :class="{
'bg-yellow-50 text-yellow-600': section.id === 'favorites',
'bg-brand-50 text-brand-600': section.id === 'quick_questions',
@@ -573,13 +806,15 @@ onMounted(async () => {
<component :is="section.id === 'favorites' ? Star : (section.id === 'embedded' ? Bot : LayoutGrid)" class="w-5 h-5" />
</div>
{{ $t(section.title || section.id) }}
<component :is="section.collapsed ? ChevronDown : ChevronUp" class="w-4 h-4 text-slate-400" />
</h2>
<!-- Actions for Quick Questions -->
<button v-if="section.id === 'quick_questions' && !isAddingQuestion" @click="openAddQuestionForm" class="btn-ghost text-sm text-brand-600 hover:text-brand-700 hover:bg-brand-50">
<button v-if="section.id === 'quick_questions' && !isAddingQuestion && !section.collapsed" @click="openAddQuestionForm" class="btn-ghost text-sm text-brand-600 hover:text-brand-700 hover:bg-brand-50">
<Plus class="w-4 h-4" /> {{ $t('workspace.quickQuestions.add') }}
</button>
</div>
<div v-show="!section.collapsed" class="animate-fade-in">
<!-- Content: Favorites -->
<div v-if="section.id === 'favorites'">
<div v-if="favoriteAgents.length === 0" class="text-slate-400 text-sm italic py-4 bg-slate-50 rounded-xl text-center border border-dashed border-slate-200">{{ $t('workspace.noFavorites') }}</div>
@@ -695,7 +930,53 @@ onMounted(async () => {
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Forgot Password Modal -->
<div v-if="showForgotPasswordModal" class="fixed inset-0 bg-slate-900/40 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fade-in">
<div class="bg-white rounded-3xl shadow-2xl w-full max-w-md p-8 animate-slide-up relative">
<button @click="showForgotPasswordModal = false" class="absolute top-4 right-4 text-slate-400 hover:text-slate-600">
<X class="w-5 h-5" />
</button>
<div class="text-center mb-6">
<div class="w-12 h-12 bg-brand-100 rounded-xl mx-auto flex items-center justify-center text-brand-600 mb-4">
<Lock class="w-6 h-6" />
</div>
<h3 class="text-xl font-bold text-slate-900">{{ $t('login.forgotPassword') }}</h3>
<p class="text-slate-500 text-sm mt-2">{{ $t('login.forgotPasswordDesc') || 'Enter your email to reset your password' }}</p>
</div>
<div class="space-y-4">
<label class="text-xs font-semibold text-slate-700 uppercase ml-1">{{ $t('register.email') }}</label>
<input v-model="forgotPasswordForm.email" :placeholder="$t('register.email')" class="input-field" @keyup.enter="handleForgotPassword" />
</div>
<div class="flex justify-end gap-3 mt-8">
<button @click="showForgotPasswordModal = false" class="btn-secondary flex-1">{{ $t('register.cancel') }}</button>
<button @click="handleForgotPassword" class="btn-primary flex-1">{{ $t('login.findPassword') || 'Find Password' }}</button>
</div>
</div>
</div>
<!-- Announcement Modal -->
<div v-if="showAnnouncementModal && selectedAnnouncement" class="fixed inset-0 bg-slate-900/40 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fade-in">
<div class="bg-white rounded-3xl shadow-2xl w-full max-w-2xl p-8 animate-slide-up relative max-h-[80vh] overflow-y-auto">
<button @click="showAnnouncementModal = false" class="absolute top-4 right-4 text-slate-400 hover:text-slate-600">
<X class="w-5 h-5" />
</button>
<div class="mb-6">
<span class="text-xs font-bold text-brand-600 bg-brand-50 px-2 py-1 rounded-full">{{ new Date(selectedAnnouncement.created_at).toLocaleDateString() }}</span>
<h3 class="text-2xl font-bold text-slate-900 mt-2">{{ selectedAnnouncement.title }}</h3>
</div>
<div class="prose prose-slate max-w-none">
<p class="whitespace-pre-wrap text-slate-600 leading-relaxed">{{ selectedAnnouncement.content }}</p>
</div>
<div class="mt-8 pt-6 border-t border-slate-100 flex justify-end">
<button @click="showAnnouncementModal = false" class="btn-primary">
{{ $t('admin.close') }}
</button>
</div>
</div>
</div>
@@ -703,7 +984,10 @@ onMounted(async () => {
<!-- Register Modal -->
<div v-if="showRegisterModal" class="fixed inset-0 bg-slate-900/40 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fade-in">
<div class="bg-white rounded-3xl shadow-2xl w-full max-w-md p-8 animate-slide-up">
<div class="bg-white rounded-3xl shadow-2xl w-full max-w-md p-8 animate-slide-up relative">
<button @click="showRegisterModal = false" class="absolute top-4 right-4 text-slate-400 hover:text-slate-600">
<X class="w-5 h-5" />
</button>
<h3 class="text-xl font-bold text-slate-900 mb-6 text-center">{{ $t('register.title') }}</h3>
<div class="space-y-4">
<input v-model="registerForm.real_name" :placeholder="$t('register.fields.realName')" class="input-field" />
@@ -725,4 +1009,4 @@ onMounted(async () => {
<style scoped>
/* Scoped styles removed in favor of global utilities in style.css */
</style>
</style>