@app.route("/")
def index():
- username = session.get("username", None)
- return render_template("index.html")
+ users = [row["username"] for row in query_db("select username from users")]
+ return render_template("index.html", users=users)
@app.get("/signup")
def signup_get():
return redirect("/")
-@app.get("/users")
-def users():
- users = [row["username"] for row in query_db("select username from users")]
- return render_template("users.html", users=users)
-
@app.get("/users/<profile_username>")
def users_profile(profile_username):
username = session.get("username", None)
console.log(song);
var songData = JSON.parse(song.dataset.song);
+ var player = document.getElementById("player")
+ player.hidden = false;
+
var audio = document.getElementById("player-audio");
audio.pause();
audio.src = `/song/${songData.userid}/${songData.songid}`;
:root {
--yellow: #e8e590;
--purple: #9986a6;
+ --pink: #bc80af;
+ --blue: #8dcbc2;
}
body {
background: var(--yellow);
color: var(--purple);
+ font-family: sans-serif;
+ border-color: var(--purple);
+ max-width: 700px;
+ margin: auto;
+}
+
+a {
+ color: var(--purple);
+}
+
+h2 {
+ font-size: 20px;
+}
+
+textarea {
+ font-family: sans-serif;
+ color: var(--purple);
+ border: 2px solid var(--blue);
+ border-radius: 10px;
+ padding: 10px;
+ background: var(--yellow);
+ height: 100px;
+ width: 100%;
+ box-sizing: border-box;
+ resize: vertical;
+}
+
+.button {
+ font-family: sans-serif;
+ color: var(--yellow);
+ background: var(--pink);
+ border: 0px;
+ border-radius: 5px;
+ padding: 8px;
}
div.main {
- max-width: 500px;
+ max-width: 700px;
margin: auto;
}
+div.page-header {
+ box-shadow: 0px 0px 20px 0px;
+ border-radius: 10px;
+ margin: 10px;
+}
+
+.flashes {
+ border: 3px solid var(--blue);
+ border-radius: 10px;
+ margin-top: 20px;
+}
+
+.title-image {
+ image-rendering: pixelated;
+ width: 512px;
+ margin: 10px;
+}
+
/* Navbar */
div.navbar {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
+ padding: 10px;
+}
+
+/* Profile */
+.profile-name {
+ text-align: center;
+ font-size: 40px;
+}
+
+.profile-action {
+ margin: 10px;
+}
+
+.profile-edit-buttons {
+ display: flex;
+ justify-content: left;
+ align-items: center;
+ gap: 10px;
+ margin: 10px;
}
/* Filters on /songs page */
div.song-list {
display: flex;
flex-direction: column;
- gap: 5px;
+ gap: 10px;
}
div.song {
- border: 3px solid #000;
+ box-shadow: 0px 0px 5px 0px;
+ border-radius: 10px;
+ padding-left: 10px;
}
div.song-main {
div.player {
position: fixed;
+ max-width: 700px;
+ margin: auto;
+ margin-bottom: 10px;
+ box-shadow: 0px 0px 20px 0px;
+ border-radius: 10px;
bottom: 0;
left: 0;
right: 0;
height: 100px;
- border: 3px solid #000;
+ /*border-top: 3px solid;*/
background: var(--yellow);
}
#player-position-bar {
position: absolute;
display: inline-block;
- background-color: #ccc;
+ background-color: var(--purple);
left: 100;
top: 23px;
width: 100%;
position: absolute;
display: inline-block;
visibility: hidden;
- background-color: #555;
+ background-color: var(--pink);
top: 15px;
width: 20px;
height: 20px;
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
- <!-- Navbar -->
- <div class="navbar">
- {% if "username" in session %}
- <p>Signed in as {{ session["username"] }}</p>
- <a href="/logout">Sign Out</a>
- <a href="/users/{{ session["username"] }}">My Profile</a>
- {% else %}
- <a href="/login">Sign In</a>
- <a href="/signup">Create Account</a>
- {% endif %}
- <a href="/users">All Users</a>
- <a href="/">Home</a>
+
+ <div class="page-header">
+ <div style="text-align: center;">
+ <img src="/static/littlesongplace01.gif" class="title-image">
+ </div>
+ <!-- Navbar -->
+ <div class="navbar">
+ <a href="/">Home</a>
+ {% if "username" in session %}
+ <a href="/users/{{ session["username"] }}">My Profile</a>
+ <a href="/logout">Sign Out</a>
+ {% else %}
+ <a href="/signup">Create Account</a>
+ <a href="/login">Sign In</a>
+ {% endif %}
+
+ {% if "username" in session %}
+ Signed in as {{ session["username"] }}
+ {% endif %}
+ </div>
</div>
<!-- Stite Status Messages -->
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
- <ul class="flashes">
- {% for category, message in messages %}
- <li class="flash-msg {{ category }}">{{ message }}</li>
- {% endfor %}
- </ul>
+ <div class="flashes">
+ <ul>
+ {% for category, message in messages %}
+ <li class="flash-msg {{ category }}">{{ message }}</li>
+ {% endfor %}
+ </ul>
+ </div>
{% endif %}
{% endwith %}
<div id="scroll-padding"></div>
<!-- Song Player -->
- <div class="player">
+ <div class="player" id="player" hidden>
<div class="player-info">
<!-- TODO: Show song title, artist -->
<span id="player-title">Not Playing</span>
{% block body %}
-<img src="/static/littlesongplace01.gif" style="image-rendering:pixelated;width:512px">
-
<p>Hello, and welcome!</p>
+<p>Check out the music of the fine folks below! If you create an account, you'll show up here too. :)</p>
+
+<h2>Lovely Humans:</h2>
+{% for user in users %}
+<a href="/users/{{ user }}">{{ user }}</a><br>
+{% endfor %}
+
{% endblock %}
<!-- Bio edit form -->
{% if session["userid"] == userid %}
-<a href="javascript:showEditForm();" id="profile-bio-edit-btn">Edit Bio</a>
+<div class="profile-action">
+ <a href="javascript:showEditForm();" id="profile-bio-edit-btn">Edit Bio</a>
+</div>
<form id="profile-edit-form" action="/update-bio" method="post" hidden>
<h2> Edit Bio </h2>
<p>Common HTML tags (<a>, <b>, <i>, <img>, etc.) are allowed.</p>
- <div class="profile-edit">
+ <div>
<textarea name="bio" maxlength="10000">{{ bio }}</textarea>
</div>
- <div class="profile-edit">
+ <div class="profile-edit-buttons">
<a href="javascript:hideEditForm();">Cancel</a>
- <input type="submit" value="Save">
+ <input type="submit" value="Save" class="button">
</div>
</form>
<!-- Upload New Song button -->
{% if session["userid"] == userid %}
-<a href="/edit-song">Upload New Song</a>
+<div class="profile-action">
+ <a href="/edit-song">Upload New Song</a>
+</div>
{% endif %}
<!-- Song List -->
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}All Users{% endblock %}
-
-{% block body %}
-
-<h1>All Users</h1>
-{% for user in users %}
-<a href="/users/{{ user }}">{{ user }}</a><br>
-{% endfor %}
-
-{% endblock %}