Compare commits

...

2 Commits

Author SHA1 Message Date
Jill 5370119e4c standardize header in accounts section 2023-01-18 21:11:53 +03:00
Jill 8abf5a5778 avoid hotlinking 2023-01-18 21:07:02 +03:00
10 changed files with 40 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -150,4 +150,20 @@ pre {
.circle-button.notifications-unread > svg { .circle-button.notifications-unread > svg {
fill: currentColor; 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" /> <link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/style.css" /> <link rel="stylesheet" href="/style.css" />
<title>Account Management</title> <title>Home</title>
<style> <style>
body { body {
max-width: 800px; max-width: 800px;
@ -115,11 +115,11 @@
hewwo, <b><%= username %></b>! hewwo, <b><%= username %></b>!
</div> </div>
<div class="greeting-stats"> <div class="greeting-stats">
<%= stars %> <img src="https://gdbrowser.com/assets/star.png"> <%= diamonds %> <img src="https://gdbrowser.com/assets/diamond.png"> <%= coins %> <img src="https://gdbrowser.com/assets/coin.png"> <%= user_coins %> <img src="https://gdbrowser.com/assets/silvercoin.png"> <%= demons %> <img src="https://gdbrowser.com/assets/demon.png"> <%= stars %> <img src="/assets/icons/gd/star.png"> <%= diamonds %> <img src="/assets/icons/gd/diamond.png"> <%= coins %> <img src="/assets/icons/gd/coin.png"> <%= user_coins %> <img src="/assets/icons/gd/silvercoin.png"> <%= demons %> <img src="/assets/icons/gd/demon.png">
</div> </div>
</div> </div>
<div class="greeting-bottom"> <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> </div>
</div> </div>

View File

@ -5,7 +5,7 @@
<link rel="icon" type="image/png" href="/favicon.png" /> <link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/style.css" /> <link rel="stylesheet" href="/style.css" />
<title>Account Management</title> <title>Settings</title>
<style> <style>
body { body {
max-width: 800px; max-width: 800px;
@ -23,7 +23,19 @@
</style> </style>
</head> </head>
<body> <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 -%> <%- if error -%>
<div class="error"><%= error %></div> <div class="error"><%= error %></div>

View File

@ -13,22 +13,6 @@
padding: 1em; 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 { .notification {
margin: 0.5em; margin: 0.5em;
border-radius: 20px; border-radius: 20px;

View File

@ -11,6 +11,13 @@ CrystalGauntlet.template_endpoints["/accounts/settings"] = ->(context : HTTP::Se
Templates.auth() 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}) email = DATABASE.query_one("select email from accounts where id = ?", account_id, as: {String})
result = nil result = nil