File tree 5 files changed +15
-9
lines changed
5 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export function FairDOElasticSearch({
48
48
facetOptionView ?: ComponentType < OptionViewProps >
49
49
50
50
/**
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
52
52
*/
53
53
dark ?: boolean
54
54
} ) {
@@ -74,7 +74,7 @@ export function FairDOElasticSearch({
74
74
< SearchProvider config = { elasticConfig } >
75
75
< FairDOSearchProvider config = { rawConfig } >
76
76
< TooltipProvider >
77
- < GlobalModalProvider resultView = { actualResultView } >
77
+ < GlobalModalProvider resultView = { actualResultView } dark = { dark } >
78
78
< WithSearch
79
79
mapContextToProps = { ( { wasSearched, isLoading } : SearchContextState ) => ( {
80
80
wasSearched,
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { ResultViewProps } from "@elastic/react-search-ui-views"
9
9
import { GraphNode } from "@/components/graph/GraphNode"
10
10
import { RelationsGraphOptions } from "@/components/graph/RelationsGraphOptions"
11
11
12
- export function GlobalModalProvider ( props : PropsWithChildren < { resultView : ComponentType < ResultViewProps > } > ) {
12
+ export function GlobalModalProvider ( props : PropsWithChildren < { resultView : ComponentType < ResultViewProps > ; dark ?: boolean } > ) {
13
13
const [ relationGraphState , setRelationGraphState ] = useState < {
14
14
nodes : GraphNode [ ]
15
15
options : RelationsGraphOptions
@@ -41,6 +41,7 @@ export function GlobalModalProvider(props: PropsWithChildren<{ resultView: Compo
41
41
onOpenChange = { onRelationGraphOpenChange }
42
42
resultView = { props . resultView }
43
43
options = { relationGraphState . options }
44
+ dark = { props . dark }
44
45
/>
45
46
46
47
{ props . children }
Original file line number Diff line number Diff line change @@ -23,8 +23,13 @@ import { RelationsGraphOptions } from "@/components/graph/RelationsGraphOptions"
23
23
/**
24
24
* Renders an interactive graph for the specified results. Results will be fetched from cache via PID. Currently intended for internal use only.
25
25
*/
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" )
28
33
29
34
useEffect ( ( ) => {
30
35
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({
14
14
onOpenChange,
15
15
nodes,
16
16
resultView,
17
- options
17
+ options,
18
+ dark
18
19
} : {
19
20
isOpen : boolean
20
21
onOpenChange : ( val : boolean ) => void
21
22
nodes : GraphNode [ ]
22
23
options ?: RelationsGraphOptions
23
24
resultView : ComponentType < ResultViewProps >
25
+ dark ?: boolean
24
26
} ) {
25
27
const searchContext = useContext ( FairDOSearchContext )
26
28
@@ -48,7 +50,7 @@ export function RelationsGraphModal({
48
50
config : searchContext . config
49
51
} }
50
52
>
51
- < RelationsGraph nodes = { nodes } resultView = { resultView } options = { options } />
53
+ < RelationsGraph nodes = { nodes } resultView = { resultView } options = { options } dark = { dark } />
52
54
</ FairDOSearchContext . Provider >
53
55
54
56
< 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() {
60
60
return ( ) => search . driver . unsubscribeToStateChanges ( handler )
61
61
} , [ makeKey , search . driver ] )
62
62
63
- console . log ( "haha" )
64
-
65
63
if ( ! config . sortOptions || config . sortOptions . length === 0 ) return null
66
64
67
65
return (
You can’t perform that action at this time.
0 commit comments