diff --git a/app.py b/app.py index c30f59b..ccd5e43 100644 --- a/app.py +++ b/app.py @@ -34,31 +34,47 @@ def searchpage(): searchargs = flask.request.args['q'] - searchresult = db.execute(''' - select - 'song', id, name - from - song - where - name - like - '%' || ? || '%' - union all - select - 'album', id, name - from - album - where - name - like - '%' || ? || '%' - ''', - (searchargs,searchargs) - ).fetchall() + if searchargs: + searchresult = db.execute(''' + select + 'song', id, name, instr(lower(name),lower(?)) + from + song + where + name + like + '%' || ? || '%' + union all + select + 'album', id, name, instr(lower(name),lower(?)) + from + album + where + name + like + '%' || ? || '%' + union all + select + 'motif', id, name, instr(lower(name),lower(?)) + from + motif + where + name + like + '%' || ? || '%' + order by + 4 + limit + 10 + ''', + (searchargs,)*6 + ).fetchall() - return flask.render_template('', - album_info=album_info, - song_info=song_info + else: + searchresult = [] + + return flask.render_template('searchresults.html', + searchresult=searchresult ) @@ -79,7 +95,7 @@ def songindex(): album_info = db.execute(''' select - id, name, date + id, name, date, code from album order by diff --git a/static/style.css b/static/style.css index 0db7e12..0c7623f 100644 --- a/static/style.css +++ b/static/style.css @@ -2,14 +2,38 @@ max-width:50rem;margin-left:auto;margin-right:auto; } */ +:root{ + --light-block: lch(90% 25 85); + --light-box: lch(100% 0 90); + --light-back: linear-gradient(90deg, lch(95% 20 260), white 25%, white 75%, lch(95% 20 260)); + --light-border: lch(80% 45 85); +} + body{ margin: 0; + background: var(--light-back); + display: flex; + flex-direction: column; + flex-shrink: 0; + height: 100vh; } header{ - background-color: lch(80% 25 79); + background-color: var(--light-block); margin: 0; border-style: outset; + border-top: 0; border-left: 0; border-right: 0; + border-color: var(--light-border); +} + +footer{ + background-color: var(--light-block); + border-style: outset; + border-bottom: 0; border-left: 0; border-right: 0; + border-color: var(--light-border); + width: 100%; + padding: 0; + margin-top: auto; } .top-buttons{ @@ -23,6 +47,7 @@ header{ .top-buttons li{ flex: auto; border-style: outset; + border-color: var(--light-border); list-style: none; text-align: center; } @@ -31,15 +56,69 @@ header{ flex: none; } -main{ - background-color: lch(80% 25 79); +.search-bar{ max-width: 50rem; + width: 100%; + height: 2rem; + margin-left: auto; + margin-right: auto; + background-color: var(--light-block); + border-style: outset; + border-top: 0; + border-color: var(--light-border); + display: flex; + flex-shrink: 0; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.search-items{ + display: inline-block; + position: relative; + width: 80%; +} + +.search-items input{ + all: unset; + background-color: white; + width: 100%; + height: 1rem; +} + +#search-results{ + display: flex; + flex-direction: column; + margin: auto; + position: absolute; + width: 100%; +} + +#search-results h2{ + visibility: collapse; +} + +#search-results ul{ + background-color: white; + padding-left: 0; + margin-top: 0; + list-style: none; + z-index: 1; +} + +main{ + background-color: var(--light-block); + max-width: 50rem; + width: 100%; margin-left: auto; margin-right: auto; } main ul{ margin: 0; + display: flex; + flex-direction: column; + padding-left: 0; } h1{ @@ -60,121 +139,214 @@ a{ 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%; + row-gap: 1rem; +} + +.album-info{ + display: flex; + align-items: baseline; + border-style: solid; + border-color: var(--light-box); + margin: 1rem; + margin-bottom: 0.5rem; + background: var(--light-box); + position: sticky; + top: 0px; gap: 1rem; } -.category-box{ +.sort-box h2{ + color: black; +} + +.sort-box.album{ gap: 1rem; - margin-left: auto; - margin-right: auto; +} + +.sort-box.category{ + gap: 1rem; + margin-left: auto; margin-right: auto; width: 24rem; } -.category-box h2{ - color: white; - border-style: solid; - border-color: lch(25% 40 45); +.sort-box.category h2{ margin: 1rem; margin-bottom: 0px; - background: lch(25% 40 45); + border-style: solid; + border-color: var(--light-box); + background: var(--light-box); } -.category-box ul{ - display: flex; - flex: initial; - flex-direction: column; - padding-left: 0; -} - -.motif-box{ +.entry-box{ list-style: none; min-height: 1.5rem; + display: flex; +} + +.entry-box.song{ + margin-top: 0.5rem; margin-bottom: 0.5rem; margin-left: 4rem; margin-right: 1rem; +} + +.entry-box.motif{ margin: 1rem; margin-bottom: 0; - background: lch(25% 40 45); - display: flex; - flex: auto; + background: var(--light-box); justify-content: center; } -.motif-box span{ - color: white; +.entry-box.song li{ + display: flex; + flex: auto; + flex-wrap: nowrap; + justify-content: left; + column-gap: 1rem; + align-content: bottom; + white-space: nowrap; + overflow: hidden; + height: 1.5rem; +} + +.entry-box.song span{ + align-self: center; +} + +.entry-box.song.full{ + background: var(--light-box); +} + +.entry-box.song.empty{ + margin-top: 0; margin-bottom: 0; +} + +.entry-box.song.full li span{ + color: black; +} + +.entry-box.song.empty li span{ + color: gray; +} + +.entry-box.motif span{ + color: black; vertical-align: middle; } -.motif-name::before{ - content: "T"; - margin-right: 2rem; +.entry-box.motif::before{ + content: "b"; + min-width: 2rem; visibility: hidden; + margin-right: auto; } .motif-name{ text-align: center; - margin: auto; } -.motif-count{ - position: absolute, right; +.clip-count{ + color: black; + flex-wrap: nowrap; + display: inline; + border-left-style: solid; + align-self: center; + margin-left: auto; + min-width: 2rem; text-align: right; - width: 2rem; +} + +.sort-box.album label{ + cursor: pointer; +} + +.collapse{ + display: none; +} + +.sort-list{ + visibility: collapse; +} + +.collapse:checked ~ .sort-list{ + visibility: visible; +} + +.title-box{ + margin: 1rem; + margin-bottom: 0px; + border-style: solid; + border-color: var(--light-box); + background: var(--light-box); + display: flex; + align-items: baseline; +} + +.title-box h1{ + padding: 0; +} + +.track-info{ + margin-top: 1rem; + display: flex; + flex-wrap: wrap; + row-gap: 1rem; +} + +.track-info li{ + list-style: none; +} + +.songpage-artist{ + display: flex; + flex-direction: column; + width: 23rem; + margin-left: 2rem; margin-right: auto; +} + +.songpage-album{ + display: flex; + flex-direction: column; + width: 23rem; + margin-left: 2rem; margin-right: auto; +} + +.songpage-motifs{ + display: flex; + flex-direction: column; + width: 100%; + justify-content: center; +} +.songpage-motifs h2{ + text-align: center; +} + +.songpage-clip{ + margin-top: 1rem; + display: flex; + flex-wrap: wrap-reverse; + column-gap: 2rem; + justify-content: center; + align-items: center; + flex-shrink: 0; + flex-grow: 1; +} + +.songpage-clip audio{ + +} + +.songpage-clip::before{ + /* content: ""; + visibility: hidden; + width: 15%; */ +} + +.motif-pointer{ + width: 12rem; + white-space: nowrap; + text-align: center; } \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 2119cb2..dd33954 100644 --- a/templates/base.html +++ b/templates/base.html @@ -11,10 +11,10 @@
+ {% block nav %}{% include 'nav.html' %}{% endblock %}