Fixed couple of bugs
This commit is contained in:
1 parent
5a5cc814c3
commit
ce399ce258
7 files changed
+84
-68
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
|
## How to build
|
||||||
|
|
||||||
$ npm install
|
No build, it uses [deno](https://deno.land)
|
||||||
$ node_modules/.bin/gulp help
|
|
||||||
|
|
||||||
# How it is made
|
# How to run it
|
||||||
|
|
||||||
* mithril.js as client side framework
|
```shell
|
||||||
* uikit as css framework
|
deno run -A --unstable-vk server.ts
|
||||||
* coffee and love
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## How to deploy the website
|
||||||
|
|
||||||
|
```shell
|
||||||
|
./deploy
|
||||||
|
```
|
||||||
@@ -1 +0,0 @@
|
|||||||
hello {{ title }}
|
|
||||||
@@ -1,99 +1,109 @@
|
|||||||
// alert("ok")
|
// alert("ok")
|
||||||
import * as util from "./util.js";
|
import * as util from "./util.js";
|
||||||
import * as resultParser from './resultParser.js'
|
import * as resultParser from "./resultParser.js";
|
||||||
import * as teams from './teams.js'
|
import * as teams from "./teams.js";
|
||||||
import m from "https://esm.sh/mithril@2.2.2"
|
import m from "https://esm.sh/mithril@2.2.2";
|
||||||
import {rainSvg} from "./images.js";
|
import { rainSvg } from "./images.js";
|
||||||
import _ from "https://esm.sh/lodash-es@4.17.21"
|
import _ from "https://esm.sh/lodash-es@4.17.21";
|
||||||
|
|
||||||
import {statsView, tabView, scheduleTeamTags } from './schedule.js'
|
|
||||||
|
|
||||||
|
import { statsView, tabView, scheduleTeamTags } from "./schedule.js";
|
||||||
|
|
||||||
const nextGameDaySchedule = {};
|
const nextGameDaySchedule = {};
|
||||||
|
|
||||||
nextGameDaySchedule._toDay = function(){
|
nextGameDaySchedule._toDay = function () {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
return new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
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({
|
const result = await m.request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: `/api/results/2024.json`
|
url: `/api/results/${new Date().getFullYear()}.json`,
|
||||||
});
|
});
|
||||||
const nightGames = resultParser.getNightGames(result);
|
const nightGames = resultParser.getNightGames(result);
|
||||||
nextGameDaySchedule.games = nextGameDaySchedule._getNextNightGame(nightGames, nextGameDaySchedule._toDay());
|
nextGameDaySchedule.games = nextGameDaySchedule._getNextNightGame(
|
||||||
|
nightGames,
|
||||||
|
nextGameDaySchedule._toDay(),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule._getNextNightGame = function(games, date){
|
nextGameDaySchedule._getNextNightGame = function (games, date) {
|
||||||
return _(games)
|
return _(games)
|
||||||
.filter(g => g.jsDate.getTime() >= date.getTime())
|
.filter((g) => g.jsDate.getTime() >= date.getTime())
|
||||||
.last()
|
.last()
|
||||||
.games
|
.games.sort((g1, g2) => g1.jsDate - g2.jsDate);
|
||||||
.sort((g1, g2) => g1.jsDate - g2.jsDate);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule._getTableHead = function(){
|
nextGameDaySchedule._getTableHead = function () {
|
||||||
return m('thead', m('tr', [
|
return m(
|
||||||
m('td', 'Date'),
|
"thead",
|
||||||
m('td', 'Heure'),
|
m("tr", [
|
||||||
m('td', 'Receveur'),
|
m("td", "Date"),
|
||||||
m('td', 'Visiteur')
|
m("td", "Heure"),
|
||||||
]));
|
m("td", "Receveur"),
|
||||||
|
m("td", "Visiteur"),
|
||||||
|
]),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule._responsoveText = function(largeText, smallText, game){
|
nextGameDaySchedule._responsoveText = function (largeText, smallText, game) {
|
||||||
var ret = [];
|
var ret = [];
|
||||||
if(game.rain){
|
if (game.rain) {
|
||||||
ret.push(rainSvg('1.5em'));
|
ret.push(rainSvg("1.5em"));
|
||||||
ret.push(' ');
|
ret.push(" ");
|
||||||
} else if(game.practice){
|
} else if (game.practice) {
|
||||||
ret.push(m('span.uk-badge.uk-badge-success', 'pratique!'));
|
ret.push(m("span.uk-badge.uk-badge-success", "pratique!"));
|
||||||
ret.push(' ');
|
ret.push(" ");
|
||||||
}
|
}
|
||||||
ret.push(m('span.uk-visible-large', largeText));
|
ret.push(m("span.uk-visible-large", largeText));
|
||||||
ret.push(m('span.uk-hidden-large', smallText));
|
ret.push(m("span.uk-hidden-large", smallText));
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule._getGamesRow = function(game){
|
nextGameDaySchedule._getGamesRow = function (game) {
|
||||||
return m('tr', [
|
return m("tr", [
|
||||||
m('td', nextGameDaySchedule._responsoveText(util.formatDate(game.jsDate),
|
m(
|
||||||
|
"td",
|
||||||
|
nextGameDaySchedule._responsoveText(
|
||||||
|
util.formatDate(game.jsDate),
|
||||||
util.formatDateSmall(game.jsDate),
|
util.formatDateSmall(game.jsDate),
|
||||||
game)),
|
game,
|
||||||
m('td', game.time),
|
),
|
||||||
m('td', scheduleTeamTags.getHomeTeamTag(game)),
|
),
|
||||||
m('td',scheduleTeamTags.getAwayTeamTag(game))
|
m("td", game.time),
|
||||||
|
m("td", scheduleTeamTags.getHomeTeamTag(game)),
|
||||||
|
m("td", scheduleTeamTags.getAwayTeamTag(game)),
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule._getGamesRows = function(games){
|
nextGameDaySchedule._getGamesRows = function (games) {
|
||||||
return _.map(games, nextGameDaySchedule._getGamesRow);
|
return _.map(games, nextGameDaySchedule._getGamesRow);
|
||||||
};
|
};
|
||||||
|
|
||||||
nextGameDaySchedule.view = function(){
|
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(),
|
nextGameDaySchedule._getTableHead(),
|
||||||
m('tbody',
|
m("tbody", nextGameDaySchedule._getGamesRows(nextGameDaySchedule.games)),
|
||||||
nextGameDaySchedule._getGamesRows(nextGameDaySchedule.games)
|
],
|
||||||
)]);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const LittleCalendar = {};
|
||||||
|
|
||||||
|
LittleCalendar.view = function () {
|
||||||
|
|
||||||
|
|
||||||
const LittleCalendar = {}
|
|
||||||
|
|
||||||
LittleCalendar.view = function(){
|
|
||||||
return m(nextGameDaySchedule);
|
return m(nextGameDaySchedule);
|
||||||
}
|
};
|
||||||
|
|
||||||
const containerIds = ['large-mithril-container',
|
const containerIds = [
|
||||||
'medium-mithril-container',
|
"large-mithril-container",
|
||||||
'small-mithril-container']
|
"medium-mithril-container",
|
||||||
|
"small-mithril-container",
|
||||||
|
];
|
||||||
|
|
||||||
for(const id of containerIds){
|
for (const id of containerIds) {
|
||||||
m.mount(document.getElementById(id), LittleCalendar);
|
m.mount(document.getElementById(id), LittleCalendar);
|
||||||
}
|
}
|
||||||
+2
-1
@@ -87,7 +87,8 @@
|
|||||||
<div class="uk-panel uk-panel-box">
|
<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>
|
<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>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<h3 class="uk-panel-title">
|
<h3 class="uk-panel-title">
|
||||||
<a href="#/nouvelles" class="uk-link-muted">
|
<a href="#/nouvelles" class="uk-link-muted">
|
||||||
<h2 id="saison-2023">Saison 2023</h2>
|
<h2 id="saison-2025">Saison 2025</h2>
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
<div>
|
<div>
|
||||||
<article class="uk-article uk-margin-">
|
<article class="uk-article uk-margin-">
|
||||||
<h1 class="uk-article-title">
|
<h1 class="uk-article-title">
|
||||||
<h2 id="saison-2023">Saison 2023</h2>
|
<h2 id="saison-2025">Saison 2025</h2>
|
||||||
</h1>
|
</h1>
|
||||||
<p class="uk-article-meta">
|
<p class="uk-article-meta">
|
||||||
<p>Dimanche 10 Juillet 2023</p>
|
<p>Vendredi 25 Avril 2025</p>
|
||||||
</p>
|
</p>
|
||||||
<p>Bonne saison à tous et toutes!</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>
|
<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>
|
<hr>
|
||||||
<button class="uk-button"
|
<button class="uk-button"
|
||||||
hx-get="/member/new-game-editor"
|
hx-get="/membre/new-game-editor"
|
||||||
hx-target="#content">
|
hx-target="#content">
|
||||||
Nouvelle Partie
|
Nouvelle Partie
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in new issue
Block a user