Skip to content

Commit 94576de

Browse files
committed
Added ratings to currently reading state book / refactor overlays
1 parent eccb345 commit 94576de

File tree

4 files changed

+45
-62
lines changed

4 files changed

+45
-62
lines changed

templates/book_list/componenten/book_section.html

Lines changed: 14 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -36,83 +36,35 @@ <h2 class="text-xl md:text-2xl font-bold text-gray-900 dark:text-white">{{ secti
3636
<!-- Progress Bar -->
3737
<div class="book-progress-bar progress-reading" style="width: {{ book.progress_percentage_display() }}%;"></div>
3838

39+
<!-- Rating Indicator -->
40+
{% include "book_list/componenten/rating_overlay.html" %}
41+
3942
<!-- Notes Indicator for Reading -->
40-
{% match book.koreader_metadata %}
41-
{% when Some with (metadata) %}
42-
{% if !metadata.annotations.is_empty() %}
43-
<div class="absolute top-2 right-2 bg-gradient-to-br from-blue-500 to-blue-600 text-white text-xs px-2 py-1 rounded-lg shadow-lg backdrop-blur-sm border border-blue-400/30 flex items-center space-x-1">
44-
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">
45-
<path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"></path>
46-
</svg>
47-
<span class="font-medium">{{ book.annotation_count() }}</span>
48-
</div>
49-
{% endif %}
50-
{% when None %}
51-
{% endmatch %}
43+
{% set notes_color_classes = "bg-gradient-to-br from-blue-500 to-blue-600 border border-blue-400/30" %}
44+
{% include "book_list/componenten/notes_overlay.html" %}
45+
5246
{% elif section_name == "abandoned" %}
5347
<!-- Progress Bar -->
5448
<div class="book-progress-bar progress-reading" style="width: {{ book.progress_percentage_display() }}%;"></div>
5549

5650
<!-- Rating Indicator -->
57-
{% match book.rating() %}
58-
{% when Some with (rating) %}
59-
<div class="absolute top-2 left-2 bg-gradient-to-br from-yellow-400 to-yellow-500 text-white text-xs px-2 py-1 rounded-lg shadow-lg backdrop-blur-sm border border-yellow-300/30 flex items-center space-x-1">
60-
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 24 24">
61-
<path d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path>
62-
</svg>
63-
<span class="font-medium">{{ rating }}</span>
64-
</div>
65-
{% when None %}
66-
{% endmatch %}
51+
{% include "book_list/componenten/rating_overlay.html" %}
6752

6853
<!-- Notes Indicator for On Hold -->
69-
{% match book.koreader_metadata %}
70-
{% when Some with (metadata) %}
71-
{% if !metadata.annotations.is_empty() %}
72-
<div class="absolute top-2 right-2 bg-gradient-to-br from-purple-500 to-purple-600 text-white text-xs px-2 py-1 rounded-lg shadow-lg backdrop-blur-sm border border-purple-400/30 flex items-center space-x-1">
73-
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">
74-
<path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"></path>
75-
</svg>
76-
<span class="font-medium">{{ book.annotation_count() }}</span>
77-
</div>
78-
{% endif %}
79-
{% when None %}
80-
{% endmatch %}
54+
{% set notes_color_classes = "bg-gradient-to-br from-purple-500 to-purple-600 border border-purple-400/30" %}
55+
{% include "book_list/componenten/notes_overlay.html" %}
8156

8257
{% elif section_name == "completed" %}
8358
<!-- Rating Indicator -->
84-
{% match book.rating() %}
85-
{% when Some with (rating) %}
86-
<div class="absolute top-2 left-2 bg-gradient-to-br from-yellow-400 to-yellow-500 text-white text-xs px-2 py-1 rounded-lg shadow-lg backdrop-blur-sm border border-yellow-300/30 flex items-center space-x-1">
87-
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 24 24">
88-
<path d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path>
89-
</svg>
90-
<span class="font-medium">{{ rating }}</span>
91-
</div>
92-
{% when None %}
93-
{% endmatch %}
59+
{% include "book_list/componenten/rating_overlay.html" %}
9460

9561
<!-- Notes Indicator for Completed -->
96-
{% match book.koreader_metadata %}
97-
{% when Some with (metadata) %}
98-
{% if !metadata.annotations.is_empty() %}
99-
<div class="absolute top-2 right-2 bg-gradient-to-br from-emerald-500 to-emerald-600 text-white text-xs px-2 py-1 rounded-lg shadow-lg backdrop-blur-sm border border-emerald-400/30 flex items-center space-x-1">
100-
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">
101-
<path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"></path>
102-
</svg>
103-
<span class="font-medium">{{ book.annotation_count() }}</span>
104-
</div>
105-
{% endif %}
106-
{% when None %}
107-
{% endmatch %}
62+
{% set notes_color_classes = "bg-gradient-to-br from-emerald-500 to-emerald-600 border border-emerald-400/30" %}
63+
{% include "book_list/componenten/notes_overlay.html" %}
64+
10865
{% elif section_name == "unread" %}
10966
<!-- Unread Indicator -->
110-
<div class="absolute top-2 left-2 bg-gradient-to-br from-orange-500 to-orange-600 text-white text-xs px-2.5 py-1 rounded-lg shadow-lg backdrop-blur-sm border border-orange-400/30 flex items-center space-x-1">
111-
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">
112-
<path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"></path>
113-
</svg>
114-
<span class="font-medium">New</span>
115-
</div>
67+
{% include "book_list/componenten/unread_overlay.html" %}
11668
{% endif %}
11769
</div>
11870
</a>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Notes Indicator -->
2+
{% match book.koreader_metadata %}
3+
{% when Some with (metadata) %}
4+
{% if !metadata.annotations.is_empty() %}
5+
<div class="absolute top-2 right-2 {{ notes_color_classes }} text-white text-xs px-2 py-1 rounded-lg shadow-lg backdrop-blur-sm flex items-center space-x-1">
6+
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">
7+
<path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"></path>
8+
</svg>
9+
<span class="font-medium">{{ book.annotation_count() }}</span>
10+
</div>
11+
{% endif %}
12+
{% when None %}
13+
{% endmatch %}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Rating Indicator -->
2+
{% match book.rating() %}
3+
{% when Some with (rating) %}
4+
<div class="absolute top-2 left-2 bg-gradient-to-br from-yellow-400 to-yellow-500 text-white text-xs px-2 py-1 rounded-lg shadow-lg backdrop-blur-sm border border-yellow-300/30 flex items-center space-x-1">
5+
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 24 24">
6+
<path d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"></path>
7+
</svg>
8+
<span class="font-medium">{{ rating }}</span>
9+
</div>
10+
{% when None %}
11+
{% endmatch %}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- Unread Indicator -->
2+
<div class="absolute top-2 left-2 bg-gradient-to-br from-orange-500 to-orange-600 text-white text-xs px-2.5 py-1 rounded-lg shadow-lg backdrop-blur-sm border border-orange-400/30 flex items-center space-x-1">
3+
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">
4+
<path stroke-linecap="round" stroke-linejoin="round" d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"></path>
5+
</svg>
6+
<span class="font-medium">New</span>
7+
</div>

0 commit comments

Comments
 (0)