@bytebrand/fe-ui-core-autobahn 1.0.175 → 1.0.177

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/chrome/TopBar.tsx CHANGED
@@ -170,8 +170,14 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
170
170
  }) => {
171
171
  const [menu, setMenu] = useState(false); // mobile hamburger dropdown
172
172
  const [account, setAccount] = useState(false); // account popover
173
+ const [dealersOpen, setDealersOpen] = useState(false); // Konto menu: "Meine Händler" expanded
173
174
  const [hidden, setHidden] = useState(false); // autoHideOnScroll: header slid out of view
174
175
 
176
+ // the dealer list opens collapsed every time the Konto menu opens
177
+ useEffect(() => {
178
+ if (!account) setDealersOpen(false);
179
+ }, [account]);
180
+
175
181
  // scroll-direction tracking for autoHideOnScroll — down hides, up shows, and it never hides
176
182
  // near the very top (HIDE_AT) so the header doesn't disappear on the first tiny scroll nudge.
177
183
  const lastScrollY = useRef(0);
@@ -228,14 +234,15 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
228
234
 
229
235
  /** one Konto-menu row (Figma "acct-row"): 22px icon, label, count badge when above 0. `icon` is a
230
236
  * menu glyph; `lucide` is a lib Icon for the guest rows Figma doesn't draw. `checked` (dealer rows)
231
- * marks the active choice with the same check as the language rows. */
237
+ * marks the active choice with the same check as the language rows; `nested` rows sit under an
238
+ * expanded row, their label in line with its label. */
232
239
  const acctRow = (
233
240
  key: string,
234
241
  label: string,
235
242
  onClick: () => void,
236
- opts: { icon?: AccountMenuIconName; lucide?: string; badge?: number; checked?: boolean } = {},
243
+ opts: { icon?: AccountMenuIconName; lucide?: string; badge?: number; checked?: boolean; nested?: boolean } = {},
237
244
  ): JSX.Element => (
238
- <button key={key} type="button" className="acct-row" onClick={onClick} aria-pressed={opts.checked}>
245
+ <button key={key} type="button" className={opts.nested ? 'acct-row acct-row--nested' : 'acct-row'} onClick={onClick} aria-pressed={opts.checked}>
239
246
  {opts.icon && <AccountMenuIcon name={opts.icon} />}
240
247
  {opts.lucide && <Icon name={opts.lucide} size={22} stroke={ACCT_ICON_STROKE} cls="acct-icon" />}
241
248
  <span className="acct-label">{label}</span>
@@ -297,15 +304,27 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
297
304
  <div className="acct-list">
298
305
  {isDealer &&
299
306
  acctRow('myVehicles', t('autobahn:chrome.myVehicles'), () => goRoute(R_MY_VEHICLES), { lucide: 'car' })}
307
+ {/* ADV-271 (comment of 01.11.2026): one "Meine Händler" row; a click expands the
308
+ dealers to pick from (the active one checked) and collapses them again */}
300
309
  {showDealers && (
301
310
  <>
302
- <div className="acct-sub">{t('autobahn:chrome.myDealers')} ({dealers.length})</div>
303
- {dealers.map((d) =>
304
- acctRow(`dealer-${d.dealer.id}`, d.dealer.email, () => {
305
- setAccount(false);
306
- if (!d.isActive && onDealerSelect) onDealerSelect(d.dealer.id);
307
- }, { icon: 'store', checked: d.isActive }),
308
- )}
311
+ <button
312
+ type="button"
313
+ className="acct-row"
314
+ aria-expanded={dealersOpen}
315
+ onClick={() => setDealersOpen((open) => !open)}
316
+ >
317
+ <AccountMenuIcon name="store" />
318
+ <span className="acct-label">{t('autobahn:chrome.myDealers')} ({dealers.length})</span>
319
+ <Icon name="chevron-down" size={20} cls={dealersOpen ? 'acct-chevron acct-chevron--open' : 'acct-chevron'} />
320
+ </button>
321
+ {dealersOpen &&
322
+ dealers.map((d) =>
323
+ acctRow(`dealer-${d.dealer.id}`, d.dealer.email, () => {
324
+ setAccount(false);
325
+ if (!d.isActive && onDealerSelect) onDealerSelect(d.dealer.id);
326
+ }, { checked: d.isActive, nested: true }),
327
+ )}
309
328
  </>
310
329
  )}
311
330
  {isDealerOrAdmin &&