crystal-gauntlet/public/template/levels.ecr

88 lines
2.4 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<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>Levels</title>
<style>
.level {
width: 100%;
height: 4em;
background-color: var(--background-color-2);
border-radius: 2em;
padding: 1em;
display: flex;
flex-direction: row;
align-items: stretch;
gap: 0.5em;
}
.line {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.name {
flex: 1 1 0px;
min-width: 0;
font-size: 1.2em;
}
.id {
flex: 0 0 auto;
}
.level-img {
flex: 0 0 auto;
}
.level-right {
flex: 1 1 0px;
min-width: 0;
}
.pagination {
display: flex;
flex-direction: row;
gap: 1em;
}
img {
width: auto;
height: 100%;
}
.levels {
width: 600px;
max-width: 90vw;
display: flex;
flex-direction: column;
align-items: center;
gap: 1em
}
</style>
</head>
<body style="display: flex; flex-direction: column; align-items: center; gap: 1em">
<div class="levels">
<%- levels.each do |id, name, username, difficulty_community, difficulty_set, demon_difficulty_int, featured, epic| -%>
<div class="level">
<%=
difficulty = (difficulty_set || difficulty_community).try { |n| LevelDifficulty.new(n) }
demon_difficulty = demon_difficulty_int.try { |n| DemonDifficulty.new(n) }
"<img src='#{Templates.get_difficulty_icon(difficulty, featured, epic, demon_difficulty)}' class='level-img'>"
%>
<div class="level-right">
<span class="line"><span class="name"><%= name %></span><span class="id dim">#<%= id %></span></span>
<small>by <%= username %></small><br>
</div>
</div>
<%- end -%>
</div>
<div class="pagination">
<%- if page > 0 -%>
<a href="?page=<%= page - 1 %>"><</a>
<%- end -%>
<%- if total_levels > ((page + 1) * levels_per_page) -%>
<a href="?page=<%= page + 1 %>">></a>
<%- end -%>
</div>
</body>
</html>