Fixed couple of bugs
This commit is contained in:
1 parent
5a5cc814c3
commit
ce399ce258
7 files changed
+72
-56
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# Site Web de Balle Phénix
|
||||
# Site Web de [Balle Phénix](http://ballephenix.com)
|
||||

|
||||
|
||||
|
||||
@@ -32,11 +32,17 @@ side for The softball league 'Balle Phénix'.
|
||||
|
||||
## How to build
|
||||
|
||||
$ npm install
|
||||
$ node_modules/.bin/gulp help
|
||||
No build, it uses [deno](https://deno.land)
|
||||
|
||||
# How it is made
|
||||
# How to run it
|
||||
|
||||
* mithril.js as client side framework
|
||||
* uikit as css framework
|
||||
* coffee and love
|
||||
```shell
|
||||
deno run -A --unstable-vk server.ts
|
||||
```
|
||||
|
||||
|
||||
## How to deploy the website
|
||||
|
||||
```shell
|
||||
./deploy
|
||||
```
|
||||
@@ -1 +0,0 @@
|
||||
hello {{ title }}
|
||||
@@ -1,13 +1,12 @@
|
||||
// alert("ok")
|
||||
import * as util from "./util.js";
|
||||
import * as resultParser from './resultParser.js'
|
||||
import * as teams from './teams.js'
|
||||
import m from "https://esm.sh/mithril@2.2.2"
|
||||
import * as resultParser from "./resultParser.js";
|
||||
import * as teams from "./teams.js";
|
||||
import m from "https://esm.sh/mithril@2.2.2";
|
||||
import { rainSvg } from "./images.js";
|
||||
import _ from "https://esm.sh/lodash-es@4.17.21"
|
||||
|
||||
import {statsView, tabView, scheduleTeamTags } from './schedule.js'
|
||||
import _ from "https://esm.sh/lodash-es@4.17.21";
|
||||
|
||||
import { statsView, tabView, scheduleTeamTags } from "./schedule.js";
|
||||
|
||||
const nextGameDaySchedule = {};
|
||||
|
||||
@@ -16,55 +15,66 @@ nextGameDaySchedule._toDay = function(){
|
||||
return new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
};
|
||||
|
||||
nextGameDaySchedule.oninit = async function(){
|
||||
const currentYear = new Date();
|
||||
|
||||
nextGameDaySchedule.oninit = async function () {
|
||||
const result = await m.request({
|
||||
method: "GET",
|
||||
url: `/api/results/2024.json`
|
||||
url: `/api/results/${new Date().getFullYear()}.json`,
|
||||
});
|
||||
const nightGames = resultParser.getNightGames(result);
|
||||
nextGameDaySchedule.games = nextGameDaySchedule._getNextNightGame(nightGames, nextGameDaySchedule._toDay());
|
||||
nextGameDaySchedule.games = nextGameDaySchedule._getNextNightGame(
|
||||
nightGames,
|
||||
nextGameDaySchedule._toDay(),
|
||||
);
|
||||
};
|
||||
|
||||
nextGameDaySchedule._getNextNightGame = function (games, date) {
|
||||
return _(games)
|
||||
.filter(g => g.jsDate.getTime() >= date.getTime())
|
||||
.filter((g) => g.jsDate.getTime() >= date.getTime())
|
||||
.last()
|
||||
.games
|
||||
.sort((g1, g2) => g1.jsDate - g2.jsDate);
|
||||
.games.sort((g1, g2) => g1.jsDate - g2.jsDate);
|
||||
};
|
||||
|
||||
nextGameDaySchedule._getTableHead = function () {
|
||||
return m('thead', m('tr', [
|
||||
m('td', 'Date'),
|
||||
m('td', 'Heure'),
|
||||
m('td', 'Receveur'),
|
||||
m('td', 'Visiteur')
|
||||
]));
|
||||
return m(
|
||||
"thead",
|
||||
m("tr", [
|
||||
m("td", "Date"),
|
||||
m("td", "Heure"),
|
||||
m("td", "Receveur"),
|
||||
m("td", "Visiteur"),
|
||||
]),
|
||||
);
|
||||
};
|
||||
|
||||
nextGameDaySchedule._responsoveText = function (largeText, smallText, game) {
|
||||
var ret = [];
|
||||
if (game.rain) {
|
||||
ret.push(rainSvg('1.5em'));
|
||||
ret.push(' ');
|
||||
ret.push(rainSvg("1.5em"));
|
||||
ret.push(" ");
|
||||
} else if (game.practice) {
|
||||
ret.push(m('span.uk-badge.uk-badge-success', 'pratique!'));
|
||||
ret.push(' ');
|
||||
ret.push(m("span.uk-badge.uk-badge-success", "pratique!"));
|
||||
ret.push(" ");
|
||||
}
|
||||
ret.push(m('span.uk-visible-large', largeText));
|
||||
ret.push(m('span.uk-hidden-large', smallText));
|
||||
ret.push(m("span.uk-visible-large", largeText));
|
||||
ret.push(m("span.uk-hidden-large", smallText));
|
||||
return ret;
|
||||
};
|
||||
|
||||
nextGameDaySchedule._getGamesRow = function (game) {
|
||||
return m('tr', [
|
||||
m('td', nextGameDaySchedule._responsoveText(util.formatDate(game.jsDate),
|
||||
return m("tr", [
|
||||
m(
|
||||
"td",
|
||||
nextGameDaySchedule._responsoveText(
|
||||
util.formatDate(game.jsDate),
|
||||
util.formatDateSmall(game.jsDate),
|
||||
game)),
|
||||
m('td', game.time),
|
||||
m('td', scheduleTeamTags.getHomeTeamTag(game)),
|
||||
m('td',scheduleTeamTags.getAwayTeamTag(game))
|
||||
game,
|
||||
),
|
||||
),
|
||||
m("td", game.time),
|
||||
m("td", scheduleTeamTags.getHomeTeamTag(game)),
|
||||
m("td", scheduleTeamTags.getAwayTeamTag(game)),
|
||||
]);
|
||||
};
|
||||
|
||||
@@ -73,26 +83,26 @@ nextGameDaySchedule._getGamesRows = function(games){
|
||||
};
|
||||
|
||||
nextGameDaySchedule.view = function () {
|
||||
return m('table.uk-table.uk-table-hover.uk-table-striped.uk-table-condensed',[
|
||||
return m(
|
||||
"table.uk-table.uk-table-hover.uk-table-striped.uk-table-condensed",
|
||||
[
|
||||
nextGameDaySchedule._getTableHead(),
|
||||
m('tbody',
|
||||
nextGameDaySchedule._getGamesRows(nextGameDaySchedule.games)
|
||||
)]);
|
||||
m("tbody", nextGameDaySchedule._getGamesRows(nextGameDaySchedule.games)),
|
||||
],
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const LittleCalendar = {}
|
||||
const LittleCalendar = {};
|
||||
|
||||
LittleCalendar.view = function () {
|
||||
return m(nextGameDaySchedule);
|
||||
}
|
||||
};
|
||||
|
||||
const containerIds = ['large-mithril-container',
|
||||
'medium-mithril-container',
|
||||
'small-mithril-container']
|
||||
const containerIds = [
|
||||
"large-mithril-container",
|
||||
"medium-mithril-container",
|
||||
"small-mithril-container",
|
||||
];
|
||||
|
||||
for (const id of containerIds) {
|
||||
m.mount(document.getElementById(id), LittleCalendar);
|
||||
|
||||
+2
-1
@@ -87,7 +87,8 @@
|
||||
<div class="uk-panel uk-panel-box">
|
||||
<div class="uk-panel-badge uk-badge"><i class="fa fa-calendar" style="font-size: 1.7em;"></i></div>
|
||||
<h3 class="uk-panel-title"><a href="#/calendrier" class="uk-link-muted">Calendrier</a></h3>
|
||||
<div id="small-mithril-container"></div>
|
||||
<div id="small-mithril-container">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h3 class="uk-panel-title">
|
||||
<a href="#/nouvelles" class="uk-link-muted">
|
||||
<h2 id="saison-2023">Saison 2023</h2>
|
||||
<h2 id="saison-2025">Saison 2025</h2>
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<div>
|
||||
<article class="uk-article uk-margin-">
|
||||
<h1 class="uk-article-title">
|
||||
<h2 id="saison-2023">Saison 2023</h2>
|
||||
<h2 id="saison-2025">Saison 2025</h2>
|
||||
</h1>
|
||||
<p class="uk-article-meta">
|
||||
<p>Dimanche 10 Juillet 2023</p>
|
||||
<p>Vendredi 25 Avril 2025</p>
|
||||
</p>
|
||||
<p>Bonne saison à tous et toutes!</p>
|
||||
<p>N'oubliez pas de consulter la page facebook: <a href="https://www.facebook.com/SportsPhenixMtl/">https://www.facebook.com/SportsPhenixMtl/</a> pour toutes mises à jour, y compris les annulations due à la météo.</p>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<hr>
|
||||
<button class="uk-button"
|
||||
hx-get="/member/new-game-editor"
|
||||
hx-get="/membre/new-game-editor"
|
||||
hx-target="#content">
|
||||
Nouvelle Partie
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user