Исправлена подсветка шаблонов, добавлен макет тестовый список, исправлены проблемы со шрифтами
- Добавлено поле template_id в модель DesignSettings - Исправлена логика подсветки выбранного шаблона в TemplatesSelector - Добавлен новый макет 'test-list' - полный несворачиваемый список - Обновлены шрифты с поддержкой CSS переменных - Создан CSS модуль для тестового списка - Обеспечена совместимость иконок во всех макетах
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
/* Стили для макета "Тестовый список" */
|
||||
.testListLayout {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
/* Применяем пользовательские шрифты через CSS переменные */
|
||||
font-family: var(--user-font-family, 'Inter', sans-serif);
|
||||
}
|
||||
|
||||
.testListLayout h5 {
|
||||
font-family: var(--user-heading-font-family, var(--user-font-family, 'Inter', sans-serif));
|
||||
}
|
||||
|
||||
.linkGroup {
|
||||
margin-bottom: 2rem;
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.groupHeader {
|
||||
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
||||
color: white;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 0.75rem;
|
||||
font-weight: 600;
|
||||
font-size: 1.125rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-family: var(--user-heading-font-family, var(--user-font-family, 'Inter', sans-serif));
|
||||
}
|
||||
|
||||
.groupLinks {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.linkItem {
|
||||
background: white;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 0.75rem 1rem;
|
||||
transition: all 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
color: #475569;
|
||||
font-family: var(--user-body-font-family, var(--user-font-family, 'Inter', sans-serif));
|
||||
}
|
||||
|
||||
.linkItem:hover {
|
||||
background: #f1f5f9;
|
||||
border-color: #6366f1;
|
||||
transform: translateX(4px);
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.linkIcon {
|
||||
margin-right: 0.75rem;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 4px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.linkTitle {
|
||||
font-weight: 500;
|
||||
color: #334155;
|
||||
flex-grow: 1;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.linkDescription {
|
||||
color: #6b7280;
|
||||
font-size: 0.875rem;
|
||||
margin-left: auto;
|
||||
opacity: 0.8;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
/* Для групп с иконками в заголовке */
|
||||
.groupHeader .linkIcon {
|
||||
margin-right: 0.5rem;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
/* Адаптивность */
|
||||
@media (max-width: 768px) {
|
||||
.testListLayout {
|
||||
max-width: 100%;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.groupHeader {
|
||||
padding: 0.75rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.linkItem {
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
.linkDescription {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Темная тема поддержка */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.linkItem {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
color: #e2e8f0;
|
||||
}
|
||||
|
||||
.linkItem:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-color: #8b5cf6;
|
||||
}
|
||||
|
||||
.linkTitle {
|
||||
color: #f1f5f9;
|
||||
}
|
||||
|
||||
.linkDescription {
|
||||
color: #cbd5e1;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import Link from 'next/link'
|
||||
import { useEffect, useState, Fragment } from 'react'
|
||||
import FontLoader from '../components/FontLoader'
|
||||
import ExpandableGroup from '../components/ExpandableGroup'
|
||||
import styles from './TestListLayout.module.css'
|
||||
|
||||
interface LinkItem {
|
||||
id: number
|
||||
@@ -836,9 +837,79 @@ export default function UserPage({
|
||||
</div>
|
||||
)
|
||||
|
||||
// Тестовый список - все группы и ссылки в одном списке
|
||||
const renderTestListLayout = () => (
|
||||
<div className={styles.testListLayout}>
|
||||
{(designSettings.show_groups_title !== false) && (
|
||||
<h5 className="mb-4" style={{
|
||||
color: designSettings.header_text_color || designSettings.theme_color,
|
||||
fontFamily: designSettings.heading_font_family || designSettings.font_family
|
||||
}}>
|
||||
Все группы и ссылки
|
||||
</h5>
|
||||
)}
|
||||
{data!.groups.map((group) => (
|
||||
<div key={group.id} className={styles.linkGroup}>
|
||||
{/* Заголовок группы */}
|
||||
<div className={styles.groupHeader}>
|
||||
{group.icon_url && designSettings.show_group_icons && (
|
||||
<img
|
||||
src={group.icon_url}
|
||||
width={24}
|
||||
height={24}
|
||||
className={styles.linkIcon}
|
||||
alt={group.name}
|
||||
/>
|
||||
)}
|
||||
<span className={styles.linkTitle}>{group.name}</span>
|
||||
{group.is_favorite && (
|
||||
<i className="bi bi-star-fill text-warning ms-2"></i>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Описание группы если есть */}
|
||||
{group.description && (
|
||||
<p className={`${styles.linkDescription} mb-3 ps-2`}>
|
||||
{group.description}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* Ссылки группы */}
|
||||
<div className={styles.groupLinks}>
|
||||
{group.links.map((link) => (
|
||||
<a
|
||||
key={link.id}
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={styles.linkItem}
|
||||
>
|
||||
{link.icon_url && designSettings.show_link_icons && (
|
||||
<img
|
||||
src={link.icon_url}
|
||||
width={20}
|
||||
height={20}
|
||||
className={styles.linkIcon}
|
||||
alt={link.title}
|
||||
/>
|
||||
)}
|
||||
<span className={styles.linkTitle}>{link.title}</span>
|
||||
{link.description && (
|
||||
<small className={styles.linkDescription}>{link.description}</small>
|
||||
)}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
|
||||
// Основная функция рендеринга групп в зависимости от выбранного макета
|
||||
const renderGroupsLayout = () => {
|
||||
switch (designSettings.dashboard_layout) {
|
||||
case 'test-list':
|
||||
return renderTestListLayout()
|
||||
case 'list':
|
||||
return renderListLayout()
|
||||
case 'grid':
|
||||
@@ -888,8 +959,17 @@ export default function UserPage({
|
||||
backgroundAttachment: 'fixed',
|
||||
minHeight: '100vh',
|
||||
paddingTop: '2rem', // отступ сверху для рамки фона
|
||||
paddingBottom: '2rem' // отступ снизу для рамки фона
|
||||
}
|
||||
paddingBottom: '2rem', // отступ снизу для рамки фона
|
||||
// CSS переменные для использования в стилях
|
||||
'--user-font-family': designSettings.font_family,
|
||||
'--user-heading-font-family': designSettings.heading_font_family || designSettings.font_family,
|
||||
'--user-body-font-family': designSettings.body_font_family || designSettings.font_family,
|
||||
'--user-theme-color': designSettings.theme_color,
|
||||
'--user-header-text-color': designSettings.header_text_color || designSettings.theme_color,
|
||||
'--user-group-text-color': designSettings.group_text_color || '#333333',
|
||||
'--user-link-text-color': designSettings.link_text_color || '#666666',
|
||||
'--user-group-description-text-color': designSettings.group_description_text_color || '#666666'
|
||||
} as React.CSSProperties
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user