Naprawa obsługi GPX, czyszczenie projektu, naprawa błędów związanych z obrazami
This commit is contained in:
38
App.tsx
38
App.tsx
@@ -131,9 +131,9 @@ const App: React.FC = () => {
|
||||
const [isLoaded, setIsLoaded] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
|
||||
// LOGO & AVATAR STATE
|
||||
const [logoLoaded, setLogoLoaded] = useState(false);
|
||||
const [avatarLoaded, setAvatarLoaded] = useState(false);
|
||||
// LOGO & AVATAR STATE: Default to false (no error), so we try to show image first.
|
||||
const [logoError, setLogoError] = useState(false);
|
||||
const [avatarError, setAvatarError] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const storedAuth = localStorage.getItem(AUTH_KEY);
|
||||
@@ -245,14 +245,15 @@ const App: React.FC = () => {
|
||||
<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="flex items-center space-x-3">
|
||||
{/* LOGO LOGIC: Image is hidden by default. If it loads, it shows and text hides. */}
|
||||
<img
|
||||
src="logo.png"
|
||||
alt="Logo"
|
||||
onLoad={() => setLogoLoaded(true)}
|
||||
className={`h-10 object-contain ${logoLoaded ? 'block' : 'hidden'}`}
|
||||
/>
|
||||
{!logoLoaded && (
|
||||
{/* LOGO LOGIC: Try to show image. If error, fallback to icon/text. */}
|
||||
{!logoError ? (
|
||||
<img
|
||||
src="logo.png"
|
||||
alt="Logo"
|
||||
onError={() => setLogoError(true)}
|
||||
className="h-10 object-contain"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex items-center gap-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>
|
||||
@@ -326,13 +327,14 @@ const App: React.FC = () => {
|
||||
<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>
|
||||
|
||||
{/* AVATAR LOGIC */}
|
||||
<img
|
||||
src={AUTHOR_CONFIG.avatarImage}
|
||||
alt={AUTHOR_CONFIG.name}
|
||||
onLoad={() => setAvatarLoaded(true)}
|
||||
className={`relative w-20 h-20 rounded-full object-cover border border-gray-100 bg-white ${avatarLoaded ? 'block' : 'hidden'}`}
|
||||
/>
|
||||
{!avatarLoaded && (
|
||||
{!avatarError ? (
|
||||
<img
|
||||
src={AUTHOR_CONFIG.avatarImage}
|
||||
alt={AUTHOR_CONFIG.name}
|
||||
onError={() => setAvatarError(true)}
|
||||
className="relative w-20 h-20 rounded-full object-cover border border-gray-100 bg-white"
|
||||
/>
|
||||
) : (
|
||||
<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} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user