@@ -2,7 +2,7 @@ import React, { useLayoutEffect } from "react";
22import { Dispatch , MutableRefObject , SetStateAction , useContext , useEffect , useRef , useState } from "react" ;
33import { Explanation , explain , isExplained , keywordExplanations , setExplained } from "../explain.js" ;
44import { useClientSelector } from "../store.js" ;
5- import { CacheContext , HelpContext , HighlightContext , PlayerContext } from "./Game.js" ;
5+ import { CacheContext , HighlightContext , PlayerContext } from "./Game.js" ;
66import Rectangle from "../Rectangle.js" ;
77import { Container } from "@pixi/react-animated" ;
88import { Spring } from "react-spring" ;
@@ -115,41 +115,21 @@ export function ExplanationPopup(props: ExplanationProps) {
115115export default function Explanations ( ) {
116116 const player = useContext ( PlayerContext ) ;
117117 const cache = useContext ( CacheContext ) ;
118- const { help } = useContext ( HelpContext ) ;
119118 const game = useClientSelector ( ( state ) => state . game ) ;
120119 const [ clickExplanations , setClickExplanations ] = useState ( [ ] as Explanation [ ] ) ;
121- const [ tempExplanations , setTempExplanations ] = useState ( [ ] as Explanation [ ] ) ;
122120
123121 useEffect ( ( ) => {
124122 const newExplanations = explain ( cache , game , player ) . filter ( ( e ) => ! isExplained ( e ) ) ;
125123 setClickExplanations ( ( es ) => [ ...es , ...newExplanations . filter ( ( e1 ) => ! es . find ( ( e2 ) => e1 . text == e2 . text ) ) ] ) ;
126124 } , [ game ] ) ;
127125
128- useEffect ( ( ) => {
129- if ( help != null ) {
130- setTempExplanations (
131- keywordExplanations . filter ( ( e ) =>
132- e . relevantCards ( cache , game , player , true ) . some ( ( c ) => c . id == help . id )
133- )
134- ) ;
135- } else {
136- setTimeout ( ( ) => {
137- setTempExplanations ( [ ] ) ;
138- } , 300 ) ;
139- }
140- } , [ help ] ) ;
141-
142126 const clicks = clickExplanations . map ( ( e , i ) => (
143127 < ExplanationPopup explanation = { e } setClickExplanations = { setClickExplanations } index = { i } key = { `click-${ e . id } ` } />
144128 ) ) ;
145129
146- const temps = tempExplanations . map ( ( e , i ) => (
147- < ExplanationPopup explanation = { e } help = { help } index = { clickExplanations . length + i } key = { `temp-${ e . id } ` } />
148- ) ) ;
149-
150130 return (
151131 < Container x = { targetResolution . width - explanationWidth } zIndex = { 10000 } >
152- { [ ... clicks , ... temps ] }
132+ { clicks }
153133 </ Container >
154134 ) ;
155135}
0 commit comments