Исправлена подсветка шаблонов, добавлен макет тестовый список, исправлены проблемы со шрифтами
- Добавлено поле template_id в модель DesignSettings - Исправлена логика подсветки выбранного шаблона в TemplatesSelector - Добавлен новый макет 'test-list' - полный несворачиваемый список - Обновлены шрифты с поддержкой CSS переменных - Создан CSS модуль для тестового списка - Обеспечена совместимость иконок во всех макетах
This commit is contained in:
@@ -6,6 +6,7 @@ import { designTemplates, DesignTemplate } from '../constants/designTemplates'
|
||||
|
||||
interface DesignSettings {
|
||||
id?: number
|
||||
template_id?: string
|
||||
theme_color: string
|
||||
background_image?: string
|
||||
background_image_url?: string
|
||||
@@ -92,6 +93,7 @@ export function CustomizationPanel({ isOpen, onClose, onSettingsUpdate }: Custom
|
||||
const formData = new FormData()
|
||||
|
||||
// Добавляем все настройки
|
||||
formData.append('template_id', settings.template_id || '')
|
||||
formData.append('theme_color', settings.theme_color)
|
||||
formData.append('dashboard_layout', settings.dashboard_layout)
|
||||
formData.append('groups_default_expanded', settings.groups_default_expanded.toString())
|
||||
@@ -135,6 +137,7 @@ export function CustomizationPanel({ isOpen, onClose, onSettingsUpdate }: Custom
|
||||
} else {
|
||||
// Если файл не выбран, отправляем только JSON настройки (картинка остается прежней)
|
||||
const editableSettings = {
|
||||
template_id: settings.template_id,
|
||||
theme_color: settings.theme_color,
|
||||
dashboard_layout: settings.dashboard_layout,
|
||||
groups_default_expanded: settings.groups_default_expanded,
|
||||
@@ -144,7 +147,6 @@ export function CustomizationPanel({ isOpen, onClose, onSettingsUpdate }: Custom
|
||||
font_family: settings.font_family,
|
||||
custom_css: settings.custom_css,
|
||||
header_text_color: settings.header_text_color || '#000000',
|
||||
header_text_color: settings.header_text_color || '#000000',
|
||||
group_text_color: settings.group_text_color || '#333333',
|
||||
link_text_color: settings.link_text_color || '#666666',
|
||||
cover_overlay_enabled: settings.cover_overlay_enabled || false,
|
||||
@@ -195,10 +197,31 @@ export function CustomizationPanel({ isOpen, onClose, onSettingsUpdate }: Custom
|
||||
setSettings(prev => ({
|
||||
...prev,
|
||||
...template.settings,
|
||||
id: prev.id // Сохраняем оригинальный ID
|
||||
id: prev.id, // Сохраняем оригинальный ID
|
||||
template_id: template.id // Добавляем ID шаблона для отслеживания
|
||||
}))
|
||||
}
|
||||
|
||||
// Определяем текущий шаблон
|
||||
const getCurrentTemplateId = () => {
|
||||
// Если есть сохраненный template_id
|
||||
if ((settings as any).template_id) {
|
||||
return (settings as any).template_id
|
||||
}
|
||||
|
||||
// Или пытаемся определить по совпадению настроек
|
||||
for (const template of designTemplates) {
|
||||
if (
|
||||
template.settings.theme_color === settings.theme_color &&
|
||||
template.settings.background_color === settings.dashboard_background_color &&
|
||||
template.settings.dashboard_layout === settings.dashboard_layout
|
||||
) {
|
||||
return template.id
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (!isOpen) return null
|
||||
|
||||
return (
|
||||
@@ -328,6 +351,12 @@ export function CustomizationPanel({ isOpen, onClose, onSettingsUpdate }: Custom
|
||||
label: 'Журнальный',
|
||||
icon: 'bi-newspaper',
|
||||
description: 'Стиль журнала с крупными изображениями'
|
||||
},
|
||||
{
|
||||
value: 'test-list',
|
||||
label: 'Тестовый список',
|
||||
icon: 'bi-list-check',
|
||||
description: 'Полный несворачиваемый список всех групп и ссылок'
|
||||
}
|
||||
].map((layout) => (
|
||||
<div key={layout.value} className="col-md-6 col-lg-4">
|
||||
@@ -683,7 +712,7 @@ export function CustomizationPanel({ isOpen, onClose, onSettingsUpdate }: Custom
|
||||
<div className="tab-pane fade show active">
|
||||
<TemplatesSelector
|
||||
onTemplateSelect={handleTemplateSelect}
|
||||
currentTemplate={undefined} // Можно добавить определение текущего шаблона
|
||||
currentTemplate={getCurrentTemplateId()}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user