Sprzątanie projektu - dodanie podglądu gpx - dodanie obsługi logo i avatara - dodanie editable config do prostej edycji tekstów na stronie
This commit is contained in:
160
App.tsx
160
App.tsx
@@ -11,11 +11,13 @@ import { ChevronLeft, ExternalLink, Sparkles, User, Lock, ArrowRight, AlertCircl
|
|||||||
import { generateStoryContent } from './services/geminiService';
|
import { generateStoryContent } from './services/geminiService';
|
||||||
import { getEnvVar } from './utils/envUtils';
|
import { getEnvVar } from './utils/envUtils';
|
||||||
|
|
||||||
|
// --- CONFIG IMPORT ---
|
||||||
|
import { AUTHOR_CONFIG } from './_EDITABLE_CONFIG/author';
|
||||||
|
import { UI_TEXT } from './_EDITABLE_CONFIG/ui_text';
|
||||||
|
|
||||||
const STORAGE_KEY = 'gpx-storyteller-state-v6';
|
const STORAGE_KEY = 'gpx-storyteller-state-v6';
|
||||||
const AUTH_KEY = 'promptstory-auth-token';
|
const AUTH_KEY = 'promptstory-auth-token';
|
||||||
|
|
||||||
// --- PASSWORD CONFIGURATION ---
|
|
||||||
// STRICT MODE: No fallbacks. The environment variable must be set in Coolify/Vercel/Netlify.
|
|
||||||
const APP_PASSWORD = getEnvVar('VITE_APP_PASSWORD');
|
const APP_PASSWORD = getEnvVar('VITE_APP_PASSWORD');
|
||||||
|
|
||||||
const INITIAL_STATE: WizardState = {
|
const INITIAL_STATE: WizardState = {
|
||||||
@@ -44,12 +46,9 @@ const INITIAL_STATE: WizardState = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- LOGIN SCREEN COMPONENT ---
|
|
||||||
const LoginScreen: React.FC<{ onLogin: (success: boolean) => void }> = ({ onLogin }) => {
|
const LoginScreen: React.FC<{ onLogin: (success: boolean) => void }> = ({ onLogin }) => {
|
||||||
const [input, setInput] = useState('');
|
const [input, setInput] = useState('');
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
|
|
||||||
// Check if password is misconfigured (empty)
|
|
||||||
const isConfigMissing = !APP_PASSWORD;
|
const isConfigMissing = !APP_PASSWORD;
|
||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
@@ -67,16 +66,10 @@ const LoginScreen: React.FC<{ onLogin: (success: boolean) => void }> = ({ onLogi
|
|||||||
<div className="min-h-screen bg-gray-50 flex items-center justify-center p-4">
|
<div className="min-h-screen bg-gray-50 flex items-center justify-center p-4">
|
||||||
<div className="bg-white p-8 rounded-xl shadow-lg border border-red-200 max-w-md w-full text-center">
|
<div className="bg-white p-8 rounded-xl shadow-lg border border-red-200 max-w-md w-full text-center">
|
||||||
<Bug className="mx-auto text-red-500 mb-4" size={48} />
|
<Bug className="mx-auto text-red-500 mb-4" size={48} />
|
||||||
<h2 className="text-xl font-bold text-gray-900">Błąd Konfiguracji</h2>
|
<h2 className="text-xl font-bold text-gray-900">{UI_TEXT.login.configError}</h2>
|
||||||
<p className="text-gray-600 mt-2 text-sm">
|
<p className="text-gray-600 mt-2 text-sm">
|
||||||
Aplikacja nie wykryła hasła w zmiennych środowiskowych.
|
Missing VITE_APP_PASSWORD.
|
||||||
</p>
|
</p>
|
||||||
<div className="mt-4 bg-gray-100 p-3 rounded text-left text-xs font-mono text-gray-700">
|
|
||||||
<p>Brakuje zmiennej: <span className="font-bold">VITE_APP_PASSWORD</span></p>
|
|
||||||
<p className="mt-2">Jeśli używasz Coolify/Vercel:</p>
|
|
||||||
<p>1. Dodaj zmienną w panelu.</p>
|
|
||||||
<p>2. Przebuduj projekt (Re-deploy).</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -85,20 +78,16 @@ const LoginScreen: React.FC<{ onLogin: (success: boolean) => void }> = ({ onLogi
|
|||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gray-50 flex flex-col items-center justify-center p-4">
|
<div className="min-h-screen bg-gray-50 flex flex-col items-center justify-center p-4">
|
||||||
<div className="bg-white p-8 rounded-xl shadow-lg border border-gray-100 max-w-md w-full text-center space-y-6 animate-fade-in relative">
|
<div className="bg-white p-8 rounded-xl shadow-lg border border-gray-100 max-w-md w-full text-center space-y-6 animate-fade-in relative">
|
||||||
|
|
||||||
<div className="flex justify-center mb-2">
|
<div className="flex justify-center mb-2">
|
||||||
<div className="bg-[#EA4420]/10 p-4 rounded-full text-[#EA4420]">
|
<div className="bg-[#EA4420]/10 p-4 rounded-full text-[#EA4420]">
|
||||||
<Lock size={32} />
|
<Lock size={32} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-2xl font-bold text-gray-900">Dostęp Chroniony</h2>
|
<h2 className="text-2xl font-bold text-gray-900">{UI_TEXT.login.title}</h2>
|
||||||
<p className="text-gray-500 mt-2">Wprowadź hasło, aby uzyskać dostęp.</p>
|
<p className="text-gray-500 mt-2">{UI_TEXT.login.desc}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit} className="space-y-4">
|
<form onSubmit={handleSubmit} className="space-y-4">
|
||||||
<div className="relative">
|
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
value={input}
|
value={input}
|
||||||
@@ -114,54 +103,41 @@ const LoginScreen: React.FC<{ onLogin: (success: boolean) => void }> = ({ onLogi
|
|||||||
}`}
|
}`}
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<div className="flex items-center justify-center gap-2 text-red-500 text-sm font-medium animate-pulse">
|
<div className="flex items-center justify-center gap-2 text-red-500 text-sm font-medium animate-pulse">
|
||||||
<AlertCircle size={16} />
|
<AlertCircle size={16} />
|
||||||
<span>Nieprawidłowe hasło</span>
|
<span>{UI_TEXT.login.error}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="w-full bg-[#EA4420] text-white py-4 rounded-lg font-bold hover:bg-[#d63b1a] transition-colors flex items-center justify-center gap-2"
|
className="w-full bg-[#EA4420] text-white py-4 rounded-lg font-bold hover:bg-[#d63b1a] transition-colors flex items-center justify-center gap-2"
|
||||||
>
|
>
|
||||||
<span>Odblokuj</span>
|
<span>{UI_TEXT.login.btn}</span>
|
||||||
<ArrowRight size={20} />
|
<ArrowRight size={20} />
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p className="text-xs text-gray-300 pt-4">
|
|
||||||
PromptStory v1.2 • Secure Production Build
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
// Auth State
|
|
||||||
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
||||||
const [isAuthChecking, setIsAuthChecking] = useState(true);
|
const [isAuthChecking, setIsAuthChecking] = useState(true);
|
||||||
|
|
||||||
// App State
|
|
||||||
const [data, setData] = useState<WizardState>(INITIAL_STATE);
|
const [data, setData] = useState<WizardState>(INITIAL_STATE);
|
||||||
const [generatedContent, setGeneratedContent] = useState<GeneratedContent | null>(null);
|
const [generatedContent, setGeneratedContent] = useState<GeneratedContent | null>(null);
|
||||||
const [isGenerating, setIsGenerating] = useState(false);
|
const [isGenerating, setIsGenerating] = useState(false);
|
||||||
const [isLoaded, setIsLoaded] = useState(false);
|
const [isLoaded, setIsLoaded] = useState(false);
|
||||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||||
|
|
||||||
// Image loading states
|
// LOGO & AVATAR STATE
|
||||||
const [logoError, setLogoError] = useState(false);
|
const [logoLoaded, setLogoLoaded] = useState(false);
|
||||||
const [avatarError, setAvatarError] = useState(false);
|
const [avatarLoaded, setAvatarLoaded] = useState(false);
|
||||||
|
|
||||||
// 1. Check Auth on Mount
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const storedAuth = localStorage.getItem(AUTH_KEY);
|
const storedAuth = localStorage.getItem(AUTH_KEY);
|
||||||
if (storedAuth === 'true') {
|
if (storedAuth === 'true') setIsAuthenticated(true);
|
||||||
setIsAuthenticated(true);
|
|
||||||
}
|
|
||||||
setIsAuthChecking(false);
|
setIsAuthChecking(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -178,21 +154,18 @@ const App: React.FC = () => {
|
|||||||
resetApp();
|
resetApp();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 2. Load Data Persistence Logic
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const saved = localStorage.getItem(STORAGE_KEY);
|
const saved = localStorage.getItem(STORAGE_KEY);
|
||||||
if (saved) {
|
if (saved) {
|
||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(saved);
|
const parsed = JSON.parse(saved);
|
||||||
parsed.files = []; // Reset files
|
parsed.files = [];
|
||||||
|
|
||||||
if (!parsed.stats) parsed.stats = { distance: '', duration: '', elevation: '' };
|
if (!parsed.stats) parsed.stats = { distance: '', duration: '', elevation: '' };
|
||||||
if (!parsed.waypoints) parsed.waypoints = [];
|
if (!parsed.waypoints) parsed.waypoints = [];
|
||||||
if (!parsed.tripData) parsed.tripData = { ...INITIAL_STATE.tripData };
|
if (!parsed.tripData) parsed.tripData = { ...INITIAL_STATE.tripData };
|
||||||
if (!parsed.tone) parsed.tone = null;
|
if (!parsed.tone) parsed.tone = null;
|
||||||
if (!parsed.goal) parsed.goal = null;
|
if (!parsed.goal) parsed.goal = null;
|
||||||
if (!parsed.storyStyle) parsed.storyStyle = null;
|
if (!parsed.storyStyle) parsed.storyStyle = null;
|
||||||
|
|
||||||
setData(parsed);
|
setData(parsed);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to load state", e);
|
console.error("Failed to load state", e);
|
||||||
@@ -216,37 +189,28 @@ const App: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const nextStep = () => {
|
const nextStep = () => {
|
||||||
if (data.step < Step.RESULT) {
|
if (data.step < Step.RESULT) updateData({ step: data.step + 1 });
|
||||||
updateData({ step: data.step + 1 });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const prevStep = () => {
|
const prevStep = () => {
|
||||||
if (data.step > Step.CONTEXT) {
|
if (data.step > Step.CONTEXT) updateData({ step: data.step - 1 });
|
||||||
updateData({ step: data.step - 1 });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGenerate = async () => {
|
const handleGenerate = async () => {
|
||||||
setIsGenerating(true);
|
setIsGenerating(true);
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
|
|
||||||
// STRICT MODE: Use VITE_API_KEY
|
|
||||||
const apiKey = getEnvVar('VITE_API_KEY');
|
const apiKey = getEnvVar('VITE_API_KEY');
|
||||||
|
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
setErrorMessage("BŁĄD KRYTYCZNY: Brak klucza API (VITE_API_KEY). Skonfiguruj zmienne w panelu Coolify.");
|
setErrorMessage("BŁĄD: Brak VITE_API_KEY.");
|
||||||
setIsGenerating(false);
|
setIsGenerating(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const content = await generateStoryContent(data, apiKey);
|
const content = await generateStoryContent(data, apiKey);
|
||||||
setGeneratedContent(content);
|
setGeneratedContent(content);
|
||||||
updateData({ step: Step.RESULT });
|
updateData({ step: Step.RESULT });
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error("Generowanie nie powiodło się:", error);
|
setErrorMessage("Błąd: " + (error.message || 'Unknown'));
|
||||||
setErrorMessage("Błąd generowania: " + (error.message || 'Sprawdź konsolę'));
|
|
||||||
} finally {
|
} finally {
|
||||||
setIsGenerating(false);
|
setIsGenerating(false);
|
||||||
}
|
}
|
||||||
@@ -255,15 +219,12 @@ const App: React.FC = () => {
|
|||||||
const handleRegenerate = async (slideCount: number, feedback: string) => {
|
const handleRegenerate = async (slideCount: number, feedback: string) => {
|
||||||
setIsGenerating(true);
|
setIsGenerating(true);
|
||||||
setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
|
|
||||||
const apiKey = getEnvVar('VITE_API_KEY');
|
const apiKey = getEnvVar('VITE_API_KEY');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const content = await generateStoryContent(data, apiKey || '', { slideCount, feedback });
|
const content = await generateStoryContent(data, apiKey || '', { slideCount, feedback });
|
||||||
setGeneratedContent(content);
|
setGeneratedContent(content);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error("Regenerowanie nie powiodło się:", error);
|
setErrorMessage("Błąd: " + (error.message || ''));
|
||||||
setErrorMessage("Błąd regenerowania: " + (error.message || ''));
|
|
||||||
} finally {
|
} finally {
|
||||||
setIsGenerating(false);
|
setIsGenerating(false);
|
||||||
}
|
}
|
||||||
@@ -277,39 +238,34 @@ const App: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (isAuthChecking || !isLoaded) return null;
|
if (isAuthChecking || !isLoaded) return null;
|
||||||
|
if (!isAuthenticated) return <LoginScreen onLogin={handleLogin} />;
|
||||||
if (!isAuthenticated) {
|
|
||||||
return <LoginScreen onLogin={handleLogin} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
const stepsLabels = ['Kontekst', 'Typ', 'Platforma', 'Vibe & Cel', 'Szczegóły'];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-white text-gray-900 flex flex-col font-sans">
|
<div className="min-h-screen bg-white text-gray-900 flex flex-col font-sans">
|
||||||
<header className="bg-white sticky top-0 z-10 border-b border-gray-100">
|
<header className="bg-white sticky top-0 z-10 border-b border-gray-100">
|
||||||
<div className="max-w-4xl mx-auto px-6 py-4 flex justify-between items-center">
|
<div className="max-w-4xl mx-auto px-6 py-4 flex justify-between items-center">
|
||||||
<div className="flex items-center space-x-3">
|
<div className="flex items-center space-x-3">
|
||||||
{!logoError ? (
|
{/* LOGO LOGIC: Image is hidden by default. If it loads, it shows and text hides. */}
|
||||||
<img
|
<img
|
||||||
src="logo.png"
|
src="logo.png"
|
||||||
onError={() => setLogoError(true)}
|
alt="Logo"
|
||||||
alt="PromptStory Logo"
|
onLoad={() => setLogoLoaded(true)}
|
||||||
className="w-10 h-10 object-contain"
|
className={`h-10 object-contain ${logoLoaded ? 'block' : 'hidden'}`}
|
||||||
/>
|
/>
|
||||||
) : (
|
{!logoLoaded && (
|
||||||
<div className="text-[#EA4420]">
|
<div className="flex items-center gap-2">
|
||||||
<Sparkles size={32} strokeWidth={2} />
|
<div className="text-[#EA4420]"><Sparkles size={32} strokeWidth={2} /></div>
|
||||||
|
<h1 className="text-xl font-bold tracking-tight text-gray-900">{UI_TEXT.header.appTitle}</h1>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<h1 className="text-xl font-bold tracking-tight text-gray-900">PromptStory</h1>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<button onClick={resetApp} className="text-xs font-medium text-gray-400 hover:text-[#EA4420] transition-colors uppercase tracking-wide">
|
<button onClick={resetApp} className="text-xs font-medium text-gray-400 hover:text-[#EA4420] transition-colors uppercase tracking-wide">
|
||||||
Resetuj
|
{UI_TEXT.header.resetBtn}
|
||||||
</button>
|
</button>
|
||||||
<button onClick={handleLogout} className="text-xs font-medium text-gray-400 hover:text-red-500 transition-colors uppercase tracking-wide">
|
<button onClick={handleLogout} className="text-xs font-medium text-gray-400 hover:text-red-500 transition-colors uppercase tracking-wide">
|
||||||
Wyloguj
|
{UI_TEXT.header.logoutBtn}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -319,17 +275,14 @@ const App: React.FC = () => {
|
|||||||
{data.step !== Step.RESULT && (
|
{data.step !== Step.RESULT && (
|
||||||
<div className="mb-12">
|
<div className="mb-12">
|
||||||
<div className="flex justify-between mb-3">
|
<div className="flex justify-between mb-3">
|
||||||
{stepsLabels.map((label, idx) => (
|
{UI_TEXT.steps.labels.map((label, idx) => (
|
||||||
<span key={label} className={`text-xs font-bold uppercase tracking-wider transition-colors ${data.step >= idx ? 'text-[#EA4420]' : 'text-gray-300'}`}>
|
<span key={label} className={`text-xs font-bold uppercase tracking-wider transition-colors ${data.step >= idx ? 'text-[#EA4420]' : 'text-gray-300'}`}>
|
||||||
0{idx + 1}. {label}
|
0{idx + 1}. {label}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="h-1 bg-gray-100 rounded-full overflow-hidden">
|
<div className="h-1 bg-gray-100 rounded-full overflow-hidden">
|
||||||
<div
|
<div className="h-full bg-[#EA4420] transition-all duration-500 ease-out" style={{ width: `${((data.step + 1) / 5) * 100}%` }} />
|
||||||
className="h-full bg-[#EA4420] transition-all duration-500 ease-out"
|
|
||||||
style={{ width: `${((data.step + 1) / 5) * 100}%` }}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -339,22 +292,8 @@ const App: React.FC = () => {
|
|||||||
{data.step === Step.EVENT_TYPE && <StepEventType data={data} updateData={updateData} nextStep={nextStep} />}
|
{data.step === Step.EVENT_TYPE && <StepEventType data={data} updateData={updateData} nextStep={nextStep} />}
|
||||||
{data.step === Step.PLATFORM && <StepPlatform data={data} updateData={updateData} nextStep={nextStep} />}
|
{data.step === Step.PLATFORM && <StepPlatform data={data} updateData={updateData} nextStep={nextStep} />}
|
||||||
{data.step === Step.TONE_GOAL && <StepToneGoal data={data} updateData={updateData} nextStep={nextStep} />}
|
{data.step === Step.TONE_GOAL && <StepToneGoal data={data} updateData={updateData} nextStep={nextStep} />}
|
||||||
{data.step === Step.DETAILS && (
|
{data.step === Step.DETAILS && <StepDetails data={data} updateData={updateData as any} onGenerate={handleGenerate} isGenerating={isGenerating} />}
|
||||||
<StepDetails
|
{data.step === Step.RESULT && generatedContent && <StepResult content={generatedContent} onRegenerate={handleRegenerate} isRegenerating={isGenerating} tripData={data.tripData} />}
|
||||||
data={data}
|
|
||||||
updateData={updateData as any}
|
|
||||||
onGenerate={handleGenerate}
|
|
||||||
isGenerating={isGenerating}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{data.step === Step.RESULT && generatedContent && (
|
|
||||||
<StepResult
|
|
||||||
content={generatedContent}
|
|
||||||
onRegenerate={handleRegenerate}
|
|
||||||
isRegenerating={isGenerating}
|
|
||||||
tripData={data.tripData}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{errorMessage && (
|
{errorMessage && (
|
||||||
<div className="mt-6 p-4 bg-red-50 text-red-600 rounded-md border border-red-100 text-sm text-center">
|
<div className="mt-6 p-4 bg-red-50 text-red-600 rounded-md border border-red-100 text-sm text-center">
|
||||||
@@ -372,26 +311,28 @@ const App: React.FC = () => {
|
|||||||
className="flex items-center space-x-2 text-gray-500 hover:text-gray-900 font-semibold px-6 py-3 rounded-md border border-gray-200 hover:bg-gray-50 transition-colors disabled:opacity-50"
|
className="flex items-center space-x-2 text-gray-500 hover:text-gray-900 font-semibold px-6 py-3 rounded-md border border-gray-200 hover:bg-gray-50 transition-colors disabled:opacity-50"
|
||||||
>
|
>
|
||||||
<ChevronLeft size={20} />
|
<ChevronLeft size={20} />
|
||||||
<span>Wróć</span>
|
<span>{UI_TEXT.steps.nav.back}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
{/* FOOTER - Uses AUTHOR_CONFIG */}
|
||||||
<footer className="border-t border-gray-100 py-10 bg-gray-50/30 mt-auto">
|
<footer className="border-t border-gray-100 py-10 bg-gray-50/30 mt-auto">
|
||||||
<div className="max-w-4xl mx-auto px-6 flex flex-col md:flex-row items-center justify-between gap-8">
|
<div className="max-w-4xl mx-auto px-6 flex flex-col md:flex-row items-center justify-between gap-8">
|
||||||
<div className="flex items-start md:items-center gap-5">
|
<div className="flex items-start md:items-center gap-5">
|
||||||
<div className="relative group cursor-pointer flex-shrink-0">
|
<div className="relative group cursor-pointer flex-shrink-0">
|
||||||
<div className="absolute -inset-0.5 bg-gradient-to-r from-[#EA4420] to-orange-400 rounded-full opacity-30 group-hover:opacity-100 transition duration-500 blur"></div>
|
<div className="absolute -inset-0.5 bg-gradient-to-r from-[#EA4420] to-orange-400 rounded-full opacity-30 group-hover:opacity-100 transition duration-500 blur"></div>
|
||||||
{!avatarError ? (
|
|
||||||
|
{/* AVATAR LOGIC */}
|
||||||
<img
|
<img
|
||||||
src="avatar.jpeg"
|
src={AUTHOR_CONFIG.avatarImage}
|
||||||
onError={() => setAvatarError(true)}
|
alt={AUTHOR_CONFIG.name}
|
||||||
alt="Arkadiusz Bykowski"
|
onLoad={() => setAvatarLoaded(true)}
|
||||||
className="relative w-20 h-20 rounded-full object-cover border border-gray-100 bg-white"
|
className={`relative w-20 h-20 rounded-full object-cover border border-gray-100 bg-white ${avatarLoaded ? 'block' : 'hidden'}`}
|
||||||
/>
|
/>
|
||||||
) : (
|
{!avatarLoaded && (
|
||||||
<div className="relative w-20 h-20 rounded-full border border-gray-100 bg-white flex items-center justify-center text-gray-300">
|
<div className="relative w-20 h-20 rounded-full border border-gray-100 bg-white flex items-center justify-center text-gray-300">
|
||||||
<User size={40} />
|
<User size={40} />
|
||||||
</div>
|
</div>
|
||||||
@@ -399,20 +340,25 @@ const App: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="text-left">
|
<div className="text-left">
|
||||||
<h3 className="text-gray-900 font-bold text-xl leading-tight">Arkadiusz Bykowski</h3>
|
<h3 className="text-gray-900 font-bold text-xl leading-tight">{AUTHOR_CONFIG.name}</h3>
|
||||||
<p className="text-gray-600 text-sm mt-2 leading-relaxed max-w-lg">
|
<p className="text-gray-600 text-sm mt-2 leading-relaxed max-w-lg">
|
||||||
Zamieniam Twoją stronę w maszynkę do zarabiania pieniędzy.
|
{AUTHOR_CONFIG.description}
|
||||||
</p>
|
</p>
|
||||||
|
<div className="flex flex-wrap gap-2 mt-3">
|
||||||
|
{AUTHOR_CONFIG.tags.map(tag => (
|
||||||
|
<span key={tag} className="text-xs font-medium text-gray-500 bg-gray-100 px-2 py-1 rounded-md">{tag}</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
href="https://bykowski.pro/"
|
href={AUTHOR_CONFIG.websiteUrl}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="flex-shrink-0 flex items-center space-x-2 text-sm font-bold text-gray-700 hover:text-[#EA4420] transition-all bg-white border border-gray-200 px-6 py-3 rounded-full hover:shadow-md hover:border-[#EA4420]/30 active:scale-95"
|
className="flex-shrink-0 flex items-center space-x-2 text-sm font-bold text-gray-700 hover:text-[#EA4420] transition-all bg-white border border-gray-200 px-6 py-3 rounded-full hover:shadow-md hover:border-[#EA4420]/30 active:scale-95"
|
||||||
>
|
>
|
||||||
<span>Odwiedź stronę</span>
|
<span>{AUTHOR_CONFIG.websiteLabel}</span>
|
||||||
<ExternalLink size={16} />
|
<ExternalLink size={16} />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
// === ELEMENT 1: KONTEKST (RAMY CZASOWE I NARRACYJNE) ===
|
|
||||||
export const CONTEXT_PROMPTS = {
|
import { WizardState } from '../types';
|
||||||
|
|
||||||
|
// === HELPER CONSTANTS ===
|
||||||
|
|
||||||
|
const CONTEXT_PROMPTS = {
|
||||||
relacja: `
|
relacja: `
|
||||||
### KROK 1: KONTEKST - RELACJA (VLOG)
|
### KROK 1: KONTEKST - RELACJA (VLOG)
|
||||||
Twoim zadaniem jest opisanie wydarzenia, w którym brałeś bezpośredni udział. Piszesz z pierwszej osoby ("ja"). Skup się na autentyczności, tym co widziałeś, czułeś i robiłeś. To ma być dynamiczny zapis Twoich doświadczeń, a nie suchy raport.
|
Twoim zadaniem jest opisanie wydarzenia, w którym brałeś bezpośredni udział. Piszesz z pierwszej osoby ("ja"). Skup się na autentyczności, tym co widziałeś, czułeś i robiłeś. To ma być dynamiczny zapis Twoich doświadczeń, a nie suchy raport.
|
||||||
@@ -13,8 +17,7 @@ Twoim zadaniem jest opisanie wydarzenia, w którym brałeś bezpośredni udział
|
|||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
// === ELEMENT 1B: STYL OPOWIEŚCI (OPCJONALNY DLA KONTEKSTU OPOWIEŚĆ) ===
|
const STORY_STYLE_PROMPTS = {
|
||||||
export const STORY_STYLE_PROMPTS = {
|
|
||||||
noir: `
|
noir: `
|
||||||
### KROK 1B: STYL - KRYMINAŁ NOIR
|
### KROK 1B: STYL - KRYMINAŁ NOIR
|
||||||
- KLIMAT: Mroczny, deszczowy, cyniczny, pełen cieni i kontrastów.
|
- KLIMAT: Mroczny, deszczowy, cyniczny, pełen cieni i kontrastów.
|
||||||
@@ -31,8 +34,7 @@ export const STORY_STYLE_PROMPTS = {
|
|||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
// === ELEMENT 2: TYP WYDARZENIA (SŁOWNICTWO I BRANŻA) ===
|
const EVENT_PROMPTS = {
|
||||||
export const EVENT_PROMPTS = {
|
|
||||||
sport: `
|
sport: `
|
||||||
### KROK 2: TYP - SPORT & WYSIŁEK
|
### KROK 2: TYP - SPORT & WYSIŁEK
|
||||||
- SŁOWNICTWO: Kadencja, strefy tętna, PB (Personal Best), bomba, ściana, endorfiny, laktat, tempo, waty, regeneracja.
|
- SŁOWNICTWO: Kadencja, strefy tętna, PB (Personal Best), bomba, ściana, endorfiny, laktat, tempo, waty, regeneracja.
|
||||||
@@ -65,8 +67,7 @@ export const EVENT_PROMPTS = {
|
|||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
// === ELEMENT 3: PLATFORMA (FORMAT TECHNICZNY I STRUKTURA) ===
|
const PLATFORM_PROMPTS = {
|
||||||
export const PLATFORM_PROMPTS = {
|
|
||||||
instagram: `
|
instagram: `
|
||||||
### KROK 3: PLATFORMA - INSTAGRAM (PROFESSIONAL CAROUSEL)
|
### KROK 3: PLATFORMA - INSTAGRAM (PROFESSIONAL CAROUSEL)
|
||||||
- ZASADA GŁÓWNA: Twoim celem jest zatrzymanie scrollowania (Stop the scroll).
|
- ZASADA GŁÓWNA: Twoim celem jest zatrzymanie scrollowania (Stop the scroll).
|
||||||
@@ -158,8 +159,7 @@ W polu 'overlay_text' dla Stravy wpisuj tylko krótkie hasła typu: "DANE", "TWA
|
|||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
// === ELEMENT 4A: TON (VIBE / OSOBOWOŚĆ) ===
|
const TONE_PROMPTS = {
|
||||||
export const TONE_PROMPTS = {
|
|
||||||
funny: `
|
funny: `
|
||||||
### KROK 4A: TON - LUZAK / ŚMIESZEK (Funny & Casual)
|
### KROK 4A: TON - LUZAK / ŚMIESZEK (Funny & Casual)
|
||||||
- STYL: Autoironia, żarty sytuacyjne, slang, memiczny język.
|
- STYL: Autoironia, żarty sytuacyjne, slang, memiczny język.
|
||||||
@@ -180,8 +180,7 @@ export const TONE_PROMPTS = {
|
|||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
// === ELEMENT 4B: CEL (STRATEGIA I CTA) ===
|
const GOAL_PROMPTS = {
|
||||||
export const GOAL_PROMPTS = {
|
|
||||||
engagement: `
|
engagement: `
|
||||||
### KROK 4B: CEL - BUDOWANIE SPOŁECZNOŚCI (Engagement)
|
### KROK 4B: CEL - BUDOWANIE SPOŁECZNOŚCI (Engagement)
|
||||||
- STRATEGIA: Zadawaj pytania, bądź kontrowersyjny lub bardzo "relatable" (buduj tożsamość).
|
- STRATEGIA: Zadawaj pytania, bądź kontrowersyjny lub bardzo "relatable" (buduj tożsamość).
|
||||||
@@ -201,3 +200,68 @@ export const GOAL_PROMPTS = {
|
|||||||
- HOOK: Obietnica korzyści lub rozwiązania palącego problemu.
|
- HOOK: Obietnica korzyści lub rozwiązania palącego problemu.
|
||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// === MAIN GENERATOR FUNCTION ===
|
||||||
|
|
||||||
|
export const getSystemPrompt = (data: WizardState): string => {
|
||||||
|
|
||||||
|
// 1. KROK 1: KONTEKST
|
||||||
|
let contextPrompt = data.context
|
||||||
|
? CONTEXT_PROMPTS[data.context]
|
||||||
|
: CONTEXT_PROMPTS.relacja;
|
||||||
|
|
||||||
|
// 1b. KROK 1b: STYL OPOWIEŚCI
|
||||||
|
if (data.context === 'opowiesc' && data.storyStyle) {
|
||||||
|
const stylePrompt = STORY_STYLE_PROMPTS[data.storyStyle];
|
||||||
|
contextPrompt += `\n\n${stylePrompt}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. KROK 2: TYP WYDARZENIA
|
||||||
|
const eventPrompt = data.eventType
|
||||||
|
? EVENT_PROMPTS[data.eventType]
|
||||||
|
: EVENT_PROMPTS.other;
|
||||||
|
|
||||||
|
// 3. KROK 3: PLATFORMA
|
||||||
|
const platformPrompt = data.platform
|
||||||
|
? PLATFORM_PROMPTS[data.platform]
|
||||||
|
: PLATFORM_PROMPTS.instagram;
|
||||||
|
|
||||||
|
// 4a. KROK 4a: TON
|
||||||
|
const tonePrompt = data.tone
|
||||||
|
? TONE_PROMPTS[data.tone]
|
||||||
|
: TONE_PROMPTS.funny;
|
||||||
|
|
||||||
|
// 4b. KROK 4b: CEL
|
||||||
|
const goalPrompt = data.goal
|
||||||
|
? GOAL_PROMPTS[data.goal]
|
||||||
|
: GOAL_PROMPTS.engagement;
|
||||||
|
|
||||||
|
// SKLEJANIE MASTER PROMPTU
|
||||||
|
return `
|
||||||
|
Jesteś światowej klasy ekspertem od Content Marketingu i Social Media.
|
||||||
|
Twoim zadaniem jest stworzenie treści idealnie dopasowanej do poniższej konfiguracji "puzzli".
|
||||||
|
|
||||||
|
=== KONFIGURACJA MASTER PROMPT (PUZZLE) ===
|
||||||
|
|
||||||
|
${contextPrompt}
|
||||||
|
|
||||||
|
${eventPrompt}
|
||||||
|
|
||||||
|
${platformPrompt}
|
||||||
|
|
||||||
|
${tonePrompt}
|
||||||
|
|
||||||
|
${goalPrompt}
|
||||||
|
|
||||||
|
=== INSTRUKCJA KOŃCOWA ===
|
||||||
|
Twoim zadaniem jest synteza powyższych elementów w jedną spójną całość.
|
||||||
|
1. Przyjmij perspektywę czasową z kroku 1 (KONTEKST).
|
||||||
|
2. Jeśli zdefiniowano STYL (Noir/Fantasy), bezwzględnie narzuć ten klimat na całą narrację.
|
||||||
|
3. Użyj słownictwa i atmosfery z kroku 2 (TYP).
|
||||||
|
4. Sformatuj wynik technicznie zgodnie z wymogami kroku 3 (PLATFORMA).
|
||||||
|
5. Nadaj wypowiedzi charakter i styl z kroku 4a (TON).
|
||||||
|
6. Zrealizuj cel biznesowy/społeczny z kroku 4b (CEL).
|
||||||
|
|
||||||
|
Nie dodawaj meta-komentarzy. Zwróć czysty JSON zgodny ze schematem zdefiniowanym w sekcji PLATFORMA.
|
||||||
|
`;
|
||||||
|
};
|
||||||
10
_EDITABLE_CONFIG/author.ts
Normal file
10
_EDITABLE_CONFIG/author.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
export const AUTHOR_CONFIG = {
|
||||||
|
name: "Arkadiusz AreBynd[] Bykowski",
|
||||||
|
description: "Zamieniam Twoją stronę w maszynkę do zarabiania pieniędzy. Od 12 lat projektuję strony, które sprzedają bez Twojego udziału – póki Ty śpisz, one robią za Ciebie robotę. Specjalizuję się w landing page'ach, które budują zaufanie i zmieniają odwiedzających w płacących klientów.",
|
||||||
|
tags: ["Product Design", "AI Automation", "No-Code"],
|
||||||
|
websiteUrl: "https://bykowski.pro/",
|
||||||
|
websiteLabel: "Odwiedź stronę",
|
||||||
|
// Nazwa pliku w folderze public
|
||||||
|
avatarImage: "avatar.jpeg"
|
||||||
|
};
|
||||||
143
_EDITABLE_CONFIG/ui_text.ts
Normal file
143
_EDITABLE_CONFIG/ui_text.ts
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
|
||||||
|
export const UI_TEXT = {
|
||||||
|
header: {
|
||||||
|
appTitle: "PromptStory",
|
||||||
|
resetBtn: "Resetuj",
|
||||||
|
logoutBtn: "Wyloguj"
|
||||||
|
},
|
||||||
|
steps: {
|
||||||
|
labels: ['Kontekst', 'Typ', 'Platforma', 'Vibe & Cel', 'Szczegóły'],
|
||||||
|
nav: {
|
||||||
|
back: "Wróć",
|
||||||
|
next: "Dalej"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stepContext: {
|
||||||
|
title: "Wybierz Kontekst",
|
||||||
|
subtitle: "Jaki rodzaj historii chcesz opowiedzieć?",
|
||||||
|
relacja: {
|
||||||
|
title: "Relacja (Vlog)",
|
||||||
|
desc: "Tu i teraz, emocje, akcja."
|
||||||
|
},
|
||||||
|
opowiesc: {
|
||||||
|
title: "Opowieść",
|
||||||
|
desc: "Wspomnienia, refleksja, morał."
|
||||||
|
},
|
||||||
|
styles: {
|
||||||
|
title: "Wybierz Styl Opowieści",
|
||||||
|
subtitle: "Nadaj historii unikalny klimat.",
|
||||||
|
noir: {
|
||||||
|
title: "Kryminał NOIR",
|
||||||
|
desc: "Mrok, deszcz, cyniczny detektyw."
|
||||||
|
},
|
||||||
|
fantasy: {
|
||||||
|
title: "Przygoda Fantasy",
|
||||||
|
desc: "Epicka podróż, magia, artefakty."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stepType: {
|
||||||
|
title: "Rodzaj Wydarzenia",
|
||||||
|
subtitle: "Czego dotyczy Twoja relacja?",
|
||||||
|
types: {
|
||||||
|
sport: "Wydarzenie Sportowe",
|
||||||
|
culture: "Wydarzenie Kulturalne",
|
||||||
|
trip: "Wycieczka / Podróż",
|
||||||
|
party: "Impreza",
|
||||||
|
work: "Praca / Konferencja",
|
||||||
|
other: "Inne"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stepPlatform: {
|
||||||
|
title: "Wybierz Platformę",
|
||||||
|
subtitle: "Gdzie opublikujesz materiał?",
|
||||||
|
instagram: {
|
||||||
|
title: "Instagram",
|
||||||
|
desc: "Carousel / Post"
|
||||||
|
},
|
||||||
|
youtube: {
|
||||||
|
title: "YouTube",
|
||||||
|
desc: "Shorts / Video"
|
||||||
|
},
|
||||||
|
strava: {
|
||||||
|
title: "Strava",
|
||||||
|
desc: "Activity / Photos"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stepToneGoal: {
|
||||||
|
toneTitle: "Wybierz Ton (Vibe)",
|
||||||
|
toneSubtitle: "Jak chcesz brzmieć?",
|
||||||
|
goalTitle: "Wybierz Cel",
|
||||||
|
goalSubtitle: "Co chcesz osiągnąć tym postem?",
|
||||||
|
nextBtn: "Przejdź do szczegółów",
|
||||||
|
tones: {
|
||||||
|
funny: { label: "Luzak", desc: "Humor, dystans, memy" },
|
||||||
|
serious: { label: "Ekspert", desc: "Konkrety, wiedza, liczby" },
|
||||||
|
inspirational: { label: "Mentor", desc: "Emocje, głębia, lekcja" }
|
||||||
|
},
|
||||||
|
goals: {
|
||||||
|
engagement: { label: "Społeczność", desc: "Komentarze i dyskusja" },
|
||||||
|
viral: { label: "Zasięg", desc: "Udostępnienia (Share)" },
|
||||||
|
sales: { label: "Sprzedaż", desc: "Kliknięcie w link / Zakup" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stepDetails: {
|
||||||
|
title: "Szczegóły",
|
||||||
|
subtitleTrip: "Zaplanuj trasę i opisz przebieg podróży.",
|
||||||
|
subtitleEvent: "Uzupełnij informacje o wydarzeniu.",
|
||||||
|
tripSection: {
|
||||||
|
title: "Plan Podróży",
|
||||||
|
apiKeyMissing: "Brak klucza w konfiguracji (VITE_GOOGLE_MAPS_KEY)",
|
||||||
|
apiKeyMissingDesc: "Wklej klucz ręcznie poniżej, aby mapy zadziałały.",
|
||||||
|
apiKeyPlaceholder: "Wklej klucz Google Maps API (AIza...)",
|
||||||
|
modeDriving: "Samochód / Droga",
|
||||||
|
modeWalking: "Pieszo / Szlak",
|
||||||
|
modeRequired: "* Wybór rodzaju trasy jest wymagany",
|
||||||
|
startPoint: "Punkt Startowy (np. Kraków)",
|
||||||
|
startDesc: "Opis startu (np. Zbiórka o 6:00)",
|
||||||
|
endPoint: "Punkt Końcowy (np. Zakopane)",
|
||||||
|
endDesc: "Opis końca (np. Nareszcie piwo)",
|
||||||
|
stopPlaceholder: "Przystanek",
|
||||||
|
stopDescPlaceholder: "Co tam robiliście?",
|
||||||
|
addStop: "Dodaj przystanek"
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
title: "Tytuł wydarzenia",
|
||||||
|
titlePlaceholder: "np. Roadtrip po Bałkanach",
|
||||||
|
desc: "Krótki opis / Notatki",
|
||||||
|
descPlaceholder: "Ogólny klimat, emocje, dodatkowe szczegóły...",
|
||||||
|
files: "Materiały pomocnicze (Max 3)",
|
||||||
|
filesDrop: "Kliknij, aby dodać pliki",
|
||||||
|
filesSub: "GPX, PDF, JPG, PNG",
|
||||||
|
gpxPreviewBtn: "👁️ Podgląd danych dla AI"
|
||||||
|
},
|
||||||
|
generateBtn: {
|
||||||
|
loading: "Generowanie Historii...",
|
||||||
|
idle: "Generuj Relację"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stepResult: {
|
||||||
|
title: "Twój Vibe Gotowy! 🎉",
|
||||||
|
subtitle: "Oto kompletna struktura Twojego posta. Skopiuj i publikuj.",
|
||||||
|
editBtn: "Edytuj / Popraw",
|
||||||
|
captionTitle: "Post Caption (Opis)",
|
||||||
|
slidesTitle: "Struktura Wizualna (Slajdy / Zdjęcia)",
|
||||||
|
copy: "Kopiuj",
|
||||||
|
copied: "Skopiowano!",
|
||||||
|
editPanel: {
|
||||||
|
title: "Wprowadź poprawki",
|
||||||
|
regenerating: "Nanoszę poprawki...",
|
||||||
|
slidesLabel: "Liczba slajdów / Elementów",
|
||||||
|
feedbackLabel: "Co chcesz zmienić w treści?",
|
||||||
|
feedbackPlaceholder: "np. Zmień 'ból szczęki' na 'ból głowy'. Dodaj więcej emoji...",
|
||||||
|
applyBtn: "Zastosuj poprawki"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
login: {
|
||||||
|
title: "Dostęp Chroniony",
|
||||||
|
desc: "Wprowadź hasło, aby uzyskać dostęp.",
|
||||||
|
btn: "Odblokuj",
|
||||||
|
error: "Nieprawidłowe hasło",
|
||||||
|
configError: "Błąd Konfiguracji"
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { WizardState, Step } from '../types';
|
import { WizardState } from '../types';
|
||||||
import { Camera, BookOpen, Ghost, Sword } from 'lucide-react';
|
import { Camera, BookOpen, Ghost, Sword } from 'lucide-react';
|
||||||
|
import { UI_TEXT } from '../_EDITABLE_CONFIG/ui_text';
|
||||||
|
|
||||||
interface StepContextProps {
|
interface StepContextProps {
|
||||||
data: WizardState;
|
data: WizardState;
|
||||||
@@ -11,13 +13,11 @@ interface StepContextProps {
|
|||||||
const StepContext: React.FC<StepContextProps> = ({ data, updateData, nextStep }) => {
|
const StepContext: React.FC<StepContextProps> = ({ data, updateData, nextStep }) => {
|
||||||
|
|
||||||
const handleContextSelect = (context: WizardState['context']) => {
|
const handleContextSelect = (context: WizardState['context']) => {
|
||||||
// If selecting Relacja, clear storyStyle and move on
|
|
||||||
if (context === 'relacja') {
|
if (context === 'relacja') {
|
||||||
updateData({ context, storyStyle: null });
|
updateData({ context, storyStyle: null });
|
||||||
setTimeout(nextStep, 150);
|
setTimeout(nextStep, 150);
|
||||||
} else {
|
} else {
|
||||||
// If selecting Opowiesc, just update context and stay for sub-step
|
updateData({ context, storyStyle: null });
|
||||||
updateData({ context, storyStyle: null }); // Reset style if switching back to opowiesc
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,10 +29,9 @@ const StepContext: React.FC<StepContextProps> = ({ data, updateData, nextStep })
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-8 animate-fade-in">
|
<div className="space-y-8 animate-fade-in">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">Wybierz Kontekst</h2>
|
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">{UI_TEXT.stepContext.title}</h2>
|
||||||
<p className="text-gray-500 mb-8 text-lg">Jaki rodzaj historii chcesz opowiedzieć?</p>
|
<p className="text-gray-500 mb-8 text-lg">{UI_TEXT.stepContext.subtitle}</p>
|
||||||
|
|
||||||
{/* Main Context Selection */}
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
|
||||||
<button
|
<button
|
||||||
onClick={() => handleContextSelect('relacja')}
|
onClick={() => handleContextSelect('relacja')}
|
||||||
@@ -43,8 +42,8 @@ const StepContext: React.FC<StepContextProps> = ({ data, updateData, nextStep })
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Camera size={48} className={`mb-5 stroke-1 transition-colors ${data.context === 'relacja' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
<Camera size={48} className={`mb-5 stroke-1 transition-colors ${data.context === 'relacja' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
||||||
<span className="text-xl font-bold tracking-tight">Relacja (Vlog)</span>
|
<span className="text-xl font-bold tracking-tight">{UI_TEXT.stepContext.relacja.title}</span>
|
||||||
<span className="text-sm opacity-75 mt-2 font-medium">Tu i teraz, emocje, akcja.</span>
|
<span className="text-sm opacity-75 mt-2 font-medium">{UI_TEXT.stepContext.relacja.desc}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -56,16 +55,15 @@ const StepContext: React.FC<StepContextProps> = ({ data, updateData, nextStep })
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<BookOpen size={48} className={`mb-5 stroke-1 transition-colors ${data.context === 'opowiesc' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
<BookOpen size={48} className={`mb-5 stroke-1 transition-colors ${data.context === 'opowiesc' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
||||||
<span className="text-xl font-bold tracking-tight">Opowieść</span>
|
<span className="text-xl font-bold tracking-tight">{UI_TEXT.stepContext.opowiesc.title}</span>
|
||||||
<span className="text-sm opacity-75 mt-2 font-medium">Wspomnienia, refleksja, morał.</span>
|
<span className="text-sm opacity-75 mt-2 font-medium">{UI_TEXT.stepContext.opowiesc.desc}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Sub-step for Opowiesc: Story Style */}
|
|
||||||
{data.context === 'opowiesc' && (
|
{data.context === 'opowiesc' && (
|
||||||
<div className="animate-fade-in border-t border-gray-100 pt-8">
|
<div className="animate-fade-in border-t border-gray-100 pt-8">
|
||||||
<h3 className="text-xl font-bold tracking-tight text-gray-900 mb-3">Wybierz Styl Opowieści</h3>
|
<h3 className="text-xl font-bold tracking-tight text-gray-900 mb-3">{UI_TEXT.stepContext.styles.title}</h3>
|
||||||
<p className="text-gray-500 mb-6 text-sm">Nadaj historii unikalny klimat.</p>
|
<p className="text-gray-500 mb-6 text-sm">{UI_TEXT.stepContext.styles.subtitle}</p>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
<button
|
<button
|
||||||
@@ -78,8 +76,8 @@ const StepContext: React.FC<StepContextProps> = ({ data, updateData, nextStep })
|
|||||||
>
|
>
|
||||||
<Ghost size={32} className={`mr-4 stroke-1 ${data.storyStyle === 'noir' ? 'text-white' : 'text-gray-400 group-hover:text-gray-900'}`} />
|
<Ghost size={32} className={`mr-4 stroke-1 ${data.storyStyle === 'noir' ? 'text-white' : 'text-gray-400 group-hover:text-gray-900'}`} />
|
||||||
<div>
|
<div>
|
||||||
<span className="text-lg font-bold tracking-tight block">Kryminał NOIR</span>
|
<span className="text-lg font-bold tracking-tight block">{UI_TEXT.stepContext.styles.noir.title}</span>
|
||||||
<span className={`text-xs block mt-1 ${data.storyStyle === 'noir' ? 'text-gray-400' : 'text-gray-500'}`}>Mrok, deszcz, cyniczny detektyw.</span>
|
<span className={`text-xs block mt-1 ${data.storyStyle === 'noir' ? 'text-gray-400' : 'text-gray-500'}`}>{UI_TEXT.stepContext.styles.noir.desc}</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -93,14 +91,13 @@ const StepContext: React.FC<StepContextProps> = ({ data, updateData, nextStep })
|
|||||||
>
|
>
|
||||||
<Sword size={32} className={`mr-4 stroke-1 ${data.storyStyle === 'fantasy' ? 'text-purple-600' : 'text-gray-400 group-hover:text-purple-600'}`} />
|
<Sword size={32} className={`mr-4 stroke-1 ${data.storyStyle === 'fantasy' ? 'text-purple-600' : 'text-gray-400 group-hover:text-purple-600'}`} />
|
||||||
<div>
|
<div>
|
||||||
<span className="text-lg font-bold tracking-tight block">Przygoda Fantasy</span>
|
<span className="text-lg font-bold tracking-tight block">{UI_TEXT.stepContext.styles.fantasy.title}</span>
|
||||||
<span className="text-xs text-gray-500 block mt-1">Epicka podróż, magia, artefakty.</span>
|
<span className="text-xs text-gray-500 block mt-1">{UI_TEXT.stepContext.styles.fantasy.desc}</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
import React, { useRef, useState, useEffect } from 'react';
|
import React, { useRef, useState, useEffect } from 'react';
|
||||||
import { WizardState } from '../types';
|
import { WizardState } from '../types';
|
||||||
import { UploadCloud, FileText, X, Image as ImageIcon, Sparkles, Loader2, MapPin, Navigation, Plus, Trash2, Flag, Target, AlertCircle, CheckCircle2, Car, Footprints } from 'lucide-react';
|
import { UploadCloud, FileText, X, Image as ImageIcon, Sparkles, Loader2, MapPin, Navigation, Plus, Trash2, Flag, Target, AlertCircle, CheckCircle2, Car, Footprints, Eye } from 'lucide-react';
|
||||||
import { processFile } from '../utils/fileUtils';
|
import { processFile } from '../utils/fileUtils';
|
||||||
import { getEnvVar } from '../utils/envUtils';
|
import { getEnvVar } from '../utils/envUtils';
|
||||||
|
import { UI_TEXT } from '../_EDITABLE_CONFIG/ui_text';
|
||||||
|
|
||||||
// --- HELPER COMPONENT: PLACE AUTOCOMPLETE INPUT (WIDGET VERSION) ---
|
// --- HELPER COMPONENT: PLACE AUTOCOMPLETE INPUT (WIDGET VERSION) ---
|
||||||
interface PlaceAutocompleteInputProps {
|
interface PlaceAutocompleteInputProps {
|
||||||
@@ -21,33 +22,20 @@ const PlaceAutocompleteInput: React.FC<PlaceAutocompleteInputProps> = ({ value,
|
|||||||
const inputRef = useRef<HTMLInputElement>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
const autocompleteRef = useRef<any>(null);
|
const autocompleteRef = useRef<any>(null);
|
||||||
|
|
||||||
// Initialize Google Autocomplete Widget
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!scriptLoaded || !inputRef.current || !(window as any).google || autocompleteRef.current) return;
|
if (!scriptLoaded || !inputRef.current || !(window as any).google || autocompleteRef.current) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const google = (window as any).google;
|
const google = (window as any).google;
|
||||||
|
|
||||||
// Use the standard Autocomplete widget attached to the input
|
|
||||||
const autocomplete = new google.maps.places.Autocomplete(inputRef.current, {
|
const autocomplete = new google.maps.places.Autocomplete(inputRef.current, {
|
||||||
fields: ["place_id", "geometry", "name", "formatted_address"],
|
fields: ["place_id", "geometry", "name", "formatted_address"],
|
||||||
types: ["geocode", "establishment"]
|
types: ["geocode", "establishment"]
|
||||||
});
|
});
|
||||||
|
|
||||||
autocompleteRef.current = autocomplete;
|
autocompleteRef.current = autocomplete;
|
||||||
|
|
||||||
autocomplete.addListener("place_changed", () => {
|
autocomplete.addListener("place_changed", () => {
|
||||||
const place = autocomplete.getPlace();
|
const place = autocomplete.getPlace();
|
||||||
|
if (!place.geometry) return;
|
||||||
if (!place.geometry) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIX: Use formatted_address as fallback if name is empty/missing
|
|
||||||
const name = place.name || place.formatted_address || "";
|
const name = place.name || place.formatted_address || "";
|
||||||
const address = place.formatted_address;
|
const address = place.formatted_address;
|
||||||
|
|
||||||
// Update parent state
|
|
||||||
onChange(name, address);
|
onChange(name, address);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -71,8 +59,6 @@ const PlaceAutocompleteInput: React.FC<PlaceAutocompleteInputProps> = ({ value,
|
|||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Address Confirmation Hint */}
|
|
||||||
{addressPreview && (
|
{addressPreview && (
|
||||||
<div className="text-[10px] text-gray-500 mt-1 ml-1 flex items-center gap-1 animate-fade-in">
|
<div className="text-[10px] text-gray-500 mt-1 ml-1 flex items-center gap-1 animate-fade-in">
|
||||||
<CheckCircle2 size={10} className="text-green-500" />
|
<CheckCircle2 size={10} className="text-green-500" />
|
||||||
@@ -84,7 +70,6 @@ const PlaceAutocompleteInput: React.FC<PlaceAutocompleteInputProps> = ({ value,
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// --- MAIN COMPONENT ---
|
|
||||||
interface StepDetailsProps {
|
interface StepDetailsProps {
|
||||||
data: WizardState;
|
data: WizardState;
|
||||||
updateData: (updates: Partial<WizardState> | ((prev: WizardState) => Partial<WizardState>)) => void;
|
updateData: (updates: Partial<WizardState> | ((prev: WizardState) => Partial<WizardState>)) => void;
|
||||||
@@ -98,26 +83,23 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
const [mapError, setMapError] = useState<{title: string, msg: string} | null>(null);
|
const [mapError, setMapError] = useState<{title: string, msg: string} | null>(null);
|
||||||
const [scriptLoaded, setScriptLoaded] = useState(false);
|
const [scriptLoaded, setScriptLoaded] = useState(false);
|
||||||
|
|
||||||
// STRICT MODE: Use VITE_GOOGLE_MAPS_KEY
|
// State for GPX Text Preview
|
||||||
|
const [showGpxPreview, setShowGpxPreview] = useState(false);
|
||||||
|
|
||||||
const getEffectiveKey = () => {
|
const getEffectiveKey = () => {
|
||||||
if (data.tripData?.googleMapsKey) return data.tripData.googleMapsKey;
|
if (data.tripData?.googleMapsKey) return data.tripData.googleMapsKey;
|
||||||
return getEnvVar('VITE_GOOGLE_MAPS_KEY');
|
return getEnvVar('VITE_GOOGLE_MAPS_KEY');
|
||||||
};
|
};
|
||||||
|
|
||||||
const effectiveKey = getEffectiveKey();
|
const effectiveKey = getEffectiveKey();
|
||||||
|
|
||||||
// Warning if no key is found at all
|
|
||||||
const isKeyMissing = !effectiveKey;
|
const isKeyMissing = !effectiveKey;
|
||||||
|
|
||||||
// --- GOOGLE MAPS LOADING ---
|
|
||||||
const loadMapsScript = (apiKey: string) => {
|
const loadMapsScript = (apiKey: string) => {
|
||||||
if (!apiKey) return;
|
if (!apiKey) return;
|
||||||
|
|
||||||
if ((window as any).google?.maps?.places) {
|
if ((window as any).google?.maps?.places) {
|
||||||
setScriptLoaded(true);
|
setScriptLoaded(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingScript = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
const existingScript = document.querySelector(`script[src*="maps.googleapis.com/maps/api/js"]`);
|
||||||
if (existingScript) {
|
if (existingScript) {
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
@@ -129,7 +111,6 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
}, 500);
|
}, 500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places&loading=async&v=weekly`;
|
script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places&loading=async&v=weekly`;
|
||||||
script.async = true;
|
script.async = true;
|
||||||
@@ -157,7 +138,6 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
}
|
}
|
||||||
}, [data.eventType, effectiveKey]);
|
}, [data.eventType, effectiveKey]);
|
||||||
|
|
||||||
// Initialize Trip Data if missing
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data.eventType === 'trip') {
|
if (data.eventType === 'trip') {
|
||||||
if (!data.tripData) {
|
if (!data.tripData) {
|
||||||
@@ -167,7 +147,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
endPoint: { place: '', description: '' },
|
endPoint: { place: '', description: '' },
|
||||||
stops: [{ id: crypto.randomUUID(), place: '', description: '' }],
|
stops: [{ id: crypto.randomUUID(), place: '', description: '' }],
|
||||||
travelMode: null,
|
travelMode: null,
|
||||||
googleMapsKey: '' // Don't auto-fill undefined keys
|
googleMapsKey: ''
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -190,7 +170,6 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
updateData(prev => ({ files: prev.files.filter(f => f.id !== id) }));
|
updateData(prev => ({ files: prev.files.filter(f => f.id !== id) }));
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- TRIP DATA HELPERS ---
|
|
||||||
const updateApiKey = (val: string) => {
|
const updateApiKey = (val: string) => {
|
||||||
updateData(prev => ({
|
updateData(prev => ({
|
||||||
tripData: prev.tripData ? { ...prev.tripData, googleMapsKey: val } : prev.tripData
|
tripData: prev.tripData ? { ...prev.tripData, googleMapsKey: val } : prev.tripData
|
||||||
@@ -202,13 +181,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
updateData(prev => {
|
updateData(prev => {
|
||||||
if (!prev.tripData) return {};
|
if (!prev.tripData) return {};
|
||||||
return {
|
return {
|
||||||
tripData: {
|
tripData: { ...prev.tripData, [pointType]: { ...prev.tripData[pointType], [field]: value } }
|
||||||
...prev.tripData,
|
|
||||||
[pointType]: {
|
|
||||||
...prev.tripData[pointType],
|
|
||||||
[field]: value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -217,79 +190,97 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
updateData(prev => {
|
updateData(prev => {
|
||||||
if (!prev.tripData) return {};
|
if (!prev.tripData) return {};
|
||||||
const newStops = prev.tripData.stops.map(s => s.id === id ? { ...s, [field]: value } : s);
|
const newStops = prev.tripData.stops.map(s => s.id === id ? { ...s, [field]: value } : s);
|
||||||
return {
|
return { tripData: { ...prev.tripData, stops: newStops } };
|
||||||
tripData: { ...prev.tripData, stops: newStops }
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const addStop = () => {
|
const addStop = () => {
|
||||||
updateData(prev => {
|
updateData(prev => {
|
||||||
if (!prev.tripData) return {};
|
if (!prev.tripData) return {};
|
||||||
return {
|
return { tripData: { ...prev.tripData, stops: [...prev.tripData.stops, { id: crypto.randomUUID(), place: '', description: '' }] } };
|
||||||
tripData: {
|
|
||||||
...prev.tripData,
|
|
||||||
stops: [...prev.tripData.stops, { id: crypto.randomUUID(), place: '', description: '' }]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeStop = (id: string) => {
|
const removeStop = (id: string) => {
|
||||||
updateData(prev => {
|
updateData(prev => {
|
||||||
if (!prev.tripData) return {};
|
if (!prev.tripData) return {};
|
||||||
return {
|
return { tripData: { ...prev.tripData, stops: prev.tripData.stops.filter(s => s.id !== id) } };
|
||||||
tripData: {
|
|
||||||
...prev.tripData,
|
|
||||||
stops: prev.tripData.stops.filter(s => s.id !== id)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const setTravelMode = (mode: 'DRIVING' | 'WALKING') => {
|
const setTravelMode = (mode: 'DRIVING' | 'WALKING') => {
|
||||||
updateData(prev => {
|
updateData(prev => {
|
||||||
if (!prev.tripData) return {};
|
if (!prev.tripData) return {};
|
||||||
return {
|
return { tripData: { ...prev.tripData, travelMode: mode } };
|
||||||
tripData: { ...prev.tripData, travelMode: mode }
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Validation Check
|
|
||||||
const isTripModeValid = data.eventType !== 'trip' || (data.tripData && data.tripData.travelMode !== null);
|
const isTripModeValid = data.eventType !== 'trip' || (data.tripData && data.tripData.travelMode !== null);
|
||||||
const isReadyToGenerate = data.title && isTripModeValid;
|
const isReadyToGenerate = data.title && isTripModeValid;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-10 animate-fade-in">
|
<div className="space-y-10 animate-fade-in relative">
|
||||||
|
|
||||||
|
{/* GPX PREVIEW MODAL */}
|
||||||
|
{showGpxPreview && (
|
||||||
|
<div className="fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4 backdrop-blur-sm animate-fade-in">
|
||||||
|
<div className="bg-white rounded-lg shadow-xl max-w-lg w-full overflow-hidden flex flex-col max-h-[80vh]">
|
||||||
|
<div className="p-4 border-b border-gray-100 flex justify-between items-center bg-gray-50">
|
||||||
|
<h3 className="font-bold text-gray-900 flex items-center gap-2">
|
||||||
|
<FileText size={18} className="text-[#EA4420]" />
|
||||||
|
Podgląd kontekstu GPX
|
||||||
|
</h3>
|
||||||
|
<button onClick={() => setShowGpxPreview(false)} className="text-gray-400 hover:text-gray-600">
|
||||||
|
<X size={20} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="p-4 overflow-y-auto font-mono text-xs text-gray-700 bg-gray-50/50">
|
||||||
|
<p className="mb-2 text-gray-400 font-sans uppercase font-bold tracking-wider">To widzi AI:</p>
|
||||||
|
<div className="bg-white border border-gray-200 p-3 rounded">
|
||||||
|
<p>DYSTANS: {data.stats.distance || "0"}</p>
|
||||||
|
<p>CZAS TRWANIA: {data.stats.duration || "0"}</p>
|
||||||
|
<p>PRZEWYŻSZENIA: {data.stats.elevation || "0"}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="p-4 border-t border-gray-100 flex justify-end">
|
||||||
|
<button
|
||||||
|
onClick={() => setShowGpxPreview(false)}
|
||||||
|
className="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded text-sm font-bold transition-colors"
|
||||||
|
>
|
||||||
|
Zamknij
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">Szczegóły</h2>
|
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">{UI_TEXT.stepDetails.title}</h2>
|
||||||
<p className="text-gray-500 mb-8 text-lg">
|
<p className="text-gray-500 mb-8 text-lg">
|
||||||
{data.eventType === 'trip' ? 'Zaplanuj trasę i opisz przebieg podróży.' : 'Uzupełnij informacje o wydarzeniu.'}
|
{data.eventType === 'trip' ? UI_TEXT.stepDetails.subtitleTrip : UI_TEXT.stepDetails.subtitleEvent}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-8">
|
<div className="space-y-8">
|
||||||
|
|
||||||
{/* SEKCJA DLA WYCIECZEK (TRIP) */}
|
{/* TRIP SECTION */}
|
||||||
{data.eventType === 'trip' && data.tripData && (
|
{data.eventType === 'trip' && data.tripData && (
|
||||||
<div className="bg-gray-50 border border-gray-200 rounded-xl p-6 space-y-6">
|
<div className="bg-gray-50 border border-gray-200 rounded-xl p-6 space-y-6">
|
||||||
|
|
||||||
{/* Manual Input if Env key is missing */}
|
|
||||||
{isKeyMissing && !data.tripData.googleMapsKey && (
|
{isKeyMissing && !data.tripData.googleMapsKey && (
|
||||||
<div className="bg-yellow-50 p-4 rounded-md border border-yellow-200 mb-2">
|
<div className="bg-yellow-50 p-4 rounded-md border border-yellow-200 mb-2">
|
||||||
<div className="flex items-start gap-3">
|
<div className="flex items-start gap-3">
|
||||||
<AlertCircle className="text-yellow-600 mt-0.5" size={20} />
|
<AlertCircle className="text-yellow-600 mt-0.5" size={20} />
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<h4 className="font-bold text-yellow-800 text-sm">Brak klucza w konfiguracji (VITE_GOOGLE_MAPS_KEY)</h4>
|
<h4 className="font-bold text-yellow-800 text-sm">{UI_TEXT.stepDetails.tripSection.apiKeyMissing}</h4>
|
||||||
<p className="text-xs text-yellow-700 mt-1 mb-2">
|
<p className="text-xs text-yellow-700 mt-1 mb-2">
|
||||||
Wklej klucz ręcznie poniżej, aby mapy zadziałały.
|
{UI_TEXT.stepDetails.tripSection.apiKeyMissingDesc}
|
||||||
</p>
|
</p>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={data.tripData?.googleMapsKey || ''}
|
value={data.tripData?.googleMapsKey || ''}
|
||||||
onChange={(e) => updateApiKey(e.target.value)}
|
onChange={(e) => updateApiKey(e.target.value)}
|
||||||
placeholder="Wklej klucz Google Maps API (AIza...)"
|
placeholder={UI_TEXT.stepDetails.tripSection.apiKeyPlaceholder}
|
||||||
className="w-full p-2 text-sm border border-yellow-300 rounded bg-white focus:border-[#EA4420] outline-none"
|
className="w-full p-2 text-sm border border-yellow-300 rounded bg-white focus:border-[#EA4420] outline-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -297,7 +288,6 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Detailed Error Banner for Maps */}
|
|
||||||
{mapError && (
|
{mapError && (
|
||||||
<div className="bg-red-50 border border-red-200 p-4 rounded-lg flex items-start gap-3 text-red-700">
|
<div className="bg-red-50 border border-red-200 p-4 rounded-lg flex items-start gap-3 text-red-700">
|
||||||
<AlertCircle className="flex-shrink-0 mt-0.5" size={20} />
|
<AlertCircle className="flex-shrink-0 mt-0.5" size={20} />
|
||||||
@@ -311,7 +301,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
<div className="flex items-center justify-between gap-2 mb-2 pt-1">
|
<div className="flex items-center justify-between gap-2 mb-2 pt-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Navigation className="text-[#EA4420]" size={24} />
|
<Navigation className="text-[#EA4420]" size={24} />
|
||||||
<h3 className="text-xl font-bold text-gray-900">Plan Podróży</h3>
|
<h3 className="text-xl font-bold text-gray-900">{UI_TEXT.stepDetails.tripSection.title}</h3>
|
||||||
{scriptLoaded && !mapError && (
|
{scriptLoaded && !mapError && (
|
||||||
<span className="hidden sm:flex text-xs bg-green-100 text-green-700 px-2 py-1 rounded-full font-bold items-center gap-1">
|
<span className="hidden sm:flex text-xs bg-green-100 text-green-700 px-2 py-1 rounded-full font-bold items-center gap-1">
|
||||||
<CheckCircle2 size={12} /> API OK
|
<CheckCircle2 size={12} /> API OK
|
||||||
@@ -330,7 +320,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Car size={32} className="mb-2" />
|
<Car size={32} className="mb-2" />
|
||||||
<span className="font-bold text-sm sm:text-base">Samochód / Droga</span>
|
<span className="font-bold text-sm sm:text-base">{UI_TEXT.stepDetails.tripSection.modeDriving}</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => setTravelMode('WALKING')}
|
onClick={() => setTravelMode('WALKING')}
|
||||||
@@ -341,13 +331,13 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Footprints size={32} className="mb-2" />
|
<Footprints size={32} className="mb-2" />
|
||||||
<span className="font-bold text-sm sm:text-base">Pieszo / Szlak</span>
|
<span className="font-bold text-sm sm:text-base">{UI_TEXT.stepDetails.tripSection.modeWalking}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!data.tripData.travelMode && (
|
{!data.tripData.travelMode && (
|
||||||
<p className="text-center text-xs text-red-500 font-bold animate-pulse">
|
<p className="text-center text-xs text-red-500 font-bold animate-pulse">
|
||||||
* Wybór rodzaju trasy jest wymagany
|
{UI_TEXT.stepDetails.tripSection.modeRequired}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -362,7 +352,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
if(preview) updatePoint('startPoint', 'addressPreview', preview);
|
if(preview) updatePoint('startPoint', 'addressPreview', preview);
|
||||||
}}
|
}}
|
||||||
addressPreview={data.tripData.startPoint.addressPreview}
|
addressPreview={data.tripData.startPoint.addressPreview}
|
||||||
placeholder="Punkt Startowy (np. Kraków)"
|
placeholder={UI_TEXT.stepDetails.tripSection.startPoint}
|
||||||
icon={<Flag size={16} className="text-green-600" />}
|
icon={<Flag size={16} className="text-green-600" />}
|
||||||
scriptLoaded={scriptLoaded}
|
scriptLoaded={scriptLoaded}
|
||||||
onError={(msg) => setMapError({title: "Błąd API Places", msg})}
|
onError={(msg) => setMapError({title: "Błąd API Places", msg})}
|
||||||
@@ -373,7 +363,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
value={data.tripData.startPoint.description}
|
value={data.tripData.startPoint.description}
|
||||||
onChange={(e) => updatePoint('startPoint', 'description', e.target.value)}
|
onChange={(e) => updatePoint('startPoint', 'description', e.target.value)}
|
||||||
className="w-full p-3 border border-gray-300 rounded-md focus:border-[#EA4420] outline-none"
|
className="w-full p-3 border border-gray-300 rounded-md focus:border-[#EA4420] outline-none"
|
||||||
placeholder="Opis startu (np. Zbiórka o 6:00)"
|
placeholder={UI_TEXT.stepDetails.tripSection.startDesc}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-[42px]"></div>
|
<div className="w-[42px]"></div>
|
||||||
@@ -390,7 +380,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
if(preview) updateStop(stop.id, 'addressPreview', preview);
|
if(preview) updateStop(stop.id, 'addressPreview', preview);
|
||||||
}}
|
}}
|
||||||
addressPreview={stop.addressPreview}
|
addressPreview={stop.addressPreview}
|
||||||
placeholder={`Przystanek ${index + 1}`}
|
placeholder={`${UI_TEXT.stepDetails.tripSection.stopPlaceholder} ${index + 1}`}
|
||||||
icon={<MapPin size={16} className="text-blue-500" />}
|
icon={<MapPin size={16} className="text-blue-500" />}
|
||||||
scriptLoaded={scriptLoaded}
|
scriptLoaded={scriptLoaded}
|
||||||
onError={(msg) => setMapError({title: "Błąd API Places", msg})}
|
onError={(msg) => setMapError({title: "Błąd API Places", msg})}
|
||||||
@@ -401,7 +391,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
value={stop.description}
|
value={stop.description}
|
||||||
onChange={(e) => updateStop(stop.id, 'description', e.target.value)}
|
onChange={(e) => updateStop(stop.id, 'description', e.target.value)}
|
||||||
className="w-full p-3 border border-gray-200 rounded-md focus:border-[#EA4420] outline-none"
|
className="w-full p-3 border border-gray-200 rounded-md focus:border-[#EA4420] outline-none"
|
||||||
placeholder="Co tam robiliście?"
|
placeholder={UI_TEXT.stepDetails.tripSection.stopDescPlaceholder}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@@ -420,7 +410,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
className="flex items-center space-x-2 text-sm font-bold text-[#EA4420] hover:bg-[#EA4420]/5 px-4 py-2 rounded-md transition-colors"
|
className="flex items-center space-x-2 text-sm font-bold text-[#EA4420] hover:bg-[#EA4420]/5 px-4 py-2 rounded-md transition-colors"
|
||||||
>
|
>
|
||||||
<Plus size={16} />
|
<Plus size={16} />
|
||||||
<span>Dodaj przystanek</span>
|
<span>{UI_TEXT.stepDetails.tripSection.addStop}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -434,7 +424,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
if(preview) updatePoint('endPoint', 'addressPreview', preview);
|
if(preview) updatePoint('endPoint', 'addressPreview', preview);
|
||||||
}}
|
}}
|
||||||
addressPreview={data.tripData.endPoint.addressPreview}
|
addressPreview={data.tripData.endPoint.addressPreview}
|
||||||
placeholder="Punkt Końcowy (np. Zakopane)"
|
placeholder={UI_TEXT.stepDetails.tripSection.endPoint}
|
||||||
icon={<Target size={16} className="text-red-600" />}
|
icon={<Target size={16} className="text-red-600" />}
|
||||||
scriptLoaded={scriptLoaded}
|
scriptLoaded={scriptLoaded}
|
||||||
onError={(msg) => setMapError({title: "Błąd API Places", msg})}
|
onError={(msg) => setMapError({title: "Błąd API Places", msg})}
|
||||||
@@ -445,7 +435,7 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
value={data.tripData.endPoint.description}
|
value={data.tripData.endPoint.description}
|
||||||
onChange={(e) => updatePoint('endPoint', 'description', e.target.value)}
|
onChange={(e) => updatePoint('endPoint', 'description', e.target.value)}
|
||||||
className="w-full p-3 border border-gray-300 rounded-md focus:border-[#EA4420] outline-none"
|
className="w-full p-3 border border-gray-300 rounded-md focus:border-[#EA4420] outline-none"
|
||||||
placeholder="Opis końca (np. Nareszcie piwo)"
|
placeholder={UI_TEXT.stepDetails.tripSection.endDesc}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-[42px]"></div>
|
<div className="w-[42px]"></div>
|
||||||
@@ -457,29 +447,29 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
{/* Standard Fields */}
|
{/* Standard Fields */}
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-bold text-gray-700 mb-2">Tytuł wydarzenia</label>
|
<label className="block text-sm font-bold text-gray-700 mb-2">{UI_TEXT.stepDetails.fields.title}</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={data.title}
|
value={data.title}
|
||||||
onChange={(e) => updateData({ title: e.target.value })}
|
onChange={(e) => updateData({ title: e.target.value })}
|
||||||
className="w-full p-4 border border-gray-200 rounded-md focus:ring-1 focus:ring-[#EA4420] focus:border-[#EA4420] outline-none transition-all font-medium text-gray-900 placeholder-gray-300"
|
className="w-full p-4 border border-gray-200 rounded-md focus:ring-1 focus:ring-[#EA4420] focus:border-[#EA4420] outline-none transition-all font-medium text-gray-900 placeholder-gray-300"
|
||||||
placeholder="np. Roadtrip po Bałkanach"
|
placeholder={UI_TEXT.stepDetails.fields.titlePlaceholder}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-bold text-gray-700 mb-2">Krótki opis / Notatki</label>
|
<label className="block text-sm font-bold text-gray-700 mb-2">{UI_TEXT.stepDetails.fields.desc}</label>
|
||||||
<textarea
|
<textarea
|
||||||
value={data.description}
|
value={data.description}
|
||||||
onChange={(e) => updateData({ description: e.target.value })}
|
onChange={(e) => updateData({ description: e.target.value })}
|
||||||
placeholder="Ogólny klimat, emocje, dodatkowe szczegóły, których nie ma w planie wycieczki..."
|
placeholder={UI_TEXT.stepDetails.fields.descPlaceholder}
|
||||||
rows={4}
|
rows={4}
|
||||||
className="w-full border border-gray-200 rounded-md p-4 text-base text-gray-700 focus:ring-1 focus:ring-[#EA4420] focus:border-[#EA4420] outline-none resize-none placeholder-gray-300"
|
className="w-full border border-gray-200 rounded-md p-4 text-base text-gray-700 focus:ring-1 focus:ring-[#EA4420] focus:border-[#EA4420] outline-none resize-none placeholder-gray-300"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-bold text-gray-700 mb-2">Materiały pomocnicze (Max 3)</label>
|
<label className="block text-sm font-bold text-gray-700 mb-2">{UI_TEXT.stepDetails.fields.files}</label>
|
||||||
<div
|
<div
|
||||||
className={`border-2 border-dashed rounded-md p-8 flex flex-col items-center justify-center text-center transition-all cursor-pointer group ${
|
className={`border-2 border-dashed rounded-md p-8 flex flex-col items-center justify-center text-center transition-all cursor-pointer group ${
|
||||||
error ? 'border-red-300 bg-red-50' : 'border-gray-200 hover:border-[#EA4420] hover:bg-[#EA4420]/5'
|
error ? 'border-red-300 bg-red-50' : 'border-gray-200 hover:border-[#EA4420] hover:bg-[#EA4420]/5'
|
||||||
@@ -495,8 +485,8 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
className="hidden"
|
className="hidden"
|
||||||
/>
|
/>
|
||||||
<UploadCloud size={32} className="text-gray-300 group-hover:text-[#EA4420] mb-3 transition-colors" />
|
<UploadCloud size={32} className="text-gray-300 group-hover:text-[#EA4420] mb-3 transition-colors" />
|
||||||
<p className="text-gray-600 font-medium">Kliknij, aby dodać pliki</p>
|
<p className="text-gray-600 font-medium">{UI_TEXT.stepDetails.fields.filesDrop}</p>
|
||||||
<p className="text-gray-400 text-xs mt-1">GPX, PDF, JPG, PNG</p>
|
<p className="text-gray-400 text-xs mt-1">{UI_TEXT.stepDetails.fields.filesSub}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error && <p className="text-red-500 text-sm mt-2">{error}</p>}
|
{error && <p className="text-red-500 text-sm mt-2">{error}</p>}
|
||||||
@@ -522,6 +512,19 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* GPX Preview Button */}
|
||||||
|
{(data.stats.distance || data.stats.duration || data.files.some(f => f.file.name.endsWith('.gpx'))) && (
|
||||||
|
<div className="flex justify-end">
|
||||||
|
<button
|
||||||
|
onClick={() => setShowGpxPreview(true)}
|
||||||
|
className="text-xs font-bold text-[#EA4420] flex items-center gap-1 hover:underline"
|
||||||
|
>
|
||||||
|
<Eye size={14} />
|
||||||
|
{UI_TEXT.stepDetails.fields.gpxPreviewBtn}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -534,12 +537,12 @@ const StepDetails: React.FC<StepDetailsProps> = ({ data, updateData, onGenerate,
|
|||||||
{isGenerating ? (
|
{isGenerating ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 size={24} className="animate-spin" />
|
<Loader2 size={24} className="animate-spin" />
|
||||||
<span>Generowanie Historii...</span>
|
<span>{UI_TEXT.stepDetails.generateBtn.loading}</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Sparkles size={24} />
|
<Sparkles size={24} />
|
||||||
<span>Generuj Relację</span>
|
<span>{UI_TEXT.stepDetails.generateBtn.idle}</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { WizardState, EventType } from '../types';
|
import { WizardState, EventType } from '../types';
|
||||||
import { Trophy, Tent, Ticket, PartyPopper, Briefcase, Sparkles } from 'lucide-react';
|
import { Trophy, Tent, Ticket, PartyPopper, Briefcase, Sparkles } from 'lucide-react';
|
||||||
|
import { UI_TEXT } from '../_EDITABLE_CONFIG/ui_text';
|
||||||
|
|
||||||
interface StepEventTypeProps {
|
interface StepEventTypeProps {
|
||||||
data: WizardState;
|
data: WizardState;
|
||||||
@@ -16,19 +18,19 @@ const StepEventType: React.FC<StepEventTypeProps> = ({ data, updateData, nextSte
|
|||||||
};
|
};
|
||||||
|
|
||||||
const types: { id: EventType; label: string; icon: React.ReactNode }[] = [
|
const types: { id: EventType; label: string; icon: React.ReactNode }[] = [
|
||||||
{ id: 'sport', label: 'Wydarzenie Sportowe', icon: <Trophy size={32} /> },
|
{ id: 'sport', label: UI_TEXT.stepType.types.sport, icon: <Trophy size={32} /> },
|
||||||
{ id: 'culture', label: 'Wydarzenie Kulturalne', icon: <Ticket size={32} /> },
|
{ id: 'culture', label: UI_TEXT.stepType.types.culture, icon: <Ticket size={32} /> },
|
||||||
{ id: 'trip', label: 'Wycieczka / Podróż', icon: <Tent size={32} /> },
|
{ id: 'trip', label: UI_TEXT.stepType.types.trip, icon: <Tent size={32} /> },
|
||||||
{ id: 'party', label: 'Impreza', icon: <PartyPopper size={32} /> },
|
{ id: 'party', label: UI_TEXT.stepType.types.party, icon: <PartyPopper size={32} /> },
|
||||||
{ id: 'work', label: 'Praca / Konferencja', icon: <Briefcase size={32} /> },
|
{ id: 'work', label: UI_TEXT.stepType.types.work, icon: <Briefcase size={32} /> },
|
||||||
{ id: 'other', label: 'Inne', icon: <Sparkles size={32} /> },
|
{ id: 'other', label: UI_TEXT.stepType.types.other, icon: <Sparkles size={32} /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8 animate-fade-in">
|
<div className="space-y-8 animate-fade-in">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">Rodzaj Wydarzenia</h2>
|
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">{UI_TEXT.stepType.title}</h2>
|
||||||
<p className="text-gray-500 mb-8 text-lg">Czego dotyczy Twoja relacja?</p>
|
<p className="text-gray-500 mb-8 text-lg">{UI_TEXT.stepType.subtitle}</p>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
|
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4">
|
||||||
{types.map((type) => (
|
{types.map((type) => (
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { WizardState } from '../types';
|
import { WizardState } from '../types';
|
||||||
import { Instagram, Youtube, Activity } from 'lucide-react';
|
import { Instagram, Youtube, Activity } from 'lucide-react';
|
||||||
|
import { UI_TEXT } from '../_EDITABLE_CONFIG/ui_text';
|
||||||
|
|
||||||
interface StepPlatformProps {
|
interface StepPlatformProps {
|
||||||
data: WizardState;
|
data: WizardState;
|
||||||
@@ -18,8 +20,8 @@ const StepPlatform: React.FC<StepPlatformProps> = ({ data, updateData, nextStep
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-8 animate-fade-in">
|
<div className="space-y-8 animate-fade-in">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">Wybierz Platformę</h2>
|
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">{UI_TEXT.stepPlatform.title}</h2>
|
||||||
<p className="text-gray-500 mb-8 text-lg">Gdzie opublikujesz materiał?</p>
|
<p className="text-gray-500 mb-8 text-lg">{UI_TEXT.stepPlatform.subtitle}</p>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||||
<button
|
<button
|
||||||
@@ -31,8 +33,8 @@ const StepPlatform: React.FC<StepPlatformProps> = ({ data, updateData, nextStep
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Instagram size={48} className={`mb-5 stroke-1 transition-colors ${data.platform === 'instagram' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
<Instagram size={48} className={`mb-5 stroke-1 transition-colors ${data.platform === 'instagram' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
||||||
<span className="text-xl font-bold tracking-tight">Instagram</span>
|
<span className="text-xl font-bold tracking-tight">{UI_TEXT.stepPlatform.instagram.title}</span>
|
||||||
<span className="text-sm opacity-75 mt-2 font-medium">Carousel / Post</span>
|
<span className="text-sm opacity-75 mt-2 font-medium">{UI_TEXT.stepPlatform.instagram.desc}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -44,8 +46,8 @@ const StepPlatform: React.FC<StepPlatformProps> = ({ data, updateData, nextStep
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Youtube size={48} className={`mb-5 stroke-1 transition-colors ${data.platform === 'youtube' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
<Youtube size={48} className={`mb-5 stroke-1 transition-colors ${data.platform === 'youtube' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
||||||
<span className="text-xl font-bold tracking-tight">YouTube</span>
|
<span className="text-xl font-bold tracking-tight">{UI_TEXT.stepPlatform.youtube.title}</span>
|
||||||
<span className="text-sm opacity-75 mt-2 font-medium">Shorts / Video</span>
|
<span className="text-sm opacity-75 mt-2 font-medium">{UI_TEXT.stepPlatform.youtube.desc}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -57,8 +59,8 @@ const StepPlatform: React.FC<StepPlatformProps> = ({ data, updateData, nextStep
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Activity size={48} className={`mb-5 stroke-1 transition-colors ${data.platform === 'strava' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
<Activity size={48} className={`mb-5 stroke-1 transition-colors ${data.platform === 'strava' ? 'text-[#EA4420]' : 'text-gray-400 group-hover:text-[#EA4420]'}`} />
|
||||||
<span className="text-xl font-bold tracking-tight">Strava</span>
|
<span className="text-xl font-bold tracking-tight">{UI_TEXT.stepPlatform.strava.title}</span>
|
||||||
<span className="text-sm opacity-75 mt-2 font-medium">Activity / Photos</span>
|
<span className="text-sm opacity-75 mt-2 font-medium">{UI_TEXT.stepPlatform.strava.desc}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,33 +3,18 @@ import React, { useState } from 'react';
|
|||||||
import { GeneratedContent, WizardState } from '../types';
|
import { GeneratedContent, WizardState } from '../types';
|
||||||
import { Copy, Check, Instagram, Image as ImageIcon, MessageSquare, Edit2, RefreshCw, X } from 'lucide-react';
|
import { Copy, Check, Instagram, Image as ImageIcon, MessageSquare, Edit2, RefreshCw, X } from 'lucide-react';
|
||||||
import TripMap from './TripMap';
|
import TripMap from './TripMap';
|
||||||
|
import { UI_TEXT } from '../_EDITABLE_CONFIG/ui_text';
|
||||||
|
|
||||||
interface StepResultProps {
|
interface ExtendedStepResultProps {
|
||||||
content: GeneratedContent;
|
content: GeneratedContent;
|
||||||
onRegenerate: (slideCount: number, feedback: string) => void;
|
onRegenerate: (slideCount: number, feedback: string) => void;
|
||||||
isRegenerating: boolean;
|
isRegenerating: boolean;
|
||||||
// We need to access the wizard state to check for trip data
|
|
||||||
// But standard props here only have content.
|
|
||||||
// Ideally, StepResult should receive `data` too, but for now I'll check if I can pass it from App.tsx or infer it.
|
|
||||||
// Wait, I can't access `data` unless I modify App.tsx to pass it to StepResult.
|
|
||||||
// Let's assume the parent updates the props.
|
|
||||||
// Actually, I'll modify the StepResultProps in this file, but I also need to modify App.tsx to pass 'data'.
|
|
||||||
// However, looking at App.tsx, StepResult is rendered inside App.tsx. I can pass `data` there easily.
|
|
||||||
// But wait, the previous code block for StepResult didn't show 'data' in props.
|
|
||||||
// I will add `tripData` to the props.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extending interface to include tripData optionally passed from parent
|
|
||||||
// Note: I will update App.tsx to pass this prop.
|
|
||||||
interface ExtendedStepResultProps extends StepResultProps {
|
|
||||||
tripData?: WizardState['tripData'];
|
tripData?: WizardState['tripData'];
|
||||||
}
|
}
|
||||||
|
|
||||||
const StepResult: React.FC<ExtendedStepResultProps> = ({ content, onRegenerate, isRegenerating, tripData }) => {
|
const StepResult: React.FC<ExtendedStepResultProps> = ({ content, onRegenerate, isRegenerating, tripData }) => {
|
||||||
const [copiedSection, setCopiedSection] = useState<string | null>(null);
|
const [copiedSection, setCopiedSection] = useState<string | null>(null);
|
||||||
const [copiedSlideIndex, setCopiedSlideIndex] = useState<number | null>(null);
|
const [copiedSlideIndex, setCopiedSlideIndex] = useState<number | null>(null);
|
||||||
|
|
||||||
// Edit Mode State
|
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const [slideCount, setSlideCount] = useState(content.slides.length || 12);
|
const [slideCount, setSlideCount] = useState(content.slides.length || 12);
|
||||||
const [feedback, setFeedback] = useState("");
|
const [feedback, setFeedback] = useState("");
|
||||||
@@ -48,16 +33,15 @@ const StepResult: React.FC<ExtendedStepResultProps> = ({ content, onRegenerate,
|
|||||||
|
|
||||||
const handleApplyChanges = () => {
|
const handleApplyChanges = () => {
|
||||||
onRegenerate(slideCount, feedback);
|
onRegenerate(slideCount, feedback);
|
||||||
setIsEditing(false); // Close edit panel on submit, assumes success or loading state handles visual feedback
|
setIsEditing(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-12 animate-fade-in pb-20 relative">
|
<div className="space-y-12 animate-fade-in pb-20 relative">
|
||||||
|
|
||||||
{/* Top Header with Edit Button */}
|
|
||||||
<div className="text-center max-w-2xl mx-auto relative">
|
<div className="text-center max-w-2xl mx-auto relative">
|
||||||
<h2 className="text-4xl font-bold tracking-tight text-gray-900 mb-3">Twój Vibe Gotowy! 🎉</h2>
|
<h2 className="text-4xl font-bold tracking-tight text-gray-900 mb-3">{UI_TEXT.stepResult.title}</h2>
|
||||||
<p className="text-gray-500 text-lg mb-6">Oto kompletna struktura Twojego posta. Skopiuj i publikuj.</p>
|
<p className="text-gray-500 text-lg mb-6">{UI_TEXT.stepResult.subtitle}</p>
|
||||||
|
|
||||||
{!isEditing && !isRegenerating && (
|
{!isEditing && !isRegenerating && (
|
||||||
<button
|
<button
|
||||||
@@ -65,25 +49,24 @@ const StepResult: React.FC<ExtendedStepResultProps> = ({ content, onRegenerate,
|
|||||||
className="inline-flex items-center space-x-2 text-sm font-bold text-gray-600 bg-gray-100 hover:bg-gray-200 px-5 py-2.5 rounded-full transition-colors"
|
className="inline-flex items-center space-x-2 text-sm font-bold text-gray-600 bg-gray-100 hover:bg-gray-200 px-5 py-2.5 rounded-full transition-colors"
|
||||||
>
|
>
|
||||||
<Edit2 size={16} />
|
<Edit2 size={16} />
|
||||||
<span>Edytuj / Popraw</span>
|
<span>{UI_TEXT.stepResult.editBtn}</span>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Edit Panel (Conditional) */}
|
|
||||||
{(isEditing || isRegenerating) && (
|
{(isEditing || isRegenerating) && (
|
||||||
<div className="bg-white border-2 border-[#EA4420]/20 rounded-xl p-6 shadow-sm mb-10 animate-fade-in relative overflow-hidden">
|
<div className="bg-white border-2 border-[#EA4420]/20 rounded-xl p-6 shadow-sm mb-10 animate-fade-in relative overflow-hidden">
|
||||||
{isRegenerating && (
|
{isRegenerating && (
|
||||||
<div className="absolute inset-0 bg-white/80 z-10 flex flex-col items-center justify-center backdrop-blur-[1px]">
|
<div className="absolute inset-0 bg-white/80 z-10 flex flex-col items-center justify-center backdrop-blur-[1px]">
|
||||||
<RefreshCw size={32} className="text-[#EA4420] animate-spin mb-3" />
|
<RefreshCw size={32} className="text-[#EA4420] animate-spin mb-3" />
|
||||||
<p className="font-bold text-gray-800">Nanuszę poprawki...</p>
|
<p className="font-bold text-gray-800">{UI_TEXT.stepResult.editPanel.regenerating}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="flex justify-between items-start mb-6">
|
<div className="flex justify-between items-start mb-6">
|
||||||
<h3 className="text-xl font-bold text-gray-900 flex items-center gap-2">
|
<h3 className="text-xl font-bold text-gray-900 flex items-center gap-2">
|
||||||
<Edit2 size={20} className="text-[#EA4420]" />
|
<Edit2 size={20} className="text-[#EA4420]" />
|
||||||
Wprowadź poprawki
|
{UI_TEXT.stepResult.editPanel.title}
|
||||||
</h3>
|
</h3>
|
||||||
{!isRegenerating && (
|
{!isRegenerating && (
|
||||||
<button onClick={() => setIsEditing(false)} className="text-gray-400 hover:text-gray-600">
|
<button onClick={() => setIsEditing(false)} className="text-gray-400 hover:text-gray-600">
|
||||||
@@ -93,10 +76,9 @@ const StepResult: React.FC<ExtendedStepResultProps> = ({ content, onRegenerate,
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
{/* Slider */}
|
|
||||||
<div>
|
<div>
|
||||||
<label className="flex justify-between text-sm font-bold text-gray-700 mb-3">
|
<label className="flex justify-between text-sm font-bold text-gray-700 mb-3">
|
||||||
<span>Liczba slajdów / Elementów</span>
|
<span>{UI_TEXT.stepResult.editPanel.slidesLabel}</span>
|
||||||
<span className="text-[#EA4420]">{slideCount}</span>
|
<span className="text-[#EA4420]">{slideCount}</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@@ -113,50 +95,46 @@ const StepResult: React.FC<ExtendedStepResultProps> = ({ content, onRegenerate,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Feedback Textarea */}
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-bold text-gray-700 mb-2">Co chcesz zmienić w treści?</label>
|
<label className="block text-sm font-bold text-gray-700 mb-2">{UI_TEXT.stepResult.editPanel.feedbackLabel}</label>
|
||||||
<textarea
|
<textarea
|
||||||
value={feedback}
|
value={feedback}
|
||||||
onChange={(e) => setFeedback(e.target.value)}
|
onChange={(e) => setFeedback(e.target.value)}
|
||||||
placeholder="np. Zmień 'ból szczęki' na 'ból głowy'. Dodaj więcej emoji w slajdzie nr 3. Zrób bardziej agresywny wstęp."
|
placeholder={UI_TEXT.stepResult.editPanel.feedbackPlaceholder}
|
||||||
rows={3}
|
rows={3}
|
||||||
className="w-full border border-gray-200 rounded-md p-3 text-sm focus:ring-1 focus:ring-[#EA4420] focus:border-[#EA4420] outline-none"
|
className="w-full border border-gray-200 rounded-md p-3 text-sm focus:ring-1 focus:ring-[#EA4420] focus:border-[#EA4420] outline-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Action Buttons */}
|
|
||||||
<div className="flex justify-end pt-2">
|
<div className="flex justify-end pt-2">
|
||||||
<button
|
<button
|
||||||
onClick={handleApplyChanges}
|
onClick={handleApplyChanges}
|
||||||
className="bg-[#EA4420] text-white px-6 py-3 rounded-md font-bold hover:bg-[#d63b1a] transition-colors flex items-center gap-2"
|
className="bg-[#EA4420] text-white px-6 py-3 rounded-md font-bold hover:bg-[#d63b1a] transition-colors flex items-center gap-2"
|
||||||
>
|
>
|
||||||
<RefreshCw size={18} />
|
<RefreshCw size={18} />
|
||||||
Zastosuj poprawki
|
{UI_TEXT.stepResult.editPanel.applyBtn}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* TRIP MAP (IF APPLICABLE) */}
|
|
||||||
{tripData && tripData.startPoint && (
|
{tripData && tripData.startPoint && (
|
||||||
<TripMap tripData={tripData} />
|
<TripMap tripData={tripData} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Caption Section */}
|
|
||||||
<div className="bg-white rounded-md border border-gray-200 overflow-hidden">
|
<div className="bg-white rounded-md border border-gray-200 overflow-hidden">
|
||||||
<div className="bg-gray-50 px-8 py-5 border-b border-gray-200 flex justify-between items-center">
|
<div className="bg-gray-50 px-8 py-5 border-b border-gray-200 flex justify-between items-center">
|
||||||
<div className="flex items-center space-x-3 text-gray-900">
|
<div className="flex items-center space-x-3 text-gray-900">
|
||||||
<MessageSquare size={20} className="text-[#EA4420]" />
|
<MessageSquare size={20} className="text-[#EA4420]" />
|
||||||
<span className="font-bold">Post Caption (Opis)</span>
|
<span className="font-bold">{UI_TEXT.stepResult.captionTitle}</span>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => copyToClipboard(content.caption, 'caption')}
|
onClick={() => copyToClipboard(content.caption, 'caption')}
|
||||||
className="flex items-center space-x-2 text-sm font-semibold text-[#EA4420] hover:text-[#d63b1a] transition-colors bg-white border border-gray-200 px-4 py-2 rounded-md hover:bg-gray-50"
|
className="flex items-center space-x-2 text-sm font-semibold text-[#EA4420] hover:text-[#d63b1a] transition-colors bg-white border border-gray-200 px-4 py-2 rounded-md hover:bg-gray-50"
|
||||||
>
|
>
|
||||||
{copiedSection === 'caption' ? <Check size={16} /> : <Copy size={16} />}
|
{copiedSection === 'caption' ? <Check size={16} /> : <Copy size={16} />}
|
||||||
<span>{copiedSection === 'caption' ? 'Skopiowano!' : 'Kopiuj'}</span>
|
<span>{copiedSection === 'caption' ? UI_TEXT.stepResult.copied : UI_TEXT.stepResult.copy}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="p-8 text-gray-700 whitespace-pre-wrap font-sans text-base leading-relaxed">
|
<div className="p-8 text-gray-700 whitespace-pre-wrap font-sans text-base leading-relaxed">
|
||||||
@@ -164,11 +142,10 @@ const StepResult: React.FC<ExtendedStepResultProps> = ({ content, onRegenerate,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Slides Grid */}
|
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center space-x-3 text-gray-900 mb-8 px-1">
|
<div className="flex items-center space-x-3 text-gray-900 mb-8 px-1">
|
||||||
<ImageIcon size={28} className="text-[#EA4420]" />
|
<ImageIcon size={28} className="text-[#EA4420]" />
|
||||||
<h3 className="text-2xl font-bold tracking-tight">Struktura Wizualna (Slajdy / Zdjęcia)</h3>
|
<h3 className="text-2xl font-bold tracking-tight">{UI_TEXT.stepResult.slidesTitle}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
@@ -186,7 +163,7 @@ const StepResult: React.FC<ExtendedStepResultProps> = ({ content, onRegenerate,
|
|||||||
<button
|
<button
|
||||||
onClick={() => copySlideText(slide.overlay_text, idx)}
|
onClick={() => copySlideText(slide.overlay_text, idx)}
|
||||||
className="text-gray-300 hover:text-[#EA4420] transition-colors"
|
className="text-gray-300 hover:text-[#EA4420] transition-colors"
|
||||||
title="Kopiuj tekst"
|
title={UI_TEXT.stepResult.copy}
|
||||||
>
|
>
|
||||||
{copiedSlideIndex === idx ? <Check size={14} className="text-green-500" /> : <Copy size={14} />}
|
{copiedSlideIndex === idx ? <Check size={14} className="text-green-500" /> : <Copy size={14} />}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { WizardState, Tone, Goal } from '../types';
|
import { WizardState, Tone, Goal } from '../types';
|
||||||
import { Laugh, Brain, Zap, MessageCircle, Share2, ShoppingBag } from 'lucide-react';
|
import { Laugh, Brain, Zap, MessageCircle, Share2, ShoppingBag } from 'lucide-react';
|
||||||
|
import { UI_TEXT } from '../_EDITABLE_CONFIG/ui_text';
|
||||||
|
|
||||||
interface StepToneGoalProps {
|
interface StepToneGoalProps {
|
||||||
data: WizardState;
|
data: WizardState;
|
||||||
@@ -21,15 +23,15 @@ const StepToneGoal: React.FC<StepToneGoalProps> = ({ data, updateData, nextStep
|
|||||||
const isComplete = data.tone && data.goal;
|
const isComplete = data.tone && data.goal;
|
||||||
|
|
||||||
const tones: { id: Tone; label: string; desc: string; icon: React.ReactNode }[] = [
|
const tones: { id: Tone; label: string; desc: string; icon: React.ReactNode }[] = [
|
||||||
{ id: 'funny', label: 'Luzak', desc: 'Humor, dystans, memy', icon: <Laugh size={32} /> },
|
{ id: 'funny', label: UI_TEXT.stepToneGoal.tones.funny.label, desc: UI_TEXT.stepToneGoal.tones.funny.desc, icon: <Laugh size={32} /> },
|
||||||
{ id: 'serious', label: 'Ekspert', desc: 'Konkrety, wiedza, liczby', icon: <Brain size={32} /> },
|
{ id: 'serious', label: UI_TEXT.stepToneGoal.tones.serious.label, desc: UI_TEXT.stepToneGoal.tones.serious.desc, icon: <Brain size={32} /> },
|
||||||
{ id: 'inspirational', label: 'Mentor', desc: 'Emocje, głębia, lekcja', icon: <Zap size={32} /> },
|
{ id: 'inspirational', label: UI_TEXT.stepToneGoal.tones.inspirational.label, desc: UI_TEXT.stepToneGoal.tones.inspirational.desc, icon: <Zap size={32} /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
const goals: { id: Goal; label: string; desc: string; icon: React.ReactNode }[] = [
|
const goals: { id: Goal; label: string; desc: string; icon: React.ReactNode }[] = [
|
||||||
{ id: 'engagement', label: 'Społeczność', desc: 'Komentarze i dyskusja', icon: <MessageCircle size={32} /> },
|
{ id: 'engagement', label: UI_TEXT.stepToneGoal.goals.engagement.label, desc: UI_TEXT.stepToneGoal.goals.engagement.desc, icon: <MessageCircle size={32} /> },
|
||||||
{ id: 'viral', label: 'Zasięg', desc: 'Udostępnienia (Share)', icon: <Share2 size={32} /> },
|
{ id: 'viral', label: UI_TEXT.stepToneGoal.goals.viral.label, desc: UI_TEXT.stepToneGoal.goals.viral.desc, icon: <Share2 size={32} /> },
|
||||||
{ id: 'sales', label: 'Sprzedaż', desc: 'Kliknięcie w link / Zakup', icon: <ShoppingBag size={32} /> },
|
{ id: 'sales', label: UI_TEXT.stepToneGoal.goals.sales.label, desc: UI_TEXT.stepToneGoal.goals.sales.desc, icon: <ShoppingBag size={32} /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -37,8 +39,8 @@ const StepToneGoal: React.FC<StepToneGoalProps> = ({ data, updateData, nextStep
|
|||||||
|
|
||||||
{/* Sekcja 1: TON */}
|
{/* Sekcja 1: TON */}
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">Wybierz Ton (Vibe)</h2>
|
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">{UI_TEXT.stepToneGoal.toneTitle}</h2>
|
||||||
<p className="text-gray-500 mb-6 text-lg">Jak chcesz brzmieć?</p>
|
<p className="text-gray-500 mb-6 text-lg">{UI_TEXT.stepToneGoal.toneSubtitle}</p>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||||
{tones.map((t) => (
|
{tones.map((t) => (
|
||||||
@@ -63,8 +65,8 @@ const StepToneGoal: React.FC<StepToneGoalProps> = ({ data, updateData, nextStep
|
|||||||
|
|
||||||
{/* Sekcja 2: CEL */}
|
{/* Sekcja 2: CEL */}
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">Wybierz Cel</h2>
|
<h2 className="text-3xl font-bold tracking-tight text-gray-900 mb-3">{UI_TEXT.stepToneGoal.goalTitle}</h2>
|
||||||
<p className="text-gray-500 mb-6 text-lg">Co chcesz osiągnąć tym postem?</p>
|
<p className="text-gray-500 mb-6 text-lg">{UI_TEXT.stepToneGoal.goalSubtitle}</p>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||||
{goals.map((g) => (
|
{goals.map((g) => (
|
||||||
@@ -87,14 +89,13 @@ const StepToneGoal: React.FC<StepToneGoalProps> = ({ data, updateData, nextStep
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Next Button */}
|
|
||||||
<div className="flex justify-end pt-4">
|
<div className="flex justify-end pt-4">
|
||||||
<button
|
<button
|
||||||
onClick={nextStep}
|
onClick={nextStep}
|
||||||
disabled={!isComplete}
|
disabled={!isComplete}
|
||||||
className="bg-[#EA4420] text-white px-8 py-3 rounded-md font-bold hover:bg-[#d63b1a] transition-all disabled:opacity-50 disabled:cursor-not-allowed shadow-md"
|
className="bg-[#EA4420] text-white px-8 py-3 rounded-md font-bold hover:bg-[#d63b1a] transition-all disabled:opacity-50 disabled:cursor-not-allowed shadow-md"
|
||||||
>
|
>
|
||||||
Przejdź do szczegółów
|
{UI_TEXT.stepToneGoal.nextBtn}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
import { WizardState } from '../types';
|
|
||||||
import {
|
|
||||||
CONTEXT_PROMPTS,
|
|
||||||
STORY_STYLE_PROMPTS,
|
|
||||||
EVENT_PROMPTS,
|
|
||||||
PLATFORM_PROMPTS,
|
|
||||||
TONE_PROMPTS,
|
|
||||||
GOAL_PROMPTS
|
|
||||||
} from './modular';
|
|
||||||
|
|
||||||
export const getSystemPrompt = (data: WizardState): string => {
|
|
||||||
|
|
||||||
// 1. KROK 1: KONTEKST
|
|
||||||
let contextPrompt = data.context
|
|
||||||
? CONTEXT_PROMPTS[data.context]
|
|
||||||
: CONTEXT_PROMPTS.relacja;
|
|
||||||
|
|
||||||
// 1b. KROK 1b: STYL OPOWIEŚCI (Jeśli wybrano Opowieść i podano styl)
|
|
||||||
if (data.context === 'opowiesc' && data.storyStyle) {
|
|
||||||
const stylePrompt = STORY_STYLE_PROMPTS[data.storyStyle];
|
|
||||||
contextPrompt += `\n\n${stylePrompt}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. KROK 2: TYP WYDARZENIA
|
|
||||||
const eventPrompt = data.eventType
|
|
||||||
? EVENT_PROMPTS[data.eventType]
|
|
||||||
: EVENT_PROMPTS.other;
|
|
||||||
|
|
||||||
// 3. KROK 3: PLATFORMA
|
|
||||||
const platformPrompt = data.platform
|
|
||||||
? PLATFORM_PROMPTS[data.platform]
|
|
||||||
: PLATFORM_PROMPTS.instagram;
|
|
||||||
|
|
||||||
// 4a. KROK 4a: TON
|
|
||||||
const tonePrompt = data.tone
|
|
||||||
? TONE_PROMPTS[data.tone]
|
|
||||||
: TONE_PROMPTS.funny;
|
|
||||||
|
|
||||||
// 4b. KROK 4b: CEL
|
|
||||||
const goalPrompt = data.goal
|
|
||||||
? GOAL_PROMPTS[data.goal]
|
|
||||||
: GOAL_PROMPTS.engagement;
|
|
||||||
|
|
||||||
// SKLEJANIE MASTER PROMPTU
|
|
||||||
return `
|
|
||||||
Jesteś światowej klasy ekspertem od Content Marketingu i Social Media.
|
|
||||||
Twoim zadaniem jest stworzenie treści idealnie dopasowanej do poniższej konfiguracji "puzzli".
|
|
||||||
|
|
||||||
=== KONFIGURACJA MASTER PROMPT (PUZZLE) ===
|
|
||||||
|
|
||||||
${contextPrompt}
|
|
||||||
|
|
||||||
${eventPrompt}
|
|
||||||
|
|
||||||
${platformPrompt}
|
|
||||||
|
|
||||||
${tonePrompt}
|
|
||||||
|
|
||||||
${goalPrompt}
|
|
||||||
|
|
||||||
=== INSTRUKCJA KOŃCOWA ===
|
|
||||||
Twoim zadaniem jest synteza powyższych elementów w jedną spójną całość.
|
|
||||||
1. Przyjmij perspektywę czasową z kroku 1 (KONTEKST).
|
|
||||||
2. Jeśli zdefiniowano STYL (Noir/Fantasy), bezwzględnie narzuć ten klimat na całą narrację.
|
|
||||||
3. Użyj słownictwa i atmosfery z kroku 2 (TYP).
|
|
||||||
4. Sformatuj wynik technicznie zgodnie z wymogami kroku 3 (PLATFORMA).
|
|
||||||
5. Nadaj wypowiedzi charakter i styl z kroku 4a (TON).
|
|
||||||
6. Zrealizuj cel biznesowy/społeczny z kroku 4b (CEL).
|
|
||||||
|
|
||||||
Nie dodawaj meta-komentarzy. Zwróć czysty JSON zgodny ze schematem zdefiniowanym w sekcji PLATFORMA.
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { GoogleGenAI, Type, Schema } from "@google/genai";
|
import { GoogleGenAI, Type, Schema } from "@google/genai";
|
||||||
import { WizardState, GeneratedContent } from "../types";
|
import { WizardState, GeneratedContent } from "../types";
|
||||||
import { getSystemPrompt } from "../prompts";
|
import { getSystemPrompt } from "../_EDITABLE_CONFIG/ai_prompts"; // Updated path
|
||||||
|
|
||||||
// SCHEMAT ODPOWIEDZI JSON
|
// SCHEMAT ODPOWIEDZI JSON
|
||||||
const responseSchema: Schema = {
|
const responseSchema: Schema = {
|
||||||
|
|||||||
Reference in New Issue
Block a user