@mohasinac/appkit 3.2.2 → 3.2.4

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.
@@ -77,6 +77,10 @@ function useResponsiveDrawer(storageKey) {
77
77
  setMobileOpen(false);
78
78
  });
79
79
  }, [isDesktop, storageKey]);
80
+ // Close only the mobile drawer — used on route change so desktop sidebar stays persistent.
81
+ const closeMobile = useCallback(() => {
82
+ startTransition(() => { setMobileOpen(false); });
83
+ }, []);
80
84
  const toggle = useCallback(() => {
81
85
  startTransition(() => {
82
86
  if (isDesktop()) {
@@ -97,7 +101,7 @@ function useResponsiveDrawer(storageKey) {
97
101
  registerNav({ open, close, toggle });
98
102
  return () => unregisterNav();
99
103
  }, [registerNav, unregisterNav, open, close, toggle]);
100
- return { desktopOpen, mobileOpen, close, toggle };
104
+ return { desktopOpen, mobileOpen, close, closeMobile, toggle };
101
105
  }
102
106
  /** Filter nav groups by navConfig (enabled toggle) + requiredPermission. */
103
107
  function filterGroups(groups, navConfig, permissions) {
@@ -117,7 +121,8 @@ export function DashboardLayoutClient({ variant, groups, permissions, activeHref
117
121
  const pathname = usePathname();
118
122
  const activeHref = explicitActiveHref ?? pathname ?? "";
119
123
  const storageKey = `appkit:sidebar-open:${variant}`;
120
- const { desktopOpen, mobileOpen, close, toggle } = useResponsiveDrawer(storageKey);
124
+ const { desktopOpen, mobileOpen, close, closeMobile, toggle } = useResponsiveDrawer(storageKey);
125
+ useEffect(() => { closeMobile(); }, [pathname, closeMobile]);
121
126
  const { data: settings } = useSiteSettings();
122
127
  const navConfig = settings?.navConfig;
123
128
  const filteredGroups = filterGroups(groups, navConfig, permissions);
@@ -26,6 +26,7 @@ import { SidebarLayout } from "./SidebarLayout";
26
26
  import { TitleBar } from "./TitleBar";
27
27
  import { BackToTop } from "./BackToTop";
28
28
  import { useDashboardNav } from "./DashboardNavContext";
29
+ import { usePathname } from "next/navigation";
29
30
  // Background defaults consumed by BackgroundRenderer — these are seed values
30
31
  // written into siteSettings on first deploy and may be overridden at runtime.
31
32
  // audit-hex-tokens-ok: seed defaults for siteSettings.theme.background
@@ -113,6 +114,8 @@ export function AppLayoutShell({ children, navItems, sidebarItems = [], sidebarS
113
114
  // a single consumer-level QueryProvider is the correct architecture.
114
115
  const [sidebarOpen, setSidebarOpen] = useState(false);
115
116
  const [searchOpen, setSearchOpen] = useState(false);
117
+ const pathname = usePathname();
118
+ useEffect(() => { setSidebarOpen(false); }, [pathname]);
116
119
  const { theme, toggleTheme } = useTheme();
117
120
  const { closeNav: closeDashboardNav, hasNav: hasDashboardNav, toggleNav: toggleDashboardNav } = useDashboardNav();
118
121
  const { state: bottomActionsState } = useBottomActionsContext();
@@ -2206,14 +2206,14 @@ const bundleRows = [
2206
2206
  },
2207
2207
  ];
2208
2208
  export const categoriesSeedData = [
2209
- ...rawCategories.map((c) => ({ viewCount: 0, ancestors: [], ...c, createdByType: "admin" })),
2210
- ...sublistingRows.map((s) => ({ viewCount: 0, ancestors: [], ...s, createdByType: "admin" })),
2211
- ...brandRows.map((b) => ({ viewCount: 0, ancestors: [], ...b, createdByType: "admin" })),
2212
- ...bundleRows.map((bundle) => ({ viewCount: 0, ancestors: [], ...bundle, createdByType: "admin" })),
2209
+ ...rawCategories.map((c) => ({ ancestors: [], ...c, createdByType: "admin" })),
2210
+ ...sublistingRows.map((s) => ({ ancestors: [], ...s, createdByType: "admin" })),
2211
+ ...brandRows.map((b) => ({ ancestors: [], ...b, createdByType: "admin" })),
2212
+ ...bundleRows.map((bundle) => ({ ancestors: [], ...bundle, createdByType: "admin" })),
2213
2213
  ];
2214
2214
  // P-1 default seed: excludes bundle rows (FEATURE_BUNDLES is off in P-1)
2215
2215
  export const categoriesP1SeedData = [
2216
- ...rawCategories.map((c) => ({ viewCount: 0, ancestors: [], ...c, createdByType: "admin" })),
2217
- ...sublistingRows.map((s) => ({ viewCount: 0, ancestors: [], ...s, createdByType: "admin" })),
2218
- ...brandRows.map((b) => ({ viewCount: 0, ancestors: [], ...b, createdByType: "admin" })),
2216
+ ...rawCategories.map((c) => ({ ancestors: [], ...c, createdByType: "admin" })),
2217
+ ...sublistingRows.map((s) => ({ ancestors: [], ...s, createdByType: "admin" })),
2218
+ ...brandRows.map((b) => ({ ancestors: [], ...b, createdByType: "admin" })),
2219
2219
  ];
@@ -19,7 +19,6 @@ function withTokens(p) {
19
19
  return {
20
20
  tags: [],
21
21
  featured: false,
22
- viewCount: 0,
23
22
  ...p,
24
23
  searchTokens: buildSearchTokens(p.title, p.description, p.brand, p.brandSlug, p.categoryNames, p.tags, p.features, p.condition, p.card?.setName, p.card?.cardNumber, p.grading?.service, p.specifications?.map((s) => `${s.name} ${s.value}`)),
25
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"