mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-01-22 09:19:28 +00:00
Fix advisories to work with redux
This commit is contained in:
parent
3bb3de24ce
commit
9c58fdf7dd
@ -3,17 +3,25 @@ import { useState, useEffect } from 'react'
|
|||||||
import { Stack, XStack, YStack } from 'tamagui'
|
import { Stack, XStack, YStack } from 'tamagui'
|
||||||
|
|
||||||
import AdvisoriesContent from './AdvisoriesContent'
|
import AdvisoriesContent from './AdvisoriesContent'
|
||||||
|
import { useSelector } from 'react-redux'
|
||||||
|
import { RootState } from '../../../redux/store'
|
||||||
|
|
||||||
type AdvisoryTopicsType = {
|
type AdvisoryTopicsType = {
|
||||||
[key: string]: string[]
|
[key: string]: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type AdvisoriesProps = {
|
|
||||||
advisoriesIcons: string[]
|
|
||||||
subStepAdvisories: number
|
|
||||||
}
|
|
||||||
|
|
||||||
const Advisories = ({ advisoriesIcons, subStepAdvisories }: AdvisoriesProps) => {
|
|
||||||
|
const Advisories = () => {
|
||||||
|
const { subStepAdvisories } = useSelector(
|
||||||
|
(state: RootState) => state.advisories,
|
||||||
|
)
|
||||||
|
|
||||||
|
const unicodeNumbers = ['➀', '➁', '➂', '➃', '➄', '➅']
|
||||||
|
const advisoriesIcons = unicodeNumbers.map((number, index) =>
|
||||||
|
index <= subStepAdvisories ? '✓' : number,
|
||||||
|
)
|
||||||
|
|
||||||
const [selectedTitle, setSelectedTitle] = useState(Object.keys(advisoryTopics)[0])
|
const [selectedTitle, setSelectedTitle] = useState(Object.keys(advisoryTopics)[0])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSelectedTitle(Object.keys(advisoryTopics)[subStepAdvisories])
|
setSelectedTitle(Object.keys(advisoryTopics)[subStepAdvisories])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user