Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit fa0a655

Browse files
committed
feat(overview): Grid layout & Leaderboard
1 parent 0fa37f0 commit fa0a655

File tree

3 files changed

+49
-12
lines changed

3 files changed

+49
-12
lines changed

assets/styles/app.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,3 +323,28 @@ ul.credit {
323323
transition: opacity 300ms;
324324
}
325325
}
326+
327+
.app-overview-dashboard {
328+
display: grid;
329+
gap: 3rem;
330+
grid-template:
331+
"hello-text hello-text hello-text hello-text" auto
332+
"weekly-metrics weekly-metrics leaderboard leaderboard" 1fr
333+
"historic-statistics historic-statistics leaderboard leaderboard" 1fr;
334+
335+
&__hello-text {
336+
grid-area: hello-text;
337+
}
338+
339+
&__weekly-metrics {
340+
grid-area: weekly-metrics;
341+
}
342+
343+
&__historic-statistics {
344+
grid-area: historic-statistics;
345+
}
346+
347+
&__leaderboard {
348+
grid-area: leaderboard;
349+
}
350+
}

src/Controller/OverviewCardsController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ public function eventDailyChart(
170170
],
171171
],
172172
]);
173+
$chart->setOptions([
174+
'scales' => [
175+
'y' => [
176+
'beginAtZero' => true,
177+
'min' => 0,
178+
],
179+
],
180+
]);
173181

174182
return $this->render('overview/cards/events_daily_chart.html.twig', [
175183
'chart' => $chart,

templates/overview/index.html.twig

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,49 @@
44
{% block title %}學習概況{% endblock %}
55

66
{% block app %}
7-
<section class="hello-text mb-5">
7+
<main class="app-overview-dashboard">
8+
<section class="app-overview-dashboard__hello-text">
89
<h2 class="display-4">哈囉,{{ app.user.name }} 👋</h2>
910
<p class="lead">這些是你最近的表現 ↓</p>
1011
</section>
1112

12-
<section class="week-overview mb-5">
13+
<section class="app-overview-dashboard__weekly-metrics">
1314
<h3 class="mb-3">每週學習概況</h3>
1415

15-
<div class="week-overview__main row gutter-2">
16-
<div class="col-4">
16+
<div class="row gutter-2">
17+
<div class="col-6">
1718
<div class="week-overview__cards vstack gap-1">
1819
<turbo-frame id="solved_questions" src="{{ path('app_overview_cards_solved_questions') }}"></turbo-frame>
1920
<turbo-frame id="points" src="{{ path('app_overview_cards_points') }}"></turbo-frame>
2021
<turbo-frame id="level" src="{{ path('app_overview_cards_level') }}"></turbo-frame>
2122
</div>
2223
</div>
23-
<div class="col-8">
24-
<p>WIP: Chart</p>
24+
<div class="col-6">
25+
<turbo-frame id="events_daily_chart" src="{{ path('app_overview_cards_events_daily_chart') }}"></turbo-frame>
2526
</div>
2627
</div>
2728
</section>
2829

29-
<section class="historic-statistics mb-5">
30+
<section class="app-overview-dashboard__historic-statistics">
3031
<h3 class="mb-3">學習歷程</h3>
3132

3233
<div class="historic-statistics__main row gutter-2">
33-
<div class="col-4">
34+
<div class="col-6">
3435
<div class="historic-statistics__cards vstack gap-1">
3536
<turbo-frame id="solved_questions" src="{{ path('app_overview_cards_solved_questions') }}"></turbo-frame>
3637
<turbo-frame id="events_count" src="{{ path('app_overview_cards_events_count') }}"></turbo-frame>
3738
<turbo-frame id="questions_count" src="{{ path('app_overview_cards_questions_count') }}"></turbo-frame>
3839
</div>
3940
</div>
40-
<div class="col-4">
41+
<div class="col-6">
4142
<turbo-frame id="events_history" src="{{ path('app_overview_cards_events_history') }}"></turbo-frame>
4243
</div>
43-
<div class="col-4">
44-
<turbo-frame id="events_daily_chart" src="{{ path('app_overview_cards_events_daily_chart') }}"></turbo-frame>
45-
</div>
4644
</div>
4745
</section>
46+
47+
<section class="app-overview-dashboard__leaderboard">
48+
<h3 class="mb-3">週排行榜</h3>
49+
50+
</section>
51+
</main>
4852
{% endblock %}

0 commit comments

Comments
 (0)