jp.ms.common.modules 1.0.41 → 1.0.42
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/dist/modules/anti-freeze-system/anti-freeze-system.module.d.ts +3 -1
- package/dist/modules/anti-freeze-system/anti-freeze-system.module.js +8 -4
- package/dist/modules/anti-freeze-system/anti-freeze-system.module.js.map +1 -1
- package/dist/modules/anti-freeze-system/anti-freeze-system.service.d.ts +6 -2
- package/dist/modules/anti-freeze-system/anti-freeze-system.service.js +37 -10
- package/dist/modules/anti-freeze-system/anti-freeze-system.service.js.map +1 -1
- package/dist/modules/base-achievements/base-achievements.module.js +2 -2
- package/dist/modules/base-achievements/base-achievements.module.js.map +1 -1
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.constants.d.ts +1 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.constants.js +5 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.constants.js.map +1 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.interfaces.d.ts +13 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.interfaces.js +3 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.interfaces.js.map +1 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.module.d.ts +15 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.module.js +77 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.module.js.map +1 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.service.d.ts +19 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.service.js +83 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.service.js.map +1 -0
- package/dist/modules/event-bus/events-bus.module.js +3 -0
- package/dist/modules/event-bus/events-bus.module.js.map +1 -1
- package/dist/modules/event-bus/events-bus.player-ws-message.subscribe.service.d.ts +10 -0
- package/dist/modules/event-bus/events-bus.player-ws-message.subscribe.service.js +26 -0
- package/dist/modules/event-bus/events-bus.player-ws-message.subscribe.service.js.map +1 -0
- package/dist/modules/event-bus/index.d.ts +1 -0
- package/dist/modules/event-bus/index.js +3 -1
- package/dist/modules/event-bus/index.js.map +1 -1
- package/dist/modules/events/events.gateway.d.ts +6 -1
- package/dist/modules/events/events.gateway.js +15 -3
- package/dist/modules/events/events.gateway.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +3 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/main/main.module.js +1 -1
- package/dist/modules/main/main.module.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.module.js +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.module.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.module.js +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +57 -57
- package/src/dto/app-screen/app-screen-app-bar.dto.ts +36 -36
- package/src/dto/app-screen/app-screen-dialog.dto.ts +64 -64
- package/src/dto/app-screen/app-screen-field-list-item.dto.ts +42 -42
- package/src/dto/app-screen/app-screen-field.dto.ts +59 -59
- package/src/dto/app-screen/app-screen-section-button.dto.ts +60 -60
- package/src/dto/app-screen/app-screen-section-buttons.dto.ts +14 -14
- package/src/dto/app-screen/app-screen-section-image.dto.ts +33 -33
- package/src/dto/app-screen/app-screen-section-list-item.dto.ts +105 -105
- package/src/dto/app-screen/app-screen-section-req.dto.ts +33 -33
- package/src/dto/app-screen/app-screen-section.dto.ts +76 -76
- package/src/dto/app-screen/app-screen.dto.ts +50 -50
- package/src/dto/app-screen/base-app-screen.dto.ts +16 -16
- package/src/dto/app-screen/index.ts +10 -10
- package/src/dto/app-table/bids-panel-item.dto.ts +33 -33
- package/src/dto/app-table/bids-panel.dto.ts +32 -32
- package/src/dto/app-table/card.dto.ts +54 -54
- package/src/dto/app-table/cards-deck.dto.ts +22 -22
- package/src/dto/app-table/cards-pair-slots-item.dto.ts +45 -45
- package/src/dto/app-table/cards-pair-slots.dto.ts +13 -13
- package/src/dto/app-table/cards-panel.dto.ts +48 -48
- package/src/dto/app-table/cards-player.dto.ts +14 -14
- package/src/dto/app-table/cards-slots-item.dto.ts +40 -40
- package/src/dto/app-table/cards-slots.dto.ts +13 -13
- package/src/dto/app-table/index.ts +15 -15
- package/src/dto/app-table/moves-panel-button.dto.ts +24 -24
- package/src/dto/app-table/moves-panel.dto.ts +23 -23
- package/src/dto/app-table/player.dto.ts +69 -69
- package/src/dto/app-table/summary-item.dto.ts +51 -51
- package/src/dto/app-table/summary.dto.ts +13 -13
- package/src/dto/common/find-free-table.dto.ts +3 -3
- package/src/dto/common/index.ts +2 -2
- package/src/dto/common/join-tournament.dto.ts +33 -33
- package/src/dto/common/log.dto.ts +9 -9
- package/src/dto/common/many-tables-tournament-create.dto.ts +125 -125
- package/src/dto/common/many-tables-tournament-update.dto.ts +3 -3
- package/src/dto/common/player-check-state.dto.ts +33 -33
- package/src/dto/common/player-connected.dto.ts +58 -58
- package/src/dto/games/fool/fool-player.dto.ts +3 -3
- package/src/dto/games/fool/fool-table.dto.ts +81 -81
- package/src/dto/games/index.ts +2 -2
- package/src/dto/games/poker/poker-player.dto.ts +3 -3
- package/src/dto/games/poker/poker-table.dto.ts +81 -81
- package/src/dto/index.ts +4 -4
- package/src/exception/error-code.enum.ts +4 -4
- package/src/exception/global-exception-filter.ts +53 -53
- package/src/exception/http-exception-wth-snackbar.ts +27 -27
- package/src/exception/index.ts +4 -4
- package/src/exception/not-enough-money-for-purchase.exception.ts +14 -14
- package/src/exception/not-found-free-room-for-fast-game.exception.ts +14 -14
- package/src/index.ts +4 -4
- package/src/modules/anti-freeze-system/anti-freeze-system.constants.ts +1 -1
- package/src/modules/anti-freeze-system/anti-freeze-system.interfaces.ts +20 -20
- package/src/modules/anti-freeze-system/anti-freeze-system.module.ts +59 -55
- package/src/modules/anti-freeze-system/anti-freeze-system.service.ts +136 -105
- package/src/modules/anti-freeze-system/index.ts +1 -1
- package/src/modules/base-achievements/base-achievements.module.ts +324 -322
- package/src/modules/base-achievements/index.ts +1 -1
- package/src/modules/confirmation-message-manager/confirmation-message-manager.constants.ts +3 -0
- package/src/modules/confirmation-message-manager/confirmation-message-manager.interfaces.ts +20 -0
- package/src/modules/confirmation-message-manager/confirmation-message-manager.module.ts +77 -0
- package/src/modules/confirmation-message-manager/confirmation-message-manager.service.ts +91 -0
- package/src/modules/event-bus/events-bus.app.subscribe.service.ts +20 -20
- package/src/modules/event-bus/events-bus.main-tables.subscribe.service.ts +34 -34
- package/src/modules/event-bus/events-bus.many-tables-tournament.subscribe.service.ts +6 -6
- package/src/modules/event-bus/events-bus.module.ts +26 -23
- package/src/modules/event-bus/events-bus.one-table-tournament.subscribe.service.ts +6 -6
- package/src/modules/event-bus/events-bus.player-ws-message.subscribe.service.ts +30 -0
- package/src/modules/event-bus/events-bus.tournament.subscribe.service.ts +18 -18
- package/src/modules/event-bus/index.ts +6 -5
- package/src/modules/events/events.constants.ts +1 -1
- package/src/modules/events/events.gateway.ts +82 -70
- package/src/modules/events/events.interfaces.ts +17 -17
- package/src/modules/events/events.module.ts +32 -32
- package/src/modules/events/index.ts +1 -1
- package/src/modules/index.ts +28 -27
- package/src/modules/logger/index.ts +2 -2
- package/src/modules/logger/jp-logger.module.ts +10 -10
- package/src/modules/logger/jp-logger.service.ts +38 -38
- package/src/modules/main/index.ts +1 -1
- package/src/modules/main/main-tables-list-screen.view.ts +275 -275
- package/src/modules/main/main.constants.ts +1 -1
- package/src/modules/main/main.controller.ts +72 -72
- package/src/modules/main/main.interfaces.ts +17 -17
- package/src/modules/main/main.module.ts +73 -73
- package/src/modules/main/main.service.ts +183 -183
- package/src/modules/many-tables-tournament/index.ts +1 -1
- package/src/modules/many-tables-tournament/many-tables-tournament-status-screen.view.ts +143 -143
- package/src/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.ts +63 -63
- package/src/modules/many-tables-tournament/many-tables-tournament.constants.ts +3 -3
- package/src/modules/many-tables-tournament/many-tables-tournament.controller.ts +151 -151
- package/src/modules/many-tables-tournament/many-tables-tournament.interfaces.ts +20 -20
- package/src/modules/many-tables-tournament/many-tables-tournament.module.ts +81 -80
- package/src/modules/many-tables-tournament/many-tables-tournament.service.ts +208 -208
- package/src/modules/many-tables-tournament-rooms-manager/index.ts +2 -2
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.constants.ts +3 -3
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.interfaces.ts +37 -37
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.module.ts +84 -84
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.service.ts +331 -331
- package/src/modules/menu/index.ts +1 -1
- package/src/modules/menu/menu-screen.view.ts +71 -71
- package/src/modules/menu/menu.constants.ts +1 -1
- package/src/modules/menu/menu.controller.ts +16 -16
- package/src/modules/menu/menu.interfaces.ts +17 -17
- package/src/modules/menu/menu.module.ts +39 -39
- package/src/modules/menu/menu.service.ts +39 -39
- package/src/modules/one-table-tournament/index.ts +1 -1
- package/src/modules/one-table-tournament/one-table-tournament-status-screen.view.ts +166 -166
- package/src/modules/one-table-tournament/one-table-tournament.constants.ts +3 -3
- package/src/modules/one-table-tournament/one-table-tournament.controller.ts +104 -104
- package/src/modules/one-table-tournament/one-table-tournament.interfaces.ts +20 -20
- package/src/modules/one-table-tournament/one-table-tournament.module.ts +80 -76
- package/src/modules/one-table-tournament/one-table-tournament.service.ts +146 -146
- package/src/modules/one-table-tournament-rooms-manager/index.ts +2 -2
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.constants.ts +3 -3
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.interfaces.ts +31 -31
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.module.ts +66 -66
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.service.ts +220 -220
- package/src/modules/players-manager/index.ts +2 -2
- package/src/modules/players-manager/players-manager.module.ts +9 -9
- package/src/modules/players-manager/players-manager.service.ts +27 -27
- package/src/modules/simple-rooms/index.ts +1 -1
- package/src/modules/simple-rooms/simple-rooms.constants.ts +1 -1
- package/src/modules/simple-rooms/simple-rooms.controller.ts +63 -63
- package/src/modules/simple-rooms/simple-rooms.interfaces.ts +20 -20
- package/src/modules/simple-rooms/simple-rooms.module.ts +39 -39
- package/src/modules/simple-rooms/simple-rooms.service.ts +95 -95
- package/src/modules/simple-rooms-manager/index.ts +2 -2
- package/src/modules/simple-rooms-manager/simple-rooms-manager.constants.ts +3 -3
- package/src/modules/simple-rooms-manager/simple-rooms-manager.interfaces.ts +26 -26
- package/src/modules/simple-rooms-manager/simple-rooms-manager.module.ts +60 -60
- package/src/modules/simple-rooms-manager/simple-rooms-manager.service.ts +190 -190
- package/src/modules/support/dump.service.ts +11 -11
- package/src/modules/support/index.ts +1 -1
- package/src/modules/support/metric.service.ts +41 -41
- package/src/modules/support/support.constants.ts +1 -1
- package/src/modules/support/support.controller.ts +79 -79
- package/src/modules/support/support.interfaces.ts +16 -16
- package/src/modules/support/support.module.ts +35 -35
- package/src/modules/support/support.service.ts +27 -27
- package/src/utils/date.ts +7 -7
- package/src/utils/game-table-result.ts +129 -129
- package/src/views/index.ts +5 -5
- package/src/views/many-tables-tournament-conifrm-exit-dialog.view.ts +37 -37
- package/src/views/one-table-tournament-conifrm-exit-dialog.view.ts +37 -37
- package/src/views/simple-room-conifrm-exit-dialog.view.ts +37 -37
- package/src/views/table-summary.view.ts +104 -104
- package/src/views/tournament-buy-ticket-dialog.view.ts +34 -34
|
@@ -1,275 +1,275 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import {
|
|
3
|
-
AppScreenIconEnum,
|
|
4
|
-
AppScreenIdEnum,
|
|
5
|
-
IAppScreen,
|
|
6
|
-
UniversalScreenView,
|
|
7
|
-
ILocaleService,
|
|
8
|
-
AppScreeButtonIdEnum,
|
|
9
|
-
StandardScreenComponent,
|
|
10
|
-
AppScreenRouter,
|
|
11
|
-
IAppScreenSectionListItem,
|
|
12
|
-
StandardAppBarComponent,
|
|
13
|
-
ArrowBackButtonComponent,
|
|
14
|
-
CardListSectionComponent,
|
|
15
|
-
MiniCardSectionListItemComponent,
|
|
16
|
-
IconImageComponent,
|
|
17
|
-
ExtendedCardSectionListItemComponent,
|
|
18
|
-
TextButtonComponent,
|
|
19
|
-
FullButtonsButtonsComponent,
|
|
20
|
-
PrimaryButtonButtonsComponent,
|
|
21
|
-
IconTextImageComponent,
|
|
22
|
-
} from 'jp.common.models';
|
|
23
|
-
import {
|
|
24
|
-
SimpleRoom,
|
|
25
|
-
OneTableTournamentRoom,
|
|
26
|
-
ManyTablesTournamentRoom,
|
|
27
|
-
TournamentMaster,
|
|
28
|
-
TournamentRoom,
|
|
29
|
-
} from 'jp.ms.common.engine';
|
|
30
|
-
import { formatDate, formatTime, replacePattern } from 'jp.common.utils';
|
|
31
|
-
|
|
32
|
-
import { TournamentBuyTicketDialogView } from '../../views';
|
|
33
|
-
|
|
34
|
-
export class MainTablesListScreenView extends UniversalScreenView {
|
|
35
|
-
private readonly simpleRooms: Array<SimpleRoom>;
|
|
36
|
-
private readonly oneTableTournamentRooms: Array<OneTableTournamentRoom>;
|
|
37
|
-
private readonly manyTablesTournamentRooms: Array<ManyTablesTournamentRoom>;
|
|
38
|
-
private readonly playerId: string;
|
|
39
|
-
|
|
40
|
-
constructor(
|
|
41
|
-
localeService: ILocaleService,
|
|
42
|
-
lang: string,
|
|
43
|
-
simpleRooms: Array<SimpleRoom>,
|
|
44
|
-
oneTableTournamentRooms: Array<OneTableTournamentRoom>,
|
|
45
|
-
manyTablesTournamentRooms: Array<ManyTablesTournamentRoom>,
|
|
46
|
-
playerId: string,
|
|
47
|
-
) {
|
|
48
|
-
super(localeService, lang);
|
|
49
|
-
this.simpleRooms = simpleRooms;
|
|
50
|
-
this.oneTableTournamentRooms = oneTableTournamentRooms;
|
|
51
|
-
this.manyTablesTournamentRooms = manyTablesTournamentRooms;
|
|
52
|
-
this.playerId = playerId;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
build(): IAppScreen {
|
|
56
|
-
return new StandardScreenComponent(AppScreenIdEnum.ROOMS)
|
|
57
|
-
.addAppBar(
|
|
58
|
-
new StandardAppBarComponent(
|
|
59
|
-
this.localeService.t('common.rooms.screen.title', {
|
|
60
|
-
lang: this.lang,
|
|
61
|
-
}),
|
|
62
|
-
new ArrowBackButtonComponent(
|
|
63
|
-
this.localeService.t('common.button.back', { lang: this.lang }),
|
|
64
|
-
),
|
|
65
|
-
),
|
|
66
|
-
)
|
|
67
|
-
.addSection(
|
|
68
|
-
new CardListSectionComponent('id1', [
|
|
69
|
-
...this.getManyTablesTournamentsCardList(),
|
|
70
|
-
...this.getOneTableTournamentsCardList(),
|
|
71
|
-
...this.getSimpleRoomsTableCardList(),
|
|
72
|
-
]),
|
|
73
|
-
)
|
|
74
|
-
.addDialog(
|
|
75
|
-
new TournamentBuyTicketDialogView(
|
|
76
|
-
this.localeService,
|
|
77
|
-
this.lang,
|
|
78
|
-
).build(),
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
private getSimpleRoomsTableCardList(): Array<IAppScreenSectionListItem> {
|
|
83
|
-
return this.simpleRooms.reduce<Array<IAppScreenSectionListItem>>(
|
|
84
|
-
(result, room) => {
|
|
85
|
-
const list = room.getTables().map(
|
|
86
|
-
(table) =>
|
|
87
|
-
new MiniCardSectionListItemComponent(
|
|
88
|
-
table.getId(),
|
|
89
|
-
table.getTitleWithNumber(this.lang),
|
|
90
|
-
replacePattern(table.getSubtitle(this.lang), {
|
|
91
|
-
HALF_BET: table.getHalfBet().toString(),
|
|
92
|
-
BET: table.getBet().toString(),
|
|
93
|
-
}),
|
|
94
|
-
new IconTextImageComponent(
|
|
95
|
-
`${table.getPlayers().length}/${table.getTableSize()}`,
|
|
96
|
-
),
|
|
97
|
-
true,
|
|
98
|
-
true,
|
|
99
|
-
AppScreenRouter.getSimpleRoomTablePath(table.getId()),
|
|
100
|
-
),
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
return [...result, ...list];
|
|
104
|
-
},
|
|
105
|
-
[],
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
private getOneTableTournamentsCardList(): Array<IAppScreenSectionListItem> {
|
|
110
|
-
return this.oneTableTournamentRooms.map(
|
|
111
|
-
(room) =>
|
|
112
|
-
new MiniCardSectionListItemComponent(
|
|
113
|
-
room.getId(),
|
|
114
|
-
room.getTitle(this.lang),
|
|
115
|
-
this.getOneTableTournamentSubtitle(room),
|
|
116
|
-
this.getOneTableTournamentIcon(room),
|
|
117
|
-
true,
|
|
118
|
-
true,
|
|
119
|
-
AppScreenRouter.getOneTableTournamentStatusPath(room.getId()),
|
|
120
|
-
),
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
private getOneTableTournamentSubtitle(tournament: TournamentRoom): string {
|
|
125
|
-
if (tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
126
|
-
return this.localeService.t('common.tournaments.status.4', {
|
|
127
|
-
lang: this.lang,
|
|
128
|
-
});
|
|
129
|
-
} else if (tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
130
|
-
return this.localeService.t('common.tournaments.status.3', {
|
|
131
|
-
lang: this.lang,
|
|
132
|
-
});
|
|
133
|
-
} else if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
134
|
-
return this.localeService.t('common.tournaments.status.2', {
|
|
135
|
-
lang: this.lang,
|
|
136
|
-
});
|
|
137
|
-
} else if (tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
138
|
-
return tournament.getSubtitle(this.lang);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return '';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
private getOneTableTournamentIcon(tournament: TournamentRoom) {
|
|
145
|
-
if (tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
146
|
-
return new IconImageComponent(AppScreenIconEnum.EMOJI_EVENTS);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
150
|
-
return new IconImageComponent(AppScreenIconEnum.INFO);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
154
|
-
return new IconImageComponent(AppScreenIconEnum.BOLT);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return new IconTextImageComponent(
|
|
158
|
-
`${tournament.getParticipants().length}/${tournament.getTableSize()}`,
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
private getManyTablesTournamentsCardList(): Array<IAppScreenSectionListItem> {
|
|
163
|
-
return this.manyTablesTournamentRooms.map((room) =>
|
|
164
|
-
this.getManyTablesTournamentsCardListItem(room),
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private getManyTablesTournamentsCardListItem(
|
|
169
|
-
tournament: ManyTablesTournamentRoom,
|
|
170
|
-
): IAppScreenSectionListItem {
|
|
171
|
-
if (
|
|
172
|
-
tournament.getRoomMaster<TournamentMaster>().isWaiting() ||
|
|
173
|
-
tournament.getRoomMaster<TournamentMaster>().isInProgress()
|
|
174
|
-
) {
|
|
175
|
-
return new ExtendedCardSectionListItemComponent(
|
|
176
|
-
tournament.getId(),
|
|
177
|
-
tournament.getTitle(this.lang),
|
|
178
|
-
this.getManyTablesTournamentSubtitle(tournament),
|
|
179
|
-
this.getManyTablesTournamentIcon(tournament),
|
|
180
|
-
true,
|
|
181
|
-
true,
|
|
182
|
-
this.getManyTablesTournamentIcon(tournament),
|
|
183
|
-
replacePattern(tournament.getDescription(this.lang), {
|
|
184
|
-
PARTICIPANTS: tournament.getParticipants().length.toString(),
|
|
185
|
-
TOTAL_PARTICIPANTS: tournament.getMaxParticipants().toString(),
|
|
186
|
-
}),
|
|
187
|
-
this.getManyTablesTournamenButtons(tournament),
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return new MiniCardSectionListItemComponent(
|
|
192
|
-
tournament.getId(),
|
|
193
|
-
tournament.getTitle(this.lang),
|
|
194
|
-
this.getManyTablesTournamentSubtitle(tournament),
|
|
195
|
-
this.getManyTablesTournamentIcon(tournament),
|
|
196
|
-
true,
|
|
197
|
-
true,
|
|
198
|
-
AppScreenRouter.getManyTablesTournamentStatusPath(tournament.getId()),
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
private getManyTablesTournamentIcon(tournament: TournamentRoom) {
|
|
203
|
-
if (tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
204
|
-
return new IconImageComponent(AppScreenIconEnum.INFO);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
208
|
-
return new IconImageComponent(AppScreenIconEnum.BOLT);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return new IconImageComponent(AppScreenIconEnum.EMOJI_EVENTS);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
private getManyTablesTournamentSubtitle(
|
|
215
|
-
tournament: ManyTablesTournamentRoom,
|
|
216
|
-
): string {
|
|
217
|
-
if (tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
218
|
-
return this.localeService.t('common.tournaments.status.4', {
|
|
219
|
-
lang: this.lang,
|
|
220
|
-
});
|
|
221
|
-
} else if (tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
222
|
-
return this.localeService.t('common.tournaments.status.3', {
|
|
223
|
-
lang: this.lang,
|
|
224
|
-
});
|
|
225
|
-
} else if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
226
|
-
return this.localeService.t('common.tournaments.status.2', {
|
|
227
|
-
lang: this.lang,
|
|
228
|
-
});
|
|
229
|
-
} else if (tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
230
|
-
return replacePattern(tournament.getSubtitle(this.lang), {
|
|
231
|
-
DATE: dayjs(tournament.getScheduleDate()).isToday()
|
|
232
|
-
? this.localeService.t('common.tournaments.status.today', {
|
|
233
|
-
lang: this.lang,
|
|
234
|
-
})
|
|
235
|
-
: formatDate(tournament.getScheduleDate() ?? ''),
|
|
236
|
-
SCHEDULE_DATE: formatTime(tournament.getScheduleDate() ?? ''),
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return '';
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
private getManyTablesTournamenButtons(tournament: ManyTablesTournamentRoom) {
|
|
244
|
-
if (tournament.isParticipant(this.playerId)) {
|
|
245
|
-
return new PrimaryButtonButtonsComponent(
|
|
246
|
-
new TextButtonComponent(
|
|
247
|
-
this.localeService.t(
|
|
248
|
-
'common.tournaments.screen.button.join.tournament',
|
|
249
|
-
{ lang: this.lang },
|
|
250
|
-
),
|
|
251
|
-
).setId(
|
|
252
|
-
AppScreeButtonIdEnum.BUTTON_MAIN_TABLES_MANY_TABLES_TOURNAMENT_JOIN,
|
|
253
|
-
),
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return new FullButtonsButtonsComponent(
|
|
258
|
-
new TextButtonComponent(
|
|
259
|
-
this.localeService.t('common.tournaments.screen.button.buy.ticket', {
|
|
260
|
-
lang: this.lang,
|
|
261
|
-
}),
|
|
262
|
-
).setId(
|
|
263
|
-
AppScreeButtonIdEnum.BUTTON_MAIN_TABLES_MANY_TABLES_TOURNAMENT_BUY_TICKET,
|
|
264
|
-
),
|
|
265
|
-
new TextButtonComponent(
|
|
266
|
-
this.localeService.t(
|
|
267
|
-
'common.tournaments.screen.button.join.tournament',
|
|
268
|
-
{ lang: this.lang },
|
|
269
|
-
),
|
|
270
|
-
).setId(
|
|
271
|
-
AppScreeButtonIdEnum.BUTTON_MAIN_TABLES_MANY_TABLES_TOURNAMENT_JOIN,
|
|
272
|
-
),
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import {
|
|
3
|
+
AppScreenIconEnum,
|
|
4
|
+
AppScreenIdEnum,
|
|
5
|
+
IAppScreen,
|
|
6
|
+
UniversalScreenView,
|
|
7
|
+
ILocaleService,
|
|
8
|
+
AppScreeButtonIdEnum,
|
|
9
|
+
StandardScreenComponent,
|
|
10
|
+
AppScreenRouter,
|
|
11
|
+
IAppScreenSectionListItem,
|
|
12
|
+
StandardAppBarComponent,
|
|
13
|
+
ArrowBackButtonComponent,
|
|
14
|
+
CardListSectionComponent,
|
|
15
|
+
MiniCardSectionListItemComponent,
|
|
16
|
+
IconImageComponent,
|
|
17
|
+
ExtendedCardSectionListItemComponent,
|
|
18
|
+
TextButtonComponent,
|
|
19
|
+
FullButtonsButtonsComponent,
|
|
20
|
+
PrimaryButtonButtonsComponent,
|
|
21
|
+
IconTextImageComponent,
|
|
22
|
+
} from 'jp.common.models';
|
|
23
|
+
import {
|
|
24
|
+
SimpleRoom,
|
|
25
|
+
OneTableTournamentRoom,
|
|
26
|
+
ManyTablesTournamentRoom,
|
|
27
|
+
TournamentMaster,
|
|
28
|
+
TournamentRoom,
|
|
29
|
+
} from 'jp.ms.common.engine';
|
|
30
|
+
import { formatDate, formatTime, replacePattern } from 'jp.common.utils';
|
|
31
|
+
|
|
32
|
+
import { TournamentBuyTicketDialogView } from '../../views';
|
|
33
|
+
|
|
34
|
+
export class MainTablesListScreenView extends UniversalScreenView {
|
|
35
|
+
private readonly simpleRooms: Array<SimpleRoom>;
|
|
36
|
+
private readonly oneTableTournamentRooms: Array<OneTableTournamentRoom>;
|
|
37
|
+
private readonly manyTablesTournamentRooms: Array<ManyTablesTournamentRoom>;
|
|
38
|
+
private readonly playerId: string;
|
|
39
|
+
|
|
40
|
+
constructor(
|
|
41
|
+
localeService: ILocaleService,
|
|
42
|
+
lang: string,
|
|
43
|
+
simpleRooms: Array<SimpleRoom>,
|
|
44
|
+
oneTableTournamentRooms: Array<OneTableTournamentRoom>,
|
|
45
|
+
manyTablesTournamentRooms: Array<ManyTablesTournamentRoom>,
|
|
46
|
+
playerId: string,
|
|
47
|
+
) {
|
|
48
|
+
super(localeService, lang);
|
|
49
|
+
this.simpleRooms = simpleRooms;
|
|
50
|
+
this.oneTableTournamentRooms = oneTableTournamentRooms;
|
|
51
|
+
this.manyTablesTournamentRooms = manyTablesTournamentRooms;
|
|
52
|
+
this.playerId = playerId;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
build(): IAppScreen {
|
|
56
|
+
return new StandardScreenComponent(AppScreenIdEnum.ROOMS)
|
|
57
|
+
.addAppBar(
|
|
58
|
+
new StandardAppBarComponent(
|
|
59
|
+
this.localeService.t('common.rooms.screen.title', {
|
|
60
|
+
lang: this.lang,
|
|
61
|
+
}),
|
|
62
|
+
new ArrowBackButtonComponent(
|
|
63
|
+
this.localeService.t('common.button.back', { lang: this.lang }),
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
.addSection(
|
|
68
|
+
new CardListSectionComponent('id1', [
|
|
69
|
+
...this.getManyTablesTournamentsCardList(),
|
|
70
|
+
...this.getOneTableTournamentsCardList(),
|
|
71
|
+
...this.getSimpleRoomsTableCardList(),
|
|
72
|
+
]),
|
|
73
|
+
)
|
|
74
|
+
.addDialog(
|
|
75
|
+
new TournamentBuyTicketDialogView(
|
|
76
|
+
this.localeService,
|
|
77
|
+
this.lang,
|
|
78
|
+
).build(),
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private getSimpleRoomsTableCardList(): Array<IAppScreenSectionListItem> {
|
|
83
|
+
return this.simpleRooms.reduce<Array<IAppScreenSectionListItem>>(
|
|
84
|
+
(result, room) => {
|
|
85
|
+
const list = room.getTables().map(
|
|
86
|
+
(table) =>
|
|
87
|
+
new MiniCardSectionListItemComponent(
|
|
88
|
+
table.getId(),
|
|
89
|
+
table.getTitleWithNumber(this.lang),
|
|
90
|
+
replacePattern(table.getSubtitle(this.lang), {
|
|
91
|
+
HALF_BET: table.getHalfBet().toString(),
|
|
92
|
+
BET: table.getBet().toString(),
|
|
93
|
+
}),
|
|
94
|
+
new IconTextImageComponent(
|
|
95
|
+
`${table.getPlayers().length}/${table.getTableSize()}`,
|
|
96
|
+
),
|
|
97
|
+
true,
|
|
98
|
+
true,
|
|
99
|
+
AppScreenRouter.getSimpleRoomTablePath(table.getId()),
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
return [...result, ...list];
|
|
104
|
+
},
|
|
105
|
+
[],
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private getOneTableTournamentsCardList(): Array<IAppScreenSectionListItem> {
|
|
110
|
+
return this.oneTableTournamentRooms.map(
|
|
111
|
+
(room) =>
|
|
112
|
+
new MiniCardSectionListItemComponent(
|
|
113
|
+
room.getId(),
|
|
114
|
+
room.getTitle(this.lang),
|
|
115
|
+
this.getOneTableTournamentSubtitle(room),
|
|
116
|
+
this.getOneTableTournamentIcon(room),
|
|
117
|
+
true,
|
|
118
|
+
true,
|
|
119
|
+
AppScreenRouter.getOneTableTournamentStatusPath(room.getId()),
|
|
120
|
+
),
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private getOneTableTournamentSubtitle(tournament: TournamentRoom): string {
|
|
125
|
+
if (tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
126
|
+
return this.localeService.t('common.tournaments.status.4', {
|
|
127
|
+
lang: this.lang,
|
|
128
|
+
});
|
|
129
|
+
} else if (tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
130
|
+
return this.localeService.t('common.tournaments.status.3', {
|
|
131
|
+
lang: this.lang,
|
|
132
|
+
});
|
|
133
|
+
} else if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
134
|
+
return this.localeService.t('common.tournaments.status.2', {
|
|
135
|
+
lang: this.lang,
|
|
136
|
+
});
|
|
137
|
+
} else if (tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
138
|
+
return tournament.getSubtitle(this.lang);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return '';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private getOneTableTournamentIcon(tournament: TournamentRoom) {
|
|
145
|
+
if (tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
146
|
+
return new IconImageComponent(AppScreenIconEnum.EMOJI_EVENTS);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
150
|
+
return new IconImageComponent(AppScreenIconEnum.INFO);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
154
|
+
return new IconImageComponent(AppScreenIconEnum.BOLT);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return new IconTextImageComponent(
|
|
158
|
+
`${tournament.getParticipants().length}/${tournament.getTableSize()}`,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private getManyTablesTournamentsCardList(): Array<IAppScreenSectionListItem> {
|
|
163
|
+
return this.manyTablesTournamentRooms.map((room) =>
|
|
164
|
+
this.getManyTablesTournamentsCardListItem(room),
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
private getManyTablesTournamentsCardListItem(
|
|
169
|
+
tournament: ManyTablesTournamentRoom,
|
|
170
|
+
): IAppScreenSectionListItem {
|
|
171
|
+
if (
|
|
172
|
+
tournament.getRoomMaster<TournamentMaster>().isWaiting() ||
|
|
173
|
+
tournament.getRoomMaster<TournamentMaster>().isInProgress()
|
|
174
|
+
) {
|
|
175
|
+
return new ExtendedCardSectionListItemComponent(
|
|
176
|
+
tournament.getId(),
|
|
177
|
+
tournament.getTitle(this.lang),
|
|
178
|
+
this.getManyTablesTournamentSubtitle(tournament),
|
|
179
|
+
this.getManyTablesTournamentIcon(tournament),
|
|
180
|
+
true,
|
|
181
|
+
true,
|
|
182
|
+
this.getManyTablesTournamentIcon(tournament),
|
|
183
|
+
replacePattern(tournament.getDescription(this.lang), {
|
|
184
|
+
PARTICIPANTS: tournament.getParticipants().length.toString(),
|
|
185
|
+
TOTAL_PARTICIPANTS: tournament.getMaxParticipants().toString(),
|
|
186
|
+
}),
|
|
187
|
+
this.getManyTablesTournamenButtons(tournament),
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return new MiniCardSectionListItemComponent(
|
|
192
|
+
tournament.getId(),
|
|
193
|
+
tournament.getTitle(this.lang),
|
|
194
|
+
this.getManyTablesTournamentSubtitle(tournament),
|
|
195
|
+
this.getManyTablesTournamentIcon(tournament),
|
|
196
|
+
true,
|
|
197
|
+
true,
|
|
198
|
+
AppScreenRouter.getManyTablesTournamentStatusPath(tournament.getId()),
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private getManyTablesTournamentIcon(tournament: TournamentRoom) {
|
|
203
|
+
if (tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
204
|
+
return new IconImageComponent(AppScreenIconEnum.INFO);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
208
|
+
return new IconImageComponent(AppScreenIconEnum.BOLT);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return new IconImageComponent(AppScreenIconEnum.EMOJI_EVENTS);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private getManyTablesTournamentSubtitle(
|
|
215
|
+
tournament: ManyTablesTournamentRoom,
|
|
216
|
+
): string {
|
|
217
|
+
if (tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
218
|
+
return this.localeService.t('common.tournaments.status.4', {
|
|
219
|
+
lang: this.lang,
|
|
220
|
+
});
|
|
221
|
+
} else if (tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
222
|
+
return this.localeService.t('common.tournaments.status.3', {
|
|
223
|
+
lang: this.lang,
|
|
224
|
+
});
|
|
225
|
+
} else if (tournament.getRoomMaster<TournamentMaster>().isInProgress()) {
|
|
226
|
+
return this.localeService.t('common.tournaments.status.2', {
|
|
227
|
+
lang: this.lang,
|
|
228
|
+
});
|
|
229
|
+
} else if (tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
230
|
+
return replacePattern(tournament.getSubtitle(this.lang), {
|
|
231
|
+
DATE: dayjs(tournament.getScheduleDate()).isToday()
|
|
232
|
+
? this.localeService.t('common.tournaments.status.today', {
|
|
233
|
+
lang: this.lang,
|
|
234
|
+
})
|
|
235
|
+
: formatDate(tournament.getScheduleDate() ?? ''),
|
|
236
|
+
SCHEDULE_DATE: formatTime(tournament.getScheduleDate() ?? ''),
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return '';
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private getManyTablesTournamenButtons(tournament: ManyTablesTournamentRoom) {
|
|
244
|
+
if (tournament.isParticipant(this.playerId)) {
|
|
245
|
+
return new PrimaryButtonButtonsComponent(
|
|
246
|
+
new TextButtonComponent(
|
|
247
|
+
this.localeService.t(
|
|
248
|
+
'common.tournaments.screen.button.join.tournament',
|
|
249
|
+
{ lang: this.lang },
|
|
250
|
+
),
|
|
251
|
+
).setId(
|
|
252
|
+
AppScreeButtonIdEnum.BUTTON_MAIN_TABLES_MANY_TABLES_TOURNAMENT_JOIN,
|
|
253
|
+
),
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return new FullButtonsButtonsComponent(
|
|
258
|
+
new TextButtonComponent(
|
|
259
|
+
this.localeService.t('common.tournaments.screen.button.buy.ticket', {
|
|
260
|
+
lang: this.lang,
|
|
261
|
+
}),
|
|
262
|
+
).setId(
|
|
263
|
+
AppScreeButtonIdEnum.BUTTON_MAIN_TABLES_MANY_TABLES_TOURNAMENT_BUY_TICKET,
|
|
264
|
+
),
|
|
265
|
+
new TextButtonComponent(
|
|
266
|
+
this.localeService.t(
|
|
267
|
+
'common.tournaments.screen.button.join.tournament',
|
|
268
|
+
{ lang: this.lang },
|
|
269
|
+
),
|
|
270
|
+
).setId(
|
|
271
|
+
AppScreeButtonIdEnum.BUTTON_MAIN_TABLES_MANY_TABLES_TOURNAMENT_JOIN,
|
|
272
|
+
),
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const MAIN_OPTIONS = Symbol('MAIN_OPTIONS');
|
|
1
|
+
export const MAIN_OPTIONS = Symbol('MAIN_OPTIONS');
|