File tree Expand file tree Collapse file tree 5 files changed +15
-9
lines changed
Expand file tree Collapse file tree 5 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export function FairDOElasticSearch({
4848 facetOptionView ?: ComponentType < OptionViewProps >
4949
5050 /**
51- * Set to true to enable dark mode. Alternatively, set class="dark" on your html or body element
51+ * Set to true to enable dark mode
5252 */
5353 dark ?: boolean
5454} ) {
@@ -74,7 +74,7 @@ export function FairDOElasticSearch({
7474 < SearchProvider config = { elasticConfig } >
7575 < FairDOSearchProvider config = { rawConfig } >
7676 < TooltipProvider >
77- < GlobalModalProvider resultView = { actualResultView } >
77+ < GlobalModalProvider resultView = { actualResultView } dark = { dark } >
7878 < WithSearch
7979 mapContextToProps = { ( { wasSearched, isLoading } : SearchContextState ) => ( {
8080 wasSearched,
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { ResultViewProps } from "@elastic/react-search-ui-views"
99import { GraphNode } from "@/components/graph/GraphNode"
1010import { RelationsGraphOptions } from "@/components/graph/RelationsGraphOptions"
1111
12- export function GlobalModalProvider ( props : PropsWithChildren < { resultView : ComponentType < ResultViewProps > } > ) {
12+ export function GlobalModalProvider ( props : PropsWithChildren < { resultView : ComponentType < ResultViewProps > ; dark ?: boolean } > ) {
1313 const [ relationGraphState , setRelationGraphState ] = useState < {
1414 nodes : GraphNode [ ]
1515 options : RelationsGraphOptions
@@ -41,6 +41,7 @@ export function GlobalModalProvider(props: PropsWithChildren<{ resultView: Compo
4141 onOpenChange = { onRelationGraphOpenChange }
4242 resultView = { props . resultView }
4343 options = { relationGraphState . options }
44+ dark = { props . dark }
4445 />
4546
4647 { props . children }
Original file line number Diff line number Diff line change @@ -23,8 +23,13 @@ import { RelationsGraphOptions } from "@/components/graph/RelationsGraphOptions"
2323/**
2424 * Renders an interactive graph for the specified results. Results will be fetched from cache via PID. Currently intended for internal use only.
2525 */
26- export function RelationsGraph ( props : { nodes : GraphNode [ ] ; options ?: RelationsGraphOptions ; resultView : ComponentType < ResultViewProps > } ) {
27- const [ colorMode , setColorMode ] = useState < ColorMode > ( "system" )
26+ export function RelationsGraph ( props : {
27+ nodes : GraphNode [ ]
28+ options ?: RelationsGraphOptions
29+ resultView : ComponentType < ResultViewProps >
30+ dark ?: boolean
31+ } ) {
32+ const [ colorMode , setColorMode ] = useState < ColorMode > ( props . dark ? "dark" : "light" )
2833
2934 useEffect ( ( ) => {
3035 const dark = document . querySelector ( "html" ) ?. classList . contains ( "dark" )
Original file line number Diff line number Diff line change @@ -14,13 +14,15 @@ export function RelationsGraphModal({
1414 onOpenChange,
1515 nodes,
1616 resultView,
17- options
17+ options,
18+ dark
1819} : {
1920 isOpen : boolean
2021 onOpenChange : ( val : boolean ) => void
2122 nodes : GraphNode [ ]
2223 options ?: RelationsGraphOptions
2324 resultView : ComponentType < ResultViewProps >
25+ dark ?: boolean
2426} ) {
2527 const searchContext = useContext ( FairDOSearchContext )
2628
@@ -48,7 +50,7 @@ export function RelationsGraphModal({
4850 config : searchContext . config
4951 } }
5052 >
51- < RelationsGraph nodes = { nodes } resultView = { resultView } options = { options } />
53+ < RelationsGraph nodes = { nodes } resultView = { resultView } options = { options } dark = { dark } />
5254 </ FairDOSearchContext . Provider >
5355
5456 < div className = "rfs-absolute rfs-right-4 rfs-top-4" >
Original file line number Diff line number Diff line change @@ -60,8 +60,6 @@ export function DefaultSorting() {
6060 return ( ) => search . driver . unsubscribeToStateChanges ( handler )
6161 } , [ makeKey , search . driver ] )
6262
63- console . log ( "haha" )
64-
6563 if ( ! config . sortOptions || config . sortOptions . length === 0 ) return null
6664
6765 return (
You can’t perform that action at this time.
0 commit comments