@myrjfa/ui 2.1.3 → 2.1.5
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/main/navbar.d.ts.map +1 -1
- package/dist/main/navbar.js +3 -1
- package/dist/misc/button.d.ts +2 -2
- package/dist/misc/notification.d.ts +3 -1
- package/dist/misc/notification.d.ts.map +1 -1
- package/dist/misc/notification.js +48 -3
- package/dist/misc/tile.d.ts +1 -1
- package/dist/misc/tile.d.ts.map +1 -1
- package/dist/misc/tile.js +2 -2
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../src/main/navbar.tsx"],"names":[],"mappings":"AAoBA,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,MAAM,CAAC,EAAE,IAAY,EAAE,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../src/main/navbar.tsx"],"names":[],"mappings":"AAoBA,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,MAAM,CAAC,EAAE,IAAY,EAAE,EAAE,WAAW,2CAqWnD;AAED,eAAe,MAAM,CAAC"}
|
package/dist/main/navbar.js
CHANGED
|
@@ -67,9 +67,10 @@ export function Navbar({ dark = false }) {
|
|
|
67
67
|
? "text-white/90 hover:text-white"
|
|
68
68
|
: "text-muted-foreground hover:text-foreground";
|
|
69
69
|
return (_jsx("header", { className: `fixed top-0 left-0 z-[100] mx-auto transition-all duration-300 w-full ${navbarBg} ${textColor} ${navbarBorder}`, children: _jsxs("div", { className: "mx-auto flex items-center justify-between gap-10 py-4 px-4 lg:px-8", children: [_jsxs(Link, { href: "/", className: "flex items-center gap-3", children: [_jsxs(Avatar, { className: "ml-2 -mr-4.5", children: [_jsx(AvatarImage, { src: "/images/logoicon.webp" }), _jsxs(AvatarFallback, { children: [(currentUser === null || currentUser === void 0 ? void 0 : currentUser.firstName.charAt(0)) || "D", (currentUser === null || currentUser === void 0 ? void 0 : currentUser.lastName.charAt(0)) || "P"] })] }), _jsx("span", { className: "font-heading text-xl font-bold", children: "rippeaze" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("nav", { className: "hidden md:flex items-center gap-10 justify-end", children: [_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { className: `flex items-center gap-1 text-sm font-medium cursor-pointer ${navItemColor}`, children: [_jsx(Target, { className: "h-5 w-5" }), _jsx("span", { children: "Opportunities" }), _jsx(ChevronDown, { className: "h-4 w-4" })] }) }), _jsx(PopoverContent, { className: "w-56 p-2 mt-3 bg-white rounded-lg shadow-lg border", align: "start", sideOffset: 5, children: _jsx("div", { className: "flex flex-col", children: opportunityTypeOptions.map((opt) => (_jsxs(Link, { href: `/opportunities?type=${opt.value}`, className: "px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-md flex flex-col", children: [_jsx("span", { className: "font-medium", children: opt.label }), _jsx("span", { className: "text-xs text-gray-500", children: opt.description })] }, opt.value))) }) })] }), _jsx(NavItem, { icon: _jsx(Luggage, { className: "h-5 w-5" }), label: "Packages", href: "/packages", className: navItemColor }), _jsx(NavItem, { icon: _jsx(Globe, { className: "h-5 w-5" }), label: "Blogs", href: "/blogs", className: navItemColor }), _jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { className: `flex items-center gap-1 text-sm font-medium cursor-pointer ${navItemColor}`, children: [_jsx(Compass, { className: "h-5 w-5" }), _jsx("span", { children: "Explore" }), _jsx(ChevronDown, { className: "h-4 w-4" })] }) }), _jsx(PopoverContent, { className: "w-64 p-2 mt-3 bg-white rounded-xl shadow-xl border", align: "start", sideOffset: 5, children: _jsxs("div", { className: "flex flex-col gap-0.5", children: [_jsx("p", { className: "text-[10px] font-black uppercase tracking-widest text-gray-400 px-3 pt-1 pb-0.5", children: "Travel" }), _jsxs(Link, { href: "/stays", className: "px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-lg flex items-center gap-3", children: [_jsx(BedDouble, { className: "h-4 w-4 text-primary flex-shrink-0" }), _jsxs("div", { children: [_jsx("p", { className: "font-semibold", children: "Stays" }), _jsx("p", { className: "text-xs text-gray-400", children: "Hotels, hostels & homestays" })] })] }), _jsxs(Link, { href: "/events", className: "px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-lg flex items-center gap-3", children: [_jsx(Ticket, { className: "h-4 w-4 text-primary flex-shrink-0" }), _jsxs("div", { children: [_jsx("p", { className: "font-semibold", children: "Events" }), _jsx("p", { className: "text-xs text-gray-400", children: "Concerts, workshops & more" })] })] }), _jsxs(Link, { href: "/adventures", className: "px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-lg flex items-center gap-3", children: [_jsx(Mountain, { className: "h-4 w-4 text-primary flex-shrink-0" }), _jsxs("div", { children: [_jsx("p", { className: "font-semibold", children: "Adventures" }), _jsx("p", { className: "text-xs text-gray-400", children: "Tours & thrilling activities" })] })] }), _jsxs(Link, { href: "/rentals", className: "px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-lg flex items-center gap-3", children: [_jsx(Car, { className: "h-4 w-4 text-primary flex-shrink-0" }), _jsxs("div", { children: [_jsx("p", { className: "font-semibold", children: "Rentals" }), _jsx("p", { className: "text-xs text-gray-400", children: "Bikes, cars & vehicles" })] })] }), _jsx("p", { className: "text-[10px] font-black uppercase tracking-widest text-gray-400 px-3 pt-2 pb-0.5", children: "For You" }), _jsxs(Link, { href: "/find-companion", className: "px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-lg flex items-center gap-3", children: [_jsx(Users, { className: "h-4 w-4 text-primary flex-shrink-0" }), _jsxs("div", { children: [_jsx("p", { className: "font-semibold", children: "Find Companions" }), _jsx("p", { className: "text-xs text-gray-400", children: "Connect with travel buddies" })] })] }), _jsxs(Link, { href: "/plan", className: "px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-lg flex items-center gap-3", children: [_jsx(Sparkles, { className: "h-4 w-4 text-primary flex-shrink-0" }), _jsxs("div", { children: [_jsx("p", { className: "font-semibold", children: "Plan a Trip" }), _jsx("p", { className: "text-xs text-gray-400", children: "AI-powered itinerary builder" })] })] })] }) })] }), currentUser ? _jsx(NavItem, { icon: _jsx(Store, { className: "h-5 w-5" }), label: "Become a Partner", href: "/contact", className: navItemColor })
|
|
70
|
-
: _jsx(NavItem, { icon: _jsx(Store, { className: "h-5 w-5" }), label: "Register as Business", href: "/auth/register?role=host", className: navItemColor }), isLoggedIn && _jsx(NotificationBell, { navItemColor: navItemColor })] }), _jsx("div", { className: "hidden md:flex items-center gap-2", children: _jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { variant: "link", className: "flex w-full gap-1 cursor-pointer", children: _jsxs(Avatar, { className: "ml-5 mr-4.5", children: [_jsx(AvatarImage, { src: (_a = currentUser === null || currentUser === void 0 ? void 0 : currentUser.profilePic) !== null && _a !== void 0 ? _a : "/images/profile_placeholder.webp" }), _jsxs(AvatarFallback, { children: [(currentUser === null || currentUser === void 0 ? void 0 : currentUser.firstName.charAt(0)) || "D", (currentUser === null || currentUser === void 0 ? void 0 : currentUser.lastName.charAt(0)) || "P"] })] }) }) }), _jsx(PopoverContent, { className: `w-full p-0 mt-3 bg-${dark ? "primary" : "white"} rounded-lg shadow-lg`, align: "end", sideOffset: 5, children: _jsxs("div", { className: "py-2 w-full", children: [_jsxs("div", { className: "px-4 py-3 border-b w-full", children: [_jsx("p", { className: "text-sm font-medium", children: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.username) || "Guest" }), _jsx("p", { className: "text-xs text-gray-500", children: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.email) || "user@example.com" })] }), _jsxs("div", { className: "flex flex-col", children: [isLoggedIn ?
|
|
70
|
+
: _jsx(NavItem, { icon: _jsx(Store, { className: "h-5 w-5" }), label: "Register as Business", href: "/auth/register?role=host", className: navItemColor }), isLoggedIn && _jsx(NotificationBell, { navItemColor: navItemColor, userId: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) !== "host" ? currentUser === null || currentUser === void 0 ? void 0 : currentUser.id : undefined, hostId: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === "host" ? currentUser === null || currentUser === void 0 ? void 0 : currentUser.id : undefined })] }), _jsx("div", { className: "hidden md:flex items-center gap-2", children: _jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { variant: "link", className: "flex w-full gap-1 cursor-pointer", children: _jsxs(Avatar, { className: "ml-5 mr-4.5", children: [_jsx(AvatarImage, { src: (_a = currentUser === null || currentUser === void 0 ? void 0 : currentUser.profilePic) !== null && _a !== void 0 ? _a : "/images/profile_placeholder.webp" }), _jsxs(AvatarFallback, { children: [(currentUser === null || currentUser === void 0 ? void 0 : currentUser.firstName.charAt(0)) || "D", (currentUser === null || currentUser === void 0 ? void 0 : currentUser.lastName.charAt(0)) || "P"] })] }) }) }), _jsx(PopoverContent, { className: `w-full p-0 mt-3 bg-${dark ? "primary" : "white"} rounded-lg shadow-lg`, align: "end", sideOffset: 5, children: _jsxs("div", { className: "py-2 w-full", children: [_jsxs("div", { className: "px-4 py-3 border-b w-full", children: [_jsx("p", { className: "text-sm font-medium", children: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.username) || "Guest" }), _jsx("p", { className: "text-xs text-gray-500", children: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.email) || "user@example.com" })] }), _jsxs("div", { className: "flex flex-col", children: [isLoggedIn ?
|
|
71
71
|
_jsxs(Link, { href: `/profile/${(currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) || "user"}/${(currentUser === null || currentUser === void 0 ? void 0 : currentUser.username) || "Guest"}`, className: "w-full py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2", children: [_jsxs(Avatar, { className: "w-4 h-4", children: [_jsx(AvatarImage, { src: (_b = currentUser === null || currentUser === void 0 ? void 0 : currentUser.profilePic) !== null && _b !== void 0 ? _b : "/images/profile_placeholder.webp" }), _jsx(AvatarFallback, { children: "U" })] }), "Profile"] }) :
|
|
72
72
|
_jsxs(Button, { variant: "ghost", onClick: () => router.push('/auth/login?role=user'), className: "w-full py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2 justify-start", children: [_jsxs(Avatar, { className: "w-4 h-4", children: [_jsx(AvatarImage, { src: "/images/profile_placeholder.webp" }), _jsx(AvatarFallback, { children: "U" })] }), "Login As Volunteer"] }), isLoggedIn && _jsxs(Link, { href: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === 'host' || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === 'admin' ? `/dashboard/host/overview` : `/overview/${(currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) || 'user'}`, className: "w-full py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2", children: [_jsx(LayoutDashboardIcon, { className: "h-4 w-4" }), "Dashboard"] }), isLoggedIn && ((currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === "user" || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) == null) &&
|
|
73
|
+
_jsxs(Link, { href: "/overview/user#bookings", className: "w-full py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2", children: [_jsx(Luggage, { className: "h-4 w-4" }), "My Bookings"] }), isLoggedIn && ((currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === "user" || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) == null) &&
|
|
73
74
|
_jsxs(Link, { href: "/opportunities/favourites", className: "w-full py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2", children: [_jsx(Heart, { className: "h-4 w-4" }), "Favourites"] }), (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === "host" ?
|
|
74
75
|
_jsxs(Button, { variant: "ghost", onClick: async () => {
|
|
75
76
|
await logout();
|
|
@@ -85,6 +86,7 @@ export function Navbar({ dark = false }) {
|
|
|
85
86
|
logout();
|
|
86
87
|
}, children: "Sign out" })] })] }) })] }) })] }), _jsx(MobileNavbar, { children: _jsx("div", { className: `rounded-b-lg py-4 px-4 shadow-xl ${"bg-background"} ${textColor}`, children: _jsxs("nav", { className: "flex flex-col gap-1 pt-2", children: [_jsxs("div", { className: "flex flex-col", children: [_jsxs("div", { className: "flex items-center gap-2 py-2 px-2 text-muted-foreground", children: [_jsx(Target, { className: "h-5 w-5" }), _jsx("span", { className: "text-sm font-medium", children: "Opportunities" })] }), _jsx("div", { className: "pl-8 flex flex-col gap-1", children: opportunityTypeOptions.map((opt) => (_jsx(Link, { href: `/opportunities?type=${opt.value}`, className: "py-1.5 px-2 text-sm text-gray-600 hover:text-foreground hover:bg-gray-100 rounded", children: opt.label }, opt.value))) })] }), _jsxs("div", { className: "flex flex-col", children: [_jsxs("div", { className: "flex items-center gap-2 py-2 px-2 text-muted-foreground", children: [_jsx(Compass, { className: "h-5 w-5" }), _jsx("span", { className: "text-sm font-medium", children: "Explore" })] }), _jsxs("div", { className: "pl-8 flex flex-col gap-1", children: [_jsx(Link, { href: "/stays", className: "py-1.5 px-2 text-sm text-gray-600 hover:text-foreground hover:bg-gray-100 rounded", children: "Stays" }), _jsx(Link, { href: "/events", className: "py-1.5 px-2 text-sm text-gray-600 hover:text-foreground hover:bg-gray-100 rounded", children: "Events" }), _jsx(Link, { href: "/adventures", className: "py-1.5 px-2 text-sm text-gray-600 hover:text-foreground hover:bg-gray-100 rounded", children: "Adventures" }), _jsx(Link, { href: "/rentals", className: "py-1.5 px-2 text-sm text-gray-600 hover:text-foreground hover:bg-gray-100 rounded", children: "Rentals" }), _jsx(Link, { href: "/find-companion", className: "py-1.5 px-2 text-sm text-gray-600 hover:text-foreground hover:bg-gray-100 rounded", children: "Find Companions" }), _jsx(Link, { href: "/plan", className: "py-1.5 px-2 text-sm text-gray-600 hover:text-foreground hover:bg-gray-100 rounded", children: "Plan a Trip \u2728" })] })] }), _jsx(MobileNavItem, { icon: _jsx(Luggage, { className: "h-5 w-5" }), label: "Packages", href: "/packages" }), _jsx(MobileNavItem, { icon: _jsx(Globe, { className: "h-5 w-5" }), label: "Blogs", href: "/blogs" }), currentUser ? _jsx(MobileNavItem, { icon: _jsx(Store, { className: "h-5 w-5" }), label: "Become a Partner", href: "/contact" }) :
|
|
87
88
|
_jsx(MobileNavItem, { icon: _jsx(Store, { className: "h-5 w-5" }), label: "Register as Business", href: "/auth/register?role=host" }), isLoggedIn && _jsx(MobileNotificationBell, {}), isLoggedIn && _jsx(MobileNavItem, { icon: _jsx(LayoutDashboardIcon, { className: "h-5 w-5" }), label: "Dashboard", href: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === 'host' || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === 'admin' ? `/dashboard/host/overview` : `/overview/${(currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) || 'user'}`, className: "md:hidden" }), isLoggedIn && ((currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === "user" || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) == null) &&
|
|
89
|
+
_jsx(MobileNavItem, { icon: _jsx(Luggage, { className: "h-5 w-5" }), label: "My Bookings", href: "/overview/user#bookings", className: "md:hidden" }), isLoggedIn && ((currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === "user" || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) == null) &&
|
|
88
90
|
_jsx(MobileNavItem, { icon: _jsx(Heart, { className: "h-5 w-5" }), label: "Favourites", href: "/opportunities/favourites", className: "md:hidden" }), isLoggedIn ? _jsxs(Link, { href: `/profile/${(currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) || "user"}/${(currentUser === null || currentUser === void 0 ? void 0 : currentUser.username) || "Guest"}`, className: "flex w-full gap-1 cursor-pointer my-2", children: [_jsxs(Avatar, { className: "w-5 h-5 ml-2", children: [_jsx(AvatarImage, { src: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.profilePic) || "/images/profile_placeholder.webp" }), _jsx(AvatarFallback, { children: "DP" })] }), _jsx(Label, { htmlFor: "username", className: "cursor-pointer text-muted-foreground hover:text-foreground", children: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.username) || "Guest" })] }) :
|
|
89
91
|
_jsxs(Link, { href: "/auth/login", className: "flex w-full gap-1 cursor-pointer my-2", children: [_jsxs(Avatar, { className: "w-5 h-5 ml-2", children: [_jsx(AvatarImage, { src: "/images/profile_placeholder.webp" }), _jsx(AvatarFallback, { children: "U" })] }), _jsx(Label, { htmlFor: "username", className: "cursor-pointer text-muted-foreground hover:text-foreground", children: "Login As Volunteer" })] }), (currentUser === null || currentUser === void 0 ? void 0 : currentUser.role) === "host" ?
|
|
90
92
|
_jsxs(Button, { variant: "ghost", onClick: async () => {
|
package/dist/misc/button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
declare const buttonVariants: (props?: ({
|
|
3
|
-
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" |
|
|
4
|
-
size?: "
|
|
3
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
4
|
+
size?: "icon" | "default" | "sm" | "lg" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
6
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
7
7
|
asChild?: boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export declare function NotificationBell({ navItemColor }: {
|
|
1
|
+
export declare function NotificationBell({ navItemColor, userId, hostId }: {
|
|
2
2
|
navItemColor: string;
|
|
3
|
+
userId?: string;
|
|
4
|
+
hostId?: string;
|
|
3
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
4
6
|
export declare function MobileNotificationBell(): import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/misc/notification.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/misc/notification.tsx"],"names":[],"mappings":"AAmEA,wBAAgB,gBAAgB,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,2CA0K5H;AAED,wBAAgB,sBAAsB,4CAUrC"}
|
|
@@ -3,10 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Popover, PopoverContent, PopoverTrigger } from "@radix-ui/react-popover";
|
|
4
4
|
import { getNotifications, toggleAllNotification, toggleNotification } from "@myrjfa/state/dist/lib/actions/actions";
|
|
5
5
|
import { formatTimestamp } from "@myrjfa/state/dist/lib/utils";
|
|
6
|
-
import { Bell, MessageCircle, CheckCircle2, Receipt, Users, AlertCircle, Megaphone, Briefcase, ShieldCheck, ShieldX, Package, ClipboardList } from "lucide-react";
|
|
6
|
+
import { Bell, MessageCircle, CheckCircle2, Receipt, Users, AlertCircle, Megaphone, Briefcase, ShieldCheck, ShieldX, Package, ClipboardList, Star, CalendarCheck } from "lucide-react";
|
|
7
7
|
import { useRouter } from "next/navigation";
|
|
8
|
-
import { useEffect, useState } from "react";
|
|
8
|
+
import { useEffect, useRef, useState } from "react";
|
|
9
9
|
import { FaSpinner } from "react-icons/fa6";
|
|
10
|
+
import { io } from "socket.io-client";
|
|
10
11
|
import { showAlert } from "./alertdialogclaude";
|
|
11
12
|
import { Button } from "./button";
|
|
12
13
|
import { Card, CardHeader, CardTitle } from "./card";
|
|
@@ -35,20 +36,37 @@ const getNotificationIcon = (notif) => {
|
|
|
35
36
|
case "id_rejected":
|
|
36
37
|
return _jsx(ShieldX, { className: "w-4 h-4 text-red-500 mt-0.5 flex-shrink-0" });
|
|
37
38
|
case "package_enquiry":
|
|
39
|
+
case "package_approval":
|
|
40
|
+
case "package_denial":
|
|
41
|
+
case "package_review":
|
|
42
|
+
case "package_rating":
|
|
38
43
|
return _jsx(Package, { className: "w-4 h-4 text-cyan-500 mt-0.5 flex-shrink-0" });
|
|
39
44
|
case "opportunity_assigned":
|
|
45
|
+
case "opportunity_approval":
|
|
46
|
+
case "opportunity_denial":
|
|
47
|
+
case "opportunity_review":
|
|
48
|
+
case "opportunity_rating":
|
|
40
49
|
return _jsx(ClipboardList, { className: "w-4 h-4 text-amber-500 mt-0.5 flex-shrink-0" });
|
|
50
|
+
case "blog_like":
|
|
51
|
+
case "blog_comment":
|
|
52
|
+
case "blog_posted":
|
|
53
|
+
case "blog_approval":
|
|
54
|
+
case "blog_denial":
|
|
55
|
+
return _jsx(Star, { className: "w-4 h-4 text-pink-500 mt-0.5 flex-shrink-0" });
|
|
56
|
+
case "booking_confirmed":
|
|
57
|
+
return _jsx(CalendarCheck, { className: "w-4 h-4 text-teal-500 mt-0.5 flex-shrink-0" });
|
|
41
58
|
case "system":
|
|
42
59
|
return _jsx(AlertCircle, { className: "w-4 h-4 text-gray-500 mt-0.5 flex-shrink-0" });
|
|
43
60
|
default:
|
|
44
61
|
return _jsx("div", { className: `w-2.5 h-2.5 rounded-full mt-1.5 flex-shrink-0 ${!notif.read ? "bg-blue-500" : "bg-gray-300"}` });
|
|
45
62
|
}
|
|
46
63
|
};
|
|
47
|
-
export function NotificationBell({ navItemColor }) {
|
|
64
|
+
export function NotificationBell({ navItemColor, userId, hostId }) {
|
|
48
65
|
const [notifs, setNotifs] = useState([]);
|
|
49
66
|
const [unreadCount, setUnreadCount] = useState(0);
|
|
50
67
|
const [loadingNotifId, setLoadingNotifId] = useState(null);
|
|
51
68
|
const [isOpen, setIsOpen] = useState(false);
|
|
69
|
+
const socketRef = useRef(null);
|
|
52
70
|
const router = useRouter();
|
|
53
71
|
const fetchData = async () => {
|
|
54
72
|
try {
|
|
@@ -62,6 +80,33 @@ export function NotificationBell({ navItemColor }) {
|
|
|
62
80
|
console.error("Failed to fetch notifications:", err);
|
|
63
81
|
}
|
|
64
82
|
};
|
|
83
|
+
// Connect to socket for real-time notifications
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
var _a;
|
|
86
|
+
if (!userId && !hostId)
|
|
87
|
+
return;
|
|
88
|
+
const apiUrl = ((_a = process.env.NEXT_PUBLIC_API_URL) === null || _a === void 0 ? void 0 : _a.replace("/api/v1", "")) || "";
|
|
89
|
+
if (!apiUrl)
|
|
90
|
+
return;
|
|
91
|
+
const query = {};
|
|
92
|
+
if (userId)
|
|
93
|
+
query.userId = userId;
|
|
94
|
+
if (hostId)
|
|
95
|
+
query.hostId = hostId;
|
|
96
|
+
const socket = io(apiUrl, { query, withCredentials: true, transports: ["websocket", "polling"] });
|
|
97
|
+
socketRef.current = socket;
|
|
98
|
+
socket.on("notification", (incoming) => {
|
|
99
|
+
setNotifs((prev) => {
|
|
100
|
+
const updated = [incoming, ...prev];
|
|
101
|
+
return updated.slice(0, NOTIF_LIMIT_FOR_BELL);
|
|
102
|
+
});
|
|
103
|
+
setUnreadCount((c) => c + 1);
|
|
104
|
+
});
|
|
105
|
+
return () => {
|
|
106
|
+
socket.disconnect();
|
|
107
|
+
socketRef.current = null;
|
|
108
|
+
};
|
|
109
|
+
}, [userId, hostId]);
|
|
65
110
|
// Re-fetch when popover opens
|
|
66
111
|
useEffect(() => {
|
|
67
112
|
if (isOpen)
|
package/dist/misc/tile.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TileProps } from "@myrjfa/state";
|
|
2
2
|
export type { TileProps };
|
|
3
|
-
export declare function Tile({ slug, image, title, description, location, rating, skills, tileType, className, date, host, duration, price, currency, includeHost, }: TileProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function Tile({ slug, image, title, description, location, rating, skills, tileType, className, date, host, duration, price, currency, includeHost, href, }: TileProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=tile.d.ts.map
|
package/dist/misc/tile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../../src/misc/tile.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,YAAY,EAAE,SAAS,EAAE,CAAC;AAgB1B,wBAAgB,IAAI,CAAC,EACjB,IAAI,EACJ,KAAK,EACL,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,MAAW,EACX,QAA0B,EAC1B,SAAS,EACT,IAAI,EACJ,IAAgB,EAChB,QAAY,EACZ,KAAW,EACX,QAAgB,EAChB,WAAkB,
|
|
1
|
+
{"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../../src/misc/tile.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,YAAY,EAAE,SAAS,EAAE,CAAC;AAgB1B,wBAAgB,IAAI,CAAC,EACjB,IAAI,EACJ,KAAK,EACL,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,MAAW,EACX,QAA0B,EAC1B,SAAS,EACT,IAAI,EACJ,IAAgB,EAChB,QAAY,EACZ,KAAW,EACX,QAAgB,EAChB,WAAkB,EAClB,IAAI,GACP,EAAE,SAAS,2CAkLX"}
|
package/dist/misc/tile.js
CHANGED
|
@@ -17,7 +17,7 @@ function WishlistButton({ wishlisted, handleWishlisted }) {
|
|
|
17
17
|
return _jsx(Button, { variant: "ghost", className: "absolute top-3 right-3 z-10 bg-white/70 hover:bg-white rounded-full transition", onClick: handleWishlisted, children: _jsx(Heart, { className: wishlisted ? "text-red-500 fill-red-500 drop-shadow" : "text-gray-400 fill-gray-400", size: 20 }) });
|
|
18
18
|
}
|
|
19
19
|
;
|
|
20
|
-
export function Tile({ slug, image, title, description, location, rating, skills = [], tileType = "opportunities", className, date, host = undefined, duration = 1, price = 0.0, currency = "INR", includeHost = true, }) {
|
|
20
|
+
export function Tile({ slug, image, title, description, location, rating, skills = [], tileType = "opportunities", className, date, host = undefined, duration = 1, price = 0.0, currency = "INR", includeHost = true, href, }) {
|
|
21
21
|
var _a, _b, _c, _d;
|
|
22
22
|
const [user, setUser] = useAtom(userAtom);
|
|
23
23
|
const loading = useAtomValue(userLoadingAtom);
|
|
@@ -53,7 +53,7 @@ export function Tile({ slug, image, title, description, location, rating, skills
|
|
|
53
53
|
if (clicked)
|
|
54
54
|
return; // prevent duplicate navigation
|
|
55
55
|
setClicked(true);
|
|
56
|
-
router.push(`/${tileType}/${slug}`);
|
|
56
|
+
router.push(href !== null && href !== void 0 ? href : `/${tileType}/${slug}`);
|
|
57
57
|
};
|
|
58
58
|
const formatPrice = (price, currency) => {
|
|
59
59
|
return new Intl.NumberFormat('en-IN', {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrjfa/ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"react-hook-form": "^7.54.2",
|
|
48
48
|
"react-icons": "^5.5.0",
|
|
49
49
|
"react-leaflet": "^5.0.0",
|
|
50
|
-
"react-share": "^5.2.2"
|
|
50
|
+
"react-share": "^5.2.2",
|
|
51
|
+
"socket.io-client": "^4.8.3"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
54
|
"@myrjfa/state": "*",
|
|
@@ -60,7 +61,6 @@
|
|
|
60
61
|
"zod": "*"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"@myrjfa/state": "2.1.2",
|
|
64
64
|
"@types/leaflet": "1.9.21",
|
|
65
65
|
"@types/react": "19.0.10",
|
|
66
66
|
"@types/react-dom": "^19.0.4",
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"react": "^19.0.0",
|
|
72
72
|
"react-dom": "^19.0.0",
|
|
73
73
|
"typescript": "^5.0.0",
|
|
74
|
-
"zod": "^3.24.2"
|
|
74
|
+
"zod": "^3.24.2",
|
|
75
|
+
"@myrjfa/state": "2.1.4"
|
|
75
76
|
},
|
|
76
77
|
"repository": {
|
|
77
78
|
"type": "git",
|