Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into d/erc
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Jun 17, 2024
2 parents dd7d2b3 + 1a2f4c4 commit 0dae2e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
24 changes: 17 additions & 7 deletions src/components/Process/Chained.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ import { ChainedProvider, useChainedProcesses } from './ChainedContext'
import { ConfirmVoteModal } from './ConfirmVoteModal'
import { VotingVoteModal } from './View'

type ChainedProcessesProps = {
root?: PublishedElection | ArchivedElection | InvalidElection
type ChainedProcessesInnerProps = {
connected: boolean
}

const ChainedProcessesInner = () => {
const { election, voted, setClient } = useElection()
const { processes, client, current, setProcess, setCurrent, root } = useChainedProcesses()
const ChainedProcessesInner = ({ connected }: ChainedProcessesInnerProps) => {
const { election, voted, setClient, clearClient } = useElection()
const { processes, client, current, setProcess, setCurrent } = useChainedProcesses()

// clear session of local context when login out
useEffect(() => {
if (connected) return
clearClient()
}, [connected])

// ensure the client is set to the root one
useEffect(() => {
Expand Down Expand Up @@ -70,6 +76,10 @@ const ChainedProcessesInner = () => {
)
}

type ChainedProcessesProps = {
root?: PublishedElection | ArchivedElection | InvalidElection
}

export const ChainedProcesses = ({ root }: ChainedProcessesProps) => {
const { client } = useElection()
if (!root) {
Expand Down Expand Up @@ -99,7 +109,7 @@ export const ChainedResults = ({ root }: ChainedProcessesProps) => {
const ChainedProcessesWrapper = () => {
// note election context refers to the root election here, ALWAYS
const { connected, election } = useElection()
const { processes, current, root, setCurrent, reset } = useChainedProcesses()
const { processes, current, reset } = useChainedProcesses()

// set current to root if login out
useEffect(() => {
Expand All @@ -115,7 +125,7 @@ const ChainedProcessesWrapper = () => {
return (
<>
<ElectionProvider key={current} election={processes[current]} ConnectButton={ConnectButton} fetchCensus>
<ChainedProcessesInner />
<ChainedProcessesInner connected={connected} />
</ElectionProvider>
<Box
bottom={0}
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ i18n
debug: import.meta.env.DEV,
defaultNS: 'translation',
lng: 'ca',
interpolation: {
escapeValue: false,
},
})

// load translations
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2705,9 +2705,9 @@
react-refresh "^0.14.2"

"@vocdoni/chakra-components@~0.8.3":
version "0.8.4"
resolved "https://registry.yarnpkg.com/@vocdoni/chakra-components/-/chakra-components-0.8.4.tgz#fbd8a4634919f412a373396c19ca610ca5380194"
integrity sha512-t5/GQX4vsJxIvykT4AhpRIYDtWYDbjaaDhUMKdH6dZAxMzH8/Rj20cJaKIDcn/yCOlNmFqSaEjKQ99MygAPy/Q==
version "0.8.5"
resolved "https://registry.yarnpkg.com/@vocdoni/chakra-components/-/chakra-components-0.8.5.tgz#c4ea39243f69420359ffef46d29a384abdd78949"
integrity sha512-qAxslKof1zQsrPqEZS894193f/rQi00MfYSoIYDyQZ8hfu6h25ocqTEfUr+bTz4hZ7i2cJwe4xac5Zqy0WPKGA==
dependencies:
"@vocdoni/react-providers" "~0.4.3"

Expand Down

0 comments on commit 0dae2e5

Please sign in to comment.