diff --git a/public/assets/icons/gd/browncoin.png b/public/assets/icons/gd/browncoin.png new file mode 100644 index 0000000..7cf03c1 Binary files /dev/null and b/public/assets/icons/gd/browncoin.png differ diff --git a/public/template/level.ecr b/public/template/level.ecr index ec2d343..0a97091 100644 --- a/public/template/level.ecr +++ b/public/template/level.ecr @@ -73,6 +73,11 @@ .label-right { flex: 0 0 auto; } + .label-right img { + height: 1em; + width: auto; + vertical-align: middle; + } .card-header { font-weight: bold; color: var(--text-color-dark); @@ -132,7 +137,15 @@ width: 75px; } .leaderboard td.coins { - width: 3em; + width: 4em; + } + .leaderboard td.coins .coin-container { + display: flex; + flex-direction: row; + } + .leaderboard td.coins .coin-container img { + width: 1em; + height: auto; } .leaderboard td.icon { width: 2.5em; @@ -149,6 +162,27 @@ width: auto; vertical-align: middle; } + + .comment { + flex-direction: column; + } + .comment-author { + display: flex; + flex-direction: row; + gap: 1ex; + align-items: center; + } + .comment-author .player-icon { + height: 1.5em; + width: auto; + } + .comment-date { + color: var(--text-color-dark); + } + .comment-author-label { + font-weight: bold; + text-decoration: none; + } @@ -173,7 +207,7 @@ <%= name %>
- <%= downloads %> downloads <%= likes %> likes + <%= downloads %> <%= likes %>
@@ -231,7 +265,13 @@ #<%= rank %> <%= percent %>% - + +
+ <%- coins.times do |i| -%> + .png"> + <%- end -%> +
+ " class="player-icon"> @@ -252,7 +292,25 @@ <%- end -%> -

comments go here etc etc

+

Comments

+ + <%- comments.each do |comment, created_at, username, icon_type, color1, color2, cube, ship, ball, ufo, wave, robot, spider, special| + icon_value = [cube, ship, ball, ufo, wave, robot, spider][icon_type] + type_str = ["cube", "ship", "ball", "ufo", "wave", "robot", "spider"][icon_type] + + created_at_date = Time.parse(created_at, Format::TIME_FORMAT, Time::Location::UTC) + %> +
+
+ " class="player-icon"> + <%= username %> + +
+
+ <%= HTML.escape(comment) %> +
+
+ <%- end -%> diff --git a/src/template_endpoints/levels.cr b/src/template_endpoints/levels.cr index 52d7e62..c45d330 100644 --- a/src/template_endpoints/levels.cr +++ b/src/template_endpoints/levels.cr @@ -25,7 +25,7 @@ CrystalGauntlet.template_endpoints[{ id = params["id"].as(String).to_i begin - name, username, difficulty_community, difficulty_set, demon_difficulty_int, featured, epic, downloads, likes, stars, description, song_id, song_name, song_author, song_url, song_author_url = DATABASE.query_one("select levels.name, users.username, community_difficulty, difficulty, demon_difficulty, featured, epic, downloads, likes, levels.stars, description, song_id, song_data.name, song_authors.name, songs.url, song_authors.source from levels left join users on levels.user_id = users.id left join songs on songs.id = levels.song_id left join song_data on song_data.id = levels.song_id left join song_authors on song_data.author_id = song_authors.id where levels.id = ?", id, as: {String, String, Int32?, Int32?, Int32?, Bool, Bool, Int32, Int32, Int32?, String, Int32, String?, String?, String?, String?}) + name, username, difficulty_community, difficulty_set, demon_difficulty_int, featured, epic, rated_coins, downloads, likes, stars, description, song_id, song_name, song_author, song_url, song_author_url = DATABASE.query_one("select levels.name, users.username, community_difficulty, difficulty, demon_difficulty, featured, epic, rated_coins, downloads, likes, levels.stars, description, song_id, song_data.name, song_authors.name, songs.url, song_authors.source from levels left join users on levels.user_id = users.id left join songs on songs.id = levels.song_id left join song_data on song_data.id = levels.song_id left join song_authors on song_data.author_id = song_authors.id where levels.id = ?", id, as: {String, String, Int32?, Int32?, Int32?, Bool, Bool, Bool, Int32, Int32, Int32?, String, Int32, String?, String?, String?, String?}) rescue err LOG.error {"whar.... #{err}"} context.response.status = HTTP::Status::NOT_FOUND @@ -34,5 +34,7 @@ CrystalGauntlet.template_endpoints[{ scores = DATABASE.query_all("select distinct percent, level_scores.coins, users.username, users.icon_type, users.color1, users.color2, users.cube, users.ship, users.ball, users.ufo, users.wave, users.robot, users.spider, users.special, set_at from level_scores join users on level_scores.account_id = users.account_id where level_id = ? order by percent desc, level_scores.coins desc, set_at limit 25", id, as: {Int32, Int32, String, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, String}) + comments = DATABASE.query_all("select comment, comments.created_at, users.username, users.icon_type, users.color1, users.color2, users.cube, users.ship, users.ball, users.ufo, users.wave, users.robot, users.spider, users.special from comments left join users on comments.user_id = users.id where level_id = ? order by comments.created_at asc limit 20", id, as: {String, String, String, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32}) + ECR.embed("./public/template/level.ecr", context.response) }