Skip to content

Commit 6128678

Browse files
committed
✨ Dark mode
1 parent 6997e76 commit 6128678

File tree

8 files changed

+128
-73
lines changed

8 files changed

+128
-73
lines changed

backend/trip/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.7.3"
1+
__version__ = "1.8.0"

src/src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<router-outlet></router-outlet>
2-
<p-toast [preventDuplicates]="true" />
2+
<p-toast [preventOpenDuplicates]="true" />

src/src/app/components/dashboard/dashboard.component.html

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,41 @@
66
(closeEmitter)="closePlaceBox()"></app-place-box>
77
}
88

9-
<div class="absolute z-30 top-2 right-2 p-2 bg-white shadow rounded">
9+
<div class="absolute z-30 top-2 right-2 p-2 bg-white shadow rounded dark:bg-surface-900">
1010
<p-button (click)="toggleMarkersList()" text severity="secondary" icon="pi pi-map-marker" />
1111
</div>
1212

13-
<div class="absolute z-30 top-20 right-2 p-2 bg-white shadow rounded">
13+
<div class="absolute z-30 top-20 right-2 p-2 bg-white shadow rounded dark:bg-surface-900">
1414
<p-button (click)="toggleFilters()" text [severity]="viewFilters ? 'danger' : 'secondary'"
1515
[icon]="viewFilters ? 'pi pi-times' : 'pi pi-filter'" />
1616
</div>
1717

18-
<div [class.z-50]="viewSettings" class="absolute z-30 top-[9.5rem] right-2 p-2 bg-white shadow rounded">
18+
<div [class.z-50]="viewSettings"
19+
class="absolute z-30 top-[9.5rem] right-2 p-2 bg-white shadow rounded dark:bg-surface-900">
1920
<p-button (click)="toggleSettings()" text [severity]="viewSettings ? 'danger' : 'secondary'"
2021
[icon]="viewSettings ? 'pi pi-times' : 'pi pi-cog'" />
2122
</div>
2223

2324
<div class="absolute z-30 bottom-4 right-2">
2425
<div class="relative group flex flex-col-reverse items-end h-28">
2526
<div
26-
class="absolute right-0 bottom-20 p-2 bg-white shadow rounded transition-all duration-200 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto">
27+
class="absolute right-0 bottom-20 p-2 bg-white shadow rounded transition-all duration-200 opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto dark:bg-surface-900">
2728
<p-button (click)="batchAddModal()" text severity="secondary" icon="pi pi-ellipsis-v" />
2829
</div>
2930

30-
<div class="p-2 bg-white shadow rounded">
31+
<div class="p-2 bg-white shadow rounded dark:bg-surface-900">
3132
<p-button (click)="addPlaceModal()" text severity="secondary" icon="pi pi-plus" />
3233
</div>
3334
</div>
3435
</div>
3536

36-
<div class="absolute z-30 top-2 left-2 p-2 bg-white shadow rounded">
37+
<div class="absolute z-30 top-2 left-2 p-2 bg-white shadow rounded dark:bg-surface-900">
3738
<p-button (click)="gotoTrips()" label="Trips" severity="secondary" text icon="pi pi-bars" />
3839
</div>
3940

4041
@if (viewMarkersList) {
4142
<section
42-
class="absolute left-2 right-2 top-4 bottom-4 md:max-w-md bg-white z-40 rounded-xl shadow-2xl p-4 flex flex-col">
43+
class="absolute left-2 right-2 top-4 bottom-4 md:max-w-md bg-white z-40 rounded-xl shadow-2xl p-4 flex flex-col dark:bg-surface-900">
4344
<div class="mt-1 p-4 flex items-center justify-between">
4445
<div>
4546
<h1 class="font-semibold tracking-tight text-xl">Points</h1>
@@ -63,31 +64,32 @@ <h1 class="font-semibold tracking-tight text-xl">Points</h1>
6364
}
6465

