From c8e32b0bfbdb5d85bc2615f92d87f0f44c1a03c9 Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Thu, 15 May 2025 18:04:20 +0300 Subject: [PATCH 01/23] notifications ui --- .../dashboard/_components/DashboardInner.tsx | 43 ++++++++- .../_components/Notifications/FilterTabs.tsx | 81 ++++++++++++++++ .../Notifications/NotificationFooter.tsx | 20 ++++ .../Notifications/NotificationHeader.tsx | 17 ++++ .../Notifications/NotificationItem.tsx | 69 +++++++++++++ .../Notifications/SettingsDropdown.tsx | 96 +++++++++++++++++++ .../_components/Notifications/index.tsx | 57 +++++++++++ .../_components/Notifications/mockData.ts | 49 ++++++++++ .../_components/Notifications/types.ts | 44 +++++++++ apps/web/app/globals.css | 8 +- packages/ui/style/tailwind.config.js | 3 +- 11 files changed, 481 insertions(+), 6 deletions(-) create mode 100644 apps/web/app/dashboard/_components/Notifications/FilterTabs.tsx create mode 100644 apps/web/app/dashboard/_components/Notifications/NotificationFooter.tsx create mode 100644 apps/web/app/dashboard/_components/Notifications/NotificationHeader.tsx create mode 100644 apps/web/app/dashboard/_components/Notifications/NotificationItem.tsx create mode 100644 apps/web/app/dashboard/_components/Notifications/SettingsDropdown.tsx create mode 100644 apps/web/app/dashboard/_components/Notifications/index.tsx create mode 100644 apps/web/app/dashboard/_components/Notifications/mockData.ts create mode 100644 apps/web/app/dashboard/_components/Notifications/types.ts diff --git a/apps/web/app/dashboard/_components/DashboardInner.tsx b/apps/web/app/dashboard/_components/DashboardInner.tsx index e6e004e7dc9..93e6ed425ac 100644 --- a/apps/web/app/dashboard/_components/DashboardInner.tsx +++ b/apps/web/app/dashboard/_components/DashboardInner.tsx @@ -15,6 +15,7 @@ import { PopoverTrigger, } from "@cap/ui"; import { + faBell, faCrown, faGear, faHome, @@ -24,12 +25,15 @@ import { faSun, } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { useClickAway } from "@uidotdev/usehooks"; import clsx from "clsx"; +import { AnimatePresence } from "framer-motion"; import { MoreVertical } from "lucide-react"; import { signOut } from "next-auth/react"; import Link from "next/link"; import { usePathname } from "next/navigation"; -import { useState } from "react"; +import { MutableRefObject, useRef, useState } from "react"; +import Notifications from "./Notifications"; export default function DashboardInner({ children, @@ -45,6 +49,15 @@ export default function DashboardInner({ }; const title = titles[pathname] || ""; const { theme, setThemeHandler } = useTheme(); + const [toggleNotifications, setToggleNotifications] = useState(false); + const notificationsRef: MutableRefObject = useClickAway( + (e) => { + if (bellRef.current && !bellRef.current.contains(e.target as Node)) { + setToggleNotifications(false); + } + } + ); + const bellRef = useRef(null); return ( <> {/* Top Bar - Fixed at top with proper z-index */} @@ -68,6 +81,23 @@ export default function DashboardInner({ icon={theme === "dark" ? faMoon : faSun} /> +
{ + setToggleNotifications(!toggleNotifications); + }} + className="hidden relative justify-center data-[state=open]:hover:border-gray-8 items-center bg-gradient-to-t + rounded-full border transition-colors cursor-pointer lg:flex from-gray-4 to-gray-2 border-gray-4 + hover:border-gray-6 data-[state=open]:border-gray-8 data-[state=open]:from-gray-8 + data-[state=open]:to-gray-4 size-9" + > +
+ + + {toggleNotifications && } + +
@@ -95,8 +125,10 @@ const User = () => { /> -
+
{ {user.name ?? "User"}
- +
diff --git a/apps/web/app/dashboard/_components/Notifications/FilterTabs.tsx b/apps/web/app/dashboard/_components/Notifications/FilterTabs.tsx new file mode 100644 index 00000000000..fa2d5d2cebe --- /dev/null +++ b/apps/web/app/dashboard/_components/Notifications/FilterTabs.tsx @@ -0,0 +1,81 @@ +import clsx from "clsx"; +import { motion } from "framer-motion"; +import { useRef, useEffect } from "react"; +import { Filters, FilterType } from "./types"; + +type FilterTabsProps = { + activeFilter: FilterType; + setActiveFilter: (filter: FilterType) => void; +}; + +export const FilterTabs = ({ activeFilter, setActiveFilter }: FilterTabsProps) => { + const scrollContainerRef = useRef(null); + + // Add wheel event handling for horizontal scrolling + useEffect(() => { + const container = scrollContainerRef.current; + if (!container) return; + + const handleWheel = (e: WheelEvent) => { + // Prevent the default vertical scroll + if (!e.ctrlKey) { + e.preventDefault(); + } + + // Scroll horizontally instead of vertically + container.scrollLeft += e.deltaY; + }; + + // Add the wheel event listener + container.addEventListener('wheel', handleWheel, { passive: false }); + + // Clean up + return () => { + container.removeEventListener('wheel', handleWheel); + }; + }, []); + + return ( +
+ {Filters.map((filter) => ( +
+
setActiveFilter(filter)} + className="flex relative gap-2 items-center py-4 cursor-pointer group" + > +

+ {filter} +

+
+

+ 5 +

+
+
+ + {/* Indicator */} + {activeFilter === filter && ( + + )} +
+ ))} +
+ ); +}; diff --git a/apps/web/app/dashboard/_components/Notifications/NotificationFooter.tsx b/apps/web/app/dashboard/_components/Notifications/NotificationFooter.tsx new file mode 100644 index 00000000000..830a619ed10 --- /dev/null +++ b/apps/web/app/dashboard/_components/Notifications/NotificationFooter.tsx @@ -0,0 +1,20 @@ +import { faArrowDown, faArrowUp } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { SettingsDropdown } from "./SettingsDropdown"; + +export const NotificationFooter = () => { + return ( +
+
+

Navigate

+
+ +
+
+ +
+
+ +
+ ); +}; diff --git a/apps/web/app/dashboard/_components/Notifications/NotificationHeader.tsx b/apps/web/app/dashboard/_components/Notifications/NotificationHeader.tsx new file mode 100644 index 00000000000..8d4ed38f226 --- /dev/null +++ b/apps/web/app/dashboard/_components/Notifications/NotificationHeader.tsx @@ -0,0 +1,17 @@ +import { faCheckDouble } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +export const NotificationHeader = () => { + return ( +
+

Notifications

+
+ +

Mark all as read

+
+
+ ); +}; diff --git a/apps/web/app/dashboard/_components/Notifications/NotificationItem.tsx b/apps/web/app/dashboard/_components/Notifications/NotificationItem.tsx new file mode 100644 index 00000000000..d126e478980 --- /dev/null +++ b/apps/web/app/dashboard/_components/Notifications/NotificationItem.tsx @@ -0,0 +1,69 @@ +import { faComment, faEye, faVideo } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import clsx from "clsx"; +import { Notification, NotificationType } from "./types"; + +type NotificationItemProps = { + notification: Notification; + isLast: boolean; + isFirst: boolean; +}; + +export const NotificationItem = ({ notification, isLast, isFirst }: NotificationItemProps) => { + return ( +
+ {/* Avatar */} +
+ {notification.user.avatar ? ( + {notification.user.name} + ) : ( +
+ {notification.user.name.charAt(0)} +
+ )} + {notification.user.hasUnread && ( +
+ )} +
+ + {/* Content */} +
+
+ {notification.user.name} + {notification.content} +
+ {notification.time} + + {notification.additionalText && ( +

{notification.additionalText}

+ )} +
+ + {/* Icon */} +
+ {notification.type === NotificationType.RECORDING && ( + + )} + {notification.type === NotificationType.COMMENT && ( + + )} + {notification.type === NotificationType.VIEW && ( + + )} + {notification.type === NotificationType.REACTION && ( + 🔥 + )} +
+
+ ); +}; diff --git a/apps/web/app/dashboard/_components/Notifications/SettingsDropdown.tsx b/apps/web/app/dashboard/_components/Notifications/SettingsDropdown.tsx new file mode 100644 index 00000000000..a33b73f67a6 --- /dev/null +++ b/apps/web/app/dashboard/_components/Notifications/SettingsDropdown.tsx @@ -0,0 +1,96 @@ +import { + faArrowUp, + faBellSlash, + faCog, + faCommentSlash, + faEyeSlash, + faThumbsUp, + faVideo, + IconDefinition +} from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { Menu, Transition } from '@headlessui/react'; +import clsx from "clsx"; +import { Fragment, useState } from 'react'; + +type NotificationOption = { + icon: IconDefinition; + label: string; +}; + +export const SettingsDropdown = () => { + const [showPauseSubmenu, setShowPauseSubmenu] = useState(false); + + const notificationOptions: NotificationOption[] = [ + { icon: faVideo, label: "Recordings" }, + { icon: faCommentSlash, label: "Comments" }, + { icon: faEyeSlash, label: "Views" }, + { icon: faThumbsUp, label: "Reactions" } + ]; + return ( + + + +

Settings

+
+ + + +
+ + {({ active }) => ( +
setShowPauseSubmenu(true)} + onMouseLeave={() => setShowPauseSubmenu(false)} + > +
+ +

Pause notifications

+
+ +
+ )} +
+ + {/* Submenu */} + {showPauseSubmenu && ( +
setShowPauseSubmenu(true)} + onMouseLeave={() => setShowPauseSubmenu(false)} + > + {notificationOptions.map((option, index) => ( +
+ +

{option.label}

+
+ ))} +
+ )} +
+
+
+
+ ); +}; + +export default SettingsDropdown; + diff --git a/apps/web/app/dashboard/_components/Notifications/index.tsx b/apps/web/app/dashboard/_components/Notifications/index.tsx new file mode 100644 index 00000000000..774f27b3415 --- /dev/null +++ b/apps/web/app/dashboard/_components/Notifications/index.tsx @@ -0,0 +1,57 @@ +import clsx from "clsx"; +import { motion, MotionProps } from "framer-motion"; +import { forwardRef, useState } from "react"; +import { FilterTabs } from "./FilterTabs"; +import { NotificationFooter } from "./NotificationFooter"; +import { NotificationHeader } from "./NotificationHeader"; +import { NotificationItem } from "./NotificationItem"; +import { mockNotifications } from "./mockData"; +import { filterToNotificationType, FilterType } from "./types"; + +type NotificationsProps = MotionProps & React.HTMLAttributes; + +const Notifications = forwardRef( + (props, ref) => { + const { className } = props; + const [activeFilter, setActiveFilter] = useState(FilterType.ALL); + + const filteredNotifications = mockNotifications.filter(notification => { + // If the active filter is ALL or if the notification type matches the mapped type + const mappedType = filterToNotificationType[activeFilter]; + return mappedType === null || notification.type === mappedType; + }); + + return ( + e.stopPropagation()} + className={clsx( + "flex absolute right-0 top-12 flex-col rounded-xl cursor-default w-[400px] h-[450px] bg-gray-1", + className + )} + {...props} + > + + +
+ {filteredNotifications.map((notification, idx) => ( + + ))} +
+ + +
+ ); + } +); + +export default Notifications; diff --git a/apps/web/app/dashboard/_components/Notifications/mockData.ts b/apps/web/app/dashboard/_components/Notifications/mockData.ts new file mode 100644 index 00000000000..3565c822d45 --- /dev/null +++ b/apps/web/app/dashboard/_components/Notifications/mockData.ts @@ -0,0 +1,49 @@ +import { Notification, NotificationType } from "./types"; + +export const mockNotifications: Notification[] = [ + { + id: "1", + type: NotificationType.RECORDING, + user: { + name: "Wayne", + avatar: "https://images.pexels.com/photos/771742/pexels-photo-771742.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2", + hasUnread: true + }, + content: "shared a new recording", + time: "3 mins ago" + }, + { + id: "2", + type: NotificationType.COMMENT, + user: { + name: "James", + avatar: "https://images.pexels.com/photos/1040880/pexels-photo-1040880.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2", + hasUnread: true + }, + content: "commented on your video", + time: "12 mins ago", + additionalText: "This is looking awesome, goodjob and i'm looking forward to seeing more." + }, + { + id: "3", + type: NotificationType.VIEW, + user: { + name: "Jasmin", + avatar: "", + hasUnread: true + }, + content: "viewed your video", + time: "20 mins ago" + }, + { + id: "4", + type: NotificationType.REACTION, + user: { + name: "Jasmin", + avatar: "", + hasUnread: true + }, + content: "reacted to your video", + time: "25 mins ago" + } +]; diff --git a/apps/web/app/dashboard/_components/Notifications/types.ts b/apps/web/app/dashboard/_components/Notifications/types.ts new file mode 100644 index 00000000000..913216ac9e2 --- /dev/null +++ b/apps/web/app/dashboard/_components/Notifications/types.ts @@ -0,0 +1,44 @@ +export enum NotificationType { + RECORDING = "recording", + COMMENT = "comment", + VIEW = "view", + REACTION = "reaction" +} + +export type Notification = { + id: string; + type: NotificationType; + user: { + name: string; + avatar: string; + hasUnread?: boolean; + }; + content: string; + time: string; + additionalText?: string; +}; + +export enum FilterType { + ALL = "All", + RECORDINGS = "Recordings", + COMMENTS = "Comments", + VIEWS = "Views", + REACTIONS = "Reactions" +} + +export const Filters = [ + FilterType.ALL, + FilterType.RECORDINGS, + FilterType.COMMENTS, + FilterType.VIEWS, + FilterType.REACTIONS, +] as const; + +// Map filter types to notification types +export const filterToNotificationType: Record = { + [FilterType.ALL]: null, // null means all types + [FilterType.RECORDINGS]: NotificationType.RECORDING, + [FilterType.COMMENTS]: NotificationType.COMMENT, + [FilterType.VIEWS]: NotificationType.VIEW, + [FilterType.REACTIONS]: NotificationType.REACTION +}; diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css index 1661964cb3f..eb018fd4f33 100644 --- a/apps/web/app/globals.css +++ b/apps/web/app/globals.css @@ -3,6 +3,7 @@ @import '@radix-ui/colors/gray.css'; @import '@radix-ui/colors/gray-alpha.css'; @import '@radix-ui/colors/gray-dark.css'; +@import '@radix-ui/colors/white-alpha.css'; @import '@radix-ui/colors/blue.css'; @tailwind base; @@ -474,9 +475,14 @@ slot:not(.dashboard-layout slot) { @apply bg-gray-50 } + +.hide-scroll::-webkit-scrollbar { + display: none; +} + /* Custom scrollbar */ .custom-scroll { - overflow-y: scroll; + overflow-y: auto; } .custom-scroll::-webkit-scrollbar { diff --git a/packages/ui/style/tailwind.config.js b/packages/ui/style/tailwind.config.js index 2da515051b7..531b988e1e8 100644 --- a/packages/ui/style/tailwind.config.js +++ b/packages/ui/style/tailwind.config.js @@ -1,4 +1,4 @@ -module.exports = function (app, options) { +module.exports = function (__app, _options) { // Function to generate color scales for Radix colors function getColorScale(name, alpha = false) { let scale = {}; @@ -43,6 +43,7 @@ module.exports = function (app, options) { extend: { colors: { gray: getColorScale("gray"), + "gray-a": getColorScale("gray-a", true), blue: getColorScale("blue"), red: getColorScale("red"), border: "hsl(var(--border))", From 2ca7eef210b3ee7c6db6275d30b399c7ab24068a Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:42:42 +0300 Subject: [PATCH 02/23] tweaks --- .../dashboard/_components/DashboardInner.tsx | 32 ++++++++++++++++++- .../_components/Notifications/index.tsx | 14 ++++---- apps/web/app/globals.css | 3 +- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx index ccf3c58ddf0..da0b3f959b8 100644 --- a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx +++ b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx @@ -1,5 +1,6 @@ "use client"; +import Notifications from "@/app/dashboard/_components/Notifications"; import { UpgradeModal } from "@/components/UpgradeModal"; import { buildEnv } from "@cap/env"; import { @@ -12,17 +13,20 @@ import { PopoverTrigger, } from "@cap/ui"; import { + faBell, faMoon, faSun } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { useClickAway } from "@uidotdev/usehooks"; import clsx from "clsx"; +import { AnimatePresence } from "framer-motion"; import { MoreVertical } from "lucide-react"; import { signOut } from "next-auth/react"; import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; -import React, { cloneElement, memo, useMemo, useRef, useState } from "react"; +import React, { cloneElement, memo, MutableRefObject, useMemo, useRef, useState } from "react"; import { useDashboardContext, useTheme } from "../Contexts"; import { MembersDialog } from "../spaces/[spaceId]/components/MembersDialog"; import { ArrowUpIcon } from "./AnimatedIcons/ArrowUp"; @@ -55,6 +59,15 @@ export default function DashboardInner({ const title = activeSpace ? activeSpace.name : titles[pathname] || ""; const { theme, setThemeHandler } = useTheme(); + const [toggleNotifications, setToggleNotifications] = useState(false); + const notificationsRef: MutableRefObject = useClickAway( + (e) => { + if (bellRef.current && !bellRef.current.contains(e.target as Node)) { + setToggleNotifications(false); + } + } + ); + const bellRef = useRef(null); const isSharedCapsPage = pathname === "/dashboard/shared-caps"; return (
@@ -89,6 +102,23 @@ export default function DashboardInner({
+
{ + setToggleNotifications(!toggleNotifications); + }} + className="hidden relative justify-center data-[state=open]:hover:bg-gray-5 items-center bg-gray-3 + rounded-full transition-colors cursor-pointer lg:flex + hover:bg-gray-5 data-[state=open]:bg-gray-5 + size-9" + > +
+ + + {toggleNotifications && } + +
{ if (document.startViewTransition) { diff --git a/apps/web/app/dashboard/_components/Notifications/index.tsx b/apps/web/app/dashboard/_components/Notifications/index.tsx index 774f27b3415..7f2fa65bc62 100644 --- a/apps/web/app/dashboard/_components/Notifications/index.tsx +++ b/apps/web/app/dashboard/_components/Notifications/index.tsx @@ -14,7 +14,7 @@ const Notifications = forwardRef( (props, ref) => { const { className } = props; const [activeFilter, setActiveFilter] = useState(FilterType.ALL); - + const filteredNotifications = mockNotifications.filter(notification => { // If the active filter is ALL or if the notification type matches the mapped type const mappedType = filterToNotificationType[activeFilter]; @@ -36,18 +36,18 @@ const Notifications = forwardRef( {...props} > - +
{filteredNotifications.map((notification, idx) => ( - ))}
- + ); diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css index ffef79f0cd2..d6612d1a179 100644 --- a/apps/web/app/globals.css +++ b/apps/web/app/globals.css @@ -565,8 +565,7 @@ slot:not(.dashboard-layout slot) { /* Custom scrollbar */ .custom-scroll { - overflow-y: scroll; - padding-right: 3px; + overflow-y: auto; } .custom-scroll::-webkit-scrollbar { From e78b8e2543c4a0025b4fc9acf030b2b71dfe554e Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:44:34 +0300 Subject: [PATCH 03/23] Update DashboardInner.tsx --- apps/web/app/(org)/dashboard/_components/DashboardInner.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx index da0b3f959b8..4496ac30b34 100644 --- a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx +++ b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx @@ -113,7 +113,7 @@ export default function DashboardInner({ hover:bg-gray-5 data-[state=open]:bg-gray-5 size-9" > -
+
{toggleNotifications && } From fcf56767612fed4cc296e793a469c5c2edaa3895 Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:39:30 +0300 Subject: [PATCH 04/23] Add notifications support --- .../notifications/create-notification.ts | 130 ++ .../actions/notifications/mark-all-as-read.ts | 26 + .../notifications/update-preferences.ts | 37 + apps/web/actions/videos/delete-comment.ts | 77 +- apps/web/actions/videos/new-comment.ts | 18 + apps/web/app/(org)/dashboard/Contexts.tsx | 12 +- .../dashboard/_components/DashboardInner.tsx | 16 +- .../web/app/(org)/dashboard/dashboard-data.ts | 32 +- apps/web/app/(org)/dashboard/layout.tsx | 12 +- .../api/notifications/preferences/route.ts | 49 + apps/web/app/api/notifications/route.ts | 128 ++ .../_components/Notifications/FilterTabs.tsx | 38 +- .../Notifications/NotificationHeader.tsx | 30 +- .../Notifications/NotificationItem.tsx | 125 +- .../Notifications/SettingsDropdown.tsx | 73 +- .../_components/Notifications/Skeleton.tsx | 67 + .../_components/Notifications/index.tsx | 88 +- .../_components/Notifications/types.ts | 46 +- .../app/s/[videoId]/_components/Toolbar.tsx | 2 +- .../_components/tabs/Activity/Comment.tsx | 27 +- .../_components/tabs/Activity/Comments.tsx | 60 +- apps/web/app/s/[videoId]/page.tsx | 64 +- apps/web/components/VideoThumbnail.tsx | 7 +- apps/web/utils/auth.ts | 2 +- .../migrations/meta/0007_snapshot.json | 1866 +++++++++++++++++ .../database/migrations/meta/_journal.json | 7 + packages/database/schema.ts | 43 + 27 files changed, 2861 insertions(+), 221 deletions(-) create mode 100644 apps/web/actions/notifications/create-notification.ts create mode 100644 apps/web/actions/notifications/mark-all-as-read.ts create mode 100644 apps/web/actions/notifications/update-preferences.ts create mode 100644 apps/web/app/api/notifications/preferences/route.ts create mode 100644 apps/web/app/api/notifications/route.ts create mode 100644 apps/web/app/dashboard/_components/Notifications/Skeleton.tsx create mode 100644 packages/database/migrations/meta/0007_snapshot.json diff --git a/apps/web/actions/notifications/create-notification.ts b/apps/web/actions/notifications/create-notification.ts new file mode 100644 index 00000000000..cc65b80868b --- /dev/null +++ b/apps/web/actions/notifications/create-notification.ts @@ -0,0 +1,130 @@ +"use server"; + +import { getCurrentUser } from "@cap/database/auth/session"; +import { notifications, videos, users } from "@cap/database/schema"; +import { db } from "@cap/database"; +import { and, eq, sql } from "drizzle-orm"; +import { nanoId } from "@cap/database/helpers"; +import { UserPreferences } from "@/app/(org)/dashboard/dashboard-data"; +import { revalidatePath } from "next/cache"; + +type NotificationData = (typeof notifications.$inferSelect)["data"]; + +export const createNotification = async ( + notificationData: NotificationData, + type: "reaction" | "view" | "comment" | "mention" | "reply" +) => { + const currentUser = await getCurrentUser(); + if (!currentUser) { + throw new Error("User not found"); + } + + try { + // First, get the video and owner data + const [videoResult] = await db() + .select({ + videoId: videos.id, + ownerId: users.id, + activeOrganizationId: users.activeOrganizationId, + preferences: users.preferences, + }) + .from(videos) + .innerJoin(users, eq(users.id, videos.ownerId)) + .where(eq(videos.id, notificationData.videoId)) + .limit(1); + + if (!videoResult) { + throw new Error("Video or owner not found"); + } + + // Skip notification if the video owner is the current user + if (videoResult.ownerId === currentUser.id) { + return; + } + + // Check user preferences + const preferences = videoResult.preferences as UserPreferences; + if (preferences?.notifications) { + const notificationPrefs = preferences.notifications; + + const shouldSkipNotification = + (type === "comment" && notificationPrefs.pauseComments) || + (type === "view" && notificationPrefs.pauseViews) || + (type === "reaction" && notificationPrefs.pauseReactions); + + if (shouldSkipNotification) { + return; + } + } + + // Check for existing notification to prevent duplicates + let hasExistingNotification = false; + if (type === "view") { + const [existingNotification] = await db() + .select({ id: notifications.id }) + .from(notifications) + .where( + and( + eq(notifications.type, "view"), + eq(notifications.recipientId, videoResult.ownerId), + sql`JSON_EXTRACT(${notifications.data}, '$.videoId') = ${notificationData.videoId}`, + sql`JSON_EXTRACT(${notifications.data}, '$.authorId') = ${currentUser.id}` + ) + ) + .limit(1); + + hasExistingNotification = !!existingNotification; + } else if (type === "comment" && notificationData.comment?.id) { + // Check for existing comment notification + const [existingNotification] = await db() + .select({ id: notifications.id }) + .from(notifications) + .where( + and( + eq(notifications.type, "comment"), + eq(notifications.recipientId, videoResult.ownerId), + sql`JSON_EXTRACT(${notifications.data}, '$.comment.id') = ${notificationData.comment?.id}` + ) + ) + .limit(1); + + hasExistingNotification = !!existingNotification; + } + + if (hasExistingNotification) { + return; + } + + const notificationId = nanoId(); + const now = new Date(); + + const data: NotificationData = { + videoId: notificationData.videoId, + authorId: currentUser.id, + }; + + if (notificationData.comment?.id) { + data.comment = notificationData.comment; + } + if (notificationData.content) { + data.content = notificationData.content; + } + + await db().insert(notifications).values({ + id: notificationId, + orgId: videoResult.activeOrganizationId, + recipientId: videoResult.ownerId, + type: type, + data: data, + createdAt: now, + readAt: null, + }); + + revalidatePath("/dashboard"); + + return { success: true, notificationId }; + } catch (error) { + console.error("Error creating notification:", error); + throw error; + } +}; diff --git a/apps/web/actions/notifications/mark-all-as-read.ts b/apps/web/actions/notifications/mark-all-as-read.ts new file mode 100644 index 00000000000..318d44e30d0 --- /dev/null +++ b/apps/web/actions/notifications/mark-all-as-read.ts @@ -0,0 +1,26 @@ +"use server"; + +import { getCurrentUser } from "@cap/database/auth/session"; +import { notifications } from "@cap/database/schema"; +import { db } from "@cap/database"; +import { eq } from "drizzle-orm"; +import { revalidatePath } from "next/cache"; + +export const markAllAsRead = async () => { + const currentUser = await getCurrentUser(); + if (!currentUser) { + throw new Error("User not found"); + } + + try { + await db() + .update(notifications) + .set({ readAt: new Date() }) + .where(eq(notifications.recipientId, currentUser.id)); + } catch (error) { + console.log(error); + throw new Error("Error marking notifications as read"); + } + + revalidatePath("/dashboard"); +}; diff --git a/apps/web/actions/notifications/update-preferences.ts b/apps/web/actions/notifications/update-preferences.ts new file mode 100644 index 00000000000..0dc9487baf8 --- /dev/null +++ b/apps/web/actions/notifications/update-preferences.ts @@ -0,0 +1,37 @@ +"use server"; + +import { getCurrentUser } from "@cap/database/auth/session"; +import { db } from "@cap/database"; +import { users } from "@cap/database/schema"; +import { eq } from "drizzle-orm"; +import { revalidatePath } from "next/cache"; + +export const updatePreferences = async ({ + notifications, +}: { + notifications: { + pauseComments: boolean; + pauseViews: boolean; + pauseReactions: boolean; + }; +}) => { + const currentUser = await getCurrentUser(); + if (!currentUser) { + throw new Error("User not found"); + } + + try { + await db() + .update(users) + .set({ + preferences: { + notifications, + }, + }) + .where(eq(users.id, currentUser.id)); + revalidatePath("/dashboard"); + } catch (error) { + console.log(error); + throw new Error("Error updating preferences"); + } +}; diff --git a/apps/web/actions/videos/delete-comment.ts b/apps/web/actions/videos/delete-comment.ts index 5e9e623c4a2..c62bac4d025 100644 --- a/apps/web/actions/videos/delete-comment.ts +++ b/apps/web/actions/videos/delete-comment.ts @@ -1,16 +1,18 @@ "use server"; import { db } from "@cap/database"; -import { comments } from "@cap/database/schema"; +import { comments, notifications } from "@cap/database/schema"; import { getCurrentUser } from "@cap/database/auth/session"; import { revalidatePath } from "next/cache"; -import { eq, and } from "drizzle-orm"; +import { eq, and, sql } from "drizzle-orm"; export async function deleteComment({ commentId, + parentId, videoId, }: { commentId: string; + parentId?: string; videoId: string; }) { const user = await getCurrentUser(); @@ -23,25 +25,60 @@ export async function deleteComment({ throw new Error("Comment ID and video ID are required"); } - // First, verify the comment exists and belongs to the current user - const existingComment = await db() - .select() - .from(comments) - .where(and(eq(comments.id, commentId), eq(comments.authorId, user.id))) - .limit(1); - - if (existingComment.length === 0) { - throw new Error( - "Comment not found or you don't have permission to delete it" - ); - } + try { + await db().transaction(async (tx) => { + // First, verify the comment exists and belongs to the current user + const [existingComment] = await tx + .select({ id: comments.id }) + .from(comments) + .where(and(eq(comments.id, commentId), eq(comments.authorId, user.id))) + .limit(1); + + if (!existingComment) { + throw new Error( + "Comment not found or you don't have permission to delete it" + ); + } - // Delete the comment - await db() - .delete(comments) - .where(and(eq(comments.id, commentId), eq(comments.authorId, user.id))); + await tx + .delete(comments) + .where(and(eq(comments.id, commentId), eq(comments.authorId, user.id))); - revalidatePath(`/s/${videoId}`); + // Delete related notifications + if (parentId) { + await tx + .delete(notifications) + .where( + and( + eq(notifications.type, "reply"), + sql`JSON_EXTRACT(${notifications.data}, '$.comment.id') = ${commentId}` + ) + ); + } else { + await tx + .delete(notifications) + .where( + and( + eq(notifications.type, "comment"), + sql`JSON_EXTRACT(${notifications.data}, '$.comment.id') = ${commentId}` + ) + ); - return { success: true, commentId }; + await tx + .delete(notifications) + .where( + and( + eq(notifications.type, "reply"), + sql`JSON_EXTRACT(${notifications.data}, '$.comment.parentCommentId') = ${commentId}` + ) + ); + } + }); + + revalidatePath(`/s/${videoId}`); + return { success: true }; + } catch (error) { + console.error("Error deleting comment:", error); + throw error; + } } diff --git a/apps/web/actions/videos/new-comment.ts b/apps/web/actions/videos/new-comment.ts index be874e8243f..202d02ebf43 100644 --- a/apps/web/actions/videos/new-comment.ts +++ b/apps/web/actions/videos/new-comment.ts @@ -5,6 +5,7 @@ import { comments } from "@cap/database/schema"; import { getCurrentUser } from "@cap/database/auth/session"; import { revalidatePath } from "next/cache"; import { nanoId } from "@cap/database/helpers"; +import { createNotification } from "../notifications/create-notification"; export async function newComment(data: { content: string; @@ -22,6 +23,11 @@ export async function newComment(data: { const videoId = data.videoId; const type = data.type; const parentCommentId = data.parentCommentId; + const conditionalType = parentCommentId + ? "reply" + : type === "emoji" + ? "reaction" + : "comment"; if (!content || !videoId) { throw new Error("Content and videoId are required"); @@ -42,6 +48,18 @@ export async function newComment(data: { await db().insert(comments).values(newComment); + await createNotification( + { + videoId, + comment: { + id, + parentCommentId, + }, + content, + }, + conditionalType + ); + // Add author name to the returned data const commentWithAuthor = { ...newComment, diff --git a/apps/web/app/(org)/dashboard/Contexts.tsx b/apps/web/app/(org)/dashboard/Contexts.tsx index 07de3e6fee6..e4f2b841aea 100644 --- a/apps/web/app/(org)/dashboard/Contexts.tsx +++ b/apps/web/app/(org)/dashboard/Contexts.tsx @@ -6,7 +6,7 @@ import { createContext, useContext, useEffect, useState } from "react"; import { UpgradeModal } from "@/components/UpgradeModal"; import { usePathname } from "next/navigation"; import { buildEnv } from "@cap/env"; -import { Organization, Spaces } from "./dashboard-data"; +import { Organization, Spaces, UserPreferences } from "./dashboard-data"; type SharedContext = { organizationData: Organization[] | null; @@ -18,6 +18,8 @@ type SharedContext = { user: typeof users.$inferSelect; isSubscribed: boolean; toggleSidebarCollapsed: () => void; + anyNewNotifications: boolean; + userPreferences: UserPreferences; sidebarCollapsed: boolean; upgradeModalOpen: boolean; setUpgradeModalOpen: (open: boolean) => void; @@ -32,7 +34,7 @@ const ThemeContext = createContext<{ setThemeHandler: (newTheme: ITheme) => void; }>({ theme: "light", - setThemeHandler: () => {}, + setThemeHandler: () => { }, }); export const useTheme = () => useContext(ThemeContext); @@ -46,6 +48,8 @@ export function DashboardContexts({ spacesData, user, isSubscribed, + userPreferences, + anyNewNotifications, initialTheme, initialSidebarCollapsed, }: { @@ -55,6 +59,8 @@ export function DashboardContexts({ spacesData: SharedContext["spacesData"]; user: SharedContext["user"]; isSubscribed: SharedContext["isSubscribed"]; + userPreferences: SharedContext["userPreferences"]; + anyNewNotifications: boolean; initialTheme: ITheme; initialSidebarCollapsed: boolean; }) { @@ -133,6 +139,8 @@ export function DashboardContexts({ organizationData, activeOrganization, spacesData, + anyNewNotifications, + userPreferences, userSpaces, sharedSpaces, activeSpace, diff --git a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx index 10bbb559a96..d6ad5f712c6 100644 --- a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx +++ b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx @@ -50,7 +50,7 @@ export default function DashboardInner({ children: React.ReactNode; }) { const pathname = usePathname(); - const { activeOrganization, activeSpace } = useDashboardContext(); + const { activeOrganization, activeSpace, anyNewNotifications } = useDashboardContext(); const [membersDialogOpen, setMembersDialogOpen] = useState(false); const titles: Record = { @@ -65,6 +65,7 @@ export default function DashboardInner({ const title = activeSpace ? activeSpace.name : titles[pathname] || ""; const { theme, setThemeHandler } = useTheme(); const [toggleNotifications, setToggleNotifications] = useState(false); + const bellRef = useRef(null); const notificationsRef: MutableRefObject = useClickAway( (e) => { if (bellRef.current && !bellRef.current.contains(e.target as Node)) { @@ -72,7 +73,6 @@ export default function DashboardInner({ } } ); - const bellRef = useRef(null); const isSharedCapsPage = pathname === "/dashboard/shared-caps"; return (
@@ -119,7 +119,13 @@ export default function DashboardInner({ hover:bg-gray-5 data-[state=open]:bg-gray-5 size-9" > -
+ {anyNewNotifications && ( +
+
+
+
+
+
)} {toggleNotifications && } @@ -339,8 +345,8 @@ const ReferButton = () => { {/* Red notification dot with pulse animation */}
-
-
+
+
diff --git a/apps/web/app/(org)/dashboard/dashboard-data.ts b/apps/web/app/(org)/dashboard/dashboard-data.ts index 1bc1c59ae14..4d9bbeb220b 100644 --- a/apps/web/app/(org)/dashboard/dashboard-data.ts +++ b/apps/web/app/(org)/dashboard/dashboard-data.ts @@ -8,8 +8,9 @@ import { spaces, sharedVideos, spaceMembers, + notifications, } from "@cap/database/schema"; -import { and, count, eq, inArray, or, sql } from "drizzle-orm"; +import { and, count, eq, inArray, isNull, or, sql } from "drizzle-orm"; export type Organization = { organization: typeof organizations.$inferSelect; @@ -32,6 +33,8 @@ export type Spaces = Omit< videoCount: number; }; +export type UserPreferences = (typeof users.$inferSelect)["preferences"]; + export async function getDashboardData(user: typeof userSelectProps) { try { const organizationsWithMembers = await db() @@ -73,6 +76,7 @@ export async function getDashboardData(user: typeof userSelectProps) { .where(inArray(organizationInvites.organizationId, organizationIds)); } + let anyNewNotifications = false; let spacesData: Spaces[] = []; // Find active organization ID @@ -87,6 +91,20 @@ export async function getDashboardData(user: typeof userSelectProps) { // Only fetch spaces for the active organization if (activeOrganizationId) { + const [notification] = await db() + .select({ id: notifications.id }) + .from(notifications) + .where( + and( + eq(notifications.recipientId, user.id), + eq(notifications.orgId, activeOrganizationId), + isNull(notifications.readAt) + ) + ) + .limit(1); + + anyNewNotifications = !!notification; + spacesData = await db() .select({ id: spaces.id, @@ -165,6 +183,14 @@ export async function getDashboardData(user: typeof userSelectProps) { } } + const [userPreferences] = await db() + .select({ + preferences: users.preferences, + }) + .from(users) + .where(eq(users.id, user.id)) + .limit(1); + const organizationSelect: Organization[] = await Promise.all( organizationsWithMembers .reduce((acc: (typeof organizations.$inferSelect)[], row) => { @@ -236,12 +262,16 @@ export async function getDashboardData(user: typeof userSelectProps) { return { organizationSelect, spacesData, + anyNewNotifications, + userPreferences, }; } catch (error) { console.error("Failed to fetch dashboard data", error); return { organizationSelect: [], spacesData: [], + anyNewNotifications: false, + userPreferences: null, }; } } diff --git a/apps/web/app/(org)/dashboard/layout.tsx b/apps/web/app/(org)/dashboard/layout.tsx index 64c97a0da48..65b8c48cec5 100644 --- a/apps/web/app/(org)/dashboard/layout.tsx +++ b/apps/web/app/(org)/dashboard/layout.tsx @@ -2,14 +2,14 @@ import { getCurrentUser } from "@cap/database/auth/session"; import { cookies } from "next/headers"; import { redirect } from "next/navigation"; -import { getDashboardData, Organization, Spaces } from "./dashboard-data"; +import { getDashboardData, Organization, Spaces, UserPreferences } from "./dashboard-data"; import DashboardInner from "./_components/DashboardInner"; import { DashboardContexts } from "./Contexts"; import DesktopNav from "./_components/Navbar/Desktop"; import MobileNav from "./_components/Navbar/Mobile"; +import { UploadingProvider } from "./caps/UploadingContext"; export const dynamic = "force-dynamic"; -import { UploadingProvider } from "./caps/UploadingContext"; export default async function DashboardLayout({ children, @@ -28,14 +28,20 @@ export default async function DashboardLayout({ let organizationSelect: Organization[] = []; let spacesData: Spaces[] = []; + let anyNewNotifications = false; + let userPreferences: UserPreferences; try { const dashboardData = await getDashboardData(user); organizationSelect = dashboardData.organizationSelect; + userPreferences = dashboardData.userPreferences?.preferences || null; spacesData = dashboardData.spacesData; + anyNewNotifications = dashboardData.anyNewNotifications; } catch (error) { console.error("Failed to load dashboard data", error); organizationSelect = []; spacesData = []; + anyNewNotifications = false; + userPreferences = null; } let activeOrganization = organizationSelect.find( @@ -64,6 +70,8 @@ export default async function DashboardLayout({ isSubscribed={isSubscribed} initialTheme={theme as "light" | "dark"} initialSidebarCollapsed={sidebar === "true"} + anyNewNotifications={anyNewNotifications} + userPreferences={userPreferences} >
); @@ -495,14 +497,14 @@ async function AuthorizedContent({ const membersListPromise = video.sharedOrganization?.organizationId ? db() - .select({ userId: organizationMembers.userId }) - .from(organizationMembers) - .where( - eq( - organizationMembers.organizationId, - video.sharedOrganization.organizationId + .select({ userId: organizationMembers.userId }) + .from(organizationMembers) + .where( + eq( + organizationMembers.organizationId, + video.sharedOrganization.organizationId + ) ) - ) : Promise.resolve([]); const commentsPromise = (async () => { @@ -555,7 +557,6 @@ async function AuthorizedContent({ folderId: null, }; - return ( <>
diff --git a/apps/web/actions/notifications/create-notification.ts b/apps/web/lib/Notification.ts similarity index 56% rename from apps/web/actions/notifications/create-notification.ts rename to apps/web/lib/Notification.ts index cee705becdd..13b2a499bb4 100644 --- a/apps/web/actions/notifications/create-notification.ts +++ b/apps/web/lib/Notification.ts @@ -1,5 +1,4 @@ -"use server"; - +import { z } from "zod"; import { getCurrentUser } from "@cap/database/auth/session"; import { notifications, videos, users } from "@cap/database/schema"; import { db } from "@cap/database"; @@ -8,17 +7,48 @@ import { nanoId } from "@cap/database/helpers"; import { UserPreferences } from "@/app/(org)/dashboard/dashboard-data"; import { revalidatePath } from "next/cache"; -type NotificationData = (typeof notifications.$inferSelect)["data"]; - -export const createNotification = async ( - notificationData: NotificationData, - type: "reaction" | "view" | "comment" | "mention" | "reply" -) => { - const currentUser = await getCurrentUser(); - if (!currentUser) { - throw new Error("User not found"); - } - +const buildNotification = ( + type: TType, + fields: TFields +) => z.object({ ...fields, type: z.literal(type) }); + +export const Notification = z.union([ + buildNotification("view", { videoId: z.string(), authorId: z.string() }), + buildNotification("comment", { + videoId: z.string(), + authorId: z.string(), + comment: z.object({ + id: z.string(), + content: z.string(), + }), + }), + buildNotification("reaction", { videoId: z.string(), authorId: z.string() }), + // buildNotification("mention", { + // videoId: z.string(), + // authorId: z.string(), + // comment: z.object({ + // id: z.string(), + // content: z.string(), + // }), + // }), + buildNotification("reply", { + videoId: z.string(), + authorId: z.string(), + comment: z.object({ + id: z.string(), + content: z.string(), + }), + }), +]); + +export type RawNotification = z.infer; +export type NotificationType = z.infer["type"]; + +export type HydratedNotification = + | Extract + | (Extract & { content: string }); + +export async function createNotification(notification: RawNotification) { try { // First, get the video and owner data const [videoResult] = await db() @@ -30,7 +60,7 @@ export const createNotification = async ( }) .from(videos) .innerJoin(users, eq(users.id, videos.ownerId)) - .where(eq(videos.id, notificationData.videoId)) + .where(eq(videos.id, notification.videoId)) .limit(1); if (!videoResult) { @@ -38,7 +68,7 @@ export const createNotification = async ( } // Skip notification if the video owner is the current user - if (videoResult.ownerId === currentUser.id) { + if (videoResult.ownerId === notification.authorId) { return; } @@ -48,10 +78,11 @@ export const createNotification = async ( const notificationPrefs = preferences.notifications; const shouldSkipNotification = - (type === "comment" && notificationPrefs.pauseComments) || - (type === "reply" && notificationPrefs.pauseReplies) || - (type === "view" && notificationPrefs.pauseViews) || - (type === "reaction" && notificationPrefs.pauseReactions); + (notification.type === "comment" && notificationPrefs.pauseComments) || + (notification.type === "view" && notificationPrefs.pauseViews); + // || + // (variant === "reply" && notificationPrefs.pauseReplies) || + // (variant === "reaction" && notificationPrefs.pauseReactions); if (shouldSkipNotification) { return; @@ -60,7 +91,7 @@ export const createNotification = async ( // Check for existing notification to prevent duplicates let hasExistingNotification = false; - if (type === "view") { + if (notification.type === "view") { const [existingNotification] = await db() .select({ id: notifications.id }) .from(notifications) @@ -68,14 +99,14 @@ export const createNotification = async ( and( eq(notifications.type, "view"), eq(notifications.recipientId, videoResult.ownerId), - sql`JSON_EXTRACT(${notifications.data}, '$.videoId') = ${notificationData.videoId}`, - sql`JSON_EXTRACT(${notifications.data}, '$.authorId') = ${currentUser.id}` + sql`JSON_EXTRACT(${notifications.data}, '$.videoId') = ${notification.videoId}`, + sql`JSON_EXTRACT(${notifications.data}, '$.authorId') = ${notification.authorId}` ) ) .limit(1); hasExistingNotification = !!existingNotification; - } else if (type === "comment" && notificationData.comment?.id) { + } else if (notification.type === "comment") { // Check for existing comment notification const [existingNotification] = await db() .select({ id: notifications.id }) @@ -84,7 +115,7 @@ export const createNotification = async ( and( eq(notifications.type, "comment"), eq(notifications.recipientId, videoResult.ownerId), - sql`JSON_EXTRACT(${notifications.data}, '$.comment.id') = ${notificationData.comment?.id}` + sql`JSON_EXTRACT(${notifications.data}, '$.commentId') = ${notification.comment.id}` ) ) .limit(1); @@ -99,31 +130,21 @@ export const createNotification = async ( const notificationId = nanoId(); const now = new Date(); - const data: NotificationData = { - videoId: notificationData.videoId, - authorId: currentUser.id, - }; - - if (notificationData.comment?.id) { - data.comment = notificationData.comment; - } - if (notificationData.content) { - data.content = notificationData.content; - } - if (!videoResult.activeOrganizationId) { - console.warn(`User ${videoResult.ownerId} has no active organization, skipping notification`); + console.warn( + `User ${videoResult.ownerId} has no active organization, skipping notification` + ); return; } + const { type, ...data } = notification; + await db().insert(notifications).values({ id: notificationId, orgId: videoResult.activeOrganizationId, recipientId: videoResult.ownerId, - type: type, - data: data, - createdAt: now, - readAt: null, + type, + data, }); revalidatePath("/dashboard"); @@ -133,4 +154,4 @@ export const createNotification = async ( console.error("Error creating notification:", error); throw error; } -}; +} diff --git a/apps/web/package.json b/apps/web/package.json index 7024ee2304a..d30c12256ff 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -102,7 +102,7 @@ "tailwind-merge": "^2.6.0", "tailwindcss-animate": "^1.0.7", "uuid": "^9.0.1", - "zod": "^3.24.4" + "zod": "^3.25.76" }, "devDependencies": { "@smithy/types": "^4.3.1", diff --git a/infra/package.json b/infra/package.json index 0d775a85fcf..e54262df967 100644 --- a/infra/package.json +++ b/infra/package.json @@ -8,6 +8,7 @@ }, "dependencies": { "@pulumi/github": "^6.7.0", - "@pulumiverse/vercel": "^1.14.3" + "@pulumiverse/vercel": "^1.14.3", + "zod": "^3" } } diff --git a/packages/config/package.json b/packages/config/package.json index bf2320983d0..aed0de6d76f 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -25,6 +25,7 @@ "dependencies": { "@vitejs/plugin-react": "^4.0.3", "vite": "^6.3.5", - "vite-tsconfig-paths": "^4.2.0" + "vite-tsconfig-paths": "^4.2.0", + "zod": "^3" } } diff --git a/packages/database/package.json b/packages/database/package.json index 2342b3fe59b..c0497f22616 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -27,7 +27,8 @@ "next": "14.2.9", "next-auth": "^4.24.5", "react-email": "^4.0.16", - "resend": "4.6.0" + "resend": "4.6.0", + "zod": "^3" }, "devDependencies": { "@cap/ui": "workspace:*", diff --git a/packages/database/schema.ts b/packages/database/schema.ts index 2cd8798ab88..ea004519373 100644 --- a/packages/database/schema.ts +++ b/packages/database/schema.ts @@ -310,36 +310,44 @@ export const comments = mysqlTable( }) ); -export const notifications = mysqlTable("notifications", { - id: nanoId("id").notNull().primaryKey().unique(), - orgId: nanoId("orgId").notNull(), - recipientId: nanoId("recipientId").notNull(), - type: varchar("type", { - length: 10, - enum: ["reaction", "view", "comment", "recording", "mention", "reply"], - }).notNull(), - data: json("data") - .$type<{ - videoId: string; - authorId?: string; - content?: string; - comment?: { - id: string; - parentCommentId?: string; - }; - }>() - .notNull(), - readAt: timestamp("readAt"), - createdAt: timestamp("createdAt").notNull().defaultNow(), -}, (table) => ({ -recipientIdIndex: index("recipient_id_idx").on(table.recipientId), -orgIdIndex: index("org_id_idx").on(table.orgId), -typeIndex: index("type_idx").on(table.type), -readAtIndex: index("read_at_idx").on(table.readAt), -createdAtIndex: index("created_at_idx").on(table.createdAt), -recipientReadIndex: index("recipient_read_idx").on(table.recipientId, table.readAt), -recipientCreatedIndex: index("recipient_created_idx").on(table.recipientId, table.createdAt), -})); +export const notifications = mysqlTable( + "notifications", + { + id: nanoId("id").notNull().primaryKey().unique(), + orgId: nanoId("orgId").notNull(), + recipientId: nanoId("recipientId").notNull(), + type: varchar("type", { length: 10 }) + .notNull() + .$type<"view" | "comment" | "reply" | "reaction" /* | "mention"*/>(), + data: json("data") + .$type<{ + videoId?: string; + authorId?: string; + comment?: { + id: string; + content: string; + }; + }>() + .notNull(), + readAt: timestamp("readAt"), + createdAt: timestamp("createdAt").notNull().defaultNow(), + }, + (table) => ({ + recipientIdIndex: index("recipient_id_idx").on(table.recipientId), + orgIdIndex: index("org_id_idx").on(table.orgId), + typeIndex: index("type_idx").on(table.type), + readAtIndex: index("read_at_idx").on(table.readAt), + createdAtIndex: index("created_at_idx").on(table.createdAt), + recipientReadIndex: index("recipient_read_idx").on( + table.recipientId, + table.readAt + ), + recipientCreatedIndex: index("recipient_created_idx").on( + table.recipientId, + table.createdAt + ), + }) +); export const s3Buckets = mysqlTable("s3_buckets", { id: nanoId("id").notNull().primaryKey().unique(), @@ -495,7 +503,7 @@ export const sharedVideosRelations = relations(sharedVideos, ({ one }) => ({ }), })); -export const spaces = mysqlTable( +export const spaces = mysqlTable( "spaces", { id: nanoId("id").notNull().primaryKey().unique(), @@ -508,7 +516,7 @@ export const spaces = mysqlTable( createdAt: timestamp("createdAt").notNull().defaultNow(), updatedAt: timestamp("updatedAt").notNull().defaultNow().onUpdateNow(), privacy: varchar("privacy", { length: 255, enum: ["Public", "Private"] }) - .notNull() + .notNull() .default("Private"), }, (table) => ({ diff --git a/packages/env/package.json b/packages/env/package.json index d109767154c..92d6e358a82 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -5,7 +5,7 @@ "types": "./index.ts", "dependencies": { "@t3-oss/env-nextjs": "^0.12.0", - "zod": "^3.24.2" + "zod": "^3.25.76" }, "devDependencies": { "@types/node": "^22.12.0" diff --git a/packages/local-docker/package.json b/packages/local-docker/package.json index b898192ce25..695c3c4e86d 100644 --- a/packages/local-docker/package.json +++ b/packages/local-docker/package.json @@ -9,8 +9,9 @@ "docker:stop": "docker compose stop", "docker:clean": "docker compose down -v" }, - "devDependencies": {}, - "dependencies": {}, + "dependencies": { + "zod": "^3" + }, "engines": { "node": "20" } diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json index 6efb83e14ce..220c47aaf0f 100644 --- a/packages/tsconfig/package.json +++ b/packages/tsconfig/package.json @@ -5,5 +5,8 @@ "license": "MIT", "publishConfig": { "access": "public" + }, + "dependencies": { + "zod": "^3" } } diff --git a/packages/ui-solid/package.json b/packages/ui-solid/package.json index 1162d10b9b2..fc7a664fee0 100644 --- a/packages/ui-solid/package.json +++ b/packages/ui-solid/package.json @@ -14,7 +14,8 @@ "@kobalte/core": "^0.13.7", "cva": "npm:class-variance-authority@^0.7.0", "solid-js": "^1.9.3", - "tailwindcss": "^3.4.10" + "tailwindcss": "^3.4.10", + "zod": "^3" }, "devDependencies": { "@fontsource/geist-sans": "^5.0.3", diff --git a/packages/ui/package.json b/packages/ui/package.json index b1e88870eee..cce9a24c9dd 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -52,7 +52,8 @@ "cmdk": "^0.2.0", "lucide-react": "^0.294.0", "react-hook-form": "^7.49.2", - "react-loading-skeleton": "^3.3.1" + "react-loading-skeleton": "^3.3.1", + "zod": "^3" }, "engines": { "node": "20" diff --git a/packages/utils/package.json b/packages/utils/package.json index d9d0835f3e7..0dbc1c99a8a 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -22,7 +22,8 @@ "@cap/env": "workspace:*", "clsx": "^2.0.0", "stripe": "^14.24.0", - "tailwind-merge": "^2.1.0" + "tailwind-merge": "^2.1.0", + "zod": "^3" }, "engines": { "node": "20" diff --git a/packages/web-api-contract-effect/package.json b/packages/web-api-contract-effect/package.json index caa71d8cbe5..a78434b3baf 100644 --- a/packages/web-api-contract-effect/package.json +++ b/packages/web-api-contract-effect/package.json @@ -6,6 +6,7 @@ "type": "module", "dependencies": { "@effect/platform": "^0.87.1", - "effect": "^3.16.10" + "effect": "^3.16.10", + "zod": "^3" } } diff --git a/packages/web-api-contract/package.json b/packages/web-api-contract/package.json index 425c62d86ea..3ae35b1ae4a 100644 --- a/packages/web-api-contract/package.json +++ b/packages/web-api-contract/package.json @@ -6,6 +6,6 @@ "type": "module", "dependencies": { "@ts-rest/core": "^3.52.1", - "zod": "^3.24.2" + "zod": "^3.25.76" } } diff --git a/packages/web-api-contract/src/desktop.ts b/packages/web-api-contract/src/desktop.ts index 050ad293296..2bbea087d73 100644 --- a/packages/web-api-contract/src/desktop.ts +++ b/packages/web-api-contract/src/desktop.ts @@ -1,5 +1,6 @@ import { z } from "zod"; import { c } from "./util"; +import { AppRoute } from "@ts-rest/core"; const CHANGELOG = z.object({ metadata: z.object({ @@ -38,6 +39,11 @@ const publicContract = c.router({ }, }); +const a = publicContract.getChangelogPosts; +type A = typeof a; + +type B = A extends AppRoute ? number : string; + const protectedContract = c.router( { submitFeedback: { diff --git a/packages/web-api-contract/src/index.ts b/packages/web-api-contract/src/index.ts index ac95b2056cf..46c4c929eb7 100644 --- a/packages/web-api-contract/src/index.ts +++ b/packages/web-api-contract/src/index.ts @@ -2,6 +2,65 @@ import { z } from "zod"; import desktop from "./desktop"; import { c } from "./util"; +export const NotificationAuthor = z.object({ + id: z.string(), + name: z.string(), + avatar: z.string().nullable(), +}); + +export const Notification = z + .union([ + z.object({ + type: z.literal("view"), + videoId: z.string(), + author: NotificationAuthor, + }), + z.object({ + type: z.literal("comment"), + videoId: z.string(), + author: NotificationAuthor, + comment: z.object({ + id: z.string(), + content: z.string(), + }), + }), + z.object({ + type: z.literal("reaction"), + videoId: z.string(), + author: NotificationAuthor, + comment: z.object({ + id: z.string(), + content: z.string(), + }), + }), + z.object({ + type: z.literal("reply"), + videoId: z.string(), + author: NotificationAuthor, + comment: z.object({ + id: z.string(), + content: z.string(), + }), + }), + // z.object({ + // type: z.literal("mention"), + // videoId: z.string(), + // author: NotificationAuthor, + // comment: z.object({ + // id: z.string(), + // content: z.string(), + // }), + // }), + ]) + .and( + z.object({ + id: z.string(), + readAt: z.coerce.date().nullable(), + createdAt: z.coerce.date(), + }) + ); +export type Notification = z.infer; + export const contract = c.router({ desktop, video: c.router({ @@ -32,6 +91,18 @@ export const contract = c.router({ }, }, }), + notifications: c.router({ + get: { + method: "GET", + path: "/notifications", + responses: { + 200: z.object({ + notifications: z.array(Notification), + count: z.record(z.string(), z.number()), + }), + }, + }, + }), }); export const orgCustomDomainContract = c.router({ diff --git a/packages/web-api-contract/tsconfig.json b/packages/web-api-contract/tsconfig.json new file mode 100644 index 00000000000..acdd0c7da70 --- /dev/null +++ b/packages/web-api-contract/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../config/base.tsconfig.json", + "exclude": ["node_modules"], + "include": ["**/*.ts", "**/*.tsx"], + "compilerOptions": { + "baseUrl": ".", + "moduleResolution": "bundler" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 738ef3b7d0b..337c35a3664 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -103,7 +103,7 @@ importers: version: 0.14.10(solid-js@1.9.6) '@solidjs/start': specifier: ^1.1.3 - version: 1.1.3(@testing-library/jest-dom@6.5.0)(@types/node@22.15.17)(jiti@2.4.2)(solid-js@1.9.6)(terser@5.39.0)(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0))(yaml@2.8.0) + version: 1.1.3(@testing-library/jest-dom@6.5.0)(@types/node@22.15.17)(jiti@2.4.2)(solid-js@1.9.6)(terser@5.39.0)(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1))(yaml@2.8.1) '@tanstack/solid-query': specifier: ^5.51.21 version: 5.75.4(solid-js@1.9.6) @@ -148,7 +148,7 @@ importers: version: 2.0.0 '@ts-rest/core': specifier: ^3.52.1 - version: 3.52.1(@types/node@22.15.17)(zod@3.24.4) + version: 3.52.1(@types/node@22.15.17)(zod@3.25.76) '@types/react-tooltip': specifier: ^4.2.4 version: 4.2.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0) @@ -190,13 +190,13 @@ importers: version: 9.0.1 vinxi: specifier: ^0.5.6 - version: 0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0) + version: 0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1) webcodecs: specifier: ^0.1.0 version: 0.1.0 zod: - specifier: ^3.24.2 - version: 3.24.4 + specifier: ^3.25.76 + version: 3.25.76 devDependencies: '@fontsource/geist-sans': specifier: ^5.0.3 @@ -224,10 +224,10 @@ importers: version: 5.8.3 vite: specifier: ^6.3.5 - version: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + version: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) vite-tsconfig-paths: specifier: ^5.0.1 - version: 5.1.4(typescript@5.8.3)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + version: 5.1.4(typescript@5.8.3)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) vitest: specifier: ~2.1.9 version: 2.1.9(@types/node@22.15.17)(jsdom@26.1.0)(terser@5.39.0) @@ -255,6 +255,9 @@ importers: valibot: specifier: 1.0.0-rc.1 version: 1.0.0-rc.1(typescript@5.8.3) + zod: + specifier: ^3 + version: 3.25.76 devDependencies: '@cloudflare/vitest-pool-workers': specifier: ^0.6.4 @@ -283,6 +286,9 @@ importers: solid-js: specifier: ^1.9.3 version: 1.9.6 + zod: + specifier: ^3 + version: 3.25.76 devDependencies: '@chromatic-com/storybook': specifier: ^1.6.1 @@ -313,16 +319,16 @@ importers: version: 1.0.0-beta.7(@storybook/test@8.6.12(storybook@8.6.12(prettier@3.5.3)))(solid-js@1.9.6)(storybook@8.6.12(prettier@3.5.3)) storybook-solidjs-vite: specifier: ^1.0.0-beta.2 - version: 1.0.0-beta.7(@storybook/test@8.6.12(storybook@8.6.12(prettier@3.5.3)))(solid-js@1.9.6)(storybook@8.6.12(prettier@3.5.3))(vite-plugin-solid@2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + version: 1.0.0-beta.7(@storybook/test@8.6.12(storybook@8.6.12(prettier@3.5.3)))(solid-js@1.9.6)(storybook@8.6.12(prettier@3.5.3))(vite-plugin-solid@2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) typescript: specifier: ^5.8.3 version: 5.8.3 vite: specifier: ^6.3.5 - version: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + version: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) vite-plugin-solid: specifier: ^2.10.2 - version: 2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + version: 2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) apps/tasks: dependencies: @@ -371,6 +377,9 @@ importers: typescript: specifier: ^5.8.3 version: 5.8.3 + zod: + specifier: ^3 + version: 3.25.76 devDependencies: '@typescript-eslint/eslint-plugin': specifier: ^7.6.0 @@ -458,7 +467,7 @@ importers: version: 1.7.19(react-dom@19.1.0(react@19.1.0))(react@19.1.0) '@hono/zod-validator': specifier: ^0.4.3 - version: 0.4.3(hono@4.7.8)(zod@3.25.20) + version: 0.4.3(hono@4.7.8)(zod@3.25.76) '@hookform/resolvers': specifier: ^3.3.2 version: 3.10.0(react-hook-form@7.56.2(react@19.1.0)) @@ -515,7 +524,7 @@ importers: version: 3.5.0 '@t3-oss/env-nextjs': specifier: ^0.12.0 - version: 0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.20) + version: 0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.76) '@tanstack/react-query': specifier: ^5.75.4 version: 5.75.4(react@19.1.0) @@ -527,7 +536,7 @@ importers: version: 0.5.5 '@ts-rest/core': specifier: ^3.52.1 - version: 3.52.1(@types/node@20.17.43)(zod@3.25.20) + version: 3.52.1(@types/node@20.17.43)(zod@3.25.76) '@uidotdev/usehooks': specifier: ^2.4.1 version: 2.4.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) @@ -563,7 +572,7 @@ importers: version: 0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1) dub: specifier: ^0.64.0 - version: 0.64.0(@modelcontextprotocol/sdk@1.6.1)(zod@3.25.20) + version: 0.64.0(@modelcontextprotocol/sdk@1.6.1)(zod@3.25.76) file-saver: specifier: ^2.0.5 version: 2.0.5 @@ -676,8 +685,8 @@ importers: specifier: ^9.0.1 version: 9.0.1 zod: - specifier: ^3.24.4 - version: 3.25.20 + specifier: ^3.25.76 + version: 3.25.76 devDependencies: '@smithy/types': specifier: ^4.3.1 @@ -736,6 +745,9 @@ importers: '@pulumiverse/vercel': specifier: ^1.14.3 version: 1.14.3(ts-node@10.9.2(@types/node@22.15.17)(typescript@5.8.3))(typescript@5.8.3) + zod: + specifier: ^3 + version: 3.25.76 devDependencies: sst: specifier: 3.10.13 @@ -745,13 +757,16 @@ importers: dependencies: '@vitejs/plugin-react': specifier: ^4.0.3 - version: 4.4.1(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + version: 4.4.1(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) vite: specifier: ^6.3.5 - version: 6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + version: 6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) vite-tsconfig-paths: specifier: ^4.2.0 - version: 4.3.2(typescript@5.8.3)(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + version: 4.3.2(typescript@5.8.3)(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) + zod: + specifier: ^3 + version: 3.25.76 devDependencies: '@types/node': specifier: ^20.4.5 @@ -834,6 +849,9 @@ importers: resend: specifier: 4.6.0 version: 4.6.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + zod: + specifier: ^3 + version: 3.25.76 devDependencies: '@cap/ui': specifier: workspace:* @@ -879,18 +897,26 @@ importers: dependencies: '@t3-oss/env-nextjs': specifier: ^0.12.0 - version: 0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.24.4) + version: 0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.76) zod: - specifier: ^3.24.2 - version: 3.24.4 + specifier: ^3.25.76 + version: 3.25.76 devDependencies: '@types/node': specifier: ^22.12.0 version: 22.15.14 - packages/local-docker: {} + packages/local-docker: + dependencies: + zod: + specifier: ^3 + version: 3.25.76 - packages/tsconfig: {} + packages/tsconfig: + dependencies: + zod: + specifier: ^3 + version: 3.25.76 packages/ui: dependencies: @@ -945,6 +971,9 @@ importers: react-loading-skeleton: specifier: ^3.3.1 version: 3.5.0(react@19.1.0) + zod: + specifier: ^3 + version: 3.25.76 devDependencies: '@tauri-apps/cli': specifier: ^1.5.11 @@ -960,7 +989,7 @@ importers: version: 19.1.6(@types/react@18.3.21) '@vitejs/plugin-react': specifier: ^4.0.3 - version: 4.4.1(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + version: 4.4.1(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) autoprefixer: specifier: ^10.4.16 version: 10.4.21(postcss@8.5.3) @@ -1002,10 +1031,10 @@ importers: version: 5.8.3 vite: specifier: ^6.3.5 - version: 6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + version: 6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) vite-tsconfig-paths: specifier: ^4.2.1 - version: 4.3.2(typescript@5.8.3)(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + version: 4.3.2(typescript@5.8.3)(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) packages/ui-solid: dependencies: @@ -1021,6 +1050,9 @@ importers: tailwindcss: specifier: ^3.4.10 version: 3.4.17(ts-node@10.9.2(@types/node@22.15.17)(typescript@5.8.3)) + zod: + specifier: ^3 + version: 3.25.76 devDependencies: '@fontsource/geist-sans': specifier: ^5.0.3 @@ -1054,7 +1086,7 @@ importers: version: 0.18.6(rollup@4.40.2) unplugin-fonts: specifier: ^1.1.1 - version: 1.3.1(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + version: 1.3.1(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) unplugin-icons: specifier: ^0.19.2 version: 0.19.3 @@ -1076,6 +1108,9 @@ importers: tailwind-merge: specifier: ^2.1.0 version: 2.6.0 + zod: + specifier: ^3 + version: 3.25.76 devDependencies: react: specifier: ^19.1.0 @@ -1097,10 +1132,10 @@ importers: dependencies: '@ts-rest/core': specifier: ^3.52.1 - version: 3.52.1(@types/node@22.15.17)(zod@3.24.4) + version: 3.52.1(@types/node@22.15.17)(zod@3.25.76) zod: - specifier: ^3.24.2 - version: 3.24.4 + specifier: ^3.25.76 + version: 3.25.76 packages/web-api-contract-effect: dependencies: @@ -1110,6 +1145,9 @@ importers: effect: specifier: ^3.16.10 version: 3.16.16 + zod: + specifier: ^3 + version: 3.25.76 packages: @@ -5490,10 +5528,10 @@ packages: react-dom: optional: true - '@storybook/builder-vite@9.1.0-alpha.8': - resolution: {integrity: sha512-xcwTnBzsm0MxB+LZrqvrz10tzVfhTs0zIqufxsgRA1YCzkF1v7YFVVq8xW754WZiyel4mDADCUwntrnFwyQSIQ==} + '@storybook/builder-vite@9.2.0-alpha.2': + resolution: {integrity: sha512-1olE/xZI98CXu1WMS4zi725+jyrU3DCYYBgxpZVG7cNJtXQmkNwSzUhw4EDSBcNZE7ugO4/Ff4ud3VtlB4Bntw==} peerDependencies: - storybook: ^9.1.0-alpha.8 + storybook: ^9.2.0-alpha.2 vite: ^5.0.0 || ^6.0.0 || ^7.0.0 '@storybook/core@8.6.12': @@ -5509,10 +5547,10 @@ packages: peerDependencies: storybook: ^8.6.12 - '@storybook/csf-plugin@9.1.0-alpha.8': - resolution: {integrity: sha512-1NAFT8wHIzk9q5ATwNUhkO392ni54n6d0l+Gd1Vi7S+AZSaDOqaeqjy3Zda1I1bw0suNwGJlk4ye8Oo4XzHq3g==} + '@storybook/csf-plugin@9.2.0-alpha.2': + resolution: {integrity: sha512-RoxwOkwprpxP8dtGy2riADxURcy5uxSO3+W4nf/ewVIQPKEKC97N9Nc8YuPMxLtMZ06zRY91/QBF7eq0TvXWSQ==} peerDependencies: - storybook: ^9.1.0-alpha.8 + storybook: ^9.2.0-alpha.2 '@storybook/docs-tools@8.6.12': resolution: {integrity: sha512-bOmTNJE4FM6+3/1hPQVgha8cLxX2Nyi/4Z+tYq0pCDEyQqGRTD2KXre9XsSCnziRaGxiW80OrKkmqWY8Otuu4A==} @@ -12494,8 +12532,8 @@ packages: ts-pattern@5.7.0: resolution: {integrity: sha512-0/FvIG4g3kNkYgbNwBBW5pZBkfpeYQnH+2AA3xmjkCAit/DSDPKmgwC3fKof4oYUq6gupClVOJlFl+939VRBMg==} - ts-pattern@5.7.1: - resolution: {integrity: sha512-EGs8PguQqAAUIcQfK4E9xdXxB6s2GK4sJfT/vcc9V1ELIvC4LH/zXu2t/5fajtv6oiRCxdv7BgtVK3vWgROxag==} + ts-pattern@5.8.0: + resolution: {integrity: sha512-kIjN2qmWiHnhgr5DAkAafF9fwb0T5OhMVSWrm8XEdTFnX6+wfXwYOFjeF86UZ54vduqiR7BfqScFmXSzSaH8oA==} tsconfck@3.1.5: resolution: {integrity: sha512-CLDfGgUp7XPswWnezWwsCRxNmgQjhYq3VXHM0/XIRxhVrKw0M1if9agzryh1QS3nxjCROvV+xWxoJO1YctzzWg==} @@ -13423,6 +13461,11 @@ packages: engines: {node: '>= 14.6'} hasBin: true + yaml@2.8.1: + resolution: {integrity: sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==} + engines: {node: '>= 14.6'} + hasBin: true + yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} @@ -13483,12 +13526,6 @@ packages: zod@3.24.2: resolution: {integrity: sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==} - zod@3.24.4: - resolution: {integrity: sha512-OdqJE9UDRPwWsrHjLN2F8bPxvwJBK22EHLWtanu0LSYr5YqzsaaW3RMgmjwr8Rypg5k+meEJdSPXJZXE/yqOMg==} - - zod@3.25.20: - resolution: {integrity: sha512-z03fqpTMDF1G02VLKUMt6vyACE7rNWkh3gpXVHgPTw28NPtDFRGvcpTtPwn2kMKtQ0idtYJUTxchytmnqYswcw==} - zod@3.25.76: resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==} @@ -14421,7 +14458,7 @@ snapshots: semver: 7.7.1 vitest: 2.1.9(@types/node@22.15.17)(jsdom@26.1.0)(terser@5.39.0) wrangler: 3.109.1(@cloudflare/workers-types@4.20250507.0) - zod: 3.24.4 + zod: 3.25.76 transitivePeerDependencies: - '@cloudflare/workers-types' - bufferutil @@ -14514,9 +14551,9 @@ snapshots: gray-matter: 4.0.3 imagescript: 1.3.1 micromatch: 4.0.8 - ts-pattern: 5.7.1 + ts-pattern: 5.8.0 unified: 11.0.5 - yaml: 2.8.0 + yaml: 2.8.1 zod: 3.25.76 transitivePeerDependencies: - '@effect-ts/otel-node' @@ -15289,10 +15326,10 @@ snapshots: hono: 4.7.8 valibot: 1.0.0-rc.1(typescript@5.8.3) - '@hono/zod-validator@0.4.3(hono@4.7.8)(zod@3.25.20)': + '@hono/zod-validator@0.4.3(hono@4.7.8)(zod@3.25.76)': dependencies: hono: 4.7.8 - zod: 3.25.20 + zod: 3.25.76 '@hookform/resolvers@3.10.0(react-hook-form@7.56.2(react@19.1.0))': dependencies: @@ -16048,7 +16085,7 @@ snapshots: unixify: 1.0.0 urlpattern-polyfill: 8.0.2 yargs: 17.7.2 - zod: 3.25.20 + zod: 3.25.76 transitivePeerDependencies: - encoding - rollup @@ -18565,11 +18602,11 @@ snapshots: dependencies: solid-js: 1.9.6 - '@solidjs/start@1.1.3(@testing-library/jest-dom@6.5.0)(@types/node@22.15.17)(jiti@2.4.2)(solid-js@1.9.6)(terser@5.39.0)(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0))(yaml@2.8.0)': + '@solidjs/start@1.1.3(@testing-library/jest-dom@6.5.0)(@types/node@22.15.17)(jiti@2.4.2)(solid-js@1.9.6)(terser@5.39.0)(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1))(yaml@2.8.1)': dependencies: - '@tanstack/server-functions-plugin': 1.119.2(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) - '@vinxi/plugin-directives': 0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0)) - '@vinxi/server-components': 0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0)) + '@tanstack/server-functions-plugin': 1.119.2(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) + '@vinxi/plugin-directives': 0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1)) + '@vinxi/server-components': 0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1)) defu: 6.1.4 error-stack-parser: 2.1.4 html-to-image: 1.11.13 @@ -18580,8 +18617,8 @@ snapshots: source-map-js: 1.2.1 terracotta: 1.0.6(solid-js@1.9.6) tinyglobby: 0.2.13 - vinxi: 0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0) - vite-plugin-solid: 2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + vinxi: 0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1) + vite-plugin-solid: 2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) transitivePeerDependencies: - '@testing-library/jest-dom' - '@types/node' @@ -18708,12 +18745,12 @@ snapshots: react: 19.1.0 react-dom: 19.1.0(react@19.1.0) - '@storybook/builder-vite@9.1.0-alpha.8(storybook@8.6.12(prettier@3.5.3))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0))': + '@storybook/builder-vite@9.2.0-alpha.2(storybook@8.6.12(prettier@3.5.3))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1))': dependencies: - '@storybook/csf-plugin': 9.1.0-alpha.8(storybook@8.6.12(prettier@3.5.3)) + '@storybook/csf-plugin': 9.2.0-alpha.2(storybook@8.6.12(prettier@3.5.3)) storybook: 8.6.12(prettier@3.5.3) ts-dedent: 2.2.0 - vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) '@storybook/core@8.6.12(prettier@3.5.3)(storybook@8.6.12(prettier@3.5.3))': dependencies: @@ -18741,7 +18778,7 @@ snapshots: storybook: 8.6.12(prettier@3.5.3) unplugin: 1.16.1 - '@storybook/csf-plugin@9.1.0-alpha.8(storybook@8.6.12(prettier@3.5.3))': + '@storybook/csf-plugin@9.2.0-alpha.2(storybook@8.6.12(prettier@3.5.3))': dependencies: storybook: 8.6.12(prettier@3.5.3) unplugin: 1.16.1 @@ -18823,33 +18860,19 @@ snapshots: dependencies: defer-to-connect: 2.0.1 - '@t3-oss/env-core@0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.24.4)': - optionalDependencies: - typescript: 5.8.3 - valibot: 1.0.0-rc.1(typescript@5.8.3) - zod: 3.24.4 - - '@t3-oss/env-core@0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.20)': - optionalDependencies: - typescript: 5.8.3 - valibot: 1.0.0-rc.1(typescript@5.8.3) - zod: 3.25.20 - - '@t3-oss/env-nextjs@0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.24.4)': - dependencies: - '@t3-oss/env-core': 0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.24.4) + '@t3-oss/env-core@0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.76)': optionalDependencies: typescript: 5.8.3 valibot: 1.0.0-rc.1(typescript@5.8.3) - zod: 3.24.4 + zod: 3.25.76 - '@t3-oss/env-nextjs@0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.20)': + '@t3-oss/env-nextjs@0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.76)': dependencies: - '@t3-oss/env-core': 0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.20) + '@t3-oss/env-core': 0.12.0(typescript@5.8.3)(valibot@1.0.0-rc.1(typescript@5.8.3))(zod@3.25.76) optionalDependencies: typescript: 5.8.3 valibot: 1.0.0-rc.1(typescript@5.8.3) - zod: 3.25.20 + zod: 3.25.76 '@tailwindcss/typography@0.5.16(tailwindcss@3.4.17(ts-node@10.9.2(@types/node@20.17.43)(typescript@5.8.3)))': dependencies: @@ -18867,7 +18890,7 @@ snapshots: postcss-selector-parser: 6.0.10 tailwindcss: 3.4.17(ts-node@10.9.2(@types/node@22.15.17)(typescript@5.8.3)) - '@tanstack/directive-functions-plugin@1.119.2(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)': + '@tanstack/directive-functions-plugin@1.119.2(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)': dependencies: '@babel/code-frame': 7.26.2 '@babel/core': 7.27.1 @@ -18880,7 +18903,7 @@ snapshots: babel-dead-code-elimination: 1.0.10 dedent: 1.6.0 tiny-invariant: 1.3.3 - vite: 6.1.4(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + vite: 6.1.4(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -18923,7 +18946,7 @@ snapshots: ansis: 3.17.0 diff: 7.0.0 - '@tanstack/server-functions-plugin@1.119.2(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)': + '@tanstack/server-functions-plugin@1.119.2(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)': dependencies: '@babel/code-frame': 7.26.2 '@babel/core': 7.27.1 @@ -18932,7 +18955,7 @@ snapshots: '@babel/template': 7.27.2 '@babel/traverse': 7.27.1 '@babel/types': 7.27.1 - '@tanstack/directive-functions-plugin': 1.119.2(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + '@tanstack/directive-functions-plugin': 1.119.2(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) babel-dead-code-elimination: 1.0.10 dedent: 1.6.0 tiny-invariant: 1.3.3 @@ -19146,15 +19169,15 @@ snapshots: '@total-typescript/ts-reset@0.6.1': {} - '@ts-rest/core@3.52.1(@types/node@20.17.43)(zod@3.25.20)': + '@ts-rest/core@3.52.1(@types/node@20.17.43)(zod@3.25.76)': optionalDependencies: '@types/node': 20.17.43 - zod: 3.25.20 + zod: 3.25.76 - '@ts-rest/core@3.52.1(@types/node@22.15.17)(zod@3.24.4)': + '@ts-rest/core@3.52.1(@types/node@22.15.17)(zod@3.25.76)': optionalDependencies: '@types/node': 22.15.17 - zod: 3.24.4 + zod: 3.25.76 '@tsconfig/bun@1.0.7': {} @@ -19539,7 +19562,7 @@ snapshots: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.8.3) - debug: 4.4.0 + debug: 4.4.0(supports-color@5.5.0) eslint: 9.30.1(jiti@2.4.2) optionalDependencies: typescript: 5.8.3 @@ -19782,7 +19805,7 @@ snapshots: untun: 0.1.3 uqr: 0.1.2 - '@vinxi/plugin-directives@0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0))': + '@vinxi/plugin-directives@0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1))': dependencies: '@babel/parser': 7.27.2 acorn: 8.14.1 @@ -19793,18 +19816,18 @@ snapshots: magicast: 0.2.11 recast: 0.23.11 tslib: 2.8.1 - vinxi: 0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0) + vinxi: 0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1) - '@vinxi/server-components@0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0))': + '@vinxi/server-components@0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1))': dependencies: - '@vinxi/plugin-directives': 0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0)) + '@vinxi/plugin-directives': 0.5.1(vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1)) acorn: 8.14.1 acorn-loose: 8.5.0 acorn-typescript: 1.4.13(acorn@8.14.1) astring: 1.9.0 magicast: 0.2.11 recast: 0.23.11 - vinxi: 0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0) + vinxi: 0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1) '@virtual-grid/core@2.0.1': {} @@ -19822,14 +19845,14 @@ snapshots: '@virtual-grid/shared@2.0.1': {} - '@vitejs/plugin-react@4.4.1(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0))': + '@vitejs/plugin-react@4.4.1(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1))': dependencies: '@babel/core': 7.27.1 '@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/core@7.27.1) '@babel/plugin-transform-react-jsx-source': 7.27.1(@babel/core@7.27.1) '@types/babel__core': 7.20.5 react-refresh: 0.17.0 - vite: 6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + vite: 6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) transitivePeerDependencies: - supports-color @@ -21044,10 +21067,6 @@ snapshots: dependencies: ms: 2.1.3 - debug@4.4.0: - dependencies: - ms: 2.1.3 - debug@4.4.0(supports-color@5.5.0): dependencies: ms: 2.1.3 @@ -21278,12 +21297,6 @@ snapshots: '@planetscale/database': 1.19.0 mysql2: 3.14.1 - dub@0.64.0(@modelcontextprotocol/sdk@1.6.1)(zod@3.25.20): - dependencies: - zod: 3.25.20 - optionalDependencies: - '@modelcontextprotocol/sdk': 1.6.1 - dub@0.64.0(@modelcontextprotocol/sdk@1.6.1)(zod@3.25.76): dependencies: zod: 3.25.76 @@ -21743,8 +21756,8 @@ snapshots: '@typescript-eslint/parser': 5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3) eslint: 9.30.1(jiti@2.4.2) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@9.30.1(jiti@2.4.2)) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.30.1(jiti@2.4.2)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.30.1(jiti@2.4.2)) eslint-plugin-react: 7.37.5(eslint@9.30.1(jiti@2.4.2)) eslint-plugin-react-hooks: 4.6.2(eslint@9.30.1(jiti@2.4.2)) @@ -21772,33 +21785,33 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0)(eslint@8.57.1): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.0(supports-color@5.5.0) - eslint: 8.57.1 + eslint: 9.30.1(jiti@2.4.2) get-tsconfig: 4.10.0 is-bun-module: 2.0.0 stable-hash: 0.0.5 tinyglobby: 0.2.13 unrs-resolver: 1.7.2 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)) transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0)(eslint@9.30.1(jiti@2.4.2)): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0)(eslint@8.57.1): dependencies: '@nolyfill/is-core-module': 1.0.39 - debug: 4.4.0 - eslint: 9.30.1(jiti@2.4.2) + debug: 4.4.0(supports-color@5.5.0) + eslint: 8.57.1 get-tsconfig: 4.10.0 is-bun-module: 2.0.0 stable-hash: 0.0.5 tinyglobby: 0.2.13 unrs-resolver: 1.7.2 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.30.1(jiti@2.4.2)) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1) transitivePeerDependencies: - supports-color @@ -21813,14 +21826,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.30.1(jiti@2.4.2)): + eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3) eslint: 9.30.1(jiti@2.4.2) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@9.30.1(jiti@2.4.2)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)) transitivePeerDependencies: - supports-color @@ -21864,7 +21877,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.30.1(jiti@2.4.2)): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -21875,7 +21888,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.30.1(jiti@2.4.2) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.30.1(jiti@2.4.2)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@9.30.1(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)))(eslint@9.30.1(jiti@2.4.2)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -26931,16 +26944,16 @@ snapshots: stoppable@1.1.0: {} - storybook-solidjs-vite@1.0.0-beta.7(@storybook/test@8.6.12(storybook@8.6.12(prettier@3.5.3)))(solid-js@1.9.6)(storybook@8.6.12(prettier@3.5.3))(vite-plugin-solid@2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)): + storybook-solidjs-vite@1.0.0-beta.7(@storybook/test@8.6.12(storybook@8.6.12(prettier@3.5.3)))(solid-js@1.9.6)(storybook@8.6.12(prettier@3.5.3))(vite-plugin-solid@2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)): dependencies: - '@storybook/builder-vite': 9.1.0-alpha.8(storybook@8.6.12(prettier@3.5.3))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + '@storybook/builder-vite': 9.2.0-alpha.2(storybook@8.6.12(prettier@3.5.3))(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) '@storybook/types': 9.0.0-alpha.1(storybook@8.6.12(prettier@3.5.3)) magic-string: 0.30.17 solid-js: 1.9.6 storybook: 8.6.12(prettier@3.5.3) storybook-solidjs: 1.0.0-beta.7(@storybook/test@8.6.12(storybook@8.6.12(prettier@3.5.3)))(solid-js@1.9.6)(storybook@8.6.12(prettier@3.5.3)) - vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) - vite-plugin-solid: 2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) + vite-plugin-solid: 2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) transitivePeerDependencies: - '@storybook/test' @@ -27470,7 +27483,7 @@ snapshots: ts-pattern@5.7.0: {} - ts-pattern@5.7.1: {} + ts-pattern@5.8.0: {} tsconfck@3.1.5(typescript@5.8.3): optionalDependencies: @@ -27792,11 +27805,11 @@ snapshots: transitivePeerDependencies: - rollup - unplugin-fonts@1.3.1(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)): + unplugin-fonts@1.3.1(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)): dependencies: fast-glob: 3.3.3 unplugin: 2.0.0-beta.1 - vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) unplugin-icons@0.19.3: dependencies: @@ -28006,7 +28019,7 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.0): + vinxi@0.5.6(@planetscale/database@1.19.0)(@types/node@22.15.17)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(encoding@0.1.13)(ioredis@5.6.1)(jiti@2.4.2)(mysql2@3.14.1)(terser@5.39.0)(xml2js@0.6.2)(yaml@2.8.1): dependencies: '@babel/core': 7.27.1 '@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.27.1) @@ -28040,8 +28053,8 @@ snapshots: unctx: 2.4.1 unenv: 1.10.0 unstorage: 1.16.0(@planetscale/database@1.19.0)(db0@0.3.2(drizzle-orm@0.43.1(@cloudflare/workers-types@4.20250507.0)(@opentelemetry/api@1.9.0)(@planetscale/database@1.19.0)(mysql2@3.14.1))(mysql2@3.14.1))(ioredis@5.6.1) - vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) - zod: 3.25.20 + vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) + zod: 3.25.76 transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -28102,7 +28115,7 @@ snapshots: - supports-color - terser - vite-plugin-solid@2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)): + vite-plugin-solid@2.11.6(@testing-library/jest-dom@6.5.0)(solid-js@1.9.6)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)): dependencies: '@babel/core': 7.27.1 '@types/babel__core': 7.20.5 @@ -28110,31 +28123,31 @@ snapshots: merge-anything: 5.1.7 solid-js: 1.9.6 solid-refresh: 0.6.3(solid-js@1.9.6) - vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) - vitefu: 1.0.6(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)) + vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) + vitefu: 1.0.6(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)) optionalDependencies: '@testing-library/jest-dom': 6.5.0 transitivePeerDependencies: - supports-color - vite-tsconfig-paths@4.3.2(typescript@5.8.3)(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)): + vite-tsconfig-paths@4.3.2(typescript@5.8.3)(vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)): dependencies: debug: 4.4.0(supports-color@5.5.0) globrex: 0.1.2 tsconfck: 3.1.5(typescript@5.8.3) optionalDependencies: - vite: 6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + vite: 6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) transitivePeerDependencies: - supports-color - typescript - vite-tsconfig-paths@5.1.4(typescript@5.8.3)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)): + vite-tsconfig-paths@5.1.4(typescript@5.8.3)(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)): dependencies: debug: 4.4.0(supports-color@5.5.0) globrex: 0.1.2 tsconfck: 3.1.5(typescript@5.8.3) optionalDependencies: - vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) transitivePeerDependencies: - supports-color - typescript @@ -28149,7 +28162,7 @@ snapshots: fsevents: 2.3.3 terser: 5.39.0 - vite@6.1.4(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0): + vite@6.1.4(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1): dependencies: esbuild: 0.24.2 postcss: 8.5.3 @@ -28159,9 +28172,9 @@ snapshots: fsevents: 2.3.3 jiti: 2.4.2 terser: 5.39.0 - yaml: 2.8.0 + yaml: 2.8.1 - vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0): + vite@6.3.5(@types/node@20.17.43)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1): dependencies: esbuild: 0.25.4 fdir: 6.4.4(picomatch@4.0.2) @@ -28174,9 +28187,9 @@ snapshots: fsevents: 2.3.3 jiti: 2.4.2 terser: 5.39.0 - yaml: 2.8.0 + yaml: 2.8.1 - vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0): + vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1): dependencies: esbuild: 0.25.4 fdir: 6.4.4(picomatch@4.0.2) @@ -28189,11 +28202,11 @@ snapshots: fsevents: 2.3.3 jiti: 2.4.2 terser: 5.39.0 - yaml: 2.8.0 + yaml: 2.8.1 - vitefu@1.0.6(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0)): + vitefu@1.0.6(vite@6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1)): optionalDependencies: - vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.0) + vite: 6.3.5(@types/node@22.15.17)(jiti@2.4.2)(terser@5.39.0)(yaml@2.8.1) vitest@2.1.9(@types/node@22.15.17)(jsdom@26.1.0)(terser@5.39.0): dependencies: @@ -28486,6 +28499,8 @@ snapshots: yaml@2.8.0: {} + yaml@2.8.1: {} + yargs-parser@21.1.1: {} yargs@17.7.2: @@ -28559,10 +28574,6 @@ snapshots: zod@3.24.2: {} - zod@3.24.4: {} - - zod@3.25.20: {} - zod@3.25.76: {} zwitch@2.0.4: {} From e85fed94d4314b5b69693b9c92e35b37b17b79d5 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 14:56:45 +0800 Subject: [PATCH 10/23] move to dashboard folder --- .../dashboard/_components/DashboardInner.tsx | 29 +++++---- .../_components/Notifications}/Filter.ts | 0 .../_components/Notifications/FilterTabs.tsx | 2 +- .../Notifications/NotificationFooter.tsx | 0 .../Notifications/NotificationHeader.tsx | 0 .../Notifications/NotificationItem.tsx | 6 +- .../Notifications/SettingsDropdown.tsx | 61 ++++++++++++------- .../_components/Notifications/Skeleton.tsx | 0 .../_components/Notifications/index.tsx | 4 +- .../_components/Notifications/mockData.ts | 52 ---------------- apps/web/utils/organization.ts | 15 +++-- 11 files changed, 72 insertions(+), 97 deletions(-) rename apps/web/app/{dashboard/_components => (org)/dashboard/_components/Notifications}/Filter.ts (100%) rename apps/web/app/{ => (org)}/dashboard/_components/Notifications/FilterTabs.tsx (98%) rename apps/web/app/{ => (org)}/dashboard/_components/Notifications/NotificationFooter.tsx (100%) rename apps/web/app/{ => (org)}/dashboard/_components/Notifications/NotificationHeader.tsx (100%) rename apps/web/app/{ => (org)}/dashboard/_components/Notifications/NotificationItem.tsx (97%) rename apps/web/app/{ => (org)}/dashboard/_components/Notifications/SettingsDropdown.tsx (74%) rename apps/web/app/{ => (org)}/dashboard/_components/Notifications/Skeleton.tsx (100%) rename apps/web/app/{ => (org)}/dashboard/_components/Notifications/index.tsx (97%) delete mode 100644 apps/web/app/dashboard/_components/Notifications/mockData.ts diff --git a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx index 7c3c4b8322d..ba4a7b5463f 100644 --- a/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx +++ b/apps/web/app/(org)/dashboard/_components/DashboardInner.tsx @@ -1,6 +1,6 @@ "use client"; -import Notifications from "@/app/dashboard/_components/Notifications"; +import Notifications from "@/app/(org)/dashboard/_components/Notifications"; import { UpgradeModal } from "@/components/UpgradeModal"; import { buildEnv } from "@cap/env"; import { @@ -12,11 +12,7 @@ import { PopoverContent, PopoverTrigger, } from "@cap/ui"; -import { - faBell, - faMoon, - faSun -} from "@fortawesome/free-solid-svg-icons"; +import { faBell, faMoon, faSun } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useClickAway } from "@uidotdev/usehooks"; import clsx from "clsx"; @@ -26,7 +22,14 @@ import { signOut } from "next-auth/react"; import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; -import React, { cloneElement, memo, MutableRefObject, useMemo, useRef, useState } from "react"; +import React, { + cloneElement, + memo, + MutableRefObject, + useMemo, + useRef, + useState, +} from "react"; import { useDashboardContext, useTheme } from "../Contexts"; import { MembersDialog } from "../spaces/[spaceId]/components/MembersDialog"; import { @@ -50,7 +53,8 @@ export default function DashboardInner({ children: React.ReactNode; }) { const pathname = usePathname(); - const { activeOrganization, activeSpace, anyNewNotifications } = useDashboardContext(); + const { activeOrganization, activeSpace, anyNewNotifications } = + useDashboardContext(); const [membersDialogOpen, setMembersDialogOpen] = useState(false); const titles: Record = { @@ -115,14 +119,16 @@ export default function DashboardInner({ setToggleNotifications(!toggleNotifications); }} onKeyDown={(e) => { - if (e.key === 'Enter' || e.key === ' ') { + if (e.key === "Enter" || e.key === " ") { e.preventDefault(); setToggleNotifications(!toggleNotifications); } }} tabIndex={0} role="button" - aria-label={`Notifications${anyNewNotifications ? ' (new notifications available)' : ''}`} + aria-label={`Notifications${ + anyNewNotifications ? " (new notifications available)" : "" + }`} aria-expanded={toggleNotifications} className="hidden relative justify-center data-[state=open]:hover:bg-gray-5 items-center bg-gray-3 rounded-full transition-colors cursor-pointer lg:flex @@ -136,7 +142,8 @@ export default function DashboardInner({
-
)} +
+ )} {toggleNotifications && } diff --git a/apps/web/app/dashboard/_components/Filter.ts b/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts similarity index 100% rename from apps/web/app/dashboard/_components/Filter.ts rename to apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts diff --git a/apps/web/app/dashboard/_components/Notifications/FilterTabs.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx similarity index 98% rename from apps/web/app/dashboard/_components/Notifications/FilterTabs.tsx rename to apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx index bb2f9deb712..5e1fc4f485a 100644 --- a/apps/web/app/dashboard/_components/Notifications/FilterTabs.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx @@ -2,7 +2,7 @@ import clsx from "clsx"; import { motion } from "framer-motion"; import { useRef, useEffect, useMemo } from "react"; import { NotificationType } from "@/lib/Notification"; -import { FilterType } from "../Filter"; +import { FilterType } from "./Filter"; type FilterTabsProps = { activeFilter: FilterType; diff --git a/apps/web/app/dashboard/_components/Notifications/NotificationFooter.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/NotificationFooter.tsx similarity index 100% rename from apps/web/app/dashboard/_components/Notifications/NotificationFooter.tsx rename to apps/web/app/(org)/dashboard/_components/Notifications/NotificationFooter.tsx diff --git a/apps/web/app/dashboard/_components/Notifications/NotificationHeader.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/NotificationHeader.tsx similarity index 100% rename from apps/web/app/dashboard/_components/Notifications/NotificationHeader.tsx rename to apps/web/app/(org)/dashboard/_components/Notifications/NotificationHeader.tsx diff --git a/apps/web/app/dashboard/_components/Notifications/NotificationItem.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx similarity index 97% rename from apps/web/app/dashboard/_components/Notifications/NotificationItem.tsx rename to apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx index 678450c0428..32805630218 100644 --- a/apps/web/app/dashboard/_components/Notifications/NotificationItem.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx @@ -5,7 +5,6 @@ import Link from "next/link"; import moment from "moment"; import { NotificationType } from "@/lib/Notification"; import { Notification as APINotification } from "@cap/web-api-contract"; -import z from "zod"; type NotificationItemProps = { notification: APINotification; @@ -17,7 +16,7 @@ const descriptionMap: Record = { reply: `replied to your comment`, view: `viewed your video`, reaction: `reacted to your video`, - mention: `mentioned you in a comment`, + // mention: `mentioned you in a comment`, }; export const NotificationItem = ({ @@ -98,7 +97,8 @@ function getLink(notification: APINotification) { switch (notification.type) { case "comment": case "reply": - // case "reaction": + case "reaction": + // case "mention": return `/s/${notification.videoId}/?comment=${notification.comment.id}`; default: return `/s/${notification.videoId}`; diff --git a/apps/web/app/dashboard/_components/Notifications/SettingsDropdown.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/SettingsDropdown.tsx similarity index 74% rename from apps/web/app/dashboard/_components/Notifications/SettingsDropdown.tsx rename to apps/web/app/(org)/dashboard/_components/Notifications/SettingsDropdown.tsx index 23a42d921c9..a9fe9524f51 100644 --- a/apps/web/app/dashboard/_components/Notifications/SettingsDropdown.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/SettingsDropdown.tsx @@ -6,15 +6,16 @@ import { faComment, faEye, faReply, - faThumbsUp, IconDefinition + faThumbsUp, + IconDefinition, } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { Menu, Transition } from '@headlessui/react'; +import { Menu, Transition } from "@headlessui/react"; import clsx from "clsx"; -import { Fragment, useState } from 'react'; +import { Fragment, useState } from "react"; import { updatePreferences } from "@/actions/notifications/update-preferences"; import { toast } from "sonner"; -import { useDashboardContext } from "@/app/(org)/dashboard/Contexts"; +import { useDashboardContext } from "../../Contexts"; type NotificationOption = { icon: IconDefinition; @@ -26,31 +27,34 @@ const notificationOptions: NotificationOption[] = [ { icon: faComment, label: "Comments", value: "pauseComments" }, { icon: faReply, label: "Replies", value: "pauseReplies" }, { icon: faEye, label: "Views", value: "pauseViews" }, - { icon: faThumbsUp, label: "Reactions", value: "pauseReactions" } -] + { icon: faThumbsUp, label: "Reactions", value: "pauseReactions" }, +]; export const SettingsDropdown = () => { const [showPauseSubmenu, setShowPauseSubmenu] = useState(false); const { userPreferences } = useDashboardContext(); - const updateNotificationPreferences = async (option: NotificationOption) => { try { const currentPrefs = userPreferences?.notifications ?? { pauseComments: false, pauseReplies: false, pauseViews: false, - pauseReactions: false + pauseReactions: false, }; await updatePreferences({ notifications: { ...currentPrefs, - [option.value]: !(currentPrefs[option.value] ?? false) - } + [option.value]: !(currentPrefs[option.value] ?? false), + }, }); - toast.success(`Notifications from ${option.label} have been ${!(currentPrefs[option.value] ?? false) ? "paused" : "unpaused"}`); + toast.success( + `Notifications from ${option.label} have been ${ + !(currentPrefs[option.value] ?? false) ? "paused" : "unpaused" + }` + ); } catch (error) { console.error("Failed to update preferences:", error); toast.error("Failed to update notification preferences"); @@ -60,10 +64,7 @@ export const SettingsDropdown = () => { return ( - +

Settings

@@ -83,16 +84,24 @@ export const SettingsDropdown = () => {
setShowPauseSubmenu(true)} onMouseLeave={() => setShowPauseSubmenu(false)} >
- -

Pause notifications

+ +

+ Pause notifications +

- +
)} @@ -108,11 +117,18 @@ export const SettingsDropdown = () => {
await updateNotificationPreferences(option)} + onClick={async () => + await updateNotificationPreferences(option) + } >
- -

{option.label}

+ +

+ {option.label} +

{userPreferences?.notifications[option.value] && ( @@ -133,4 +149,3 @@ export const SettingsDropdown = () => { }; export default SettingsDropdown; - diff --git a/apps/web/app/dashboard/_components/Notifications/Skeleton.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/Skeleton.tsx similarity index 100% rename from apps/web/app/dashboard/_components/Notifications/Skeleton.tsx rename to apps/web/app/(org)/dashboard/_components/Notifications/Skeleton.tsx diff --git a/apps/web/app/dashboard/_components/Notifications/index.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx similarity index 97% rename from apps/web/app/dashboard/_components/Notifications/index.tsx rename to apps/web/app/(org)/dashboard/_components/Notifications/index.tsx index eae3faeebb8..222f45b732d 100644 --- a/apps/web/app/dashboard/_components/Notifications/index.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx @@ -3,7 +3,7 @@ import clsx from "clsx"; import { motion, MotionProps } from "framer-motion"; import { forwardRef, useEffect, useRef, useMemo, useState } from "react"; -import { FilterTabs, FilterType, FilterLabels } from "./FilterTabs"; +import { FilterTabs } from "./FilterTabs"; import { NotificationFooter } from "./NotificationFooter"; import { NotificationHeader } from "./NotificationHeader"; import { NotificationItem } from "./NotificationItem"; @@ -14,7 +14,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faBellSlash } from "@fortawesome/free-solid-svg-icons"; import { useDashboardContext } from "@/app/(org)/dashboard/Contexts"; import { useApiClient } from "@/utils/web-api"; -import { matchNotificationFilter } from "../Filter"; +import { FilterType, matchNotificationFilter } from "./Filter"; type NotificationsProps = MotionProps & React.HTMLAttributes; diff --git a/apps/web/app/dashboard/_components/Notifications/mockData.ts b/apps/web/app/dashboard/_components/Notifications/mockData.ts deleted file mode 100644 index b10c254aed5..00000000000 --- a/apps/web/app/dashboard/_components/Notifications/mockData.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Notification, NotificationType } from "./types"; - -export const mockNotifications: Notification[] = [ - { - id: "1", - type: "recording", - user: { - name: "Wayne", - avatar: - "https://images.pexels.com/photos/771742/pexels-photo-771742.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2", - hasUnread: true, - }, - content: "shared a new recording", - time: "3 mins ago", - }, - { - id: "2", - type: "comment", - user: { - name: "James", - avatar: - "https://images.pexels.com/photos/1040880/pexels-photo-1040880.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2", - hasUnread: true, - }, - content: "commented on your video", - time: "12 mins ago", - additionalText: - "This is looking awesome, goodjob and i'm looking forward to seeing more.", - }, - { - id: "3", - type: "view", - user: { - name: "Jasmin", - avatar: "", - hasUnread: true, - }, - content: "viewed your video", - time: "20 mins ago", - }, - { - id: "4", - type: "reaction", - user: { - name: "Jasmin", - avatar: "", - hasUnread: true, - }, - content: "reacted to your video", - time: "25 mins ago", - }, -]; diff --git a/apps/web/utils/organization.ts b/apps/web/utils/organization.ts index 8ef75b7deb5..311defc109c 100644 --- a/apps/web/utils/organization.ts +++ b/apps/web/utils/organization.ts @@ -1,3 +1,5 @@ +import { NODE_ENV } from "@cap/env"; + /** * Calculate organization seats information */ @@ -9,14 +11,17 @@ export function calculateSeats(organization: { const inviteQuota = organization?.inviteQuota ?? 1; const memberCount = organization?.members?.length ?? 0; const pendingInvitesCount = organization?.invites?.length ?? 0; - const totalUsedSeats = memberCount + pendingInvitesCount; - const remainingSeats = Math.max(0, inviteQuota - totalUsedSeats); - + const totalUsedSeats = memberCount + pendingInvitesCount; + const remainingSeats = + NODE_ENV == "development" + ? Infinity + : Math.max(0, inviteQuota - totalUsedSeats); + return { inviteQuota, memberCount, pendingInvitesCount, totalUsedSeats, - remainingSeats + remainingSeats, }; -} \ No newline at end of file +} From d61fe557920cd14a656d23ab284816cc161d498f Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 15:15:06 +0800 Subject: [PATCH 11/23] derive createNotification api from web api contract --- apps/web/global.d.ts | 4 ++ apps/web/lib/Notification.ts | 78 +++++++++----------------- packages/database/schema.ts | 2 +- packages/web-api-contract/src/index.ts | 15 ++--- 4 files changed, 41 insertions(+), 58 deletions(-) diff --git a/apps/web/global.d.ts b/apps/web/global.d.ts index 2cd438de1d4..69ed3dd668c 100644 --- a/apps/web/global.d.ts +++ b/apps/web/global.d.ts @@ -1 +1,5 @@ declare type MaybePromise = T | Promise; + +declare type DistributiveOmit = T extends any + ? Omit + : never; diff --git a/apps/web/lib/Notification.ts b/apps/web/lib/Notification.ts index 13b2a499bb4..7c92c6aa47a 100644 --- a/apps/web/lib/Notification.ts +++ b/apps/web/lib/Notification.ts @@ -1,54 +1,33 @@ -import { z } from "zod"; -import { getCurrentUser } from "@cap/database/auth/session"; +// Ideally all the Notification-related types would be in @cap/web-domain +// but @cap/web-api-contract is the closest we have right now + import { notifications, videos, users } from "@cap/database/schema"; import { db } from "@cap/database"; import { and, eq, sql } from "drizzle-orm"; import { nanoId } from "@cap/database/helpers"; import { UserPreferences } from "@/app/(org)/dashboard/dashboard-data"; import { revalidatePath } from "next/cache"; - -const buildNotification = ( - type: TType, - fields: TFields -) => z.object({ ...fields, type: z.literal(type) }); - -export const Notification = z.union([ - buildNotification("view", { videoId: z.string(), authorId: z.string() }), - buildNotification("comment", { - videoId: z.string(), - authorId: z.string(), - comment: z.object({ - id: z.string(), - content: z.string(), - }), - }), - buildNotification("reaction", { videoId: z.string(), authorId: z.string() }), - // buildNotification("mention", { - // videoId: z.string(), - // authorId: z.string(), - // comment: z.object({ - // id: z.string(), - // content: z.string(), - // }), - // }), - buildNotification("reply", { - videoId: z.string(), - authorId: z.string(), - comment: z.object({ - id: z.string(), - content: z.string(), - }), - }), -]); - -export type RawNotification = z.infer; -export type NotificationType = z.infer["type"]; - -export type HydratedNotification = - | Extract - | (Extract & { content: string }); - -export async function createNotification(notification: RawNotification) { +import { Notification, NotificationBase } from "@cap/web-api-contract"; + +// Notification daata without id, readTime, etc +type NotificationSpecificData = DistributiveOmit< + Notification, + keyof NotificationBase +>; + +// Replaces author object with authorId since we query for that info. +// If we add more notifications this would probably be better done manually +// Type is weird since we need to operate on each member of the NotificationSpecificData union +type CreateNotificationInput = + D extends NotificationSpecificData + ? D["author"] extends never + ? D + : Omit & { authorId: string } + : never; + +export async function createNotification( + notification: CreateNotificationInput +) { try { // First, get the video and owner data const [videoResult] = await db() @@ -79,10 +58,9 @@ export async function createNotification(notification: RawNotification) { const shouldSkipNotification = (notification.type === "comment" && notificationPrefs.pauseComments) || - (notification.type === "view" && notificationPrefs.pauseViews); - // || - // (variant === "reply" && notificationPrefs.pauseReplies) || - // (variant === "reaction" && notificationPrefs.pauseReactions); + (notification.type === "view" && notificationPrefs.pauseViews) || + (notification.type === "reply" && notificationPrefs.pauseReplies) || + (notification.type === "reaction" && notificationPrefs.pauseReactions); if (shouldSkipNotification) { return; @@ -115,7 +93,7 @@ export async function createNotification(notification: RawNotification) { and( eq(notifications.type, "comment"), eq(notifications.recipientId, videoResult.ownerId), - sql`JSON_EXTRACT(${notifications.data}, '$.commentId') = ${notification.comment.id}` + sql`JSON_EXTRACT(${notifications.data}, '$.comment.id') = ${notification.comment.id}` ) ) .limit(1); diff --git a/packages/database/schema.ts b/packages/database/schema.ts index ea004519373..818ef9cec78 100644 --- a/packages/database/schema.ts +++ b/packages/database/schema.ts @@ -318,7 +318,7 @@ export const notifications = mysqlTable( recipientId: nanoId("recipientId").notNull(), type: varchar("type", { length: 10 }) .notNull() - .$type<"view" | "comment" | "reply" | "reaction" /* | "mention"*/>(), + .$type<"view" | "comment" | "reply" | "reaction" | "mention">(), data: json("data") .$type<{ videoId?: string; diff --git a/packages/web-api-contract/src/index.ts b/packages/web-api-contract/src/index.ts index 46c4c929eb7..948ed504ef5 100644 --- a/packages/web-api-contract/src/index.ts +++ b/packages/web-api-contract/src/index.ts @@ -8,6 +8,13 @@ export const NotificationAuthor = z.object({ avatar: z.string().nullable(), }); +export const NotificationBase = z.object({ + id: z.string(), + readAt: z.coerce.date().nullable(), + createdAt: z.coerce.date(), +}); +export type NotificationBase = z.infer; + export const Notification = z .union([ z.object({ @@ -52,13 +59,7 @@ export const Notification = z // }), // }), ]) - .and( - z.object({ - id: z.string(), - readAt: z.coerce.date().nullable(), - createdAt: z.coerce.date(), - }) - ); + .and(NotificationBase); export type Notification = z.infer; export const contract = c.router({ From 670b8f53e7d22989da45f59b0100c8b9d565c585 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 15:25:12 +0800 Subject: [PATCH 12/23] Update apps/web/app/(org)/dashboard/_components/Notifications/index.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .../_components/Notifications/index.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx index 222f45b732d..18cf126c572 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx @@ -55,16 +55,17 @@ const Notifications = forwardRef( useEffect(() => { if (!scrollRef.current) return; const handleKeyDown = (e: KeyboardEvent) => { + const target = e.target as HTMLElement; + // Ignore typing/navigation inside inputs/editable fields + if (target.closest("input, textarea, [contenteditable='true']")) return; + // Only handle when event originates within the panel's scroll area + if (!scrollRef.current?.contains(target)) return; if (e.key === "ArrowUp") { - scrollRef.current?.scrollBy({ - top: -100, - behavior: "smooth", - }); + e.preventDefault(); + scrollRef.current?.scrollBy({ top: -100, behavior: "smooth" }); } else if (e.key === "ArrowDown") { - scrollRef.current?.scrollBy({ - top: 100, - behavior: "smooth", - }); + e.preventDefault(); + scrollRef.current?.scrollBy({ top: 100, behavior: "smooth" }); } }; document.addEventListener("keydown", handleKeyDown); From 2e1dab1f3f642fded934b91471d5c2c90f72fdeb Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 15:25:44 +0800 Subject: [PATCH 13/23] cleanup --- .../_components/Notifications/index.tsx | 2 +- apps/web/lib/Notification.ts | 8 ++++++-- apps/web/utils/organization.ts | 6 ++---- packages/database/schema.ts | 2 +- packages/local-docker/package.json | 3 --- packages/tsconfig/package.json | 3 --- packages/web-api-contract/src/index.ts | 20 ++++++++----------- 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx index 222f45b732d..13b2f4e2211 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx @@ -14,7 +14,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faBellSlash } from "@fortawesome/free-solid-svg-icons"; import { useDashboardContext } from "@/app/(org)/dashboard/Contexts"; import { useApiClient } from "@/utils/web-api"; -import { FilterType, matchNotificationFilter } from "./Filter"; +import { FilterLabels, FilterType, matchNotificationFilter } from "./Filter"; type NotificationsProps = MotionProps & React.HTMLAttributes; diff --git a/apps/web/lib/Notification.ts b/apps/web/lib/Notification.ts index 7c92c6aa47a..659fdbba845 100644 --- a/apps/web/lib/Notification.ts +++ b/apps/web/lib/Notification.ts @@ -84,14 +84,18 @@ export async function createNotification( .limit(1); hasExistingNotification = !!existingNotification; - } else if (notification.type === "comment") { + } else if ( + notification.type === "comment" || + notification.type === "reaction" || + notification.type === "reply" + ) { // Check for existing comment notification const [existingNotification] = await db() .select({ id: notifications.id }) .from(notifications) .where( and( - eq(notifications.type, "comment"), + eq(notifications.type, notification.type), eq(notifications.recipientId, videoResult.ownerId), sql`JSON_EXTRACT(${notifications.data}, '$.comment.id') = ${notification.comment.id}` ) diff --git a/apps/web/utils/organization.ts b/apps/web/utils/organization.ts index 311defc109c..2e0ebaf2297 100644 --- a/apps/web/utils/organization.ts +++ b/apps/web/utils/organization.ts @@ -1,5 +1,3 @@ -import { NODE_ENV } from "@cap/env"; - /** * Calculate organization seats information */ @@ -13,8 +11,8 @@ export function calculateSeats(organization: { const pendingInvitesCount = organization?.invites?.length ?? 0; const totalUsedSeats = memberCount + pendingInvitesCount; const remainingSeats = - NODE_ENV == "development" - ? Infinity + process.env.NODE_ENv === "development" + ? Number.MAX_SAFE_INTEGER : Math.max(0, inviteQuota - totalUsedSeats); return { diff --git a/packages/database/schema.ts b/packages/database/schema.ts index 818ef9cec78..9eecead159c 100644 --- a/packages/database/schema.ts +++ b/packages/database/schema.ts @@ -318,7 +318,7 @@ export const notifications = mysqlTable( recipientId: nanoId("recipientId").notNull(), type: varchar("type", { length: 10 }) .notNull() - .$type<"view" | "comment" | "reply" | "reaction" | "mention">(), + .$type<"view" | "comment" | "reply" | "reaction" /*| "mention"*/>(), data: json("data") .$type<{ videoId?: string; diff --git a/packages/local-docker/package.json b/packages/local-docker/package.json index 695c3c4e86d..7b08894b11c 100644 --- a/packages/local-docker/package.json +++ b/packages/local-docker/package.json @@ -9,9 +9,6 @@ "docker:stop": "docker compose stop", "docker:clean": "docker compose down -v" }, - "dependencies": { - "zod": "^3" - }, "engines": { "node": "20" } diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json index 220c47aaf0f..6efb83e14ce 100644 --- a/packages/tsconfig/package.json +++ b/packages/tsconfig/package.json @@ -5,8 +5,5 @@ "license": "MIT", "publishConfig": { "access": "public" - }, - "dependencies": { - "zod": "^3" } } diff --git a/packages/web-api-contract/src/index.ts b/packages/web-api-contract/src/index.ts index 948ed504ef5..d9c4d9134d5 100644 --- a/packages/web-api-contract/src/index.ts +++ b/packages/web-api-contract/src/index.ts @@ -15,6 +15,11 @@ export const NotificationBase = z.object({ }); export type NotificationBase = z.infer; +const CommentData = z.object({ + id: z.string(), + content: z.string(), +}); + export const Notification = z .union([ z.object({ @@ -26,28 +31,19 @@ export const Notification = z type: z.literal("comment"), videoId: z.string(), author: NotificationAuthor, - comment: z.object({ - id: z.string(), - content: z.string(), - }), + comment: CommentData, }), z.object({ type: z.literal("reaction"), videoId: z.string(), author: NotificationAuthor, - comment: z.object({ - id: z.string(), - content: z.string(), - }), + comment: CommentData, }), z.object({ type: z.literal("reply"), videoId: z.string(), author: NotificationAuthor, - comment: z.object({ - id: z.string(), - content: z.string(), - }), + comment: CommentData, }), // z.object({ // type: z.literal("mention"), From 42c8506a15cbbffcf2161ae0aaeed2813497dc27 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 16:33:13 +0800 Subject: [PATCH 14/23] fix notifications ui --- .../web/app/(org)/dashboard/_components/Notifications/Filter.ts | 2 +- .../(org)/dashboard/_components/Notifications/FilterTabs.tsx | 2 +- apps/web/lib/Notification.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts b/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts index f92db1134c9..76148c9ed1d 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts +++ b/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts @@ -2,7 +2,7 @@ import { NotificationType } from "@/lib/Notification"; export type FilterType = "all" | "comments" | "replies" | "views" | "reactions"; -const Filters: Array = [ +export const Filters: Array = [ "all", "comments", "replies", diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx index 5e1fc4f485a..aed95464296 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx @@ -2,7 +2,7 @@ import clsx from "clsx"; import { motion } from "framer-motion"; import { useRef, useEffect, useMemo } from "react"; import { NotificationType } from "@/lib/Notification"; -import { FilterType } from "./Filter"; +import { Filters, FilterType } from "./Filter"; type FilterTabsProps = { activeFilter: FilterType; diff --git a/apps/web/lib/Notification.ts b/apps/web/lib/Notification.ts index 659fdbba845..b0b933f4087 100644 --- a/apps/web/lib/Notification.ts +++ b/apps/web/lib/Notification.ts @@ -9,6 +9,8 @@ import { UserPreferences } from "@/app/(org)/dashboard/dashboard-data"; import { revalidatePath } from "next/cache"; import { Notification, NotificationBase } from "@cap/web-api-contract"; +export type NotificationType = Notification["type"]; + // Notification daata without id, readTime, etc type NotificationSpecificData = DistributiveOmit< Notification, From 023e6e6049baa9c18b184a849176399327ba271f Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 16:45:50 +0800 Subject: [PATCH 15/23] fix frontend again --- .../(org)/dashboard/_components/Notifications/FilterTabs.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx index aed95464296..9fc007afd00 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx @@ -2,7 +2,7 @@ import clsx from "clsx"; import { motion } from "framer-motion"; import { useRef, useEffect, useMemo } from "react"; import { NotificationType } from "@/lib/Notification"; -import { Filters, FilterType } from "./Filter"; +import { FilterLabels, Filters, FilterType } from "./Filter"; type FilterTabsProps = { activeFilter: FilterType; From fc2552f78bba1c2f00a72313ed25802dc87eb5eb Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 16:50:15 +0800 Subject: [PATCH 16/23] fix useApiClient --- apps/web/utils/web-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/utils/web-api.ts b/apps/web/utils/web-api.ts index d3650b1c9cf..3db862fd836 100644 --- a/apps/web/utils/web-api.ts +++ b/apps/web/utils/web-api.ts @@ -8,7 +8,7 @@ export function useApiClient() { const { webUrl } = usePublicEnv(); const [client] = useState(() => initClient(contract, { - baseUrl: typeof window !== "undefined" ? `${webUrl}/api` : "/api", + baseUrl: typeof window === "undefined" ? `${webUrl}/api` : "/api", }) ); From 3244794181089f14b486870d276c3fd2df1adb23 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 17:21:13 +0800 Subject: [PATCH 17/23] properly extract authorId in sql --- apps/web/app/api/notifications/route.ts | 8 ++++---- apps/web/utils/sql.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 apps/web/utils/sql.ts diff --git a/apps/web/app/api/notifications/route.ts b/apps/web/app/api/notifications/route.ts index f130e0cc7b5..fd854157888 100644 --- a/apps/web/app/api/notifications/route.ts +++ b/apps/web/app/api/notifications/route.ts @@ -1,12 +1,14 @@ import { getCurrentUser } from "@cap/database/auth/session"; import { notifications, users } from "@cap/database/schema"; import { db } from "@cap/database"; -import { and, desc, eq, isNull, sql } from "drizzle-orm"; +import { and, ColumnBaseConfig, desc, eq, isNull, sql } from "drizzle-orm"; import { z } from "zod"; import { NextResponse } from "next/server"; import { Notification as APINotification } from "@cap/web-api-contract"; import { AvcProfileInfo } from "node_modules/@remotion/media-parser/dist/containers/avc/parse-avc"; import { NotificationType } from "@/lib/Notification"; +import { MySqlColumn } from "drizzle-orm/mysql-core"; +import { jsonExtractString } from "@/utils/sql"; const notificationDataSchema = z.object({ authorId: z.string(), @@ -46,9 +48,7 @@ export async function GET() { .from(notifications) .leftJoin( users, - and( - eq(sql`JSON_EXTRACT(${notifications.data}, '$.authorId')`, users.id) - ) + and(eq(jsonExtractString(notifications.data, "authorId"), users.id)) ) .where( and( diff --git a/apps/web/utils/sql.ts b/apps/web/utils/sql.ts new file mode 100644 index 00000000000..1459cf506da --- /dev/null +++ b/apps/web/utils/sql.ts @@ -0,0 +1,12 @@ +import { ColumnBaseConfig, sql } from "drizzle-orm"; +import { MySqlColumn } from "drizzle-orm/mysql-core"; + +export function jsonExtractString< + C extends ColumnBaseConfig<"json", "MySqlJson"> & { data: T }, + T extends Record, + F extends keyof T +>(column: MySqlColumn, field: F) { + return sql< + string | undefined + >`JSON_UNQUOTE(JSON_EXTRACT(${column}, $.${field}))`; +} From d7988883bbdba03efcaf7ea8cfdbf9453c99db3d Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 17:26:22 +0800 Subject: [PATCH 18/23] fix json param --- apps/web/utils/sql.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/utils/sql.ts b/apps/web/utils/sql.ts index 1459cf506da..ccd25ef3aca 100644 --- a/apps/web/utils/sql.ts +++ b/apps/web/utils/sql.ts @@ -6,7 +6,8 @@ export function jsonExtractString< T extends Record, F extends keyof T >(column: MySqlColumn, field: F) { + const jsonParam = `$.${field as string}`; return sql< string | undefined - >`JSON_UNQUOTE(JSON_EXTRACT(${column}, $.${field}))`; + >`JSON_UNQUOTE(JSON_EXTRACT(${column}, '${jsonParam}'))`; } From cf27f98acf9191f7c8f25d4a269bfcce5395d0f6 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 17:31:26 +0800 Subject: [PATCH 19/23] plz this time --- apps/web/utils/sql.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/utils/sql.ts b/apps/web/utils/sql.ts index ccd25ef3aca..c16ae2bf106 100644 --- a/apps/web/utils/sql.ts +++ b/apps/web/utils/sql.ts @@ -9,5 +9,5 @@ export function jsonExtractString< const jsonParam = `$.${field as string}`; return sql< string | undefined - >`JSON_UNQUOTE(JSON_EXTRACT(${column}, '${jsonParam}'))`; + >`JSON_UNQUOTE(JSON_EXTRACT(${column}, ${jsonParam}))`; } From d5acd6fb4ab98f527823a09546e46fee92123a2d Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 18:00:59 +0800 Subject: [PATCH 20/23] fix notif counts --- .../_components/Notifications/Filter.ts | 32 +++++++------------ .../_components/Notifications/FilterTabs.tsx | 4 +-- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts b/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts index 76148c9ed1d..1377cf0cf37 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts +++ b/apps/web/app/(org)/dashboard/_components/Notifications/Filter.ts @@ -1,37 +1,27 @@ import { NotificationType } from "@/lib/Notification"; -export type FilterType = "all" | "comments" | "replies" | "views" | "reactions"; +export type FilterType = "all" | NotificationType; export const Filters: Array = [ "all", - "comments", - "replies", - "views", - "reactions", + "comment", + "reply", + "view", + "reaction", ]; export const FilterLabels: Record = { all: "All", - comments: "Comments", - replies: "Replies", - views: "Views", - reactions: "Reactions", + comment: "Comments", + reply: "Replies", + view: "Views", + reaction: "Reactions", }; export const matchNotificationFilter = ( filter: FilterType, type: NotificationType ): boolean => { - switch (filter) { - case "all": - return true; - case "comments": - return type === "comment"; - case "replies": - return type === "reply"; - case "views": - return type === "view"; - case "reactions": - return type === "reaction"; - } + if (filter === "all") return true; + return type === filter; }; diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx index 9fc007afd00..d4055788780 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/FilterTabs.tsx @@ -75,9 +75,7 @@ export const FilterTabs = ({ : "text-gray-10 group-hover:text-gray-11" )} > - {filter === "all" - ? totalCount - : count?.[filter.toLowerCase() as NotificationType] ?? 0} + {filter === "all" ? totalCount : count?.[filter] ?? 0}

)}
From 93fc83f8e843efeacf25e01aaa28abd20b97632f Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 18:23:31 +0800 Subject: [PATCH 21/23] add border --- .../Notifications/NotificationItem.tsx | 115 +++++++++--------- .../_components/Notifications/Skeleton.tsx | 7 +- .../_components/Notifications/index.tsx | 8 +- 3 files changed, 68 insertions(+), 62 deletions(-) diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx index 32805630218..585a463ca7b 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx @@ -26,68 +26,67 @@ export const NotificationItem = ({ const link = getLink(notification); return ( - -
- {/* Avatar */} -
- {notification.author.avatar ? ( - {notification.author.name} - ) : ( -
- {notification.author.name.charAt(0)} -
- )} - {notification.readAt === null && ( -
- )} -
- - {/* Content */} -
-
- - {notification.author.name} - - - {descriptionMap[notification.type]} - + + {/* Avatar */} +
+ {notification.author.avatar ? ( + {notification.author.name} + ) : ( +
+ {notification.author.name.charAt(0)}
+ )} + {notification.readAt === null && ( +
+ )} +
- {notification.type === "comment" || - (notification.type === "reply" && ( -

- {notification.comment.content} -

- ))} -

- {moment(notification.createdAt).fromNow()} -

+ {/* Content */} +
+
+ + {notification.author.name} + + + {descriptionMap[notification.type]} +
- {/* Icon */} -
- {notification.type === "comment" && ( - - )} - {notification.type === "reply" && ( - - )} - {notification.type === "view" && ( - - )} - {notification.type === "reaction" && ( - {notification.comment.content} - )} -
+ {notification.type === "comment" || + (notification.type === "reply" && ( +

+ {notification.comment.content} +

+ ))} +

+ {moment(notification.createdAt).fromNow()} +

+
+ + {/* Icon */} +
+ {notification.type === "comment" && ( + + )} + {notification.type === "reply" && ( + + )} + {notification.type === "view" && ( + + )} + {notification.type === "reaction" && ( + {notification.comment.content} + )}
); diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/Skeleton.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/Skeleton.tsx index d892aff6cf9..394150b5b6e 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/Skeleton.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/Skeleton.tsx @@ -9,7 +9,7 @@ export const NotificationItemSkeleton = ({ return ( ( -
+
{/* Avatar Skeleton */}
{ return (
{Array.from({ length: count }).map((_, i) => ( - + ))}
); diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx index 2e892a634f6..faaca4509e7 100644 --- a/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx +++ b/apps/web/app/(org)/dashboard/_components/Notifications/index.tsx @@ -83,7 +83,7 @@ const Notifications = forwardRef( transition={{ ease: "easeOut", duration: 0.2 }} onClick={(e) => e.stopPropagation()} className={clsx( - "flex absolute right-0 top-12 flex-col rounded-xl cursor-default w-[400px] h-[450px] bg-gray-1", + "flex absolute right-0 top-12 flex-col rounded-xl cursor-default w-[400px] h-[450px] bg-gray-1 origin-top-right", className )} {...props} @@ -95,7 +95,10 @@ const Notifications = forwardRef( activeFilter={activeFilter} setActiveFilter={setActiveFilter} /> -
+
{notifications.isPending ? ( ) : isNotificationTabEmpty ? ( @@ -124,6 +127,7 @@ const Notifications = forwardRef( /> )) )} +
From 61a73a54db2a16ab9a7ae73649a921e1fbf9ed3e Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 8 Aug 2025 18:25:56 +0800 Subject: [PATCH 22/23] Update apps/web/utils/web-api.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- apps/web/utils/web-api.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/utils/web-api.ts b/apps/web/utils/web-api.ts index 3db862fd836..aca399bc76f 100644 --- a/apps/web/utils/web-api.ts +++ b/apps/web/utils/web-api.ts @@ -8,7 +8,9 @@ export function useApiClient() { const { webUrl } = usePublicEnv(); const [client] = useState(() => initClient(contract, { - baseUrl: typeof window === "undefined" ? `${webUrl}/api` : "/api", + baseUrl: typeof window === "undefined" + ? `${webUrl.replace(/\/+$/, "")}/api` + : "/api", }) ); From 5b55f28e0d79a567061000a65b53f3f4a2a474c7 Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Fri, 8 Aug 2025 13:55:02 +0300 Subject: [PATCH 23/23] remove md for now --- AGENTS.md | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index d3485bf1e1d..00000000000 --- a/AGENTS.md +++ /dev/null @@ -1,35 +0,0 @@ -# Cap Web - -Cap Web is our Next.js application for sharing screen recordings. -It is located at `./apps/web`. - -# Cap Desktop - -Cap Desktop is our Tauri application for recording and editing screen recordings. -It is located at `./apps/desktop`. - -## Crates - -Cap Desktop consumes a lot of crates inside `./crates`. -These crates have names prefixed with `cap-`, but their folders are not. -Some crates have READMEs you can use to learn more about their specific APIs. - -## Recording - -Cap allows recording in Studio Mode, where the screen, camera, and audio are recorded as separate files, or Instant Mode, where they are all combined and uploaded to Cap Web in real time. -A combination of crates are used to achieve this: -- Our `cap-camera*` crates are used for capturing frames from cameras. -- The external `scap` crate is used for capturing frames from the screen. -- The external `cpal` crate is used for capturing audio from microphones. -- `cap-media` contains binding code for all of the above, connecting some of them with FFmpeg -- `cap-media-encoders` contains encoders for various audio and video formats, powered by various media frameworks -- `cap-recording` uses `cap-media` and `cap-media-encoders` to implement instant and studio recording - -## Editing - -Studio recordings may be edited to add things like backgrounds, zooms, and cuts. Rendering is done using `wgpu` in `cap-rendering`. -`cap-editor` is the code that runs and communicates with the editor UI to coordinate playback and state mangement. - -## Exporting - -Studio recordings can be exported to single files, and optionally uploaded to Cap Web. `cap-export` uses `cap-rendering` and `cap-media-encoders` to render the recording into a single file.