standardize header in accounts section

This commit is contained in:
Jill 2023-01-18 21:11:53 +03:00
parent 8abf5a5778
commit 5370119e4c
5 changed files with 39 additions and 20 deletions

View File

@ -151,3 +151,19 @@ pre {
.circle-button.notifications-unread > svg {
fill: currentColor;
}
.header {
height: 96px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.title {
font-size: x-large;
display: flex;
flex-direction: row;
gap: 0.5em;
align-items: center;
}

View File

@ -5,7 +5,7 @@
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/style.css" />
<title>Account Management</title>
<title>Home</title>
<style>
body {
max-width: 800px;
@ -119,7 +119,7 @@
</div>
</div>
<div class="greeting-bottom">
<a href="/accounts/settings">Settings</a> · <a>Log out</a>
<a href="/accounts/settings">Settings</a> &middot; <a>Log out</a>
</div>
</div>
</div>

View File

@ -5,7 +5,7 @@
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/style.css" />
<title>Account Management</title>
<title>Settings</title>
<style>
body {
max-width: 800px;
@ -23,7 +23,19 @@
</style>
</head>
<body>
<%= Templates.dir_header %><br>
<div class="header">
<a href="/accounts/" title="<%=username%>" class="circle-button">
<img src="https://gdicon.oat.zone/icon.png?type=<%=type_str%>&value=<%=icon_value%>&color1=<%=color1%>&color2=<%=color2%><%=glow ? "&glow=1" : ""%>" class="icon">
</a>
<span class="title">
<a href="/"><img src="/favicon.png" width="64" height="auto" class="spinny favicon"></a>
Account Settings
</span>
<a href="/accounts/notifications/" title="Notifiations" class="circle-button notifications <%= unread_notifications ? "notifications-unread" : "" %>">
<%= # todo: unhardcode public dir location
File.read("public/assets/icons/bell.svg") %>
</a>
</div><br>
<%- if error -%>
<div class="error"><%= error %></div>

View File

@ -13,22 +13,6 @@
padding: 1em;
}
.header {
height: 96px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.title {
font-size: x-large;
display: flex;
flex-direction: row;
gap: 0.5em;
align-items: center;
}
.notification {
margin: 0.5em;
border-radius: 20px;

View File

@ -11,6 +11,13 @@ CrystalGauntlet.template_endpoints["/accounts/settings"] = ->(context : HTTP::Se
Templates.auth()
stars, demons, coins, user_coins, diamonds, creator_points, icon_type, color1, color2, cube, ship, ball, ufo, wave, robot, spider, glow = DATABASE.query_one("select stars, demons, coins, user_coins, diamonds, creator_points, icon_type, color1, color2, cube, ship, ball, ufo, wave, robot, spider, glow from users where id = ?", user_id, as: {Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32})
icon_value = [cube, ship, ball, ufo, wave, robot, spider][icon_type]
type_str = ["cube", "ship", "ball", "ufo", "wave", "robot", "spider"][icon_type]
unread_notifications = DATABASE.scalar("select count(*) from notifications where account_id = ? and read_at is null", account_id).as(Int64) > 0
email = DATABASE.query_one("select email from accounts where id = ?", account_id, as: {String})
result = nil