migrated from redux to recoil

This commit is contained in:
2023-07-31 12:27:36 +02:00
parent 8327d1e94c
commit b5731759b0
36 changed files with 810 additions and 741 deletions

View File

@@ -0,0 +1,39 @@
import { atom, selector } from 'recoil'
type StatusState = {
connected: boolean,
updated: boolean,
downloading: boolean,
freeSpace: number,
}
export const connectedState = atom({
key: 'connectedState',
default: false
})
export const updatedBinaryState = atom({
key: 'updatedBinaryState',
default: false
})
export const isDownloadingState = atom({
key: 'isDownloadingState',
default: false
})
export const freeSpaceBytesState = atom({
key: 'freeSpaceBytesState',
default: 0
})
export const statusState = selector<StatusState>({
key: 'statusState',
get: ({ get }) => ({
connected: get(connectedState),
updated: get(updatedBinaryState),
downloading: get(isDownloadingState),
freeSpace: get(freeSpaceBytesState),
})
})