Skip to content

Commit 6530747

Browse files
committed
Fix styles
1 parent 576e4b6 commit 6530747

File tree

6 files changed

+55
-49
lines changed

6 files changed

+55
-49
lines changed

services/app/apps/codebattle/assets/css/landing.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@import 'fonts';
2-
@import 'variables';
3-
@import '~bootstrap/scss/bootstrap';
1+
@import "fonts";
2+
@import "variables";
3+
@import "bootstrap/scss/bootstrap";
44

55
.btn:hover {
66
text-decoration: if($link-hover-decoration == underline, none, null);
@@ -55,7 +55,7 @@ h2 {
5555
}
5656

5757
.bg-codebattle {
58-
background-image: url('../static/images/landing/bg-codebattle.svg');
58+
background-image: url("../static/images/landing/bg-codebattle.svg");
5959
background-repeat: no-repeat;
6060
background-size: 70%;
6161
background-position: right;
@@ -115,7 +115,7 @@ h2 {
115115
}
116116

117117
p {
118-
font-family: 'Montserrat', sans-serif;
118+
font-family: "Montserrat", sans-serif;
119119
}
120120

121121
.lang-icons {

services/app/apps/codebattle/assets/js/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import "@fortawesome/fontawesome-free/js/all";
2121
// import '../css/style.scss';
2222
import "bootstrap";
2323

24+
import "@vitejs/plugin-react/preamble";
2425
import { inspect } from "@xstate/inspect";
2526
import NProgress from "nprogress";
2627
import { Socket } from "phoenix";

services/app/apps/codebattle/assets/js/widgets/pages/lobby/SeasonProfilePanel.jsx

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useState, useEffect } from "react";
22

3-
import axios from 'axios';
4-
import cn from 'classnames';
5-
import { camelizeKeys } from 'humps';
6-
import { useDispatch, useSelector } from 'react-redux';
3+
import axios from "axios";
4+
import cn from "classnames";
5+
import { camelizeKeys } from "humps";
6+
import { useDispatch, useSelector } from "react-redux";
77

8-
import { loadNearbyUsers } from '@/middlewares/Users';
8+
import { loadNearbyUsers } from "@/middlewares/Users";
99
import {
1010
selectDefaultAvatarUrl,
1111
currentUserIsAdminSelector,
1212
userByIdSelector,
13-
} from '@/selectors';
13+
} from "@/selectors";
1414

15-
import i18n from '../../../i18n';
16-
import { actions } from '../../slices';
15+
import i18n from "../../../i18n";
16+
import { actions } from "../../slices";
1717

18-
import CodebattleLeagueDescription from './CodebattleLeagueDescription';
19-
import TournamentListItem, { activeIcon } from './TournamentListItem';
18+
import CodebattleLeagueDescription from "./CodebattleLeagueDescription";
19+
import TournamentListItem, { activeIcon } from "./TournamentListItem";
2020

21-
const contestDatesText = 'Season: Oct 16 - Dec 21';
21+
const contestDatesText = "Season: Oct 16 - Dec 21";
2222

2323
const OpponentInfo = ({ id }) => {
2424
const user = useSelector(userByIdSelector(id));
@@ -29,34 +29,33 @@ const OpponentInfo = ({ id }) => {
2929
<UserLogo user={user} size="25px" />
3030
<span
3131
title={user?.name}
32-
className={cn('text-white text-truncate ml-2', {
33-
'cb-text-skeleton w-100': !user,
32+
className={cn("text-white text-truncate ml-2", {
33+
"cb-text-skeleton w-100": !user,
3434
})}
35-
style={{ maxWidth: '70px' }}
35+
style={{ maxWidth: "70px" }}
3636
>
3737
{user?.name}
3838
</span>
3939
</div>
4040
<div className="d-flex flex-column text-center py-1 w-100">
4141
<a href="/hall_of_fame" className="stat-item py-1 w-100">
4242
<span
43-
className={cn('stat-value d-block cb-text-danger', {
44-
'd-inline cb-text-skeleton w-25 mx-auto': !user,
43+
className={cn("stat-value d-block cb-text-danger", {
44+
"d-inline cb-text-skeleton w-25 mx-auto": !user,
4545
})}
4646
>
47-
#
48-
{user ? user.rank : ''}
47+
#{user ? user.rank : ""}
4948
</span>
5049
<span className="stat-label text-uppercase">Place</span>
5150
</a>
5251
</div>
5352
<div className="d-flex flex-column text-center py-1 w-100">
5453
<span
55-
className={cn('stat-value d-block cb-text-danger', {
56-
'd-inline cb-text-skeleton w-25 mx-auto': !user,
54+
className={cn("stat-value d-block cb-text-danger", {
55+
"d-inline cb-text-skeleton w-25 mx-auto": !user,
5756
})}
5857
>
59-
{user ? user.points : ''}
58+
{user ? user.points : ""}
6059
</span>
6160
<span className="stat-label text-uppercase">Points</span>
6261
</div>
@@ -72,7 +71,7 @@ const SeasonNearbyUsers = ({ user, nearbyUsers }) => {
7271
if (user.points) {
7372
const abortController = new AbortController();
7473

75-
const onSuccess = payload => {
74+
const onSuccess = (payload) => {
7675
if (!abortController.signal.aborted) {
7776
dispatch(actions.setNearbyUsers(payload.data));
7877
dispatch(actions.updateUsers(payload.data));
@@ -110,14 +109,14 @@ const SeasonNearbyUsers = ({ user, nearbyUsers }) => {
110109
<OpponentInfo />
111110
</>
112111
) : (
113-
nearbyUsers.map(id => <OpponentInfo id={id} />)
112+
nearbyUsers.map((id) => <OpponentInfo id={id} />)
114113
)}
115114
</div>
116115
</div>
117116
);
118117
};
119118

120-
const UserLogo = ({ user, size = '70px' }) => {
119+
const UserLogo = ({ user, size = "70px" }) => {
121120
const [userInfo, setUserInfo] = useState();
122121
const defaultAvatarUrl = useSelector(selectDefaultAvatarUrl);
123122
const avatarUrl = user?.avatarUrl || userInfo?.avatarUrl || defaultAvatarUrl;
@@ -131,7 +130,7 @@ const UserLogo = ({ user, size = '70px' }) => {
131130
.get(`/api/v1/user/${userId}/stats`, {
132131
signal: controller.signal,
133132
})
134-
.then(response => {
133+
.then((response) => {
135134
if (!controller.signal.aborted) {
136135
setUserInfo(camelizeKeys(response.data.user));
137136
}
@@ -178,7 +177,7 @@ const SeasonProfilePanel = ({
178177
</span>
179178
</div>
180179
<div className="d-flex flex-wrap">
181-
{liveTournaments.map(tournament => (
180+
{liveTournaments.map((tournament) => (
182181
<TournamentListItem
183182
isAdmin={isAdmin}
184183
key={tournament.id}
@@ -197,7 +196,7 @@ const SeasonProfilePanel = ({
197196
</span>
198197
</div>
199198
<div className="d-flex flex-wrap">
200-
{seasonTournaments.map(tournament => (
199+
{seasonTournaments.map((tournament) => (
201200
<TournamentListItem
202201
isAdmin={isAdmin}
203202
key={tournament.id}
@@ -217,21 +216,21 @@ const SeasonProfilePanel = ({
217216
type="button"
218217
className="btn btn-secondary cb-btn-secondary mx-0 mx-md-2 mx-lg-2 w-100 cb-rounded text-nowrap"
219218
>
220-
{i18n.t('Contests History')}
219+
{i18n.t("Contests History")}
221220
</a>
222221
<a
223222
href="/schedule#my"
224223
type="button"
225224
className="btn btn-secondary cb-btn-secondary mx-0 mx-md-2 mx-lg-2 w-100 cb-rounded text-nowrap"
226225
>
227-
{i18n.t('My Tournaments')}
226+
{i18n.t("My Tournaments")}
228227
</a>
229228
<a
230229
href="/tournaments"
231230
type="button"
232231
className="btn btn-secondary cb-btn-secondary mx-0 mx-md-2 mx-lg-2 w-100 cb-rounded text-nowrap"
233232
>
234-
{i18n.t('Create a Tournament')}
233+
{i18n.t("Create a Tournament")}
235234
</a>
236235
</div>
237236
</div>
@@ -243,7 +242,7 @@ const SeasonProfilePanel = ({
243242
<span className="clan-tag mt-2">{user.name}</span>
244243
<span className="h1 clan-title m-0 text-white text-uppercase">
245244
Clan
246-
{': '}
245+
{": "}
247246
{user.clanId ? (
248247
user.clan
249248
) : (
@@ -264,8 +263,7 @@ const SeasonProfilePanel = ({
264263
<a href="/hall_of_fame" className="stat-item py-1 w-100">
265264
{user.points ? (
266265
<span className="stat-value d-block cb-text-success">
267-
#
268-
{user.rank}
266+
#{user.rank}
269267
</span>
270268
) : (
271269
<span className="stat-value d-block cb-text-danger">#0</span>
@@ -290,7 +288,7 @@ const SeasonProfilePanel = ({
290288
href="/hall_of_fame"
291289
className="text-uppercase stat-label cb-rounded"
292290
>
293-
{i18n.t('View Hall of Fame')}
291+
{i18n.t("View Hall of Fame")}
294292
</a>
295293
</div>
296294
{controls}

services/app/apps/codebattle/lib/codebattle_web/templates/layout/app.html.heex

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,9 @@
3636
<meta content="#ffffff" name="theme-color" />
3737
<%= render_tags_all(assigns[:meta_tags] || %{}) %>
3838
<meta name="csrf-token" content={csrf_token_value()} />
39-
<link rel="stylesheet" href={CodebattleWeb.Vite.asset_path("styles.css")} />
4039
<%= if CodebattleWeb.Vite.dev?() do %>
40+
<link rel="stylesheet" href="http://localhost:8080/assets/css/style.scss" />
4141
<script type="module" src="http://localhost:8080/@vite/client"></script>
42-
<!-- React Fast Refresh preamble -->
43-
<script type="module">
44-
import RefreshRuntime from "http://localhost:8080/@react-refresh";
45-
RefreshRuntime.injectIntoGlobalHook(window);
46-
window.$RefreshReg$ = () => {};
47-
window.$RefreshSig$ = () => (type) => type;
48-
window.__vite_plugin_react_preamble_installed__ = true;
49-
</script>
5042
<script type="module" src="http://localhost:8080/assets/js/app.js"></script>
5143
<% else %>
5244
<link rel="stylesheet" href={CodebattleWeb.Vite.asset_path("app.css")} />

services/app/apps/codebattle/lib/codebattle_web/templates/layout/landing.html.heex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@
5151
src={Routes.static_path(@conn, "/assets/landing.js")}
5252
>
5353
</script>
54+
55+
<%= if CodebattleWeb.Vite.dev?() do %>
56+
<link rel="stylesheet" href="http://localhost:8080/assets/css/landing.scss" />
57+
<script type="module" src="http://localhost:8080/@vite/client"></script>
58+
<script type="module" src="http://localhost:8080/assets/js/landing.js"></script>
59+
<% else %>
60+
<link rel="stylesheet" href={CodebattleWeb.Vite.asset_path("app.css")} />
61+
<%= for href <- CodebattleWeb.Vite.css_paths("app.js") do %>
62+
<link rel="stylesheet" href={href} />
63+
<% end %>
64+
<script type="module" src={CodebattleWeb.Vite.asset_path("app.js")}></script>
65+
<% end %>
66+
67+
5468
<title><%= Application.get_env(:codebattle, :app_title) %></title>
5569
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport" />
5670
<script async="" defer="" src="https://buttons.github.io/buttons.js">

services/app/apps/codebattle/vite.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const input = {
3737
cssbattle: path.resolve(__dirname, "assets/js/iframes/cssbattle/index.js"),
3838
landing: path.resolve(__dirname, "assets/js/landing.js"),
3939
external: path.resolve(__dirname, "assets/js/external.js"),
40+
styles: path.resolve(__dirname, "assets/css/style.scss"),
4041
// broadcast_editor: path.resolve(
4142
// __dirname,
4243
// "assets/js/widgets/pages/broadcast-editor/index.js",

0 commit comments

Comments
 (0)