From 1adcb2ab1a2c1e6860186b75685f4e4736a8f788 Mon Sep 17 00:00:00 2001 From: celine Date: Sat, 21 Feb 2026 10:46:55 -0500 Subject: [PATCH] some tweaks to post selector and combobox --- .../dashboard/PublicationAnalytics.tsx | 51 ++++++++----------- components/Combobox.tsx | 25 ++++++++- 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/app/lish/[did]/[publication]/dashboard/PublicationAnalytics.tsx b/app/lish/[did]/[publication]/dashboard/PublicationAnalytics.tsx index fb2b6cb7..f856fd09 100644 --- a/app/lish/[did]/[publication]/dashboard/PublicationAnalytics.tsx +++ b/app/lish/[did]/[publication]/dashboard/PublicationAnalytics.tsx @@ -55,15 +55,15 @@ export const PublicationAnalytics = () => {

Traffic

- + {selectedReferror && ( <> - - {selectedReferror.name} + +
{selectedReferror.name}
)}
@@ -112,21 +112,9 @@ const PostSelector = (props: { return ( setSearchValue(e.target.value)} - onClick={(e) => e.stopPropagation()} - onPointerDown={(e) => e.stopPropagation()} - /> - ) : ( - - ) + } results={filteredPostsWithClear || []} highlighted={highlighted} @@ -135,6 +123,9 @@ const PostSelector = (props: { props.setSelectedPost(highlighted); }} sideOffset={2} + searchValue={searchValue} + setSearchValue={setSearchValue} + showSearch > {filteredPostsWithClear.map((post) => { if (post === "All Posts") @@ -151,21 +142,23 @@ const PostSelector = (props: { All Posts {filteredPosts && filteredPosts.length !== 0 && ( -
+
)} ); return ( - { - props.setSelectedPost(post); - }} - highlighted={highlighted} - setHighlighted={setHighlighted} - > - {post} - + <> + { + props.setSelectedPost(post); + }} + highlighted={highlighted} + setHighlighted={setHighlighted} + > + {post} + + ); })}
diff --git a/components/Combobox.tsx b/components/Combobox.tsx index 69d9b8d5..7d0a5ba9 100644 --- a/components/Combobox.tsx +++ b/components/Combobox.tsx @@ -2,6 +2,7 @@ import { createContext, useContext, useEffect, useRef, useState } from "react"; import * as Popover from "@radix-ui/react-popover"; import { NestedCardThemeProvider } from "components/ThemeManager/ThemeProvider"; import { create } from "zustand"; +import { Input } from "./Input"; export const useComboboxState = create(() => ({ open: false, @@ -14,6 +15,9 @@ export const Combobox = ({ onOpenChange, highlighted, setHighlighted, + searchValue, + setSearchValue, + showSearch, trigger, triggerClassName, sideOffset, @@ -26,6 +30,9 @@ export const Combobox = ({ onOpenChange?: (open: boolean) => void; highlighted: string | undefined; setHighlighted: (h: string | undefined) => void; + searchValue?: string; + setSearchValue?: (s: string) => void; + showSearch?: boolean; sideOffset?: number; }) => { let ref = useRef(null); @@ -112,8 +119,24 @@ export const Combobox = ({ `} > -
+
+ {showSearch && setSearchValue ? ( + setSearchValue(e.target.value)} + onClick={(e) => e.stopPropagation()} + onPointerDown={(e) => e.stopPropagation()} + /> + ) : null} +
{children} +
-- 2.51.2