mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-03 18:22:57 +00:00
dev day #69
This commit is contained in:
@@ -28,6 +28,30 @@ export async function generateBlogAI(payload: AIGenerateBlogReq): Promise<AIGene
|
||||
return parsedData;
|
||||
}
|
||||
|
||||
export interface AIGenerateCSSReq {
|
||||
prompt: string;
|
||||
element_name?: string;
|
||||
root_selector?: string;
|
||||
current_css?: string;
|
||||
current_styles?: Record<string, any>;
|
||||
theme?: Record<string, string>;
|
||||
breakpoints?: number[];
|
||||
context?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface AIGenerateCSSResp {
|
||||
css: string;
|
||||
}
|
||||
|
||||
export async function generateCSSAI(payload: AIGenerateCSSReq): Promise<AIGenerateCSSResp> {
|
||||
const { data } = await api.post<AIGenerateCSSResp>('/ai/css/generate', payload);
|
||||
let parsed = data as any;
|
||||
if (typeof parsed === 'string') {
|
||||
try { parsed = JSON.parse(parsed); } catch { parsed = { css: '' }; }
|
||||
}
|
||||
return parsed as AIGenerateCSSResp;
|
||||
}
|
||||
|
||||
export interface AIGenerateAboutReq {
|
||||
prompt: string;
|
||||
club_name?: string;
|
||||
|
||||
@@ -122,6 +122,7 @@ export const PREDEFINED_ELEMENTS: PredefinedElement[] = [
|
||||
// Content - Obsah
|
||||
{ name: 'news', label: 'Novinky', description: 'Nejnovější články a zprávy', icon: FaNewspaper, category: 'content', defaultVariant: 'grid' },
|
||||
{ name: 'matches', label: 'Zápasy', description: 'Nadcházející a poslední zápasy', icon: FaFutbol, category: 'content', defaultVariant: 'compact' },
|
||||
{ name: 'matches-slider', label: 'Zápasy (slider)', description: 'Přehled zápasů podle soutěže ve slideru', icon: FaFutbol, category: 'content', defaultVariant: 'carousel' },
|
||||
{ name: 'team', label: 'Tým', description: 'Hráči a realizační tým', icon: FaUsers, category: 'content', defaultVariant: 'grid' },
|
||||
{ name: 'table', label: 'Tabulka', description: 'Ligová tabulka', icon: FaTable, category: 'content', defaultVariant: 'split_news' },
|
||||
{ name: 'stats', label: 'Statistiky', description: 'Týmové a hráčské statistiky', icon: FaChartLine, category: 'content', defaultVariant: 'cards' },
|
||||
@@ -161,6 +162,8 @@ export const ELEMENT_VARIANTS: Record<string, ElementVariant[]> = {
|
||||
{ value: 'sticky', label: 'Přilepený', description: 'Pevně přilepená hlavička při scrollování' },
|
||||
{ value: 'transparent', label: 'Průhledný', description: 'Průhledná hlavička s efektem' },
|
||||
{ value: 'sparta_navbar', label: 'Sparta Navbar', description: 'AC Sparta Praha styl - burger menu, logo, navigace, vyhledávání' },
|
||||
{ value: 'current', label: 'Současný', description: 'Stávající navigace' },
|
||||
{ value: 'fullwidth', label: 'Šířka 100%', description: 'Navigace přes celou šířku obrazovky' },
|
||||
],
|
||||
hero: [
|
||||
{ value: 'grid', label: 'Mřížka', description: 'Rozložení ve formě mřížky' },
|
||||
@@ -192,6 +195,11 @@ export const ELEMENT_VARIANTS: Record<string, ElementVariant[]> = {
|
||||
{ value: 'scoreboard', label: 'Tabule', description: 'TV broadcast style - velká tabule skóre s live aktualizacemi' },
|
||||
{ value: 'ticker', label: 'Ticker', description: 'Scrollující ticker s výsledky a nadcházejícími zápasy' },
|
||||
],
|
||||
'matches-slider': [
|
||||
{ value: 'carousel', label: 'Karusel', description: 'Horizontální karusel zápasů' },
|
||||
{ value: 'scroller', label: 'Posuvník', description: 'Plynulý horizontální posuvník' },
|
||||
{ value: 'ticker', label: 'Ticker', description: 'Úzký ticker výsledků a zápasů' },
|
||||
],
|
||||
sponsors: [
|
||||
{ value: 'grid', label: 'Mřížka', description: 'Mřížkové rozložení' },
|
||||
{ value: 'slider', label: 'Posuvník', description: 'Animovaný posuvník' },
|
||||
|
||||
@@ -70,6 +70,8 @@ export interface PollOption {
|
||||
export interface PollVoteRequest {
|
||||
option_ids: number[];
|
||||
session_token?: string;
|
||||
voter_name?: string;
|
||||
voter_email?: string;
|
||||
}
|
||||
|
||||
export interface PollResult {
|
||||
|
||||
@@ -96,3 +96,9 @@ export async function unsubscribeToken(token: string): Promise<{ message: string
|
||||
const { data } = await api.post<{ message: string }>(`/newsletter/unsubscribe-token`, { token });
|
||||
return data;
|
||||
}
|
||||
|
||||
// Fetch a short-lived newsletter preferences token for the currently authenticated user
|
||||
export async function getMyNewsletterToken(): Promise<{ token: string }> {
|
||||
const { data } = await api.get<{ token: string }>(`/newsletter/token/me`);
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user