Compare commits
5 commits
7dcc576689
...
0a8400c20f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a8400c20f | ||
|
|
fa50710648 | ||
|
|
8209b7400b | ||
|
|
e3b463d91c | ||
|
|
732a4568c5 |
7 changed files with 33 additions and 38 deletions
|
|
@ -8,6 +8,7 @@ class MoodApp < Sinatra::Base
|
|||
register Sinatra::ActiveRecordExtension
|
||||
register Sinatra::Namespace
|
||||
set :database, { adapter: 'sqlite3', database: "mood-#{ENV['RACK_ENV']}.sqlite3" }
|
||||
set :bind, '::1'
|
||||
|
||||
get '/' do
|
||||
@mode = Mood.last&.mode || 'croisiere'
|
||||
|
|
|
|||
BIN
public/creatif.jpg
Normal file
BIN
public/creatif.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
BIN
public/croisiere.jpg
Normal file
BIN
public/croisiere.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
BIN
public/en-charge.jpg
Normal file
BIN
public/en-charge.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
|
|
@ -1,6 +1,8 @@
|
|||
body {
|
||||
margin: 0px;
|
||||
font: 1.8rem "Fira Sans", sans-serif;
|
||||
font-family: "Sour Gummy", sans-serif;
|
||||
font-weight: 350;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.mode {
|
||||
|
|
@ -15,26 +17,9 @@ body {
|
|||
.title {
|
||||
grid-area: title;
|
||||
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 {
|
||||
background: red;
|
||||
width: 10px;
|
||||
|
|
@ -107,15 +92,10 @@ main {
|
|||
grid-area: tracker;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: repeat(2, 1fr) repeat(7, 1fr);
|
||||
grid-template-rows: 2fr 1fr 6fr 1fr;
|
||||
grid-template-areas:
|
||||
"title title"
|
||||
"title title"
|
||||
"moods moods"
|
||||
"moods moods"
|
||||
"moods moods"
|
||||
"moods moods"
|
||||
"moods moods"
|
||||
"info-day info-day"
|
||||
"moods moods"
|
||||
". legend";
|
||||
background-color: lightgoldenrodyellow;
|
||||
|
|
@ -131,6 +111,10 @@ main {
|
|||
margin: 30px;
|
||||
}
|
||||
|
||||
.info-day {
|
||||
grid-area: info-day;
|
||||
margin: 30px;
|
||||
}
|
||||
|
||||
.info {
|
||||
grid-area: info;
|
||||
|
|
@ -151,10 +135,18 @@ main {
|
|||
max-height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.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 {
|
||||
align-self: flex-end;
|
||||
|
|
|
|||
BIN
public/triste.jpg
Normal file
BIN
public/triste.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
|
|
@ -3,21 +3,22 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<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">
|
||||
import { Application, Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js"
|
||||
window.Stimulus = Application.start()
|
||||
|
||||
Stimulus.register("mood", class extends Controller {
|
||||
static targets = [ "image" ]
|
||||
static targets = [ "image", "info" ]
|
||||
|
||||
showMode(event) {
|
||||
const image = this.imageTarget
|
||||
image.src = event.target.dataset.mode + ".png"
|
||||
}
|
||||
|
||||
showCurrent() {
|
||||
const image = this.imageTarget
|
||||
image.src = "<%= @mode %>.png"
|
||||
updateDayInfo(event) {
|
||||
const image = this.imageTarget;
|
||||
const infoDay = this.infoTarget;
|
||||
image.src = event.target.dataset.mode + ".jpg"
|
||||
infoDay.textContent = event.target.dataset.day;
|
||||
}
|
||||
|
||||
})
|
||||
|
|
@ -25,19 +26,20 @@
|
|||
</head>
|
||||
<main data-controller="mood">
|
||||
<div class="mode">
|
||||
<img data-mood-target="image" src="<%= @mode %>.png">
|
||||
<img data-mood-target="image" src="<%= @mode %>.jpg">
|
||||
</div>
|
||||
<div class="tracker">
|
||||
<div class="title">
|
||||
<h1>Comment il va le Robi ?</h1>
|
||||
</div>
|
||||
<div class="info-day" data-mood-target="info">Aujourd'hui</div>
|
||||
<div class="moods">
|
||||
<div class="log">
|
||||
<% @mood_log.each do |week| %>
|
||||
<div class="week">
|
||||
<% week.each do |d| %>
|
||||
<% 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 %>
|
||||
<div class="day"></div>
|
||||
<% end %>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue