From 4dd6f1316048fc9a74f8fae5fd8afa4feee2bc46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Fri, 13 Oct 2023 19:22:43 +0200 Subject: [PATCH] Add a button to start session from game overview Fix #62 --- CHANGELOG.md | 5 ++ games/static/base.css | 86 ++++++++++---------- games/templates/components/button.html | 20 +++-- games/templates/components/button_start.html | 26 ++++++ games/templates/list_sessions.html | 6 +- games/templates/view_game.html | 9 +- games/urls.py | 11 ++- games/views.py | 19 ++++- 8 files changed, 122 insertions(+), 60 deletions(-) create mode 100644 games/templates/components/button_start.html diff --git a/CHANGELOG.md b/CHANGELOG.md index fc2b554..2d25d71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased + +### Enhancements +* Add a button to start session from game overview + ## 1.1.2 / 2023-10-13 16:30+02:00 ### Enhancements diff --git a/games/static/base.css b/games/static/base.css index 6743314..0c5f72d 100644 --- a/games/static/base.css +++ b/games/static/base.css @@ -799,6 +799,10 @@ select { margin-bottom: 1rem; } +.ml-1 { + margin-left: 0.25rem; +} + .ml-2 { margin-left: 0.5rem; } @@ -811,14 +815,6 @@ select { margin-top: 1rem; } -.ml-8 { - margin-left: 2rem; -} - -.ml-1 { - margin-left: 0.25rem; -} - .block { display: block; } @@ -839,10 +835,6 @@ select { display: none; } -.h-6 { - height: 1.5rem; -} - .h-4 { height: 1rem; } @@ -851,26 +843,30 @@ select { height: 1.25rem; } +.h-6 { + height: 1.5rem; +} + .min-h-screen { min-height: 100vh; } -.w-6 { - width: 1.5rem; -} - -.w-full { - width: 100%; -} - .w-5 { width: 1.25rem; } +.w-6 { + width: 1.5rem; +} + .w-7 { width: 1.75rem; } +.w-full { + width: 100%; +} + .max-w-screen-lg { max-width: 1024px; } @@ -893,6 +889,10 @@ select { animation: spin 1s linear infinite; } +.flex-row { + flex-direction: row; +} + .flex-col { flex-direction: column; } @@ -905,6 +905,10 @@ select { align-items: center; } +.items-baseline { + align-items: baseline; +} + .justify-center { justify-content: center; } @@ -913,6 +917,10 @@ select { justify-content: space-between; } +.gap-2 { + gap: 0.5rem; +} + .self-center { align-self: center; } @@ -935,6 +943,10 @@ select { border-radius: 0.5rem; } +.rounded-sm { + border-radius: 0.125rem; +} + .border-gray-200 { --tw-border-opacity: 1; border-color: rgb(229 231 235 / var(--tw-border-opacity)); @@ -950,21 +962,16 @@ select { background-color: rgb(22 163 74 / var(--tw-bg-opacity)); } -.bg-white { - --tw-bg-opacity: 1; - background-color: rgb(255 255 255 / var(--tw-bg-opacity)); -} - -.bg-blue-600 { - --tw-bg-opacity: 1; - background-color: rgb(37 99 235 / var(--tw-bg-opacity)); -} - .bg-violet-600 { --tw-bg-opacity: 1; background-color: rgb(124 58 237 / var(--tw-bg-opacity)); } +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + .p-4 { padding: 1rem; } @@ -992,10 +999,6 @@ select { padding-right: 1rem; } -.pl-8 { - padding-left: 2rem; -} - .text-center { text-align: center; } @@ -1034,6 +1037,11 @@ select { line-height: 1rem; } +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + .font-semibold { font-weight: 600; } @@ -1282,11 +1290,6 @@ th label { background-color: rgb(21 128 61 / var(--tw-bg-opacity)); } -.hover\:bg-blue-700:hover { - --tw-bg-opacity: 1; - background-color: rgb(29 78 216 / var(--tw-bg-opacity)); -} - .hover\:bg-violet-700:hover { --tw-bg-opacity: 1; background-color: rgb(109 40 217 / var(--tw-bg-opacity)); @@ -1312,11 +1315,6 @@ th label { --tw-ring-color: rgb(34 197 94 / var(--tw-ring-opacity)); } -.focus\:ring-blue-500:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); -} - .focus\:ring-violet-500:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(139 92 246 / var(--tw-ring-opacity)); diff --git a/games/templates/components/button.html b/games/templates/components/button.html index 38f27d1..b18c86d 100644 --- a/games/templates/components/button.html +++ b/games/templates/components/button.html @@ -1,10 +1,13 @@ - + diff --git a/games/templates/components/button_start.html b/games/templates/components/button_start.html new file mode 100644 index 0000000..0d73ba2 --- /dev/null +++ b/games/templates/components/button_start.html @@ -0,0 +1,26 @@ +{% comment %} +title +text +{% endcomment %} + diff --git a/games/templates/list_sessions.html b/games/templates/list_sessions.html index 83b584d..af0401d 100644 --- a/games/templates/list_sessions.html +++ b/games/templates/list_sessions.html @@ -10,8 +10,8 @@
- {% include 'components/button.html' with text=last.purchase title="Start session of last played game" only %} + {% include 'components/button_start.html' with text=last.purchase title="Start session of last played game" only %}
{% endif %} diff --git a/games/templates/view_game.html b/games/templates/view_game.html index fd61dff..8ba3f3c 100644 --- a/games/templates/view_game.html +++ b/games/templates/view_game.html @@ -47,7 +47,14 @@ {% endfor %} -

Sessions ({{ sessions.count }})

+

+ Sessions + + ({{ sessions.count }}) + + {% url 'start_game_session' game.id as add_session_link %} + {% include 'components/button.html' with title="Start new session" text="New" link=add_session_link %} +