@mohasinac/appkit 2.7.26 → 2.7.27
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/dist/_internal/client/features/classified/ClassifiedDetailView.js +2 -2
- package/dist/_internal/client/features/digital-code/CodeRevealPanel.js +2 -2
- package/dist/features/layout/AppLayoutShell.js +2 -7
- package/dist/features/layout/NavbarWithSettings.d.ts +6 -0
- package/dist/features/layout/NavbarWithSettings.js +11 -0
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import Link from "next/link";
|
|
5
|
-
import { Badge, Container, Div, Heading, Row, Section, Stack, Text, } from "../../../../ui";
|
|
5
|
+
import { Badge, Button, Container, Div, Heading, Row, Section, Stack, Text, } from "../../../../ui";
|
|
6
6
|
import { ROUTES } from "../../../../next/routing/route-map";
|
|
7
7
|
import { formatCurrency } from "../../../../utils/number.formatter";
|
|
8
8
|
export function ClassifiedDetailView({ product, isLoading = false, onContactSeller, }) {
|
|
@@ -31,5 +31,5 @@ export function ClassifiedDetailView({ product, isLoading = false, onContactSell
|
|
|
31
31
|
setPending(false);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
return (_jsx(Container, { children: _jsx(Section, { className: "py-8", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: "overflow-hidden rounded-lg bg-muted", children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { className: "flex-wrap gap-2", children: [_jsx(Badge, { variant: "secondary", children: "Classified" }), meta?.negotiable && _jsx(Badge, { variant: "secondary", children: "Negotiable" }), meta?.acceptsShipping && _jsx(Badge, { variant: "secondary", children: "Shipping available" })] }), _jsx(Heading, { level: 1, className: "text-2xl font-bold", children: product.title }), _jsx(Text, { className: "text-2xl font-semibold text-primary", children: price }), location && (_jsx(Text, { className: "text-sm text-muted-foreground", children: location })), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), conversation ? (_jsxs(Div, { className: "rounded-lg border border-border bg-muted/40 p-4", children: [_jsx(Text, { className: "mb-2 font-medium", children: "Conversation started!" }), _jsx(Link, { href: ROUTES.USER.MESSAGES, className: "text-primary underline underline-offset-2", children: "Go to your messages \u2192" })] })) : (_jsxs(Stack, { gap: "sm", children: [error && (_jsx(Text, { className: "text-sm text-destructive", children: error })), _jsx(
|
|
34
|
+
return (_jsx(Container, { children: _jsx(Section, { className: "py-8", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: "overflow-hidden rounded-lg bg-muted", children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { className: "flex-wrap gap-2", children: [_jsx(Badge, { variant: "secondary", children: "Classified" }), meta?.negotiable && _jsx(Badge, { variant: "secondary", children: "Negotiable" }), meta?.acceptsShipping && _jsx(Badge, { variant: "secondary", children: "Shipping available" })] }), _jsx(Heading, { level: 1, className: "text-2xl font-bold", children: product.title }), _jsx(Text, { className: "text-2xl font-semibold text-primary", children: price }), location && (_jsx(Text, { className: "text-sm text-muted-foreground", children: location })), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), conversation ? (_jsxs(Div, { className: "rounded-lg border border-border bg-muted/40 p-4", children: [_jsx(Text, { className: "mb-2 font-medium", children: "Conversation started!" }), _jsx(Link, { href: ROUTES.USER.MESSAGES, className: "text-primary underline underline-offset-2", children: "Go to your messages \u2192" })] })) : (_jsxs(Stack, { gap: "sm", children: [error && (_jsx(Text, { className: "text-sm text-destructive", children: error })), _jsx(Button, { type: "button", variant: "primary", size: "lg", isLoading: pending, disabled: pending, onClick: handleContactSeller, className: "w-full", children: "Contact Seller" })] }))] }) }) }));
|
|
35
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { Div, Stack, Text } from "../../../../ui";
|
|
4
|
+
import { Button, Div, Span, Stack, Text } from "../../../../ui";
|
|
5
5
|
export function CodeRevealPanel({ orderId, redemptionInstructions, fetchCode, }) {
|
|
6
6
|
const [pending, setPending] = useState(false);
|
|
7
7
|
const [revealed, setRevealed] = useState(null);
|
|
@@ -28,5 +28,5 @@ export function CodeRevealPanel({ orderId, redemptionInstructions, fetchCode, })
|
|
|
28
28
|
setCopied(true);
|
|
29
29
|
setTimeout(() => setCopied(false), 2000);
|
|
30
30
|
}
|
|
31
|
-
return (_jsx(Div, { className: "rounded-lg border border-border bg-muted/40 p-4", children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { className: "font-medium", children: "Your Digital Code" }), !revealed ? (_jsxs(Stack, { gap: "sm", children: [error && _jsx(Text, { className: "text-sm text-destructive", children: error }), _jsx(
|
|
31
|
+
return (_jsx(Div, { className: "rounded-lg border border-border bg-muted/40 p-4", children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { className: "font-medium", children: "Your Digital Code" }), !revealed ? (_jsxs(Stack, { gap: "sm", children: [error && _jsx(Text, { className: "text-sm text-destructive", children: error }), _jsx(Button, { type: "button", variant: "primary", size: "lg", isLoading: pending, disabled: pending, onClick: handleReveal, className: "w-full", children: "Reveal Code" })] })) : (_jsxs(Stack, { gap: "sm", children: [_jsxs(Div, { className: "flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2 font-mono text-lg", children: [_jsx(Span, { className: "flex-1 select-all", children: revealed.code }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: handleCopy, className: "shrink-0", children: copied ? "Copied!" : "Copy" })] }), redemptionInstructions && (_jsx(Text, { className: "text-sm text-muted-foreground", children: redemptionInstructions }))] }))] }) }));
|
|
32
32
|
}
|
|
@@ -11,14 +11,12 @@ const ROLE_DOT_COLORS = {
|
|
|
11
11
|
};
|
|
12
12
|
import { useTheme } from "../../react";
|
|
13
13
|
import { useAuth } from "../../react/contexts/SessionContext";
|
|
14
|
-
import {
|
|
15
|
-
import { filterNavItems } from "../../_internal/client/features/layout/filterNavItems";
|
|
14
|
+
import { NavbarWithSettings } from "./NavbarWithSettings";
|
|
16
15
|
import { useBottomActionsContext } from "./BottomActionsContext";
|
|
17
16
|
import BottomActions from "./BottomActions";
|
|
18
17
|
import { AutoBreadcrumbs } from "./AutoBreadcrumbs";
|
|
19
18
|
import { BottomNavbar } from "./BottomNavbar";
|
|
20
19
|
import { FooterLayout } from "./FooterLayout";
|
|
21
|
-
import { MainNavbar } from "./MainNavbar";
|
|
22
20
|
import { SidebarLayout } from "./SidebarLayout";
|
|
23
21
|
import { TitleBar } from "./TitleBar";
|
|
24
22
|
import { BackToTop } from "./BackToTop";
|
|
@@ -54,9 +52,6 @@ export function AppLayoutShell({ children, navItems, sidebarItems = [], sidebarS
|
|
|
54
52
|
const { closeNav: closeDashboardNav, hasNav: hasDashboardNav, toggleNav: toggleDashboardNav } = useDashboardNav();
|
|
55
53
|
const { state: bottomActionsState } = useBottomActionsContext();
|
|
56
54
|
const { user: authUser } = useAuth();
|
|
57
|
-
const { data: siteSettingsData } = useSiteSettings();
|
|
58
|
-
const navConfig = siteSettingsData?.navConfig;
|
|
59
|
-
const visibleNavItems = filterNavItems(navItems, navConfig, authUser?.permissions);
|
|
60
55
|
const headerRef = useRef(null);
|
|
61
56
|
useEffect(() => {
|
|
62
57
|
const el = headerRef.current;
|
|
@@ -161,7 +156,7 @@ export function AppLayoutShell({ children, navItems, sidebarItems = [], sidebarS
|
|
|
161
156
|
opacity: darkBackground.overlay?.opacity ?? 0,
|
|
162
157
|
},
|
|
163
158
|
};
|
|
164
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Div, { className: "flex min-h-screen w-full flex-col overflow-x-clip transition-colors duration-300", children: [_jsx(BackgroundRenderer, { mode: theme === "dark" ? "dark" : "light", lightMode: normalizedLightBackground, darkMode: normalizedDarkBackground }), _jsxs(Div, { ref: headerRef, className: "sticky top-0 z-50 w-full", children: [_jsx(TitleBar, { onToggleSidebar: handleTogglePublicSidebar, sidebarOpen: sidebarOpen, onSearchToggle: () => setSearchOpen((prev) => !prev), searchOpen: searchOpen, brandName: brandName, brandShortName: brandShortName, siteLogoUrl: siteLogoUrl, logoHref: logoHref, promotionsHref: promotionsHref, cartHref: cartHref, wishlistHref: wishlistHref, userId: userId, profileHref: profileHref, loginHref: loginHref, registerHref: registerHref, user: user, navSlot: titleBarNavSlot, notificationSlot: titleBarNotificationSlot, devSlot: titleBarDevSlot, promoStripText: titleBarPromoStripText, isDark: theme === "dark", onToggleTheme: showThemeToggle ? toggleTheme : undefined, onBeforeToggleDashboardNav: handleBeforeDashboardNavToggle, suppressDashboardNav: suppressDashboardNav, hideSidebarToggle: hideSidebarToggle }), _jsx(
|
|
159
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsxs(Div, { className: "flex min-h-screen w-full flex-col overflow-x-clip transition-colors duration-300", children: [_jsx(BackgroundRenderer, { mode: theme === "dark" ? "dark" : "light", lightMode: normalizedLightBackground, darkMode: normalizedDarkBackground }), _jsxs(Div, { ref: headerRef, className: "sticky top-0 z-50 w-full", children: [_jsx(TitleBar, { onToggleSidebar: handleTogglePublicSidebar, sidebarOpen: sidebarOpen, onSearchToggle: () => setSearchOpen((prev) => !prev), searchOpen: searchOpen, brandName: brandName, brandShortName: brandShortName, siteLogoUrl: siteLogoUrl, logoHref: logoHref, promotionsHref: promotionsHref, cartHref: cartHref, wishlistHref: wishlistHref, userId: userId, profileHref: profileHref, loginHref: loginHref, registerHref: registerHref, user: user, navSlot: titleBarNavSlot, notificationSlot: titleBarNotificationSlot, devSlot: titleBarDevSlot, promoStripText: titleBarPromoStripText, isDark: theme === "dark", onToggleTheme: showThemeToggle ? toggleTheme : undefined, onBeforeToggleDashboardNav: handleBeforeDashboardNavToggle, suppressDashboardNav: suppressDashboardNav, hideSidebarToggle: hideSidebarToggle }), _jsx(NavbarWithSettings, { navItems: navItems, hiddenNavItems: hiddenNavItems, permissions: authUser?.permissions }), searchOpen && (searchSlotRenderer ? searchSlotRenderer(() => setSearchOpen(false)) : searchSlot)] }), eventBannerSlot, _jsx(AutoBreadcrumbs, {}), _jsxs(Div, { className: "relative flex w-full flex-1 overflow-x-clip", children: [_jsx(SidebarLayout, { isOpen: sidebarOpen, ariaLabel: "Secondary navigation", header: user ? (_jsxs(Div, { className: "flex items-center justify-between gap-3", children: [_jsxs(Div, { className: "flex items-center gap-3 flex-1 min-w-0", children: [_jsxs(Div, { className: "flex-shrink-0 relative", children: [_jsx(AvatarDisplay, { cropData: user.avatarMetadata
|
|
165
160
|
? {
|
|
166
161
|
url: user.avatarMetadata.url,
|
|
167
162
|
position: user.avatarMetadata.position ?? {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type MainNavbarItem } from "./MainNavbar";
|
|
2
|
+
export declare function NavbarWithSettings({ navItems, hiddenNavItems, permissions, }: {
|
|
3
|
+
navItems: MainNavbarItem[];
|
|
4
|
+
hiddenNavItems?: string[];
|
|
5
|
+
permissions?: string[];
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useSiteSettings } from "../../core/hooks/useSiteSettings";
|
|
4
|
+
import { filterNavItems } from "../../_internal/client/features/layout/filterNavItems";
|
|
5
|
+
import { MainNavbar } from "./MainNavbar";
|
|
6
|
+
export function NavbarWithSettings({ navItems, hiddenNavItems, permissions, }) {
|
|
7
|
+
const { data: siteSettingsData } = useSiteSettings();
|
|
8
|
+
const navConfig = siteSettingsData?.navConfig;
|
|
9
|
+
const visibleNavItems = filterNavItems(navItems, navConfig, permissions);
|
|
10
|
+
return _jsx(MainNavbar, { navItems: visibleNavItems, hiddenNavItems: hiddenNavItems });
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohasinac/appkit",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.27",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"watch:css": "tailwindcss -i src/tailwind-input.css -o dist/tailwind-utilities.css --watch",
|
|
148
148
|
"audit": "node scripts/audit-violations.mjs",
|
|
149
149
|
"check:types": "tsc --noEmit",
|
|
150
|
-
"check:audits": "node scripts/audit-violations.mjs && node scripts/verify-entries.mjs && node scripts/verify-css-build.mjs && node scripts/audit-use-client.mjs && node scripts/audit-double-navigation.mjs && node scripts/audit-repository-fields.mjs",
|
|
150
|
+
"check:audits": "node scripts/audit-violations.mjs && node scripts/verify-entries.mjs && node scripts/verify-css-build.mjs && node scripts/audit-use-client.mjs && node scripts/audit-double-navigation.mjs && node scripts/audit-repository-fields.mjs && node scripts/audit-query-provider.mjs",
|
|
151
151
|
"check": "npm run check:types && npm run check:audits"
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|