feat: ora funge decentemente anche su mobile

pull/1/head
Antonio De Lucreziis 2 years ago
parent 19541630fc
commit 5ffa1b4cb1

@ -1,6 +1,7 @@
import { useContext, useState } from 'preact/hooks' import { useContext, useState } from 'preact/hooks'
import { SolutionStat } from '../../shared/model' import { SolutionStat } from '../../shared/model'
import { sortByNumericKey, sortByStringKey } from '../../shared/utils' import { sortByNumericKey, sortByStringKey } from '../../shared/utils'
import { prependBaseUrl } from '../api'
import { Header } from '../components/Header' import { Header } from '../components/Header'
import { useResource, MetadataContext } from '../hooks' import { useResource, MetadataContext } from '../hooks'
@ -49,6 +50,7 @@ export const ScoresPage = () => {
<Header /> <Header />
<main class="page-scores"> <main class="page-scores">
<div class="subtitle">Classifica</div> <div class="subtitle">Classifica</div>
<div class="scrollable">
<div class="table"> <div class="table">
<div class="cell header"> <div class="cell header">
<span>Studente</span> <span>Studente</span>
@ -88,12 +90,15 @@ export const ScoresPage = () => {
</div> </div>
{orderedStats.map(([user, s]) => ( {orderedStats.map(([user, s]) => (
<> <>
<div class="cell">{user}</div> <div class="cell">
<a href={prependBaseUrl(`/u/${user}`)}>@{user}</a>
</div>
<div class="cell">{s.sentSolutionsCount}</div> <div class="cell">{s.sentSolutionsCount}</div>
<div class="cell">{s.correctSolutionsCount}</div> <div class="cell">{s.correctSolutionsCount}</div>
</> </>
))} ))}
</div> </div>
</div>
</main> </main>
</> </>
) )

@ -348,12 +348,20 @@ main.page-problem {
} }
main.page-scores { main.page-scores {
.scrollable {
display: flex;
overflow: auto;
max-width: 100%;
padding: 1rem;
.table { .table {
display: grid; display: grid;
grid-template-columns: auto auto auto; grid-template-columns: auto auto auto;
box-shadow: -2px 4px 6px 1px #00000018, 0 0 4px 0px #00000010; box-shadow: -2px 4px 6px 1px #00000018, 0 0 4px 0px #00000010;
border: 1px solid #ddd; // border: 1px solid #ddd;
border-radius: 0.5rem; border-radius: 0.5rem;
background: #ffffff; background: #ffffff;
@ -365,32 +373,45 @@ main.page-scores {
place-content: center; place-content: center;
} }
overflow: hidden;
position: relative; position: relative;
.cell { .cell {
padding: 1rem 1rem 1rem 2rem; padding: 1rem 2rem;
gap: 0.5rem; gap: 0.5rem;
border-left: 1px solid #ddd; border-left: 1px solid #ddd;
border-top: 1px solid #ddd; border-top: 1px solid #ddd;
&:nth-child(3n + 1) { &:nth-child(3n + 3) {
border-left: none; border-right: 1px solid #ddd;
} }
&:nth-child(1), &:nth-last-child(1),
&:nth-child(2), &:nth-last-child(2),
&:nth-last-child(3) {
border-bottom: 1px solid #ddd;
}
&:first-child {
border-top-left-radius: 0.5rem;
}
&:nth-child(3) { &:nth-child(3) {
border-top: none; 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 { &.header {
font-weight: 400; font-weight: 400;
font-size: 22px; font-size: 22px;
padding-right: 1rem;
background: #f0f0f0; background: #f0f0f0;
display: flex; display: flex;
@ -441,6 +462,7 @@ main.page-scores {
} }
} }
} }
}
} }
// //

Loading…
Cancel
Save