feat: add 'no color' option for button style customization

Adds a 'default' style option that removes color from buttons, showing
Telegram's native default style. Updates type, UI chip, preview, and
translations for all 4 locales.
This commit is contained in:
Fringg
2026-02-12 23:25:49 +03:00
parent b2898730b9
commit e586129c37
6 changed files with 15 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
import apiClient from './client';
export interface ButtonSectionConfig {
style: 'primary' | 'success' | 'danger';
style: 'primary' | 'success' | 'danger' | 'default';
icon_custom_emoji_id: string;
}

View File

@@ -9,9 +9,10 @@ import {
ButtonSection,
} from '../../api/buttonStyles';
type StyleValue = 'primary' | 'success' | 'danger';
type StyleValue = 'primary' | 'success' | 'danger' | 'default';
const STYLE_OPTIONS: { value: StyleValue; colorClass: string }[] = [
{ value: 'default', colorClass: 'bg-dark-500' },
{ value: 'primary', colorClass: 'bg-blue-500' },
{ value: 'success', colorClass: 'bg-green-500' },
{ value: 'danger', colorClass: 'bg-red-500' },
@@ -134,12 +135,14 @@ export function ButtonsTab() {
</div>
{/* Live preview chip */}
<div
className={`rounded-lg px-3 py-1.5 text-xs font-medium text-white ${
cfg.style === 'success'
? 'bg-green-500'
: cfg.style === 'danger'
? 'bg-red-500'
: 'bg-blue-500'
className={`rounded-lg px-3 py-1.5 text-xs font-medium ${
cfg.style === 'default'
? 'bg-dark-600 text-dark-300'
: cfg.style === 'success'
? 'bg-green-500 text-white'
: cfg.style === 'danger'
? 'bg-red-500 text-white'
: 'bg-blue-500 text-white'
}`}
>
{t(`admin.buttons.styles.${cfg.style}`)}

View File

@@ -1311,6 +1311,7 @@
"admin": "Web admin panel"
},
"styles": {
"default": "No color",
"primary": "Blue",
"success": "Green",
"danger": "Red"

View File

@@ -1020,6 +1020,7 @@
"admin": "پنل مدیریت وب"
},
"styles": {
"default": "بدون رنگ",
"primary": "آبی",
"success": "سبز",
"danger": "قرمز"

View File

@@ -1826,6 +1826,7 @@
"admin": "Веб-админка"
},
"styles": {
"default": "Без цвета",
"primary": "Синий",
"success": "Зелёный",
"danger": "Красный"

View File

@@ -1058,6 +1058,7 @@
"admin": "网页管理面板"
},
"styles": {
"default": "无颜色",
"primary": "蓝色",
"success": "绿色",
"danger": "红色"