fix(cms): resolve admin dogfood findings on auth, content editing, and UX
修复 CMS / Admin 后台 dogfood 专项测试发现的阻塞性与体验性问题: - 登录后无限重定向(Secure Cookie + Edge Runtime JWT 兼容) - 内容新增/编辑保存 400/500(默认不加密请求体、自动生成唯一 slug) - 编辑时提交 status 导致验证错误 - 原生 confirm 阻塞自动化测试,改为 AlertDialog - 表单字段可访问性(id/htmlFor/fieldset) - JSON 数组标签字段新增 TagInput 组件 - 操作反馈统一使用 Sonner Toast - 后台隐藏营销 Cookie 横幅 - 媒体库空状态优化 添加 dogfood-cms-regression 与 dogfood-cms-output 报告、截图及工作流路由测试。
This commit is contained in:
@@ -15,8 +15,14 @@ const LEGACY_CONSENT_KEY = 'ga_consent';
|
||||
|
||||
let hasConsentBeenHandled = false;
|
||||
|
||||
function isAdminRoute(): boolean {
|
||||
if (typeof window === 'undefined') {return false;}
|
||||
return window.location.pathname.startsWith('/admin');
|
||||
}
|
||||
|
||||
function getInitialShowConsent(): boolean {
|
||||
if (typeof window === 'undefined') {return false;}
|
||||
if (isAdminRoute()) {return false;}
|
||||
if (hasConsentBeenHandled) {return false;}
|
||||
const stored = getStoredPreferences();
|
||||
if (stored) {return false;}
|
||||
@@ -36,6 +42,11 @@ export function CookieConsent() {
|
||||
if (consentCheckedRef.current) {return;}
|
||||
consentCheckedRef.current = true;
|
||||
|
||||
if (isAdminRoute()) {
|
||||
hasConsentBeenHandled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const stored = getStoredPreferences();
|
||||
if (stored) {
|
||||
hasConsentBeenHandled = true;
|
||||
@@ -265,6 +276,7 @@ export function CookieConsent() {
|
||||
export function CookieSettingsButton() {
|
||||
const [isVisible] = useState(() => {
|
||||
if (typeof window === 'undefined') {return false;}
|
||||
if (isAdminRoute()) {return false;}
|
||||
return !!getStoredPreferences();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user