Skip to content

Commit 455f151

Browse files
committed
improves
1 parent e13b74a commit 455f151

3 files changed

Lines changed: 47 additions & 6 deletions

File tree

apps/codebattle/assets/js/widgets/pages/groupTournament/EvolutionPanel.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from "react";
22

3+
const getExternalUrl = (url) => `${url}/browse/README.md?rev=main&chatMessage=""`;
4+
35
function EvolutionPanel({ items, tournamentStatus, runId, setRunId, repoUrl }) {
46
return (
57
<div className="card cb-card border cb-border-color rounded h-100">
@@ -9,7 +11,7 @@ function EvolutionPanel({ items, tournamentStatus, runId, setRunId, repoUrl }) {
911
<div className="card-body p-1 border-top cb-border-color">
1012
<div className="cb-overflow-y-auto">
1113
{tournamentStatus !== "finished" && repoUrl && (
12-
<a href={repoUrl} rel="noopener noreferrer">
14+
<a href={getExternalUrl(repoUrl)} target="_blank" rel="noopener noreferrer">
1315
<div className="border cb-border-color rounded p-3">+ Add Solution</div>
1416
</a>
1517
)}

apps/codebattle/assets/js/widgets/pages/groupTournament/GroupTournamentPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function GroupTournamentPage({ tournamentId, tournamentName, tournamentDescripti
102102
return (
103103
<>
104104
<div className="row">
105-
<Header name={name} status={status} />
105+
<Header name={tournamentName} status={status} />
106106
</div>
107107
<div className="row mt-3 h-100">
108108
<div className="col-lg-3 col-md-3 col-12 p-1 pb-4">
@@ -120,7 +120,7 @@ function GroupTournamentPage({ tournamentId, tournamentName, tournamentDescripti
120120
run={selectedRun}
121121
externalSetup={externalSetup}
122122
description={tournamentDescription}
123-
openFullScreen={setViewerFullscreen}
123+
setViewerFullscreen={setViewerFullscreen}
124124
/>
125125
</div>
126126
<div className="col-lg-4 col-md-4 col-12 p-1 pb-4">

apps/codebattle/assets/js/widgets/pages/groupTournament/MainPanel.jsx

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,59 @@
11
import React from "react";
22

3-
function MainPanel({ status, run, externalSetup, description }) {
3+
function MainPanel({ run, externalSetup, description, setViewerFullscreen }) {
4+
if (run) {
5+
return (
6+
<>
7+
<div className="cb-bg-panel shadow-sm cb-rounded p-4 mb-3" style={{ height: "82vh" }}>
8+
<div className="d-flex justify-content-between align-items-center mb-2">
9+
<div className="text-white" style={{ fontSize: "1.6rem", lineHeight: 1.2 }}>
10+
Run Viewer{run ? ` • Run #${run.id}` : ""}
11+
</div>
12+
{run?.result?.viewerHtml ? (
13+
<button
14+
type="button"
15+
className="btn btn-sm btn-outline-secondary cb-btn-outline-secondary cb-rounded"
16+
onClick={() => setViewerFullscreen(true)}
17+
>
18+
Fullscreen
19+
</button>
20+
) : null}
21+
</div>
22+
{run?.result?.viewerHtml ? (
23+
<iframe
24+
title={`run-viewer-${run.id}`}
25+
srcDoc={run.result.viewerHtml}
26+
sandbox="allow-scripts"
27+
style={{
28+
width: "100%",
29+
height: "100%",
30+
border: 0,
31+
backgroundColor: "#fff",
32+
borderRadius: "8px",
33+
}}
34+
/>
35+
) : (
36+
<div className="cb-text">No viewer HTML for this run.</div>
37+
)}
38+
</div>
39+
</>
40+
);
41+
}
42+
443
return (
544
<div className="card cb-card cb-border-color border rounded h-100">
645
<div className="card-header py-2">
746
<h6 className="cb-text mb-0">Tournament Overview</h6>
847
</div>
948
<div className="card-body p-3 border-top cb-border-color overflow-auto">
10-
{description && !run && (
49+
{description && (
1150
<div className="mb-3">
1251
<p className="mb-0" style={{ whiteSpace: "pre-wrap" }}>
1352
{description}
1453
</p>
1554
</div>
1655
)}
17-
{run ? (
56+
{externalSetup ? (
1857
<div className="small">
1958
<div className="mb-1">
2059
<strong>External setup:</strong> {externalSetup.state}

0 commit comments

Comments
 (0)