predzadnji unstagaeni dijelovi
This commit is contained in:
@@ -4,7 +4,7 @@ import AuthWidget from './AuthWidget';
|
||||
import UserDisplay from './ui/UserDisplay';
|
||||
import { useEffect, useRef, useState } from 'preact/hooks';
|
||||
import { useSpring, animated } from '@react-spring/web';
|
||||
import { hydrateAuthFromStorage, loadCurrentUser, $user, $accessToken } from '../stores/authStore';
|
||||
import { hydrateAuthFromStorage } from '../stores/authStore';
|
||||
|
||||
const ITEMS = [
|
||||
{ id: 'dashboard', label: 'Dashboard', href: '/' },
|
||||
@@ -21,12 +21,8 @@ function normalizePath(p) {
|
||||
}
|
||||
|
||||
function getActiveIndex(path) {
|
||||
// Exact match (e.g. '/' → Dashboard)
|
||||
const exact = ITEMS.findIndex((item) => item.href === path);
|
||||
if (exact >= 0) return exact;
|
||||
// Prefix match for sub-paths (e.g. '/putni-nalozi/racuni' → Putni nalozi)
|
||||
const prefix = ITEMS.findIndex((item) => item.href !== '/' && path.startsWith(item.href));
|
||||
return prefix >= 0 ? prefix : 0;
|
||||
const idx = ITEMS.findIndex((item) => item.href === path);
|
||||
return idx >= 0 ? idx : 0;
|
||||
}
|
||||
|
||||
export default function Navbar({ minimal = false }) {
|
||||
@@ -59,10 +55,6 @@ export default function Navbar({ minimal = false }) {
|
||||
// Mount: izmjeri početnu poziciju bez animacije, pa uključi animaciju za buduće navigacije
|
||||
useEffect(() => {
|
||||
hydrateAuthFromStorage();
|
||||
// Učitaj korisnika ako token postoji ali $user još nije popunjen
|
||||
if (!$user.get() && $accessToken.get()) {
|
||||
loadCurrentUser();
|
||||
}
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
measureIndicator();
|
||||
|
||||
Reference in New Issue
Block a user