Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .customizations/setup_repos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env python3

from __future__ import annotations

import shutil
import subprocess
import tempfile
from pathlib import Path

BASE_URL = "ssh://ssh.sourcecraft.dev/universitybattle"
TMP_ROOT = Path(tempfile.gettempdir()) / "tower-repos"

REPOS = [
(1167, "fQRz3EVmbx-9K0-H0FDiUwBDUEn85eyW0G2Fh8Qyiis"),
(167, "uligelAoj-EJA54qnnXg9v7KAn__vVsYTm-an1KM5cY"),
(1175, "gubpUo3pUsS0m3PPcLYmvAVjoF1fOGxjHm-t6WffNT0"),
(1174, "WdFhXEbFgrAw6oVGopPoBVHVOH_lsuCjVcfqt2C_xYE"),
(1416, "5sy7gUusY4Fs8zScZ52RhaO4Ne0-PLKWGQqYS5ec8gc"),
(12656, "GgqBmlT5cOKXBojh6vBa83L_9djAc3S2T_UxenKwe0U"),
(9828, "RylHgDyaBXzM568gzUvDbGDyfE5Ml885A1vsYxG_jWY"),
(1172, "_RgNYPzhJL7Z36gNxLKpSs23xnkeDguiKk9sjzgEeJo"),
(8256, "bIabtEIoNRfzGU5hqmWRdsXs6LukoRLDbWnKrMr_8mY"),
(2909, "oF6s1zBTxXOxFQP0ynvy2AFydMkPV4TZbc8bss3hnc8"),
(801, "z84y49ppe36-1VF_kXaQbOmF9beZtBb4Lm91Xo8RW-c"),
(8208, "1oVSBWzUkUibUx9XYzpyJpcY3_VXSmbkY5iiRBOl40w"),
(12848, "w49EP7kh41YLbaWdnJSGlZ-tZ-5xnQsWemnvmdhOg7Q"),
(1378, "kE_9cjU0qQ6OdknFxwgdkqsfX-CU7WRP9mIqvAZx7vg"),
(135, "uHO-EuaroUX1hLQwVWhBjOSxDngcFOK2Ao49378o7Qs"),
]


def run(cmd: list[str], cwd: Path | None = None) -> None:
subprocess.run(cmd, cwd=cwd, check=True)


def main() -> None:
TMP_ROOT.mkdir(parents=True, exist_ok=True)

for repo_id, token in REPOS:
repo_dir = TMP_ROOT / f"tower-{repo_id}"
repo_url = f"{BASE_URL}/tower-{repo_id}.git"

if repo_dir.exists():
shutil.rmtree(repo_dir)

# Clone each repo into a clean temporary directory, then write the
# token locally so it never gets staged, committed, or pushed.
run(["git", "clone", repo_url, str(repo_dir)])

# The token is intentionally kept only in the working tree copy.
(repo_dir / ".env").write_text(
f"CODEBATTLE_AUTH_TOKEN={token}\n",
encoding="utf-8",
)

run(["git", "add", "."])
run(["git", "commit", "-m", "Add token"])
run(["git", "push"])

print(f"prepared {repo_dir}")

print(f"done: {TMP_ROOT}")


if __name__ == "__main__":
main()
31 changes: 31 additions & 0 deletions apps/codebattle/assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1773,6 +1773,25 @@ div.cb-dropdown-menu {
height: 410px;
}

// Stream kiosk page: keep html/body transparent so OBS browser source
// composites the cb-stream editor over the live capture instead of a solid bg.
html:has(body.cb-stream-transparent-page),
body.cb-stream-transparent-page {
background: transparent !important;
}

// Drop Monaco's focus/decoration borders on the stream kiosk so the editor
// blends into the OBS overlay instead of showing a blue outline.
body.cb-stream-transparent-page {
.monaco-editor,
.monaco-editor .overflow-guard,
.monaco-editor.focused,
.monaco-editor .decorationsOverviewRuler {
outline: none !important;
border: none !important;
}
}

