Sha256: 86837ece5317b2efca2d9ccc92755168d2799cbd3216e0c2e56ffc031dd4960b

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

import { observable, computed } from 'mobx';
import { map, filter, intersection } from 'lodash';
import Group from './group';
import Config from '../config';

const Screens = observable({

    all: observable.map(),

    get activeGroups() {
        const gids = Group.enabled_group_ids || map(Group.all, 'id');
        const groups = map(gids, gid => Group.forId(gid));
        return filter(groups, group => intersection(group.screens, this.active).length);
    },

    @computed get active() {
        return map(Config.screen_ids, id => this.all.get(id));
    },

    reset() {
        Config.screen_ids.clear();
    },

});

export default Screens;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hippo-fw-0.9.5 client/hippo/screens/index.js
hippo-fw-0.9.4 client/hippo/screens/index.js