Skip to content

Commit b5eeef2

Browse files
committed
Fix
1 parent cd44b7b commit b5eeef2

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

apps/codebattle/assets/js/widgets/pages/event/ParticipantDashboard.jsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ function ParticipantDashboard() {
3333
const participantData = useSelector(participantDataSelector);
3434
const event = useSelector(eventSelector);
3535

36-
const pendingGroupTournamentStage = participantData?.stages?.find(
36+
const pendingActiveStage = participantData?.stages?.find(
3737
(stage) =>
38-
stage.tournamentFinished &&
39-
stage.tournamentId &&
40-
stage.groupTournamentId &&
38+
stage.status === "active" &&
4139
stage.userStatus !== "completed" &&
42-
!stage.groupTournamentFinished,
40+
(stage.groupTournamentId || stage.tournamentId),
4341
);
4442

45-
const pendingGroupTournamentId = pendingGroupTournamentStage?.groupTournamentId;
43+
const pendingGroupTournamentId = pendingActiveStage?.groupTournamentId;
44+
const pendingTournamentId =
45+
!pendingGroupTournamentId && pendingActiveStage?.tournamentId
46+
? pendingActiveStage.tournamentId
47+
: null;
4648

4749
useEffect(() => {
4850
if (pendingGroupTournamentId) {
@@ -125,7 +127,15 @@ function ParticipantDashboard() {
125127
<div className="d-flex justify-content-center cb-custom-event-stage-action">
126128
{stage.isStageAvailableForUser && stage.type === "tournament" && (
127129
<div className="action-button">
128-
{stage.groupTournamentId && stage.tournamentFinished ? (
130+
{stage.userStatus === "completed" ? (
131+
<button
132+
type="button"
133+
className="btn btn-secondary rounded-pill px-4 disabled"
134+
disabled
135+
>
136+
{i18n.t(stage.actionButtonText)}
137+
</button>
138+
) : stage.groupTournamentId ? (
129139
<a
130140
type="button"
131141
className="btn btn-success rounded-pill px-4"

apps/codebattle/lib/codebattle_web/templates/public_event/show.html.heex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<div class="cb-custom-event-bg">
2+
<%= unless @current_user.is_guest do %>
3+
<div id="main-channel-root" class="d-none"></div>
4+
<% end %>
25
<div id="event-widget"></div>
36
</div>
47
<script>

0 commit comments

Comments
 (0)