.cb-stream-tasks-stats {
background-color: #faff0f;
padding: 20px 16px;
Expand Down Expand Up @@ -1974,6 +1993,18 @@ div.cb-dropdown-menu {

.cb-bg-highlight-panel {
background-color: $cb-bg-highlight-panel;

&.form-control {
background-color: $cb-bg-highlight-panel;
color: white;
caret-color: white;
}

&.form-control:hover,
&.form-control:focus {
background-color: $cb-bg-highlight-panel;
color: white;
}
}

.cb-create-game {
Expand Down
17 changes: 1 addition & 16 deletions apps/codebattle/assets/js/widgets/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,7 @@ export function GameThreejsPage() {
export function TournamentThreejsStreamPage() {
return (
<Provider store={store}>
<Suspense
fallback={
<div
style={{
background: "#000",
color: "#e0bf7a",
height: "100vh",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
Loading...
</div>
}
>
<Suspense fallback={null}>
<TournamentThreejsStreamWidget />
</Suspense>
</Provider>
Expand Down
13 changes: 9 additions & 4 deletions apps/codebattle/assets/js/widgets/components/ChatContextMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,27 @@ function ChatContextMenu({
<>
{children}
<Menu className="cb-bg-panel cb-border-color cb-rounded text-white" role="menu" id={menuId}>
<Item role="menuitem" aria-label="Copy Name" onClick={handleCopy}>
<Item role="menuitem" tabIndex={-1} aria-label="Copy Name" onClick={handleCopy}>
<FontAwesomeIcon className="mr-2 text-white" icon="copy" />
<span className="text-white">Copy Name</span>
</Item>
<Item role="menuitem" aria-label="Info" onClick={handleShowInfo}>
<Item role="menuitem" tabIndex={-1} aria-label="Info" onClick={handleShowInfo}>
<FontAwesomeIcon className="mr-2 text-white" icon="user" />
<span className="text-white">Info</span>
</Item>
{githubName && (
<Item role="menuitem" aria-label="Github account" onClick={handleShowGithubProfile}>
<Item
role="menuitem"
tabIndex={-1}
aria-label="Github account"
onClick={handleShowGithubProfile}
>
<FontAwesomeIcon className="mr-2 text-white" icon={["fab", "github"]} />
<span className="text-white">{i18n.t("Github account")}</span>
</Item>
)}
{!isCurrentUser && (
<Item role="menuitem" aria-label="Follow" onClick={handleFollow}>
<Item role="menuitem" tabIndex={-1} aria-label="Follow" onClick={handleFollow}>
<FontAwesomeIcon className="mr-2 text-white" icon="binoculars" />
<span className="text-white">Follow</span>
</Item>
Expand Down
1 change: 1 addition & 0 deletions apps/codebattle/assets/js/widgets/components/ChatInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export default function ChatInput({ inputRef, disabled = false }) {
<form className="border-top cb-border-color input-group mb-0 p-2" onSubmit={handleSubmit}>
<input
className={inputClassName}
aria-label={i18next.t("Chat message")}
placeholder={i18next.t("Be nice in chat!")}
value={text}
onChange={handleChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function FeedbackWidget() {
<label htmlFor="feedback-text">{i18n.t("Message")}</label>
<textarea
id="feedback-text"
aria-label={i18n.t("Message")}
className="form-control cb-bg-panel cb-border-color text-white cb-rounded"
rows="5"
value={text}
Expand Down
6 changes: 3 additions & 3 deletions apps/codebattle/assets/js/widgets/initEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ loader.init().then((monacoInstance) => {
{ token: "constant", foreground: "FBBF24" },
],
colors: {
"editor.background": "#000000",
"editor.background": "#00000000",
"editor.foreground": "#949EF4",
"editorLineNumber.foreground": "#3F3F5C",
"editorLineNumber.activeForeground": "#949EF4",
"editor.lineHighlightBackground": "#0A0A14",
"editor.lineHighlightBorder": "#0A0A14",
"editor.lineHighlightBackground": "#00000000",
"editor.lineHighlightBorder": "#00000000",
"editorCursor.foreground": "#949EF4",
"editor.selectionBackground": "#1E1E3F",
"editor.inactiveSelectionBackground": "#14142A",
Expand Down
10 changes: 9 additions & 1 deletion apps/codebattle/assets/js/widgets/middlewares/Tournament.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ export const connectToTournament = (newTournamentId) => (dispatch) => {
dispatch(actions.updateTournamentData(response.tournament));
};

const handleRedirect = (response) => {
const { url } = response || {};
if (typeof url === "string" && url.length > 0) {
window.location.href = url;
}
};

const handleTournamentRankingUpdate = (response) => {
dispatch(
actions.updateTournamentData({
Expand All @@ -190,7 +197,8 @@ export const connectToTournament = (newTournamentId) => (dispatch) => {
.addListener("tournament:match:upserted", handleMatchUpserted)
.addListener("tournament:restarted", handleTournamentRestarted)
.addListener("tournament:finished", handleTournamentFinished)
.addListener("tournament:ranking_update", handleTournamentRankingUpdate);
.addListener("tournament:ranking_update", handleTournamentRankingUpdate)
.addListener("tournament:redirect", handleRedirect);
};

export const uploadTournamentsByFilter = (from, to) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export default function App() {
type="text"
className="preset-input"
placeholder="Название пресета"
aria-label="Preset name"
value={saveName}
onChange={(e) => setSaveName(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && handleSaveConfirm()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export default function App() {
value={saveName}
onChange={(e) => setSaveName(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && handleSaveConfirm()}
aria-label="Preset name"
/>
<button type="button" className="preset-save-button" onClick={handleSaveConfirm}>
💾 Save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function PersonalEventTable({ currentUserId, currentUserClanId, items, type }) {
<tbody>
{groupedItems?.map((users, clanIndex) => (
<React.Fragment key={`${type}-clan-${users[0].clanId}`}>
<tr className="cb-custom-event-empty-space-tr" />
<tr className="cb-custom-event-empty-space-tr" aria-hidden="true" />
<tr
className={getCustomEventTrClassNamePersonal(
"clan",
Expand Down Expand Up @@ -117,7 +117,7 @@ function PersonalEventTable({ currentUserId, currentUserClanId, items, type }) {
</tr>
{users.map((user, userIndex) => (
<React.Fragment key={`${type}-user-${user.userId}`}>
<tr className="cb-custom-event-empty-space-tr" />
<tr className="cb-custom-event-empty-space-tr" aria-hidden="true" />
<tr
className={getCustomEventTrClassNamePersonal(
"user",
Expand Down Expand Up @@ -273,7 +273,7 @@ function EventRatingPanel({
<tbody>
{items?.map((item) => (
<React.Fragment key={`${type}${item.clanId}${item.userId}`}>
<tr className="cb-custom-event-empty-space-tr" />
<tr className="cb-custom-event-empty-space-tr" aria-hidden="true" />
<tr className={getCustomEventTrClassName(item, selectedId)}>
<td width="110" className={tableDataCellClassName}>
{item.place || "-"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function TopLeaderboardPanel({ topLeaderboard = [], selectedId }) {
<tbody>
{topLeaderboard.map((item) => (
<React.Fragment key={item.id}>
<tr className="cb-custom-event-empty-space-tr" />
<tr className="cb-custom-event-empty-space-tr" aria-hidden="true" />
<tr className={getCustomEventTrClassName(item, selectedId)}>
<td width="122" className={tableDataCellClassName}>
{item.place}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ function EditorContainer({
theme,
...userSettings,
editable,
allowClipboard: isAdmin,
loading: isPreview || editorCurrent.value === "loading",
};

Expand Down
Loading
Loading