develops the css to add song and motif boxes

This commit is contained in:
Effie 2023-06-09 16:16:47 +10:00
parent 12d51dd7d2
commit 50752c32fd
12 changed files with 267 additions and 54 deletions

24
app.py
View File

@ -47,13 +47,17 @@ def songindex():
song_info = db.execute(''' song_info = db.execute('''
select select
song_id, album_id, track, song.name, song.name_jp song_album.song_id, album_id, track, song.name, song.name_jp, count(clip.song_id)
from from
song_album song_album
join join
song song
on on
song_album.song_id=song.id song_album.song_id=song.id
left join
clip on clip.song_id=song.id
group by
song_album.song_id, album_id, track, song.name, song.name_jp
order by order by
album_id, album_id,
track track
@ -73,18 +77,30 @@ def motifindex():
category_info = db.execute(''' category_info = db.execute('''
select select
id, name category.id, category.name
from from
category category
join
motif
on
category.id=motif.category
group by
category.id, category.name
order by order by
id count(category.id) desc
''').fetchall() ''').fetchall()
motif_info = db.execute(''' motif_info = db.execute('''
select select
id, name, category id, name, category, count(clip.motif_id)
from from
motif motif
left join
clip
on
clip.motif_id=motif.id
group by
id, name, category
order by order by
id id
''').fetchall() ''').fetchall()

Binary file not shown.

View File

@ -1,2 +1,171 @@
body{max-width:50rem;margin-left:auto;margin-right:auto;} /* body{
nav{} max-width:50rem;margin-left:auto;margin-right:auto;
} */
body{
margin: 0;
}
header{
background-color: lch(80% 25 79);
margin: 0;
border-style: outset;
}
.top-buttons{
display: flex;
padding-left: 0;
margin: 0;
padding: 2rem;
column-gap: 1rem;
}
.top-buttons li{
flex: auto;
border-style: outset;
list-style: none;
text-align: center;
}
.top-buttons li:nth-child(2){
flex: none;
}
main{
background-color: lch(80% 25 79);
max-width: 50rem;
margin-left: auto;
margin-right: auto;
}
main ul{
margin: 0;
}
h1{
margin: 0;
}
h2{
margin: 0;
}
a{
text-decoration: none;
}
.album-list{
display: flex;
flex-direction: column;
gap: 1rem;
}
.album-box{
gap: 1rem;
}
.album-box h2{
color: white;
border-style: solid;
border-color: lch(25% 40 45);
margin: 1rem;
margin-bottom: 0px;
position: sticky;
top: 0px;
background: lch(25% 40 45);
}
.album-box ul{
display: flex;
flex: auto;
flex-direction: column;
padding-left: 0;
}
.song-box{
list-style: none;
min-height: 1.5rem;
margin: 1rem;
margin-bottom: 0;
margin-left: 4rem;
background: lch(25% 40 45);
display: flex;
flex: auto;
flex-wrap: wrap;
justify-content: left;
column-gap: 1rem;
align-content: bottom;
white-space: nowrap;
overflow: hidden;
}
.song-box span{
color: white;
text-align: bottom;
}
.track-name-jp{
}
.clip-count{
margin-left: auto;
min-width: 2rem;
text-align: right;
}
.category-list{
display: flex;
flex-wrap: wrap;
align-content: flex-start;
flex-basis: 51%;
gap: 1rem;
}
.category-box{
gap: 1rem;
margin-left: auto;
margin-right: auto;
width: 24rem;
}
.category-box h2{
color: white;
border-style: solid;
border-color: lch(25% 40 45);
margin: 1rem;
margin-bottom: 0px;
background: lch(25% 40 45);
}
.category-box ul{
display: flex;
flex: initial;
flex-direction: column;
padding-left: 0;
}
.motif-box{
list-style: none;
min-height: 1.5rem;
margin: 1rem;
margin-bottom: 0;
background: lch(25% 40 45);
display: flex;
flex: auto;
justify-content: right;
}
.motif-box span{
color: white;
vertical-align: middle;
}
.motif-name{
margin: auto;
}
.motif-count{
}

View File

@ -1,4 +1,4 @@
{% extends "nav.html" %} {% extends "base.html" %}
{% block title %}{{ album_info[0] }}{% endblock %} {% block title %}{{ album_info[0] }}{% endblock %}
{% block content %} {% block content %}

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>{% block title %}{% endblock %} - Eorzea Songbook</title> <title>{% block title required %}{% endblock %} - Eorzea Songbook</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=1" /> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=1" />
<meta name="description" content="Listen to the motifs of Final Fantasy XIV's soundtrack." /> <meta name="description" content="Listen to the motifs of Final Fantasy XIV's soundtrack." />
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" /> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
@ -10,7 +10,9 @@
</head> </head>
<body> <body>
{% block basecontent %}{% endblock %} {% block nav %}{% include 'nav.html' %}{% endblock %}
<main>{% block content required %}{% endblock %}</main>
{% block footer %}{% include 'footer.html' %}{% endblock %}
</body> </body>

9
templates/footer.html Normal file
View File

@ -0,0 +1,9 @@
{% block footer %}
<footer>
<p> The footer will be in here, when it's ready. </p>
</footer>
{% endblock footer %}

View File

@ -1,7 +1,7 @@
{% extends "base.html" %} {% extends 'base.html' %}
{% block title %}Home{% endblock %} {% block title %}Home{% endblock %}
{% block nav %}{% endblock %}
{% block basecontent %} {% block content %}
<h1>The Eorzea Songbook</h1> <h1>The Eorzea Songbook</h1>
@ -9,4 +9,5 @@
<a href="{{ url_for('motifindex') }}">View Motifs</a> <a href="{{ url_for('motifindex') }}">View Motifs</a>
{% block footer %}{% endblock %}
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "nav.html" %} {% extends "base.html" %}
{% block title %}{{ name }}{% endblock %} {% block title %}{{ name }}{% endblock %}

