Dev remove admin mode (#723)

* feat: remove admin mode
* feat: bugfix
---------
Co-authored-by: icy <icyoung520@gmail.com>
This commit is contained in:
Icyoung
2025-11-07 23:37:23 +08:00
committed by GitHub
parent 9ad3e99645
commit 062184054d
16 changed files with 160 additions and 180 deletions

View File

@@ -1,9 +1,8 @@
import React, { useEffect, useState } from 'react'
import React, { useState } from 'react'
import { useAuth } from '../contexts/AuthContext'
import { useLanguage } from '../contexts/LanguageContext'
import { t } from '../i18n/translations'
import HeaderBar from './landing/HeaderBar'
import { getSystemConfig } from '../lib/config'
export function LoginPage() {
const { language } = useLanguage()
@@ -16,17 +15,8 @@ export function LoginPage() {
const [error, setError] = useState('')
const [loading, setLoading] = useState(false)
const [adminPassword, setAdminPassword] = useState('')
const [adminMode, setAdminMode] = useState<boolean | null>(null)
const adminMode = false
useEffect(() => {
getSystemConfig()
.then((cfg) => {
setAdminMode(!!cfg.admin_mode)
})
.catch(() => {
setAdminMode(false)
})
}, [])
const handleAdminLogin = async (e: React.FormEvent) => {
e.preventDefault()

View File

@@ -12,7 +12,6 @@ interface HeaderBarProps {
onLanguageChange?: (lang: Language) => void
user?: { email: string } | null
onLogout?: () => void
isAdminMode?: boolean
onPageChange?: (page: string) => void
}
@@ -24,7 +23,6 @@ export default function HeaderBar({
onLanguageChange,
user,
onLogout,
isAdminMode = false,
onPageChange,
}: HeaderBarProps) {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
@@ -476,7 +474,7 @@ export default function HeaderBar({
>
{t('signIn', language)}
</a>
{!isAdminMode && (
{true && (
<a
href="/register"
className="px-4 py-2 rounded font-semibold text-sm transition-colors hover:opacity-90"
@@ -916,7 +914,7 @@ export default function HeaderBar({
>
{t('signIn', language)}
</a>
{!isAdminMode && (
{true && (
<a
href="/register"
className="block w-full px-4 py-2 rounded font-semibold text-sm text-center transition-colors"