feat: ora funge decentemente anche su mobile
This commit is contained in:
+45
-40
@@ -1,6 +1,7 @@
|
||||
import { useContext, useState } from 'preact/hooks'
|
||||
import { SolutionStat } from '../../shared/model'
|
||||
import { sortByNumericKey, sortByStringKey } from '../../shared/utils'
|
||||
import { prependBaseUrl } from '../api'
|
||||
import { Header } from '../components/Header'
|
||||
|
||||
import { useResource, MetadataContext } from '../hooks'
|
||||
@@ -49,50 +50,54 @@ export const ScoresPage = () => {
|
||||
<Header />
|
||||
<main class="page-scores">
|
||||
<div class="subtitle">Classifica</div>
|
||||
<div class="table">
|
||||
<div class="cell header">
|
||||
<span>Studente</span>
|
||||
<span onClick={() => setSortState(transitionMap[sortStateColumn][sortStateOrder]('student'))}>
|
||||
<span class="material-symbols-outlined icon">
|
||||
{sortStateColumn === 'student'
|
||||
? sortStateOrder === 'ascending'
|
||||
? 'expand_more'
|
||||
: 'expand_less'
|
||||
: 'unfold_more'}
|
||||
<div class="scrollable">
|
||||
<div class="table">
|
||||
<div class="cell header">
|
||||
<span>Studente</span>
|
||||
<span onClick={() => setSortState(transitionMap[sortStateColumn][sortStateOrder]('student'))}>
|
||||
<span class="material-symbols-outlined icon">
|
||||
{sortStateColumn === 'student'
|
||||
? sortStateOrder === 'ascending'
|
||||
? 'expand_more'
|
||||
: 'expand_less'
|
||||
: 'unfold_more'}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="cell header">
|
||||
<span>Soluzioni Inviate</span>
|
||||
<span onClick={() => setSortState(transitionMap[sortStateColumn][sortStateOrder]('sent'))}>
|
||||
<span class="material-symbols-outlined icon">
|
||||
{sortStateColumn === 'sent'
|
||||
? sortStateOrder === 'ascending'
|
||||
? 'expand_more'
|
||||
: 'expand_less'
|
||||
: 'unfold_more'}
|
||||
</div>
|
||||
<div class="cell header">
|
||||
<span>Soluzioni Inviate</span>
|
||||
<span onClick={() => setSortState(transitionMap[sortStateColumn][sortStateOrder]('sent'))}>
|
||||
<span class="material-symbols-outlined icon">
|
||||
{sortStateColumn === 'sent'
|
||||
? sortStateOrder === 'ascending'
|
||||
? 'expand_more'
|
||||
: 'expand_less'
|
||||
: 'unfold_more'}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="cell header">
|
||||
<span>Soluzioni Corrette</span>
|
||||
<span onClick={() => setSortState(transitionMap[sortStateColumn][sortStateOrder]('correct'))}>
|
||||
<span class="material-symbols-outlined icon">
|
||||
{sortStateColumn === 'correct'
|
||||
? sortStateOrder === 'ascending'
|
||||
? 'expand_more'
|
||||
: 'expand_less'
|
||||
: 'unfold_more'}
|
||||
</div>
|
||||
<div class="cell header">
|
||||
<span>Soluzioni Corrette</span>
|
||||
<span onClick={() => setSortState(transitionMap[sortStateColumn][sortStateOrder]('correct'))}>
|
||||
<span class="material-symbols-outlined icon">
|
||||
{sortStateColumn === 'correct'
|
||||
? sortStateOrder === 'ascending'
|
||||
? 'expand_more'
|
||||
: 'expand_less'
|
||||
: 'unfold_more'}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
{orderedStats.map(([user, s]) => (
|
||||
<>
|
||||
<div class="cell">
|
||||
<a href={prependBaseUrl(`/u/${user}`)}>@{user}</a>
|
||||
</div>
|
||||
<div class="cell">{s.sentSolutionsCount}</div>
|
||||
<div class="cell">{s.correctSolutionsCount}</div>
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
{orderedStats.map(([user, s]) => (
|
||||
<>
|
||||
<div class="cell">{user}</div>
|
||||
<div class="cell">{s.sentSolutionsCount}</div>
|
||||
<div class="cell">{s.correctSolutionsCount}</div>
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
</>
|
||||
|
||||
+88
-66
@@ -348,94 +348,116 @@ main.page-problem {
|
||||
}
|
||||
|
||||
main.page-scores {
|
||||
.table {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto;
|
||||
.scrollable {
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
|
||||
box-shadow: -2px 4px 6px 1px #00000018, 0 0 4px 0px #00000010;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 0.5rem;
|
||||
background: #ffffff;
|
||||
max-width: 100%;
|
||||
padding: 1rem;
|
||||
|
||||
user-select: none;
|
||||
|
||||
.icon {
|
||||
cursor: pointer;
|
||||
.table {
|
||||
display: grid;
|
||||
place-content: center;
|
||||
}
|
||||
|
||||
overflow: hidden;
|
||||
grid-template-columns: auto auto auto;
|
||||
|
||||
position: relative;
|
||||
box-shadow: -2px 4px 6px 1px #00000018, 0 0 4px 0px #00000010;
|
||||
// border: 1px solid #ddd;
|
||||
border-radius: 0.5rem;
|
||||
background: #ffffff;
|
||||
|
||||
.cell {
|
||||
padding: 1rem 1rem 1rem 2rem;
|
||||
user-select: none;
|
||||
|
||||
gap: 0.5rem;
|
||||
|
||||
border-left: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
|
||||
&:nth-child(3n + 1) {
|
||||
border-left: none;
|
||||
.icon {
|
||||
cursor: pointer;
|
||||
display: grid;
|
||||
place-content: center;
|
||||
}
|
||||
|
||||
&:nth-child(1),
|
||||
&:nth-child(2),
|
||||
&:nth-child(3) {
|
||||
border-top: none;
|
||||
}
|
||||
position: relative;
|
||||
|
||||
&.header {
|
||||
font-weight: 400;
|
||||
font-size: 22px;
|
||||
.cell {
|
||||
padding: 1rem 2rem;
|
||||
|
||||
background: #f0f0f0;
|
||||
gap: 0.5rem;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
border-left: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
|
||||
&:not(.header) {
|
||||
user-select: text;
|
||||
|
||||
&:nth-child(3n + 1) {
|
||||
text-align: left;
|
||||
}
|
||||
&:nth-child(3n + 2),
|
||||
&:nth-child(3n + 3) {
|
||||
border-right: 1px solid #ddd;
|
||||
}
|
||||
|
||||
&:nth-last-child(1),
|
||||
&:nth-last-child(2),
|
||||
&:nth-last-child(3) {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
border-top-left-radius: 0.5rem;
|
||||
}
|
||||
&:nth-child(3) {
|
||||
border-top-right-radius: 0.5rem;
|
||||
}
|
||||
&:nth-last-child(3) {
|
||||
border-bottom-left-radius: 0.5rem;
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom-right-radius: 0.5rem;
|
||||
}
|
||||
|
||||
&.header {
|
||||
font-weight: 400;
|
||||
font-size: 22px;
|
||||
|
||||
padding-right: 1rem;
|
||||
|
||||
background: #f0f0f0;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
&:nth-child(3n + 3) {
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
&:not(.header) {
|
||||
user-select: text;
|
||||
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3rem;
|
||||
|
||||
transform: translate(0, -1rem);
|
||||
|
||||
pointer-events: none;
|
||||
background: transparent;
|
||||
&:nth-child(3n + 1) {
|
||||
text-align: left;
|
||||
}
|
||||
&:nth-child(3n + 2),
|
||||
&:nth-child(3n + 3) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&:hover::after {
|
||||
background: #00000006;
|
||||
}
|
||||
}
|
||||
&:nth-child(3n + 3) {
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
|
||||
&:hover {
|
||||
&:nth-child(3n + 1) + .cell + .cell::after {
|
||||
background: #00000006;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3rem;
|
||||
|
||||
transform: translate(0, -1rem);
|
||||
|
||||
pointer-events: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&:hover::after {
|
||||
background: #00000006;
|
||||
}
|
||||
}
|
||||
&:nth-child(3n + 2) + .cell::after {
|
||||
background: #00000006;
|
||||
|
||||
&:hover {
|
||||
&:nth-child(3n + 1) + .cell + .cell::after {
|
||||
background: #00000006;
|
||||
}
|
||||
&:nth-child(3n + 2) + .cell::after {
|
||||
background: #00000006;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user