View File

@ -1,22 +1,35 @@
{% extends "nav.html" %} {% extends 'base.html' %}
{% block title %}Motif Index{% endblock %} {% block title %}Motif Index{% endblock %}
{% block content %} {% block content %}
<section class="category-list">
{% for category_id, name in category_info %} {% for category_id, name in category_info %}
<h2>{{ name }}</h2> <div class="category-box">
<ul> <h2>{{ name }}</h2>
{% for motif_id, motif, category in motif_info if category == category_id %} <ul>
<li><a href="{{ url_for('motifpage', id=motif_id) }}">{{ motif }}</a></li> {% for motif_id, motif, category, count in motif_info if category == category_id %}
<a href="{{ url_for('motifpage', id=motif_id) }}"><li class="motif-box">
<span class="motif-name">{{ motif }}</span>
{% if count %}
<span class="motif-count">x{{ count }}</span>
{% endif %}
</li></a>
{% endfor %} {% endfor %}
</ul> </ul>
</div>
{% endfor %} {% endfor %}
<h2>Misc.</h2> <div class="category-box">
<ul> <h2>Misc.</h2>
{% for motif_id, motif, category in motif_info if category == '' %} <ul>
<li><a href="{{ url_for('motifpage', id=motif_id) }}">{{ motif }}</a></li> {% for motif_id, motif, category, count in motif_info if category == '' %}
{% endfor %} <a href="{{ url_for('motifpage', id=motif_id) }}"><li class="motif-box">
</ul> <span class="motif-name">{{ motif }}</span>
<span class="motif-count">{% if count %} x{{ count }} {% endif %}</span>
</li></a>
{% endfor %}
</ul>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -1,10 +1,8 @@
{% extends "base.html" %} {% block navheader %}
{% block basecontent %}
<header> <header>
<nav> <nav>
<ul> <ul class="top-buttons">
<li><a href="{{ url_for('songindex') }}">Songs</a></li> <li><a href="{{ url_for('songindex') }}">Songs</a></li>
<li><a href="{{ url_for('homepage') }}">Home</a></li> <li><a href="{{ url_for('homepage') }}">Home</a></li>
<li><a href="{{ url_for('motifindex') }}">Motifs</a></li> <li><a href="{{ url_for('motifindex') }}">Motifs</a></li>
@ -12,12 +10,4 @@
</nav> </nav>
</header> </header>
{% block content %}{% endblock %} {% endblock %}
<footer>
<p> The footer will be in here, when it's ready. </p>
</footer>
{% endblock basecontent %}

View File

@ -1,4 +1,4 @@
{% extends "nav.html" %} {% extends "base.html" %}
{% block title %}{{ name }}{% endblock %} {% block title %}{{ name }}{% endblock %}
{% block content %} {% block content %}
@ -7,7 +7,7 @@
<!-- Artist info --> <!-- Artist info -->
<p>Artist: </p> <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>{{ name_rm }} ({{ name }}): {{ credit }}</li>
@ -16,7 +16,7 @@
<!-- Album info --> <!-- Album info -->
<p>Album: </p> <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>
@ -25,7 +25,7 @@
<!-- Clips --> <!-- Clips -->
<p>Clips: </p> <h2>Clips: </h2>
<ul> <ul>
{% for song_id, motif_id, motif in clip_info %} {% for song_id, motif_id, motif in clip_info %}
<li> <li>

View File

@ -1,15 +1,28 @@
{% extends "nav.html" %} {% extends 'base.html' %}
{% block title %}Song Index{% endblock %} {% block title %}Song Index{% endblock %}
{% block content %} {% block content %}
<section class="album-list">
{% for album_id, name, date in album_info %} {% for album_id, name, date in album_info %}
<h2>{{ name }}</h2> <div class="album-box">
<ul> <h2>{{ name }}</h2>
{% for song_id, album, track, name, name_jp in song_info if album_id == album %} <ul>
<li><a href="{{ url_for('songpage', id=song_id) }}">#{{ track }}: {{name}} / {{name_jp}}</li></a> {% for song_id, album, track, name, name_jp, count in song_info if album_id == album %}
<a href="{{ url_for('songpage', id=song_id) }}"><li class="song-box">
<span class="track-number">#{{ track }}: </span>
<span class="track-name">{{ name }}</span>
{% if name_jp %}
<span class="track-name-jp">{{ name_jp }}</span>
{% endif %}
<span class="clip-count">{% if count > 0 %} x{{ count }} {% endif %}</span>
</li></a>
{% endfor %} {% endfor %}
</ul> </ul>
{% endfor %} </div>
{% endfor %}
</section>
{% endblock %} {% endblock %}