6566
@for (p of visiblePlaces; track p.id) {
66-
<div class="mt-4 flex items-center gap-4 hover:bg-gray-50 rounded-xl cursor-pointer py-2 px-4"
67+
<div
68+
class="mt-4 flex items-center gap-4 hover:bg-gray-50 rounded-xl cursor-pointer py-2 px-4 dark:hover:bg-gray-800"
6769
(click)="gotoPlace(p)" (mouseenter)="hoverPlace(p)" (mouseleave)="resetHoverPlace()">
6870
<img [src]="p.image || p.category.image" class="w-12 rounded-full object-fit">
6971

7072
<div class="flex flex-col gap-1 truncate">
71-
<h1 class="tracking-tight truncate">{{ p.name }}</h1>
73+
<h1 class="tracking-tight truncate dark:text-surface-300">{{ p.name }}</h1>
7274
<span class="text-xs text-gray-500 truncate">{{ p.place }}</span>
7375

7476
<div class="flex gap-0.5">
7577
@if (p.allowdog) {
76-
<span class="bg-green-100 text-green-800 text-sm me-2 px-2.5 py-0.5 rounded">🐶</span>
78+
<span class="bg-green-100 text-green-800 text-sm me-2 px-2.5 py-0.5 rounded dark:bg-green-100/85">🐶</span>
7779
} @else {
78-
<span class="bg-red-100 text-red-800 text-sm me-2 px-2.5 py-0.5 rounded">🐶</span>
80+
<span class="bg-red-100 text-red-800 text-sm me-2 px-2.5 py-0.5 rounded dark:bg-red-100/85">🐶</span>
7981
}
8082

8183
@if (p.visited) {
82-
<span class="bg-green-100 text-green-800 text-sm me-2 px-2.5 py-0.5 rounded"><i
84+
<span class="bg-green-100 text-green-800 text-sm me-2 px-2.5 py-0.5 rounded dark:bg-green-100/85"><i
8385
class="pi pi-eye text-xs"></i></span>
8486
} @else {
85-
<span class="bg-red-100 text-red-800 text-sm me-2 px-2.5 py-0.5 rounded"><i
87+
<span class="bg-red-100 text-red-800 text-sm me-2 px-2.5 py-0.5 rounded dark:bg-red-100/85"><i
8688
class="pi pi-eye-slash text-xs"></i></span>
8789
}
8890

8991
<span
90-
class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded flex gap-2 items-center truncate"><i
92+
class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded flex gap-2 items-center truncate dark:bg-blue-100/85"><i
9193
class="pi pi-box text-xs"></i>{{ p.category.name }}</span>
9294
</div>
9395
</div>
@@ -103,7 +105,8 @@ <h1 class="tracking-tight">No data</h1>
103105
}
104106

