client/src/selectors/syncSelectors.js
author ymh <ymh.work@gmail.com>
Thu, 29 Jul 2021 16:46:20 +0200
changeset 207 c39d91bd16af
parent 168 ea92f4fe783d
permissions -rw-r--r--
update dependencies and create new version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
134
be36eed5e6e0 add menu to change current group and create a new group
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
// selectors linked to syncronization status
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
     2
import * as R from 'ramda';
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
     3
134
be36eed5e6e0 add menu to change current group and create a new group
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
import { ActionEnum } from '../constants';
be36eed5e6e0 add menu to change current group and create a new group
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
     6
export const getLastSync = R.pathOr(0, ['authStatus', 'lastSync']);
134
be36eed5e6e0 add menu to change current group and create a new group
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
     8
export const isSynchronizing = R.path(['status', 'isSynchronizing']);
134
be36eed5e6e0 add menu to change current group and create a new group
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
168
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    10
const isAllActionNone = R.all(R.propEq('action', ActionEnum.NONE))
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    11
const notesIsAllActionNone = R.compose(isAllActionNone, R.prop('notes'));
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    12
const sessionsIsAllActionNone = R.compose(isAllActionNone, R.prop('sessions'));
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    13
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    14
export const isSynchronized = R.converge(R.and, [notesIsAllActionNone, sessionsIsAllActionNone])
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    15
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    16
// export const isSynchronized = state =>
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    17
//     state['notes'].every((n) => n['action']===ActionEnum.NONE) &&
ea92f4fe783d - move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents: 134
diff changeset
    18
//     state['sessions'].every((n) => n['action']===ActionEnum.NONE)