From cd80c6aa224b4dbdda7f31bb0d93ce8fda8fcf81 Mon Sep 17 00:00:00 2001 From: Wolfboy248 Date: Fri, 1 Nov 2024 17:56:47 +0100 Subject: frontend: uploadrundialog --- frontend/src/api/Api.tsx | 2 +- frontend/src/components/Login.tsx | 3 +- frontend/src/components/UploadRunDialog.tsx | 52 ++++++++++++++++------------- frontend/src/css/UploadRunDialog.css | 3 +- 4 files changed, 33 insertions(+), 27 deletions(-) (limited to 'frontend') diff --git a/frontend/src/api/Api.tsx b/frontend/src/api/Api.tsx index ddc7ac6..053e920 100644 --- a/frontend/src/api/Api.tsx +++ b/frontend/src/api/Api.tsx @@ -49,7 +49,7 @@ export const API = { delete_map_summary: (token: string, map_id: string, route_id: number) => delete_map_summary(token, map_id, route_id), }; -const BASE_API_URL: string = "https://lp.portal2.sr/api/v1/" +const BASE_API_URL: string = "/api/v1/" export function url(path: string): string { return BASE_API_URL + path; diff --git a/frontend/src/components/Login.tsx b/frontend/src/components/Login.tsx index d33e25e..545f724 100644 --- a/frontend/src/components/Login.tsx +++ b/frontend/src/components/Login.tsx @@ -17,8 +17,7 @@ const Login: React.FC = ({ setToken, profile, setProfile }) => { const navigate = useNavigate(); const _login = () => { - setToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzI3Nzg0NTEsIm1vZCI6ZmFsc2UsInN1YiI6Ijc2NTYxMTk5MDg4MjU3MDk4In0.MwYcAy1q463-A2qxLn3Dk4T7ECwta_x4h-CJOTB6VZY"); - // window.location.href = "/api/v1/login"; + window.location.href = "/api/v1/login"; }; const _logout = () => { diff --git a/frontend/src/components/UploadRunDialog.tsx b/frontend/src/components/UploadRunDialog.tsx index 8c201ff..0610377 100644 --- a/frontend/src/components/UploadRunDialog.tsx +++ b/frontend/src/components/UploadRunDialog.tsx @@ -198,36 +198,42 @@ const UploadRunDialog: React.FC = ({ token, open, onClose,
-

Select Game

-
_handle_dropdowns(1)} style={{ display: "flex", alignItems: "center", cursor: "pointer", justifyContent: "space-between" }}> +

Select Game

+
_handle_dropdowns(1)} style={{ display: "flex", alignItems: "center", cursor: "pointer", justifyContent: "space-between", margin: "10px 0px" }}>
{selectedGameName}
-
+
{games.map((game) => (
{ _handle_game_select(game.id.toString(), game.name); _handle_dropdowns(1) }} key={game.id}>{game.name}
))}
-
- { - !loading && - ( - <> -
-
-

Select Map

-
_handle_dropdowns(2)} style={{ display: "flex", alignItems: "center", cursor: "pointer", justifyContent: "space-between" }}> + {!loading && ( + <> +
+

Select Map

+
_handle_dropdowns(2)} style={{ display: "flex", alignItems: "center", cursor: "pointer", justifyContent: "space-between", margin: "10px 0px" }}> {currentMap}
- -

Host Demo

+ + + )} +
+ + { + !loading && + ( + <> + +
+

Host Demo

{ _handle_file_click(true) }} onDragOver={(e) => { _handle_drag_over(e, true) }} onDrop={(e) => { _handle_drop(e, true) }} onDragLeave={(e) => { _handle_drag_leave(e, true) }} className={`upload-run-drag-area ${dragHightlight ? "upload-run-drag-area-highlight" : ""} ${uploadRunContent.host_demo ? "upload-run-drag-area-hidden" : ""}`}> _handle_file_change(e.target.files, true)} /> {!uploadRunContent.host_demo ? @@ -242,12 +248,12 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, {uploadRunContent.host_demo?.name}
-

{ games[selectedGameID].is_coop && ( <> -

Partner Demo

+
+

Partner Demo

{ _handle_file_click(false) }} onDragOver={(e) => { _handle_drag_over(e, false) }} onDrop={(e) => { _handle_drop(e, false) }} onDragLeave={(e) => { _handle_drag_leave(e, false) }} className={`upload-run-drag-area ${dragHightlightPartner ? "upload-run-drag-area-highlight-partner" : ""} ${uploadRunContent.partner_demo ? "upload-run-drag-area-hidden" : ""}`}> _handle_file_change(e.target.files, false)} /> {!uploadRunContent.partner_demo ?
@@ -265,19 +271,19 @@ const UploadRunDialog: React.FC = ({ token, open, onClose, ) } +
-
-
- - -
-
+ ) }
+
+ + +
diff --git a/frontend/src/css/UploadRunDialog.css b/frontend/src/css/UploadRunDialog.css index 78fca5e..f129bb8 100644 --- a/frontend/src/css/UploadRunDialog.css +++ b/frontend/src/css/UploadRunDialog.css @@ -51,6 +51,7 @@ div#upload-run{ .upload-run-dropdown-container .dropdown-cur { user-select: none; cursor: pointer; + width: 240px; } .upload-run-dropdown { @@ -64,7 +65,7 @@ div#upload-run{ animation: dropdown-in 0.2s ease; max-height: 300px; overflow-y: scroll; - width: 400px; + width: 260px; } .upload-run-dropdown div { -- cgit v1.2.3