105107
@if (viewFilters) {
106-
<section class="absolute right-2 top-36 bg-white z-40 rounded-xl shadow-2xl p-8 max-w-screen md:max-w-md">
108+
<section
109+
class="absolute right-2 top-36 bg-white z-40 rounded-xl shadow-2xl p-8 max-w-screen md:max-w-md dark:bg-surface-900">
107110

108111
<div class="mt-1 flex justify-between items-center">
109112
<div>
@@ -149,7 +152,8 @@ <h1 class="font-semibold tracking-tight text-xl">Categories</h1>
149152

150153
@if (viewSettings) {
151154
<section class="absolute inset-0 flex items-center justify-center z-40 bg-black/30">
152-
<div class="w-10/12 max-w-screen md:max-w-3xl h-fit max-h-screen bg-white rounded-xl shadow-2xl p-8 z-50">
155+
<div
156+
class="w-10/12 max-w-screen md:max-w-3xl h-fit max-h-screen bg-white rounded-xl shadow-2xl p-8 z-50 dark:bg-surface-900">
153157
<p-tabs value="0" scrollable>
154158
<p-tablist>
155159
<p-tab value="0" class="flex items-center gap-2">
@@ -169,19 +173,29 @@ <h1 class="font-semibold tracking-tight text-xl">Categories</h1>
169173
<p-tabpanel value="0">
170174
<div class="mt-4">
171175
<h1 class="font-semibold tracking-tight text-xl">Low Network Mode</h1>
172-
<span class="text-xs text-gray-500">You can disable Low Network Mode. Default is true. Display Category
176+
<span class="text-xs text-gray-500 dark:text-gray-400">You can disable Low Network Mode. Default is true.
177+
Display Category
173178
image instead of Place image.</span>
174179
</div>
175180
<div class="mt-4 flex justify-between">
176181
<div>Low Network Mode</div>
177182
<p-toggleswitch [(ngModel)]="isLowNet" (onChange)="toggleLowNet()" />
178183
</div>
179184

185+
<div class="mt-4">
186+
<h1 class="font-semibold tracking-tight text-xl">Dark Mode</h1>
187+
</div>
188+
<div class="mt-4 flex justify-between">
189+
<div>Enable Dark mode</div>
190+
<p-toggleswitch [(ngModel)]="isDarkMode" (onChange)="toggleDarkMode()" />
191+
</div>
192+
180193
<section [formGroup]="settingsForm">
181194
<div class="mt-4 flex justify-between items-center">
182195
<div>
183196
<h1 class="font-semibold tracking-tight text-xl">Map parameters</h1>
184-
<span class="text-xs text-gray-500">You can customize the default view on map loading</span>
197+
<span class="text-xs text-gray-500 dark:text-gray-400">You can customize the default view on map
198+
loading</span>
185199
</div>
186200

187201
<p-button icon="pi pi-ethereum" pTooltip="Set current map center as default"
@@ -213,7 +227,8 @@ <h1 class="font-semibold tracking-tight text-xl">Currency</h1>
213227

214228
<div class="mt-4">
215229
<h1 class="font-semibold tracking-tight text-xl">Filters</h1>
216-
<span class="text-xs text-gray-500">You can customize the categories to hide by default</span>
230+
<span class="text-xs text-gray-500 dark:text-gray-400">You can customize the categories to hide by
231+
default</span>
217232
</div>
218233
<div class="mt-4">
219234
<p-floatlabel variant="in" class="md:col-span-2">
@@ -234,7 +249,7 @@ <h1 class="font-semibold tracking-tight text-xl">Filters</h1>
234249
<div class="mt-1 p-2 mb-2 flex justify-between items-center">
235250
<div>
236251
<h1 class="font-semibold tracking-tight text-xl">Categories</h1>
237-
<span class="text-xs text-gray-500">You can modify the categories.</span>
252+
<span class="text-xs text-gray-500 dark:text-gray-400">You can modify the categories.</span>
238253
<span class="ml-1 text-xs text-orange-500">You cannot delete a used category.</span>
239254
</div>
240255

@@ -243,7 +258,7 @@ <h1 class="font-semibold tracking-tight text-xl">Categories</h1>
243258

244259
<div class="mt-4 flex flex-col">
245260
@for (category of categories; track category.id) {
246-
<div class="p-3 flex items-center justify-between rounded-md hover:bg-gray-50">
261+
<div class="p-3 flex items-center justify-between rounded-md hover:bg-gray-50 dark:hover:bg-gray-800">
247262
<div class="flex items-center gap-2">
248263
<img [src]="category.image" class="size-8 rounded-full" />{{ category.name }}
249264
</div>
@@ -297,7 +312,7 @@ <h1 class="font-semibold tracking-tight text-xl">About</h1>
297312
}
298313
</div>
299314

300-
<div class="mt-4 text-center text-sm text-gray-500">Made with ❤️ in BZH</div>
315+
<div class="mt-4 text-center text-sm text-gray-500 dark:text-gray-400">Made with ❤️ in BZH</div>
301316
</p-tabpanel>
302317
</p-tabpanels>
303318
</p-tabs>

src/src/app/components/dashboard/dashboard.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class DashboardComponent implements AfterViewInit {
7979
searchInput = new FormControl("");
8080
info: Info | undefined;
8181
isLowNet: boolean = false;
82+
isDarkMode: boolean = false;
8283

8384
viewSettings = false;
8485
viewFilters = false;
@@ -113,6 +114,7 @@ export class DashboardComponent implements AfterViewInit {
113114
) {
114115
this.currencySigns = this.utilsService.currencySigns();
115116
this.isLowNet = this.utilsService.isLowNet;
117+
this.isDarkMode = this.utilsService.isDarkMode;
116118

117119
this.settingsForm = this.fb.group({
118120
mapLat: [
@@ -253,6 +255,10 @@ export class DashboardComponent implements AfterViewInit {
253255
}, 200);
254256
}
255257

258+
toggleDarkMode() {
259+
this.utilsService.toggleDarkMode();
260+
}
261+
256262
get filteredPlaces(): Place[] {
257263
return this.places.filter((p) => {
258264
if (!this.filter_display_visited && p.visited) return false;
@@ -571,6 +577,8 @@ export class DashboardComponent implements AfterViewInit {
571577
}
572578

573579
toggleMarkersList() {
580+
this.searchInput.setValue("");
581+
this.viewMarkersListSearch = false;
574582
this.viewMarkersList = !this.viewMarkersList;
575583
if (this.viewMarkersList) this.setVisibleMarkers();
576584
}

0 commit comments

Comments
 (0)