ssb-chess-mithril 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -3
- package/package.json +1 -1
- package/ui/pageLayout/navigation.js +7 -5
package/index.js
CHANGED
|
@@ -61,11 +61,13 @@ module.exports = (attachToElement, dataAccess, opts = {}) => {
|
|
|
61
61
|
const gamesMyMoveObs = mainCtrl.getGameCtrl().getGamesWhereMyMove();
|
|
62
62
|
const observableGamesObs = mainCtrl.getGameCtrl().getFriendsObservableGames();
|
|
63
63
|
const userRecentActivity = mainCtrl.getRecentActivityCtrl().getRecentActivityForUserGames();
|
|
64
|
+
const pendingChallengesReceived = mainCtrl.getInviteCtrl().pendingChallengesReceived()
|
|
65
|
+
const unseenNotifications = mainCtrl.getRecentActivityCtrl().unseenNotifications()
|
|
64
66
|
|
|
65
67
|
// Hack: keep observables loaded with the latest value.
|
|
66
68
|
const watches = [
|
|
67
69
|
gamesInProgressObs(e => e),
|
|
68
|
-
gamesMyMoveObs(),
|
|
70
|
+
gamesMyMoveObs(e => e),
|
|
69
71
|
observableGamesObs(e => e),
|
|
70
72
|
userRecentActivity(e => e)
|
|
71
73
|
];
|
|
@@ -74,7 +76,12 @@ module.exports = (attachToElement, dataAccess, opts = {}) => {
|
|
|
74
76
|
|
|
75
77
|
m.route.prefix = '?';
|
|
76
78
|
|
|
77
|
-
const navigationBar = NavigationBar(mainCtrl, settingsCtrl
|
|
79
|
+
const navigationBar = NavigationBar(mainCtrl, settingsCtrl, {
|
|
80
|
+
gamesWhereMyMove: gamesMyMoveObs,
|
|
81
|
+
friendsObservableGames: observableGamesObs,
|
|
82
|
+
pendingChallengesReceived: pendingChallengesReceived,
|
|
83
|
+
unseenNotifications: unseenNotifications
|
|
84
|
+
})
|
|
78
85
|
|
|
79
86
|
m.route(mountElement, defaultView, {
|
|
80
87
|
'/my_games': layoutTemplate(navigationBar, MiniboardListComponent(mainCtrl, gamesInProgressObs, mainCtrl.getMyIdent())),
|
|
@@ -151,7 +158,7 @@ module.exports = (attachToElement, dataAccess, opts = {}) => {
|
|
|
151
158
|
},
|
|
152
159
|
destroy: () => {
|
|
153
160
|
// unmount the app
|
|
154
|
-
m.
|
|
161
|
+
m.mount(attachToElement, null);
|
|
155
162
|
globalWatches.then((watches) => watches.forEach(w => w()))
|
|
156
163
|
}
|
|
157
164
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
const m = require('mithril');
|
|
2
2
|
const SettingsDialog = require('../settings/settings-dialog');
|
|
3
3
|
|
|
4
|
-
module.exports = (mainCtrl, settings) => {
|
|
4
|
+
module.exports = (mainCtrl, settings, globalObservables) => {
|
|
5
5
|
m.route.prefix = '?';
|
|
6
6
|
|
|
7
|
+
const { gamesWhereMyMove, friendsObservableGames, pendingChallengesReceived, unseenNotifications } = globalObservables;
|
|
8
|
+
|
|
7
9
|
const gamesInProgress = {
|
|
8
10
|
name: 'Games',
|
|
9
11
|
link: '/my_games',
|
|
@@ -14,21 +16,21 @@ module.exports = (mainCtrl, settings) => {
|
|
|
14
16
|
name: 'My Move',
|
|
15
17
|
link: '/games_my_move',
|
|
16
18
|
count: 0,
|
|
17
|
-
countUpdateFn:
|
|
19
|
+
countUpdateFn: () => gamesWhereMyMove,
|
|
18
20
|
countHoverText: () => `${gamesMyMove.count} games awaiting your move.`,
|
|
19
21
|
};
|
|
20
22
|
const invitations = {
|
|
21
23
|
name: 'Invitations',
|
|
22
24
|
link: '/invitations',
|
|
23
25
|
count: 0,
|
|
24
|
-
countUpdateFn:
|
|
26
|
+
countUpdateFn: () => pendingChallengesReceived,
|
|
25
27
|
countHoverText: () => `${invitations.count} pending invitations received.`,
|
|
26
28
|
};
|
|
27
29
|
const observable = {
|
|
28
30
|
name: 'Observe',
|
|
29
31
|
link: '/observable',
|
|
30
32
|
count: 0,
|
|
31
|
-
countUpdateFn:
|
|
33
|
+
countUpdateFn: () => friendsObservableGames,
|
|
32
34
|
countOnHoverOnly: true,
|
|
33
35
|
countHoverText: () => `${observable.count} observable games.`,
|
|
34
36
|
};
|
|
@@ -36,7 +38,7 @@ module.exports = (mainCtrl, settings) => {
|
|
|
36
38
|
name: 'Recent Activity',
|
|
37
39
|
link: '/activity',
|
|
38
40
|
count: 0,
|
|
39
|
-
countUpdateFn:
|
|
41
|
+
countUpdateFn: () => unseenNotifications,
|
|
40
42
|
countHoverText: () => 'Recent Activity',
|
|
41
43
|
};
|
|
42
44
|
|