|
|
@ -8,6 +8,7 @@ const { Option } = Select; |
|
|
|
function DataTop5(props) { |
|
|
|
const { structures, accessToken, videoList } = props; |
|
|
|
const [showVideoList, setShowVideoList] = useState([]); |
|
|
|
const [structure, setStructure] = useState(structures[0]?.id); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (videoList.length && structures.length) setShowVideoList(videoList.filter(v => v.structId === structures[0].id)); |
|
|
@ -22,7 +23,8 @@ function DataTop5(props) { |
|
|
|
optionFilterProp="children" |
|
|
|
key={Math.random()} |
|
|
|
defaultValue={structures[0]?.id} |
|
|
|
onChange={(value) => { setShowVideoList(videoList.filter(v => v.structId === value)) }} |
|
|
|
value={structure} |
|
|
|
onChange={(value) => { setShowVideoList(videoList.filter(v => v.structId === value)); setStructure(value) }} |
|
|
|
> |
|
|
|
{structures.map(s => <Option key={s.id} value={s.id}>{s.name}</Option>)} |
|
|
|
</Select> |
|
|
|