Compare commits

...

5 commits

Author SHA1 Message Date
Christophe Robillard
7dcc576689 update font 2025-06-29 12:21:06 +02:00
Christophe Robillard
17b97e937a remove useless info 2025-06-03 13:26:49 +02:00
Christophe Robillard
626504ce74 maintient l'affichage du mode entre les jours
remove useless style rules

supprime les modes interstice
2025-06-03 13:13:34 +02:00
Christophe Robillard
e059c1d62d bind ipv6 2025-05-23 19:14:32 +02:00
Christophe Robillard
02116c9dd1 downsize images 2025-05-23 18:58:51 +02:00
7 changed files with 33 additions and 38 deletions

View file

@ -8,6 +8,7 @@ class MoodApp < Sinatra::Base
register Sinatra::ActiveRecordExtension register Sinatra::ActiveRecordExtension
register Sinatra::Namespace register Sinatra::Namespace
set :database, { adapter: 'sqlite3', database: "mood-#{ENV['RACK_ENV']}.sqlite3" } set :database, { adapter: 'sqlite3', database: "mood-#{ENV['RACK_ENV']}.sqlite3" }
set :bind, '::1'
get '/' do get '/' do
@mode = Mood.last&.mode || 'croisiere' @mode = Mood.last&.mode || 'croisiere'

BIN
public/creatif.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
public/croisiere.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
public/en-charge.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
public/frigo-vide.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View file

@ -1,6 +1,8 @@
body { body {
margin: 0px; margin: 0px;
font: 1.8rem "Fira Sans", sans-serif; font-family: "Sour Gummy", sans-serif;
font-weight: 350;
font-style: normal;
} }
.mode { .mode {
@ -15,26 +17,9 @@ body {
.title { .title {
grid-area: title; grid-area: title;
margin: 30px; margin: 30px;
font-size: 2rem;
} }
.moods {
grid-area: moods;
margin: 30px;
}
.legend {
grid-area: legend;
margin: 4px;
font-size: 0.8rem;
display: flex;
flex-direction: row;
align-items: flex-end;
justify-content: flex-end;
margin: 30px;
}
.info {
grid-area: info;
}
.legend .bar-creatif { .legend .bar-creatif {
background: red; background: red;
width: 10px; width: 10px;
@ -107,15 +92,10 @@ main {
grid-area: tracker; grid-area: tracker;
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
grid-template-rows: repeat(2, 1fr) repeat(7, 1fr); grid-template-rows: 2fr 1fr 6fr 1fr;
grid-template-areas: grid-template-areas:
"title title" "title title"
"title title" "info-day info-day"
"moods moods"
"moods moods"
"moods moods"
"moods moods"
"moods moods"
"moods moods" "moods moods"
". legend"; ". legend";
background-color: lightgoldenrodyellow; background-color: lightgoldenrodyellow;
@ -131,6 +111,10 @@ main {
margin: 30px; margin: 30px;
} }
.info-day {
grid-area: info-day;
margin: 30px;
}
.info { .info {
grid-area: info; grid-area: info;
@ -151,10 +135,18 @@ main {
max-height: 100%; max-height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden;
} }
.legend { .legend {
align-self: flex-end; grid-area: legend;
margin: 4px;
font-size: 0.8rem;
display: flex;
flex-direction: row;
align-items: flex-end;
justify-content: flex-end;
margin: 30px;
} }
.log { .log {
align-self: flex-end; align-self: flex-end;

View file

@ -3,21 +3,22 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css"> <link rel="stylesheet" href="main.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Delius&family=Sour+Gummy:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<script type="module"> <script type="module">
import { Application, Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js" import { Application, Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js"
window.Stimulus = Application.start() window.Stimulus = Application.start()
Stimulus.register("mood", class extends Controller { Stimulus.register("mood", class extends Controller {
static targets = [ "image" ] static targets = [ "image", "info" ]
showMode(event) { updateDayInfo(event) {
const image = this.imageTarget const image = this.imageTarget;
image.src = event.target.dataset.mode + ".png" const infoDay = this.infoTarget;
} image.src = event.target.dataset.mode + ".jpg"
infoDay.textContent = event.target.dataset.day;
showCurrent() {
const image = this.imageTarget
image.src = "<%= @mode %>.png"
} }
}) })
@ -25,19 +26,20 @@
</head> </head>
<main data-controller="mood"> <main data-controller="mood">
<div class="mode"> <div class="mode">
<img data-mood-target="image" src="<%= @mode %>.png"> <img data-mood-target="image" src="<%= @mode %>.jpg">
</div> </div>
<div class="tracker"> <div class="tracker">
<div class="title"> <div class="title">
<h1>Comment il va le Robi ?</h1> <h1>Comment il va le Robi ?</h1>
</div> </div>
<div class="info-day" data-mood-target="info">Aujourd'hui</div>
<div class="moods"> <div class="moods">
<div class="log"> <div class="log">
<% @mood_log.each do |week| %> <% @mood_log.each do |week| %>
<div class="week"> <div class="week">
<% week.each do |d| %> <% week.each do |d| %>
<% if d[1] %> <% if d[1] %>
<div data-mode="<%= d[1] %>" data-action="mouseover->mood#showMode mouseleave->mood#showCurrent" title="<%= d[0] %> : <%= d[1] %>" class="day <%= d[1] %>"></div> <div data-mode="<%= d[1] %>" data-day="<%= d[0] %>" data-action="mouseover->mood#updateDayInfo mouseleave->mood#updateDayInfo" title="<%= d[0] %> : <%= d[1] %>" class="day <%= d[1] %>"></div>
<% else %> <% else %>
<div class="day"></div> <div class="day"></div>
<% end %> <% end %>