goblin-desktop 2.0.21 → 2.0.24
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/.editorconfig +9 -9
- package/.eslintrc.js +28 -28
- package/.zou-flow +3 -3
- package/README.md +108 -108
- package/builders/builders.js +3 -3
- package/builders/wizard.js +457 -457
- package/contexts.js +13 -13
- package/desktop-manager.js +10 -10
- package/desktop-window.js +13 -13
- package/desktop.js +13 -13
- package/lib/service.js +137 -137
- package/package.json +36 -36
- package/password-wizard.js +13 -13
- package/quest-run-wizard.js +13 -13
- package/taskbar.js +13 -13
- package/widgets/audio/sfx.js +177 -177
- package/widgets/board/view.js +37 -37
- package/widgets/board/widget.js +65 -65
- package/widgets/contexts/logic-handlers.js +36 -36
- package/widgets/contexts/service.js +40 -40
- package/widgets/contexts/view.js +22 -22
- package/widgets/contexts/widget.js +147 -147
- package/widgets/datagrid/datagrid-entity.js +82 -82
- package/widgets/datagrid/datagrid-headers.js +272 -272
- package/widgets/datagrid/styles.js +13 -13
- package/widgets/datagrid/widget.js +192 -192
- package/widgets/datagrid-cell/styles.js +52 -52
- package/widgets/datagrid-cell/widget.js +41 -41
- package/widgets/datagrid-item/styles.js +15 -15
- package/widgets/datagrid-item/widget.js +74 -74
- package/widgets/default/view.js +95 -91
- package/widgets/desktop/compensator.js +9 -9
- package/widgets/desktop/logic-handlers.js +237 -237
- package/widgets/desktop/reducer.js +35 -35
- package/widgets/desktop/service.js +828 -828
- package/widgets/desktop/styles.js +28 -28
- package/widgets/desktop/widget.js +175 -175
- package/widgets/desktop-clock/styles.js +69 -69
- package/widgets/desktop-clock/widget.js +387 -387
- package/widgets/desktop-clock-clock/styles.js +56 -56
- package/widgets/desktop-clock-clock/widget.js +96 -96
- package/widgets/desktop-clock-menu/styles.js +129 -129
- package/widgets/desktop-clock-menu/widget.js +63 -63
- package/widgets/desktop-connection-status/reducer.js +15 -15
- package/widgets/desktop-connection-status/styles.js +44 -44
- package/widgets/desktop-connection-status/widget.js +129 -129
- package/widgets/desktop-content/widget.js +68 -68
- package/widgets/desktop-footer/reducer.js +31 -31
- package/widgets/desktop-footer/styles.js +36 -36
- package/widgets/desktop-footer/widget.js +52 -52
- package/widgets/desktop-monitors/styles.js +155 -155
- package/widgets/desktop-monitors/widget.js +272 -272
- package/widgets/desktop-notebook/styles.js +155 -155
- package/widgets/desktop-notebook/widget.js +252 -252
- package/widgets/desktop-notifications/styles.js +147 -147
- package/widgets/desktop-notifications/widget.js +231 -231
- package/widgets/desktop-scale/reducer.js +15 -15
- package/widgets/desktop-scale/styles.js +48 -48
- package/widgets/desktop-scale/widget.js +172 -172
- package/widgets/desktop-state-monitor/styles.js +72 -72
- package/widgets/desktop-state-monitor/widget.js +123 -123
- package/widgets/desktop-taskbar/widget.js +57 -57
- package/widgets/desktop-themes-menu/widget.js +121 -121
- package/widgets/desktop-topbar/widget.js +201 -201
- package/widgets/desktop-window/service.js +56 -56
- package/widgets/desktop-window/styles.js +22 -22
- package/widgets/desktop-window/widget.js +70 -70
- package/widgets/detail/compensator.js +17 -17
- package/widgets/detail/view.js +40 -40
- package/widgets/detail/widget.js +125 -125
- package/widgets/editor/widget.js +84 -80
- package/widgets/entity-alerts/styles.js +77 -77
- package/widgets/entity-alerts/widget.js +328 -328
- package/widgets/entity-list/styles.js +66 -66
- package/widgets/entity-list/view.js +36 -36
- package/widgets/entity-list/widget.js +209 -209
- package/widgets/entity-list-item/widget.js +68 -68
- package/widgets/entity-row/styles.js +105 -105
- package/widgets/entity-row/widget.js +524 -524
- package/widgets/entity-row-button/styles.js +46 -46
- package/widgets/entity-row-button/widget.js +57 -57
- package/widgets/entity-view/reducer.js +20 -20
- package/widgets/entity-view/styles.js +90 -90
- package/widgets/entity-view/widget.js +516 -516
- package/widgets/facet-checkbox/styles.js +17 -17
- package/widgets/facet-checkbox/widget.js +43 -43
- package/widgets/facet-filter/widget.js +94 -94
- package/widgets/facet-filter-add/styles.js +30 -30
- package/widgets/facet-filter-add/widget.js +105 -105
- package/widgets/facet-filter-button/styles.js +74 -74
- package/widgets/facet-filter-button/widget.js +214 -214
- package/widgets/facet-filter-list-dialog/styles.js +59 -59
- package/widgets/facet-filter-list-dialog/widget.js +253 -253
- package/widgets/facet-filter-list-dialog-footer/styles.js +22 -22
- package/widgets/facet-filter-list-dialog-footer/widget.js +105 -105
- package/widgets/facet-filter-range-dialog/styles.js +82 -82
- package/widgets/facet-filter-range-dialog/widget.js +399 -399
- package/widgets/facet-filter-range-dialog-footer/styles.js +22 -22
- package/widgets/facet-filter-range-dialog-footer/widget.js +182 -182
- package/widgets/gamepad/widget.js +75 -75
- package/widgets/helpers/facet-helpers.js +105 -105
- package/widgets/hinter/reducer.js +35 -35
- package/widgets/hinter/styles.js +79 -79
- package/widgets/hinter/view.js +31 -31
- package/widgets/hinter/widget.js +291 -291
- package/widgets/junction/styles.js +22 -22
- package/widgets/junction/widget.js +50 -50
- package/widgets/main-tab-menu/styles.js +17 -17
- package/widgets/main-tab-menu/widget.js +136 -136
- package/widgets/map/view.js +49 -49
- package/widgets/map/widget.js +65 -65
- package/widgets/monitor/reducer.js +15 -15
- package/widgets/monitor/widget.js +66 -66
- package/widgets/navigating-layer/widget.js +25 -25
- package/widgets/notifications-button/widget.js +44 -44
- package/widgets/password-wizard/service.js +53 -53
- package/widgets/password-wizard/ui.js +66 -66
- package/widgets/plugin/reducer.js +19 -19
- package/widgets/plugin/styles.js +294 -294
- package/widgets/plugin/widget.js +637 -636
- package/widgets/quest-run-wizard/service.js +49 -49
- package/widgets/quest-run-wizard/ui.js +25 -25
- package/widgets/search/styles.js +80 -80
- package/widgets/search/widget.js +285 -285
- package/widgets/simple/view.js +29 -29
- package/widgets/status-filters/widget.js +121 -121
- package/widgets/tab/styles.js +16 -16
- package/widgets/tab/widget.js +89 -89
- package/widgets/tab-content/widget.js +35 -35
- package/widgets/tabs/widget.js +48 -48
- package/widgets/taskbar/service.js +99 -99
- package/widgets/taskbar/view.js +24 -24
- package/widgets/taskbar/widget.js +167 -167
- package/widgets/widget-doc-caller/reducer.js +15 -15
- package/widgets/widget-doc-caller/styles.js +20 -20
- package/widgets/widget-doc-caller/widget.js +55 -55
- package/widgets/wizard/widget.js +299 -299
- package/widgets/wizard-buttons/widget.js +111 -107
- package/widgets/workitem/styles.js +281 -281
- package/widgets/workitem/view.js +62 -62
- package/widgets/workitem/widget.js +971 -971
- package/widgets/workitem-dialog/widget.js +86 -86
- package/widgets/workitem-fields/widget.js +63 -63
|
@@ -1,387 +1,387 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Widget from 'goblin-laboratory/widgets/widget';
|
|
3
|
-
import * as styles from './styles';
|
|
4
|
-
import Button from 'goblin-gadgets/widgets/button/widget';
|
|
5
|
-
import Checkbox from 'goblin-gadgets/widgets/checkbox/widget';
|
|
6
|
-
import Label from 'goblin-gadgets/widgets/label/widget';
|
|
7
|
-
import RetroPanel from 'goblin-gadgets/widgets/retro-panel/widget';
|
|
8
|
-
import Combo from 'goblin-gadgets/widgets/combo/widget';
|
|
9
|
-
import DesktopClockClock from 'goblin-desktop/widgets/desktop-clock-clock/widget';
|
|
10
|
-
import DesktopClockMenu from 'goblin-desktop/widgets/desktop-clock-menu/widget';
|
|
11
|
-
import {ColorManipulator} from 'goblin-theme';
|
|
12
|
-
import {Unit} from 'goblin-theme';
|
|
13
|
-
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
|
14
|
-
import T from 't';
|
|
15
|
-
|
|
16
|
-
/******************************************************************************/
|
|
17
|
-
|
|
18
|
-
class DesktopClock extends Widget {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.styles = styles;
|
|
22
|
-
|
|
23
|
-
this.toggleClock = this.toggleClock.bind(this);
|
|
24
|
-
this.changeClockLook = this.changeClockLook.bind(this);
|
|
25
|
-
this.clockMouseOver = this.clockMouseOver.bind(this);
|
|
26
|
-
this.clockMouseOut = this.clockMouseOut.bind(this);
|
|
27
|
-
|
|
28
|
-
this.state = {
|
|
29
|
-
mouseInClock: false,
|
|
30
|
-
showMenuSize: false,
|
|
31
|
-
showMenuLook: false,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//#region get/set
|
|
36
|
-
get mouseInClock() {
|
|
37
|
-
return this.state.mouseInClock;
|
|
38
|
-
}
|
|
39
|
-
set mouseInClock(value) {
|
|
40
|
-
this.setState({
|
|
41
|
-
mouseInClock: value,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get showMenuSize() {
|
|
46
|
-
return this.state.showMenuSize;
|
|
47
|
-
}
|
|
48
|
-
set showMenuSize(value) {
|
|
49
|
-
this.setState({
|
|
50
|
-
showMenuSize: value,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
get showMenuLook() {
|
|
55
|
-
return this.state.showMenuLook;
|
|
56
|
-
}
|
|
57
|
-
set showMenuLook(value) {
|
|
58
|
-
this.setState({
|
|
59
|
-
showMenuLook: value,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
//#endregion
|
|
63
|
-
|
|
64
|
-
//#region state in user session
|
|
65
|
-
getClockState(key, def) {
|
|
66
|
-
if (this.props.desktopClockState) {
|
|
67
|
-
return this.props.desktopClockState.get(key, def);
|
|
68
|
-
} else {
|
|
69
|
-
return def;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
changeClockState(clockState) {
|
|
74
|
-
const currentState = this.props.desktopClockState
|
|
75
|
-
? this.props.desktopClockState.toJS()
|
|
76
|
-
: {};
|
|
77
|
-
const newState = {...currentState, ...clockState};
|
|
78
|
-
this.doFor(this.props.clientSessionId, 'set-desktop-clock', {
|
|
79
|
-
theme: this.context.theme.name,
|
|
80
|
-
state: newState,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
get showClock() {
|
|
85
|
-
const def = this.context.theme.look.clockParams
|
|
86
|
-
? this.context.theme.look.clockParams.initialVisibility
|
|
87
|
-
: false;
|
|
88
|
-
return this.getClockState('show', def);
|
|
89
|
-
}
|
|
90
|
-
set showClock(value) {
|
|
91
|
-
this.changeClockState({show: value});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
get clockSize() {
|
|
95
|
-
const def = this.context.theme.look.clockParams
|
|
96
|
-
? this.context.theme.look.clockParams.size
|
|
97
|
-
: null;
|
|
98
|
-
return this.getClockState('size', def);
|
|
99
|
-
}
|
|
100
|
-
set clockSize(value) {
|
|
101
|
-
this.changeClockState({size: value});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
get clockLook() {
|
|
105
|
-
const def = this.context.theme.look.clockParams
|
|
106
|
-
? this.context.theme.look.clockParams.initialLook
|
|
107
|
-
: null;
|
|
108
|
-
return this.getClockState('look', def);
|
|
109
|
-
}
|
|
110
|
-
set clockLook(value) {
|
|
111
|
-
const mode = ['ring', 'transparent', 'light', 'discreet'].includes(value)
|
|
112
|
-
? 'fix'
|
|
113
|
-
: 'stealth';
|
|
114
|
-
this.changeClockState({look: value, mode});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
get clockMode() {
|
|
118
|
-
return this.getClockState('mode', 'stealth');
|
|
119
|
-
}
|
|
120
|
-
set clockMode(value) {
|
|
121
|
-
this.changeClockState({mode: value});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
get clockDigital() {
|
|
125
|
-
return this.getClockState('digital', false);
|
|
126
|
-
}
|
|
127
|
-
set clockDigital(value) {
|
|
128
|
-
this.changeClockState({digital: value});
|
|
129
|
-
}
|
|
130
|
-
//#endregion
|
|
131
|
-
|
|
132
|
-
toggleClock() {
|
|
133
|
-
this.showClock = !this.showClock;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
changeClockLook() {
|
|
137
|
-
const looks = this.context.theme.look.clockParams.looks;
|
|
138
|
-
const i = looks.indexOf(this.clockLook);
|
|
139
|
-
this.clockLook = looks[(i + 1) % looks.length];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
clockMouseOver() {
|
|
143
|
-
this.mouseInClock = true;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
clockMouseOut() {
|
|
147
|
-
this.mouseInClock = false;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
getMenuSizeItem(text, factor) {
|
|
151
|
-
const size = Unit.multiply(
|
|
152
|
-
this.context.theme.look.clockParams.size,
|
|
153
|
-
factor
|
|
154
|
-
);
|
|
155
|
-
return {
|
|
156
|
-
text: text,
|
|
157
|
-
active: this.clockSize === size,
|
|
158
|
-
action: () => {
|
|
159
|
-
this.showMenuSize = false;
|
|
160
|
-
this.clockSize = size;
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/******************************************************************************/
|
|
166
|
-
|
|
167
|
-
renderClock() {
|
|
168
|
-
return (
|
|
169
|
-
<DesktopClockClock
|
|
170
|
-
size={this.clockSize}
|
|
171
|
-
look={this.clockLook}
|
|
172
|
-
mode={this.clockMode}
|
|
173
|
-
digital={this.clockDigital}
|
|
174
|
-
showClock={this.showClock}
|
|
175
|
-
onClick={this.toggleClock}
|
|
176
|
-
mouseOver={this.clockMouseOver}
|
|
177
|
-
mouseOut={this.clockMouseOut}
|
|
178
|
-
serverTick={this.props.serverTick}
|
|
179
|
-
/>
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
renderButtonRetro() {
|
|
184
|
-
return (
|
|
185
|
-
<RetroPanel
|
|
186
|
-
position="relative"
|
|
187
|
-
height="54px"
|
|
188
|
-
width="250px"
|
|
189
|
-
kind="metal-plate"
|
|
190
|
-
margin="3px"
|
|
191
|
-
radius="12px"
|
|
192
|
-
flexDirection="row"
|
|
193
|
-
justifyContent="center"
|
|
194
|
-
alignItems="center"
|
|
195
|
-
fillColor={ColorManipulator.darken(
|
|
196
|
-
this.context.theme.palette.base,
|
|
197
|
-
0.5
|
|
198
|
-
)}
|
|
199
|
-
>
|
|
200
|
-
<Label
|
|
201
|
-
width="80px"
|
|
202
|
-
text="Time"
|
|
203
|
-
wrap="no"
|
|
204
|
-
fontSize="150%"
|
|
205
|
-
textColor="#ccc"
|
|
206
|
-
/>
|
|
207
|
-
<Checkbox
|
|
208
|
-
backgroundBrigtness="dark"
|
|
209
|
-
checked={this.showClock}
|
|
210
|
-
onChange={this.toggleClock}
|
|
211
|
-
/>
|
|
212
|
-
<div className={this.styles.classNames.sajexRetro} />
|
|
213
|
-
<Button
|
|
214
|
-
kind="round"
|
|
215
|
-
width="36px"
|
|
216
|
-
height="36px"
|
|
217
|
-
glyph={this.showClock ? 'regular/clock' : null}
|
|
218
|
-
onClick={
|
|
219
|
-
this.showClock ? () => (this.showMenuLook = true) : this.toggleClock
|
|
220
|
-
}
|
|
221
|
-
/>
|
|
222
|
-
</RetroPanel>
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
renderButtonModern() {
|
|
227
|
-
if (this.showClock) {
|
|
228
|
-
return (
|
|
229
|
-
<>
|
|
230
|
-
<div
|
|
231
|
-
className={this.styles.classNames.simpleButton}
|
|
232
|
-
onClick={this.toggleClock}
|
|
233
|
-
>
|
|
234
|
-
<FontAwesomeIcon icon={['fas', 'eye-slash']} />
|
|
235
|
-
</div>
|
|
236
|
-
<div
|
|
237
|
-
ref={(x) => (this.sizeButton = x)}
|
|
238
|
-
className={this.styles.classNames.simpleButton}
|
|
239
|
-
onClick={() => (this.showMenuSize = true)}
|
|
240
|
-
>
|
|
241
|
-
<FontAwesomeIcon icon={['fas', 'ellipsis-v']} />
|
|
242
|
-
</div>
|
|
243
|
-
<div
|
|
244
|
-
className={this.styles.classNames.simpleButton}
|
|
245
|
-
onClick={() => (this.showMenuLook = true)}
|
|
246
|
-
>
|
|
247
|
-
<FontAwesomeIcon icon={['far', 'clock']} />
|
|
248
|
-
</div>
|
|
249
|
-
</>
|
|
250
|
-
);
|
|
251
|
-
} else {
|
|
252
|
-
return (
|
|
253
|
-
<div
|
|
254
|
-
className={
|
|
255
|
-
this.mouseInClock && !this.showClock
|
|
256
|
-
? this.styles.classNames.tripleButtonHover
|
|
257
|
-
: this.styles.classNames.tripleButton
|
|
258
|
-
}
|
|
259
|
-
onClick={this.toggleClock}
|
|
260
|
-
></div>
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
renderButton() {
|
|
266
|
-
if (this.context.theme.look.name === 'retro') {
|
|
267
|
-
return this.renderButtonRetro();
|
|
268
|
-
} else {
|
|
269
|
-
return this.renderButtonModern();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
renderMenuSize() {
|
|
274
|
-
if (!this.showMenuSize) {
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const list = [
|
|
279
|
-
{
|
|
280
|
-
glyph:
|
|
281
|
-
this.clockMode === 'stealth'
|
|
282
|
-
? 'regular/dot-circle'
|
|
283
|
-
: 'regular/circle',
|
|
284
|
-
text: T('Mode furtif'),
|
|
285
|
-
action: () => {
|
|
286
|
-
this.showMenuSize = false;
|
|
287
|
-
this.clockMode = 'stealth';
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
glyph:
|
|
292
|
-
this.clockMode === 'fix' ? 'regular/dot-circle' : 'regular/circle',
|
|
293
|
-
text: T('Mode fixe'),
|
|
294
|
-
action: () => {
|
|
295
|
-
this.showMenuSize = false;
|
|
296
|
-
this.clockMode = 'fix';
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
separator: true,
|
|
301
|
-
kind: 'menu-line',
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
glyph: this.clockDigital ? 'solid/check' : 'solid/times',
|
|
305
|
-
text: T('Digital'),
|
|
306
|
-
action: () => {
|
|
307
|
-
this.showMenuSize = false;
|
|
308
|
-
this.clockDigital = !this.clockDigital;
|
|
309
|
-
},
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
separator: true,
|
|
313
|
-
kind: 'menu-line',
|
|
314
|
-
},
|
|
315
|
-
this.getMenuSizeItem(T('Petite horloge'), 0.5),
|
|
316
|
-
this.getMenuSizeItem(T('Horloge standard'), 1.0),
|
|
317
|
-
this.getMenuSizeItem(T('Grande horloge'), 1.5),
|
|
318
|
-
this.getMenuSizeItem(T('Immense horloge'), 2.0),
|
|
319
|
-
];
|
|
320
|
-
|
|
321
|
-
const rect = this.sizeButton.getBoundingClientRect();
|
|
322
|
-
const bottom = Unit.add(
|
|
323
|
-
this.context.theme.shapes.footerHeight,
|
|
324
|
-
this.context.theme.shapes.flyingBalloonTriangleSize
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
return (
|
|
328
|
-
<Combo
|
|
329
|
-
menuType="wrap"
|
|
330
|
-
width="150px"
|
|
331
|
-
left={(rect.left + rect.right) / 2}
|
|
332
|
-
bottom={bottom}
|
|
333
|
-
list={list}
|
|
334
|
-
close={() => (this.showMenuSize = false)}
|
|
335
|
-
/>
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
renderMenuLook() {
|
|
340
|
-
if (!this.showMenuLook) {
|
|
341
|
-
return null;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
return (
|
|
345
|
-
<DesktopClockMenu
|
|
346
|
-
right="0px"
|
|
347
|
-
bottom={this.context.theme.shapes.footerHeight}
|
|
348
|
-
looks={this.context.theme.look.clockParams.looks}
|
|
349
|
-
clockSize={this.context.theme.look.clockParams.size}
|
|
350
|
-
selected={this.clockLook}
|
|
351
|
-
onSelect={(look) => {
|
|
352
|
-
this.showMenuLook = false;
|
|
353
|
-
this.clockLook = look;
|
|
354
|
-
}}
|
|
355
|
-
onClose={() => (this.showMenuLook = false)}
|
|
356
|
-
serverTick={this.props.serverTick}
|
|
357
|
-
/>
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
render() {
|
|
362
|
-
if (this.context.theme.look.clock !== 'analog-clock') {
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return (
|
|
367
|
-
<div className={this.styles.classNames.desktopClock}>
|
|
368
|
-
{this.renderButton()}
|
|
369
|
-
{this.renderClock()}
|
|
370
|
-
{this.renderMenuSize()}
|
|
371
|
-
{this.renderMenuLook()}
|
|
372
|
-
</div>
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/******************************************************************************/
|
|
378
|
-
|
|
379
|
-
export default Widget.connect((state) => {
|
|
380
|
-
const userSession = Widget.getUserSession(state);
|
|
381
|
-
const clientSessionId = userSession.get('id');
|
|
382
|
-
const theme = userSession.get('theme') || 'default';
|
|
383
|
-
const desktopClockState = userSession.get(`desktopClock.${theme}`);
|
|
384
|
-
const serverTick = state.get(`backend.desktop-manager.serverTick`);
|
|
385
|
-
|
|
386
|
-
return {clientSessionId, desktopClockState, serverTick};
|
|
387
|
-
})(DesktopClock);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Widget from 'goblin-laboratory/widgets/widget';
|
|
3
|
+
import * as styles from './styles';
|
|
4
|
+
import Button from 'goblin-gadgets/widgets/button/widget';
|
|
5
|
+
import Checkbox from 'goblin-gadgets/widgets/checkbox/widget';
|
|
6
|
+
import Label from 'goblin-gadgets/widgets/label/widget';
|
|
7
|
+
import RetroPanel from 'goblin-gadgets/widgets/retro-panel/widget';
|
|
8
|
+
import Combo from 'goblin-gadgets/widgets/combo/widget';
|
|
9
|
+
import DesktopClockClock from 'goblin-desktop/widgets/desktop-clock-clock/widget';
|
|
10
|
+
import DesktopClockMenu from 'goblin-desktop/widgets/desktop-clock-menu/widget';
|
|
11
|
+
import {ColorManipulator} from 'goblin-theme';
|
|
12
|
+
import {Unit} from 'goblin-theme';
|
|
13
|
+
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
|
14
|
+
import T from 't';
|
|
15
|
+
|
|
16
|
+
/******************************************************************************/
|
|
17
|
+
|
|
18
|
+
class DesktopClock extends Widget {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.styles = styles;
|
|
22
|
+
|
|
23
|
+
this.toggleClock = this.toggleClock.bind(this);
|
|
24
|
+
this.changeClockLook = this.changeClockLook.bind(this);
|
|
25
|
+
this.clockMouseOver = this.clockMouseOver.bind(this);
|
|
26
|
+
this.clockMouseOut = this.clockMouseOut.bind(this);
|
|
27
|
+
|
|
28
|
+
this.state = {
|
|
29
|
+
mouseInClock: false,
|
|
30
|
+
showMenuSize: false,
|
|
31
|
+
showMenuLook: false,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#region get/set
|
|
36
|
+
get mouseInClock() {
|
|
37
|
+
return this.state.mouseInClock;
|
|
38
|
+
}
|
|
39
|
+
set mouseInClock(value) {
|
|
40
|
+
this.setState({
|
|
41
|
+
mouseInClock: value,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get showMenuSize() {
|
|
46
|
+
return this.state.showMenuSize;
|
|
47
|
+
}
|
|
48
|
+
set showMenuSize(value) {
|
|
49
|
+
this.setState({
|
|
50
|
+
showMenuSize: value,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get showMenuLook() {
|
|
55
|
+
return this.state.showMenuLook;
|
|
56
|
+
}
|
|
57
|
+
set showMenuLook(value) {
|
|
58
|
+
this.setState({
|
|
59
|
+
showMenuLook: value,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
|
|
64
|
+
//#region state in user session
|
|
65
|
+
getClockState(key, def) {
|
|
66
|
+
if (this.props.desktopClockState) {
|
|
67
|
+
return this.props.desktopClockState.get(key, def);
|
|
68
|
+
} else {
|
|
69
|
+
return def;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
changeClockState(clockState) {
|
|
74
|
+
const currentState = this.props.desktopClockState
|
|
75
|
+
? this.props.desktopClockState.toJS()
|
|
76
|
+
: {};
|
|
77
|
+
const newState = {...currentState, ...clockState};
|
|
78
|
+
this.doFor(this.props.clientSessionId, 'set-desktop-clock', {
|
|
79
|
+
theme: this.context.theme.name,
|
|
80
|
+
state: newState,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get showClock() {
|
|
85
|
+
const def = this.context.theme.look.clockParams
|
|
86
|
+
? this.context.theme.look.clockParams.initialVisibility
|
|
87
|
+
: false;
|
|
88
|
+
return this.getClockState('show', def);
|
|
89
|
+
}
|
|
90
|
+
set showClock(value) {
|
|
91
|
+
this.changeClockState({show: value});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get clockSize() {
|
|
95
|
+
const def = this.context.theme.look.clockParams
|
|
96
|
+
? this.context.theme.look.clockParams.size
|
|
97
|
+
: null;
|
|
98
|
+
return this.getClockState('size', def);
|
|
99
|
+
}
|
|
100
|
+
set clockSize(value) {
|
|
101
|
+
this.changeClockState({size: value});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get clockLook() {
|
|
105
|
+
const def = this.context.theme.look.clockParams
|
|
106
|
+
? this.context.theme.look.clockParams.initialLook
|
|
107
|
+
: null;
|
|
108
|
+
return this.getClockState('look', def);
|
|
109
|
+
}
|
|
110
|
+
set clockLook(value) {
|
|
111
|
+
const mode = ['ring', 'transparent', 'light', 'discreet'].includes(value)
|
|
112
|
+
? 'fix'
|
|
113
|
+
: 'stealth';
|
|
114
|
+
this.changeClockState({look: value, mode});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
get clockMode() {
|
|
118
|
+
return this.getClockState('mode', 'stealth');
|
|
119
|
+
}
|
|
120
|
+
set clockMode(value) {
|
|
121
|
+
this.changeClockState({mode: value});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
get clockDigital() {
|
|
125
|
+
return this.getClockState('digital', false);
|
|
126
|
+
}
|
|
127
|
+
set clockDigital(value) {
|
|
128
|
+
this.changeClockState({digital: value});
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
|
|
132
|
+
toggleClock() {
|
|
133
|
+
this.showClock = !this.showClock;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
changeClockLook() {
|
|
137
|
+
const looks = this.context.theme.look.clockParams.looks;
|
|
138
|
+
const i = looks.indexOf(this.clockLook);
|
|
139
|
+
this.clockLook = looks[(i + 1) % looks.length];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
clockMouseOver() {
|
|
143
|
+
this.mouseInClock = true;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
clockMouseOut() {
|
|
147
|
+
this.mouseInClock = false;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
getMenuSizeItem(text, factor) {
|
|
151
|
+
const size = Unit.multiply(
|
|
152
|
+
this.context.theme.look.clockParams.size,
|
|
153
|
+
factor
|
|
154
|
+
);
|
|
155
|
+
return {
|
|
156
|
+
text: text,
|
|
157
|
+
active: this.clockSize === size,
|
|
158
|
+
action: () => {
|
|
159
|
+
this.showMenuSize = false;
|
|
160
|
+
this.clockSize = size;
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/******************************************************************************/
|
|
166
|
+
|
|
167
|
+
renderClock() {
|
|
168
|
+
return (
|
|
169
|
+
<DesktopClockClock
|
|
170
|
+
size={this.clockSize}
|
|
171
|
+
look={this.clockLook}
|
|
172
|
+
mode={this.clockMode}
|
|
173
|
+
digital={this.clockDigital}
|
|
174
|
+
showClock={this.showClock}
|
|
175
|
+
onClick={this.toggleClock}
|
|
176
|
+
mouseOver={this.clockMouseOver}
|
|
177
|
+
mouseOut={this.clockMouseOut}
|
|
178
|
+
serverTick={this.props.serverTick}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
renderButtonRetro() {
|
|
184
|
+
return (
|
|
185
|
+
<RetroPanel
|
|
186
|
+
position="relative"
|
|
187
|
+
height="54px"
|
|
188
|
+
width="250px"
|
|
189
|
+
kind="metal-plate"
|
|
190
|
+
margin="3px"
|
|
191
|
+
radius="12px"
|
|
192
|
+
flexDirection="row"
|
|
193
|
+
justifyContent="center"
|
|
194
|
+
alignItems="center"
|
|
195
|
+
fillColor={ColorManipulator.darken(
|
|
196
|
+
this.context.theme.palette.base,
|
|
197
|
+
0.5
|
|
198
|
+
)}
|
|
199
|
+
>
|
|
200
|
+
<Label
|
|
201
|
+
width="80px"
|
|
202
|
+
text="Time"
|
|
203
|
+
wrap="no"
|
|
204
|
+
fontSize="150%"
|
|
205
|
+
textColor="#ccc"
|
|
206
|
+
/>
|
|
207
|
+
<Checkbox
|
|
208
|
+
backgroundBrigtness="dark"
|
|
209
|
+
checked={this.showClock}
|
|
210
|
+
onChange={this.toggleClock}
|
|
211
|
+
/>
|
|
212
|
+
<div className={this.styles.classNames.sajexRetro} />
|
|
213
|
+
<Button
|
|
214
|
+
kind="round"
|
|
215
|
+
width="36px"
|
|
216
|
+
height="36px"
|
|
217
|
+
glyph={this.showClock ? 'regular/clock' : null}
|
|
218
|
+
onClick={
|
|
219
|
+
this.showClock ? () => (this.showMenuLook = true) : this.toggleClock
|
|
220
|
+
}
|
|
221
|
+
/>
|
|
222
|
+
</RetroPanel>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
renderButtonModern() {
|
|
227
|
+
if (this.showClock) {
|
|
228
|
+
return (
|
|
229
|
+
<>
|
|
230
|
+
<div
|
|
231
|
+
className={this.styles.classNames.simpleButton}
|
|
232
|
+
onClick={this.toggleClock}
|
|
233
|
+
>
|
|
234
|
+
<FontAwesomeIcon icon={['fas', 'eye-slash']} />
|
|
235
|
+
</div>
|
|
236
|
+
<div
|
|
237
|
+
ref={(x) => (this.sizeButton = x)}
|
|
238
|
+
className={this.styles.classNames.simpleButton}
|
|
239
|
+
onClick={() => (this.showMenuSize = true)}
|
|
240
|
+
>
|
|
241
|
+
<FontAwesomeIcon icon={['fas', 'ellipsis-v']} />
|
|
242
|
+
</div>
|
|
243
|
+
<div
|
|
244
|
+
className={this.styles.classNames.simpleButton}
|
|
245
|
+
onClick={() => (this.showMenuLook = true)}
|
|
246
|
+
>
|
|
247
|
+
<FontAwesomeIcon icon={['far', 'clock']} />
|
|
248
|
+
</div>
|
|
249
|
+
</>
|
|
250
|
+
);
|
|
251
|
+
} else {
|
|
252
|
+
return (
|
|
253
|
+
<div
|
|
254
|
+
className={
|
|
255
|
+
this.mouseInClock && !this.showClock
|
|
256
|
+
? this.styles.classNames.tripleButtonHover
|
|
257
|
+
: this.styles.classNames.tripleButton
|
|
258
|
+
}
|
|
259
|
+
onClick={this.toggleClock}
|
|
260
|
+
></div>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
renderButton() {
|
|
266
|
+
if (this.context.theme.look.name === 'retro') {
|
|
267
|
+
return this.renderButtonRetro();
|
|
268
|
+
} else {
|
|
269
|
+
return this.renderButtonModern();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
renderMenuSize() {
|
|
274
|
+
if (!this.showMenuSize) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const list = [
|
|
279
|
+
{
|
|
280
|
+
glyph:
|
|
281
|
+
this.clockMode === 'stealth'
|
|
282
|
+
? 'regular/dot-circle'
|
|
283
|
+
: 'regular/circle',
|
|
284
|
+
text: T('Mode furtif'),
|
|
285
|
+
action: () => {
|
|
286
|
+
this.showMenuSize = false;
|
|
287
|
+
this.clockMode = 'stealth';
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
glyph:
|
|
292
|
+
this.clockMode === 'fix' ? 'regular/dot-circle' : 'regular/circle',
|
|
293
|
+
text: T('Mode fixe'),
|
|
294
|
+
action: () => {
|
|
295
|
+
this.showMenuSize = false;
|
|
296
|
+
this.clockMode = 'fix';
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
separator: true,
|
|
301
|
+
kind: 'menu-line',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
glyph: this.clockDigital ? 'solid/check' : 'solid/times',
|
|
305
|
+
text: T('Digital'),
|
|
306
|
+
action: () => {
|
|
307
|
+
this.showMenuSize = false;
|
|
308
|
+
this.clockDigital = !this.clockDigital;
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
separator: true,
|
|
313
|
+
kind: 'menu-line',
|
|
314
|
+
},
|
|
315
|
+
this.getMenuSizeItem(T('Petite horloge'), 0.5),
|
|
316
|
+
this.getMenuSizeItem(T('Horloge standard'), 1.0),
|
|
317
|
+
this.getMenuSizeItem(T('Grande horloge'), 1.5),
|
|
318
|
+
this.getMenuSizeItem(T('Immense horloge'), 2.0),
|
|
319
|
+
];
|
|
320
|
+
|
|
321
|
+
const rect = this.sizeButton.getBoundingClientRect();
|
|
322
|
+
const bottom = Unit.add(
|
|
323
|
+
this.context.theme.shapes.footerHeight,
|
|
324
|
+
this.context.theme.shapes.flyingBalloonTriangleSize
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
return (
|
|
328
|
+
<Combo
|
|
329
|
+
menuType="wrap"
|
|
330
|
+
width="150px"
|
|
331
|
+
left={(rect.left + rect.right) / 2}
|
|
332
|
+
bottom={bottom}
|
|
333
|
+
list={list}
|
|
334
|
+
close={() => (this.showMenuSize = false)}
|
|
335
|
+
/>
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
renderMenuLook() {
|
|
340
|
+
if (!this.showMenuLook) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return (
|
|
345
|
+
<DesktopClockMenu
|
|
346
|
+
right="0px"
|
|
347
|
+
bottom={this.context.theme.shapes.footerHeight}
|
|
348
|
+
looks={this.context.theme.look.clockParams.looks}
|
|
349
|
+
clockSize={this.context.theme.look.clockParams.size}
|
|
350
|
+
selected={this.clockLook}
|
|
351
|
+
onSelect={(look) => {
|
|
352
|
+
this.showMenuLook = false;
|
|
353
|
+
this.clockLook = look;
|
|
354
|
+
}}
|
|
355
|
+
onClose={() => (this.showMenuLook = false)}
|
|
356
|
+
serverTick={this.props.serverTick}
|
|
357
|
+
/>
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
render() {
|
|
362
|
+
if (this.context.theme.look.clock !== 'analog-clock') {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return (
|
|
367
|
+
<div className={this.styles.classNames.desktopClock}>
|
|
368
|
+
{this.renderButton()}
|
|
369
|
+
{this.renderClock()}
|
|
370
|
+
{this.renderMenuSize()}
|
|
371
|
+
{this.renderMenuLook()}
|
|
372
|
+
</div>
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/******************************************************************************/
|
|
378
|
+
|
|
379
|
+
export default Widget.connect((state) => {
|
|
380
|
+
const userSession = Widget.getUserSession(state);
|
|
381
|
+
const clientSessionId = userSession.get('id');
|
|
382
|
+
const theme = userSession.get('theme') || 'default';
|
|
383
|
+
const desktopClockState = userSession.get(`desktopClock.${theme}`);
|
|
384
|
+
const serverTick = state.get(`backend.desktop-manager.serverTick`);
|
|
385
|
+
|
|
386
|
+
return {clientSessionId, desktopClockState, serverTick};
|
|
387
|
+
})(DesktopClock);
|