From 5ecdc36b7d60aa66b49e01e9fec8ba61ad537376 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Thu, 2 Jan 2025 13:00:58 +0200
Subject: feat: Add support for smart lists (#802)

* feat: Add support for smart lists

* i18n

* Fix update list endpoint

* Add a test for smart lists

* Add header to the query explainer

* Hide remove from lists in the smart context list

* Add proper validation to list form

---------

Co-authored-by: Deepak Kapoor <41769111+orthdron@users.noreply.github.com>
---
 .../shared-react/hooks/bookmark-list-context.tsx   | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 packages/shared-react/hooks/bookmark-list-context.tsx

(limited to 'packages/shared-react/hooks/bookmark-list-context.tsx')

diff --git a/packages/shared-react/hooks/bookmark-list-context.tsx b/packages/shared-react/hooks/bookmark-list-context.tsx
new file mode 100644
index 00000000..d00e0567
--- /dev/null
+++ b/packages/shared-react/hooks/bookmark-list-context.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import { createContext, useContext } from "react";
+
+import { ZBookmarkList } from "@hoarder/shared/types/lists";
+
+export const BookmarkListContext = createContext<ZBookmarkList | undefined>(
+  undefined,
+);
+
+export function BookmarkListContextProvider({
+  list,
+  children,
+}: {
+  list: ZBookmarkList;
+  children: React.ReactNode;
+}) {
+  return (
+    <BookmarkListContext.Provider value={list}>
+      {children}
+    </BookmarkListContext.Provider>
+  );
+}
+
+export function useBookmarkListContext() {
+  return useContext(BookmarkListContext);
+}
-- 
cgit v1.2.3-70-g09d2

