diff --git a/src/api/infoPages.ts b/src/api/infoPages.ts index b482510..899a438 100644 --- a/src/api/infoPages.ts +++ b/src/api/infoPages.ts @@ -43,7 +43,7 @@ export interface InfoPageCreateRequest { sort_order: number; icon: string | null; replaces_tab: ReplacesTab | null; - display_mode?: InfoPageDisplayMode; + display_mode: InfoPageDisplayMode; } export interface InfoPageUpdateRequest { diff --git a/src/locales/en.json b/src/locales/en.json index 456a868..e02bb0c 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -4083,7 +4083,8 @@ "sortOrder": "Sort Order", "icon": "Icon (emoji)", "pageType": "Page Type", - "replacesTab": "Replaces Tab" + "replacesTab": "Replaces Tab", + "displayMode": "Visibility" }, "replacesTabNone": "None", "replacesTabOptions": { @@ -4092,6 +4093,11 @@ "privacy": "Privacy", "offer": "Offer" }, + "displayModes": { + "bot": "Bot only", + "web": "Web only", + "both": "Bot and web" + }, "replacesTabConflict": "already assigned", "replacesTabWarning": "Another page already replaces this tab. It will be unassigned on save.", "filter": { diff --git a/src/locales/ru.json b/src/locales/ru.json index 9a86c5e..71b4f35 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -4628,7 +4628,8 @@ "sortOrder": "Порядок сортировки", "icon": "Иконка (эмодзи)", "pageType": "Тип страницы", - "replacesTab": "Заменяет таб" + "replacesTab": "Заменяет таб", + "displayMode": "Отображение" }, "replacesTabNone": "Не заменяет", "replacesTabOptions": { @@ -4637,6 +4638,11 @@ "privacy": "Конфиденциальность", "offer": "Оферта" }, + "displayModes": { + "bot": "Только бот", + "web": "Только веб", + "both": "Бот и веб" + }, "replacesTabConflict": "уже занят", "replacesTabWarning": "Другая страница уже заменяет этот таб. При сохранении она будет снята.", "filter": { diff --git a/src/pages/AdminInfoPageEditor.tsx b/src/pages/AdminInfoPageEditor.tsx index 4fcc4f6..d69b979 100644 --- a/src/pages/AdminInfoPageEditor.tsx +++ b/src/pages/AdminInfoPageEditor.tsx @@ -37,7 +37,7 @@ import { TrashSmallIcon, PlusSmallIcon, } from '@/components/icons'; -import type { InfoPageType, FaqItem, ReplacesTab } from '../api/infoPages'; +import type { InfoPageType, FaqItem, ReplacesTab, InfoPageDisplayMode } from '../api/infoPages'; const AVAILABLE_LOCALES = ['ru', 'en', 'zh', 'fa'] as const; type LocaleCode = (typeof AVAILABLE_LOCALES)[number]; @@ -643,6 +643,7 @@ export default function AdminInfoPageEditor() { const [sortOrder, setSortOrder] = useState(0); const [pageType, setPageType] = useState(initialPageType); const [replacesTab, setReplacesTab] = useState(null); + const [displayMode, setDisplayMode] = useState('both'); const [saveError, setSaveError] = useState(null); // FAQ Q&A state per locale @@ -857,6 +858,7 @@ export default function AdminInfoPageEditor() { setSortOrder(pageData.sort_order); setPageType(pageData.page_type ?? 'page'); setReplacesTab(pageData.replaces_tab ?? null); + setDisplayMode(pageData.display_mode ?? 'both'); setTitles(pageData.title); if (pageData.page_type === 'faq') { @@ -927,6 +929,7 @@ export default function AdminInfoPageEditor() { sort_order: number; icon: string | null; replaces_tab: ReplacesTab | null; + display_mode: InfoPageDisplayMode; }) => { if (isEdit && pageId != null) { return infoPagesApi.updatePage(pageId, data); @@ -976,6 +979,7 @@ export default function AdminInfoPageEditor() { sort_order: sortOrder, icon: icon.trim() || null, replaces_tab: replacesTab, + display_mode: displayMode, }; haptic.buttonPress(); @@ -1089,6 +1093,31 @@ export default function AdminInfoPageEditor() { {t('admin.infoPages.fields.isActive')} +
+ +
+ {(['bot', 'web', 'both'] as const).map((mode) => ( + + ))} +
+
+ {/* Page type selector */}