Pretties up the song and motif pages.

This commit is contained in:
Effie 2023-06-18 16:50:33 +10:00
parent 03df74d985
commit 5a2ff83bea
10 changed files with 155 additions and 87 deletions

8
app.py
View File

@ -259,16 +259,16 @@ def songpage(id):
# query song name # query song name
name, = db.execute(''' song_info = db.execute('''
select select
name name, name_jp
from from
song song
where where
id = ? id = ?
''', ''',
(id,) (id,)
).fetchone() ).fetchall()
# query album info # query album info
@ -333,7 +333,7 @@ def songpage(id):
).fetchall() ).fetchall()
return flask.render_template('song.html', return flask.render_template('song.html',
name=name, song_info=song_info,
id=id, id=id,
album_info=album_info, album_info=album_info,
clip_info=clip_info, clip_info=clip_info,

BIN
static/motificon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
static/songbook.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
static/songicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

View File

@ -38,22 +38,47 @@ footer{
.top-buttons{ .top-buttons{
display: flex; display: flex;
padding-left: 0;
margin: 0; margin: 0;
padding: 2rem; padding: 1rem;
column-gap: 1rem; column-gap: 1rem;
max-height: fit-content;
} }
.top-buttons li{ .top-buttons a{
flex: auto; flex: auto;
display: flex;
list-style: none;
justify-content: center;
align-items: center;
position: relative;
}
.top-buttons a:nth-child(2){
flex: none;
}
.top-buttons a::before{
content: "";
position: absolute;
bottom: 0;
right: 0;
border-style: outset; border-style: outset;
border-color: var(--light-border); border-color: var(--light-border);
list-style: none; border-radius: 1rem;
text-align: center; top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
} }
.top-buttons li:nth-child(2){ .top-buttons li{
flex: none; vertical-align: center;
}
.top-buttons img{
display: block;
} }
.search-bar{ .search-bar{
@ -129,6 +154,10 @@ h2{
margin: 0; margin: 0;
} }
h3{
margin: 0;
}
a{ a{
text-decoration: none; text-decoration: none;
} }
@ -136,7 +165,6 @@ a{
.album-list{ .album-list{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem;
} }
.category-list{ .category-list{
@ -144,14 +172,13 @@ a{
flex-wrap: wrap; flex-wrap: wrap;
align-content: flex-start; align-content: flex-start;
flex-basis: 51%; flex-basis: 51%;
row-gap: 1rem;
} }
.album-info{ .album-info{
display: flex; display: flex;
align-items: baseline; align-items: baseline;
border-style: solid; /* border-style: solid;
border-color: var(--light-box); border-top: 0; border-left: 0; border-right: 0; */
margin: 1rem; margin: 1rem;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
background: var(--light-box); background: var(--light-box);
@ -165,13 +192,15 @@ a{
} }
.sort-box.album{ .sort-box.album{
gap: 1rem; margin-bottom: 1rem;
} }
.sort-box.category{ .sort-box.category{
gap: 1rem; gap: 1rem;
margin-left: auto; margin-right: auto; margin-left: auto; margin-right: auto;
width: 24rem; width: 24rem;
margin-bottom: 1rem;
} }
.sort-box.category h2{ .sort-box.category h2{
@ -186,17 +215,19 @@ a{
list-style: none; list-style: none;
min-height: 1.5rem; min-height: 1.5rem;
display: flex; display: flex;
border-radius: 1rem 0% 0% 1rem;
background: linear-gradient(90deg, var(--light-box) 90%, rgba(255, 255, 255, 0) 100%);
} }
.entry-box.song{ .entry-box.song{
margin-top: 0.5rem; margin-bottom: 0.5rem; margin-left: 4rem; margin-right: 1rem; margin-top: 0.5rem; margin-bottom: 0.5rem; margin-left: 1rem; margin-right: 1rem;
} }
.entry-box.motif{ .entry-box.motif{
margin: 1rem; margin: 1rem;
margin-bottom: 0; margin-bottom: 0;
background: var(--light-box);
justify-content: center; justify-content: center;
align-items: baseline;
} }
.entry-box.song li{ .entry-box.song li{
@ -215,12 +246,9 @@ a{
align-self: center; align-self: center;
} }
.entry-box.song.full{
background: var(--light-box);
}
.entry-box.song.empty{ .entry-box.song.empty{
margin-top: 0; margin-bottom: 0; margin-top: 0; margin-bottom: 0;
background: none;
} }
.entry-box.song.full li span{ .entry-box.song.full li span{
@ -239,7 +267,7 @@ a{
.entry-box.motif::before{ .entry-box.motif::before{
content: "b"; content: "b";
min-width: 2rem; min-width: 4rem;
visibility: hidden; visibility: hidden;
margin-right: auto; margin-right: auto;
} }
@ -252,11 +280,17 @@ a{
color: black; color: black;
flex-wrap: nowrap; flex-wrap: nowrap;
display: inline; display: inline;
border-left-style: solid;
align-self: center; align-self: center;
margin-left: auto;
min-width: 2rem;
text-align: right; text-align: right;
min-width: 1.5rem;
margin-right: 1rem;
}
.count-icon{
width: 1rem; height: 1rem;
margin-left: auto; margin-right: 0.2rem;
display: block;
align-self: center;
} }
.sort-box.album label{ .sort-box.album label{
@ -277,22 +311,36 @@ a{
.title-box{ .title-box{
margin: 1rem; margin: 1rem;
margin-bottom: 0px;
border-style: solid; border-style: solid;
border-color: var(--light-box); border-color: var(--light-box);
background: var(--light-box); background: var(--light-box);
display: flex; display: flex;
align-items: baseline; align-items: center;
}
.title-box img{
vertical-align: bottom;
} }
.title-box h1{ .title-box h1{
padding: 0; margin-left: .5rem;
max-width: 65%;
}
.title-jp{
margin-left: 2rem;
max-width: 65%;
}
.title-album{
margin-left: auto;
min-width: 2rem;
} }
.track-info{ .track-info{
margin-top: 1rem;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center;
row-gap: 1rem; row-gap: 1rem;
} }
@ -304,49 +352,57 @@ a{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 23rem; width: 23rem;
margin-left: 2rem; margin-right: auto;
}
.songpage-artist ul{
gap: 0.5rem;
}
.songpage-artist h2{
text-align: center;
margin-bottom: 1rem;
} }
.songpage-album{ .songpage-album{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 23rem; width: 23rem;
margin-left: 2rem; margin-right: auto;
} }
.songpage-motifs{ .songpage-album ul{
gap: 0.5rem;
}
.songpage-album h2{
text-align: center;
margin-bottom: 1rem;
}
.entrypage-connections{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
justify-content: center; justify-content: center;
} }
.songpage-motifs h2{ .entrypage-connections h2{
text-align: center; text-align: center;
margin-bottom: 1rem;
} }
.songpage-clip{ .entrypage-clip{
margin-top: 1rem; margin-bottom: 1rem;
display: flex; display: flex;
flex-wrap: wrap-reverse; flex-wrap: wrap-reverse;
column-gap: 2rem; column-gap: 2rem;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-shrink: 0;
flex-grow: 1;
} }
.songpage-clip audio{ .clip-pointer{
}
.songpage-clip::before{
/* content: "";
visibility: hidden;
width: 15%; */
}
.motif-pointer{
width: 12rem; width: 12rem;
white-space: nowrap; white-space: nowrap;
text-align: center; text-align: center;
} }

View File

@ -3,21 +3,23 @@
{% block title %}{{ name }}{% endblock %} {% block title %}{{ name }}{% endblock %}
{% block content %} {% block content %}
<h1> Motif: {{ name }} </h1> <hgroup class="title-box">
<h1> <img src="/static/motificon.png" alt="Motif Icon" class="title-icon"/> {{ name }} </h1>
</hgroup>
<!-- Clips --> <!-- Clips -->
<p>Clips: </p> <div class="entrypage-connections">
<h2>Songs Featured:</h2>
<ul> <ul>
{% for song_id, motif_id, song in clip_info %} {% for song_id, motif_id, song in clip_info %}
<li> <li class="entrypage-clip">
<audio <audio
controls controls
src = "{{ url_for('static', filename='clip/') }}{{ '%04d' % song_id }}-{{ '%03d' % motif_id }}.flac" type="audio/flac"> src = "{{ url_for('static', filename='clip/') }}{{ '%04d' % song_id }}-{{ '%03d' % motif_id }}.flac" type="audio/flac">
</audio> </audio>
<a href="/song/{{ song_id }}">{{ song }}</a> <span class="clip-pointer"><a href="/song/{{ song_id }}">{{ song }}</a></span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div>
{% endblock %} {% endblock %}

View File

@ -12,6 +12,7 @@
<li> <li>
<span class="motif-name">{{ motif }}</span> <span class="motif-name">{{ motif }}</span>
</li> </li>
<img src="/static/songicon.png" alt="Song Icon" class="count-icon"/>
{% if count %}<span class="clip-count">x {{ count }}</span>{% endif %} {% if count %}<span class="clip-count">x {{ count }}</span>{% endif %}
</a> </a>
{% endfor %} {% endfor %}
@ -27,6 +28,7 @@
<li> <li>
<span class="motif-name">{{ motif }}</span> <span class="motif-name">{{ motif }}</span>
</li> </li>
<img src="/static/songicon.png" alt="Song Icon" class="count-icon"/>
{% if count %}<span class="clip-count">x {{ count }} {% endif %}</span> {% if count %}<span class="clip-count">x {{ count }} {% endif %}</span>
</a> </a>
{% endfor %} {% endfor %}

View File

@ -1,9 +1,9 @@
<header> <header>
<nav> <nav>
<ul class="top-buttons"> <ul class="top-buttons">
<li><a href="{{ url_for('songindex') }}">Songs</a></li> <a href="{{ url_for('songindex') }}" class="song-button"><li><img src="/static/songicon.png" alt="Song Index" /></li></a>
<li><a href="{{ url_for('homepage') }}">Home</a></li> <a href="{{ url_for('homepage') }}" class="home-button"><li><img src="/static/songbook.png" alt="Home" /></li></a>
<li><a href="{{ url_for('motifindex') }}">Motifs</a></li> <a href="{{ url_for('motifindex') }}" class="motif-button"><li><img src="/static/motificon.png" alt="Motif Index" /></li></a>
</ul> </ul>
</nav> </nav>

View File

@ -1,13 +1,21 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ name }}{% endblock %} {% block title %}
{% for name, _ in song_info %}{{ name }}{% endfor %}
{% endblock %}
{% block content %} {% block content %}
<div class="title-box"> <hgroup class="title-box">
<img src="/static/songicon.png" alt="Song Icon" class="title-icon"/>
{% for name, name_jp in song_info %}
<h1>{{ name }}</h1> <h1>{{ name }}</h1>
{% for track, _, _, album_code in album_info %} {% if name_jp %}
{{ album_code }}{% if not loop.last %}, {% endif %} <h2 class="title-jp">{{name_jp}}</h2>
{% endif %}
{% endfor %} {% endfor %}
</div> {% for track, _, _, album_code in album_info %}
<h3 class="title-album">{{ album_code }}{% if not loop.last %}, {% endif %}</h3>
{% endfor %}
</hgroup>
<!-- Artist info --> <!-- Artist info -->
@ -16,7 +24,7 @@
<h2 >Artist: </h2> <h2 >Artist: </h2>
<ul> <ul>
{% for name, name_rm, credit in artist_info %} {% for name, name_rm, credit in artist_info %}
<li>{{ name_rm }} ({{ name }}): {{ credit }}</li> <li>{{ credit }}: {% if name_rm %}{{ name_rm }} - {% endif %}{{ name }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
@ -27,21 +35,21 @@
<h2>Album: </h2> <h2>Album: </h2>
<ul> <ul>
{% for album_id, track, album_name, album_code in album_info %} {% for album_id, track, album_name, album_code in album_info %}
<li><a href="{{ url_for('albumpage', id=album_id) }}">{{ album_name }}</a> #{{ track }}</li> <li><a href="{{ url_for('albumpage', id=album_id) }}">{{ album_name }}</a> - #{{ track }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
<!-- Motifs --> <!-- Motifs -->
<div class="songpage-motifs"> <div class="entrypage-connections">
<h2>Motifs Used: </h2> <h2>Motifs Featured: </h2>
<ul> <ul>
{% for song_id, motif_id, motif in clip_info %} {% for song_id, motif_id, motif in clip_info %}
<li class="songpage-clip"> <li class="entrypage-clip">
<audio <audio
controls controls
src = "{{ url_for('static', filename='clip/') }}{{ '%04d' % song_id }}-{{ '%03d' % motif_id }}.flac" type="audio/flac"> src = "{{ url_for('static', filename='clip/') }}{{ '%04d' % song_id }}-{{ '%03d' % motif_id }}.flac" type="audio/flac">
</audio> </audio>
<span class="motif-pointer"><a href = "{{ url_for('motifpage', id=motif_id) }}"> {{ motif }} </a></span> <span class="clip-pointer"><a href = "{{ url_for('motifpage', id=motif_id) }}"> {{ motif }} </a></span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -12,8 +12,7 @@
<label for="{{ code }}" class="album-info"> <label for="{{ code }}" class="album-info">
<h2>{{ name }}</h2> <h2>{{ name }}</h2>
<span class="code">{{ code }}</span> <span class="code">{{ code }}</span>
<span class="date">Released: {{ date }}</span> <span class="date">{{ date }}</span>
</label> </label>
<ul class="sort-list"> <ul class="sort-list">
{% for song_id, album, track, name, name_jp, count in song_info if album_id == album %} {% for song_id, album, track, name, name_jp, count in song_info if album_id == album %}
@ -24,6 +23,7 @@
<span class="track-name">{{ name }}</span> <span class="track-name">{{ name }}</span>
{% if name_jp %}<span class="track-name-jp">{{ name_jp }}</span>{% endif %} {% if name_jp %}<span class="track-name-jp">{{ name_jp }}</span>{% endif %}
</li> </li>
<img src="/static/motificon.png" alt="Motif Icon" class="count-icon"/>
<span class="clip-count">x {{ count }} </span> <span class="clip-count">x {{ count }} </span>
</a> </a>
{% else %} {% else %}