Skip to content

Commit 8c0ad8c

Browse files
committed
finished vacation planner
1 parent d4af135 commit 8c0ad8c

File tree

9 files changed

+237
-24
lines changed

9 files changed

+237
-24
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.6.0
4+
5+
### Features
6+
7+
- New vacation days planner
8+
39
## v0.5.8
410

511
### Bugfix

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Tech Stack: Go, templ, htmx, SQLite, Tailwind+DaisyUI
1010
### Task
1111

1212
Using task to ease testing/building
13-
https://taskfile.dev/
13+
<https://taskfile.dev/>
1414

1515
``` bash
1616
go install github.com/go-task/task/v3/cmd/task@latest
1717
```
1818

1919
### Templ
2020

21-
https://templ.guide/
21+
<https://templ.guide/>
2222

2323
``` bash
2424
go install github.com/a-h/templ/cmd/templ@latest
@@ -28,25 +28,31 @@ Go templating package to generate HTML
2828

2929
### Tailwind CSS
3030

31-
https://tailwindcss.com/docs/installation
31+
<https://tailwindcss.com/docs/installation>
3232

3333
Provides CSS classes to format HTML elements
3434

3535
### DaisyUI
3636

37-
https://daisyui.com/docs/install/
37+
<https://daisyui.com/docs/install/>
3838

3939
Component library for Tailwind CSS (Buttons, Menus, ...)
4040

4141
### HTMX
4242

43-
https://htmx.org/
43+
<https://htmx.org/>
4444

4545
Provides means to create dynamic HTML webites with minimal javascript usage
4646

47+
### Apache ECharts
48+
49+
<https://echarts.apache.org/>
50+
51+
Library for charts
52+
4753
## Go-Winres
4854

49-
https://github.com/tc-hib/go-winres
55+
<https://github.com/tc-hib/go-winres>
5056

5157
``` bash
5258
go install github.com/tc-hib/go-winres@latest
@@ -57,10 +63,10 @@ Manifest/Icons for Windows
5763
## Resources
5864

5965
Go CRUD Tutorial:
60-
https://www.honeybadger.io/blog/how-to-create-crud-application-with-golang-and-mysql/
66+
<https://www.honeybadger.io/blog/how-to-create-crud-application-with-golang-and-mysql/>
6167

6268
Go Web Examples:
63-
https://gowebexamples.com/
69+
<https://gowebexamples.com/>
6470

6571
SQL Tutorial:
66-
https://www.w3schools.com/sql/default.asp
72+
<https://www.w3schools.com/sql/default.asp>

internal/assets/css/input.css

Lines changed: 137 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,57 @@ html {
937937
content: var(--tw-content);
938938
}
939939

940+
.card {
941+
position: relative;
942+
display: flex;
943+
flex-direction: column;
944+
border-radius: var(--rounded-box, 1rem);
945+
}
946+
947+
.card:focus {
948+
outline: 2px solid transparent;
949+
outline-offset: 2px;
950+
}
951+
952+
.card figure {
953+
display: flex;
954+
align-items: center;
955+
justify-content: center;
956+
}
957+
958+
.card.image-full {
959+
display: grid;
960+
}
961+
962+
.card.image-full:before {
963+
position: relative;
964+
content: "";
965+
z-index: 10;
966+
border-radius: var(--rounded-box, 1rem);
967+
--tw-bg-opacity: 1;
968+
background-color: var(--fallback-n,oklch(var(--n)/var(--tw-bg-opacity)));
969+
opacity: 0.75;
970+
}
971+
972+
.card.image-full:before,
973+
.card.image-full > * {
974+
grid-column-start: 1;
975+
grid-row-start: 1;
976+
}
977+
978+
.card.image-full > figure img {
979+
height: 100%;
980+
-o-object-fit: cover;
981+
object-fit: cover;
982+
}
983+
984+
.card.image-full > .card-body {
985+
position: relative;
986+
z-index: 20;
987+
--tw-text-opacity: 1;
988+
color: var(--fallback-nc,oklch(var(--nc)/var(--tw-text-opacity)));
989+
}
990+
940991
.checkbox {
941992
flex-shrink: 0;
942993
--chkbg: var(--fallback-bc,oklch(var(--bc)/1));
@@ -1664,6 +1715,44 @@ html {
16641715
}
16651716
}
16661717

1718+
.card :where(figure:first-child) {
1719+
overflow: hidden;
1720+
border-start-start-radius: inherit;
1721+
border-start-end-radius: inherit;
1722+
border-end-start-radius: unset;
1723+
border-end-end-radius: unset;
1724+
}
1725+
1726+
.card :where(figure:last-child) {
1727+
overflow: hidden;
1728+
border-start-start-radius: unset;
1729+
border-start-end-radius: unset;
1730+
border-end-start-radius: inherit;
1731+
border-end-end-radius: inherit;
1732+
}
1733+
1734+
.card:focus-visible {
1735+
outline: 2px solid currentColor;
1736+
outline-offset: 2px;
1737+
}
1738+
1739+
.card.bordered {
1740+
border-width: 1px;
1741+
--tw-border-opacity: 1;
1742+
border-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-border-opacity)));
1743+
}
1744+
1745+
.card.compact .card-body {
1746+
padding: 1rem;
1747+
font-size: 0.875rem;
1748+
line-height: 1.25rem;
1749+
}
1750+
1751+
.card.image-full :where(figure) {
1752+
overflow: hidden;
1753+
border-radius: inherit;
1754+
}
1755+
16671756
.checkbox:focus {
16681757
box-shadow: none;
16691758
}
@@ -2420,6 +2509,26 @@ html {
24202509
margin-right: auto;
24212510
}
24222511

2512+
.mb-2 {
2513+
margin-bottom: 0.5rem;
2514+
}
2515+
2516+
.ml-\[30px\] {
2517+
margin-left: 30px;
2518+
}
2519+
2520+
.mr-\[30px\] {
2521+
margin-right: 30px;
2522+
}
2523+
2524+
.mt-5 {
2525+
margin-top: 1.25rem;
2526+
}
2527+
2528+
.mt-\[22px\] {
2529+
margin-top: 22px;
2530+
}
2531+
24232532
.flex {
24242533
display: flex;
24252534
}
@@ -2460,6 +2569,10 @@ html {
24602569
height: 1.25rem;
24612570
}
24622571

2572+
.h-\[300px\] {
2573+
height: 300px;
2574+
}
2575+
24632576
.h-\[400px\] {
24642577
height: 400px;
24652578
}
@@ -2480,8 +2593,8 @@ html {
24802593
width: 16rem;
24812594
}
24822595

2483-
.w-\[1400px\] {
2484-
width: 1400px;
2596+
.w-\[1200px\] {
2597+
width: 1200px;
24852598
}
24862599

24872600
.w-full {
@@ -2545,6 +2658,10 @@ html {
25452658
gap: 0.25rem;
25462659
}
25472660

2661+
.gap-2 {
2662+
gap: 0.5rem;
2663+
}
2664+
25482665
.gap-4 {
25492666
gap: 1rem;
25502667
}
@@ -2594,6 +2711,10 @@ html {
25942711
fill: currentColor;
25952712
}
25962713

2714+
.p-1 {
2715+
padding: 0.25rem;
2716+
}
2717+
25972718
.p-2 {
25982719
padding: 0.5rem;
25992720
}
@@ -2621,6 +2742,11 @@ html {
26212742
font-weight: 700;
26222743
}
26232744

2745+
.text-black {
2746+
--tw-text-opacity: 1;
2747+
color: rgb(0 0 0 / var(--tw-text-opacity));
2748+
}
2749+
26242750
.text-error {
26252751
--tw-text-opacity: 1;
26262752
color: var(--fallback-er,oklch(var(--er)/var(--tw-text-opacity)));
@@ -2646,6 +2772,15 @@ input {
26462772
color-scheme: dark;
26472773
}
26482774

2775+
.prevent-select {
2776+
-webkit-user-select: none;
2777+
/* Safari */
2778+
/* IE 10 and IE 11 */
2779+
-moz-user-select: none;
2780+
user-select: none;
2781+
/* Standard syntax */
2782+
}
2783+
26492784
@media (min-width: 640px) {
26502785
.sm\:card {
26512786
position: relative;

internal/assets/css/tailwind.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44

55
input {
66
color-scheme: dark;
7+
}
8+
9+
.prevent-select {
10+
-webkit-user-select: none; /* Safari */
11+
-ms-user-select: none; /* IE 10 and IE 11 */
12+
user-select: none; /* Standard syntax */
713
}

internal/components/components.templ

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,9 +691,40 @@ templ Quickbar() {
691691
}
692692

693693

694-
templ PlannerPage(entries []database.PlannerEntry) {
694+
templ PlannerPage(activeYear time.Time, plannedVacation int, entries []database.PlannerEntry) {
695695
<div id="vacation-planner" class="flex justify-center gap-5 py-5">
696696
@plannerChart(entries)
697-
<div id="plannerchart" class="h-[400px] w-[1400px]"></div>
697+
<div class="card bg-base-300 p-2 shadow">
698+
<form class="mt-[22px] flex justify-center" hx-post="/api/vacation" hx-target="#vacation-planner" hx-select="#vacation-planner" hx-swap="outerHTML">
699+
<select
700+
class="select rounded bg-neutral text-xl text-neutral-content"
701+
id="yearPlanner"
702+
name="year"
703+
hx-post="/api/vacation"
704+
hx-target="#vacation-planner"
705+
hx-select="#vacation-planner"
706+
hx-swap="outerHTML"
707+
hx-trigger="change delay:100ms"
708+
hx-preserve="true"
709+
>
710+
for _, year := range yearSelectList() {
711+
if year == activeYear.Year() {
712+
<option selected>{ strconv.Itoa(year) }</option>
713+
} else {
714+
<option>{ strconv.Itoa(year) }</option>
715+
}
716+
}
717+
</select>
718+
</form>
719+
<div class="prevent-select mb-2 ml-[30px] mr-[30px] mt-5 flex flex-row justify-center gap-2">
720+
<p id="planner-counter" class="p-1 font-bold" >Planned Vacation: { strconv.Itoa(plannedVacation) }</p>
721+
<p class="grow"></p>
722+
<p class="p-1 text-black" style="background-color: #d5d8dc;">Weekday</p>
723+
<p class="p-1 text-black" style="background-color: #808b96;">Weekend</p>
724+
<p class="p-1 text-black" style="background-color: #2ecc71;">Vacation</p>
725+
<p class="p-1 text-black" style="background-color: #f1c40f;">Holiday</p>
726+
</div>
727+
<div id="plannerchart" class="h-[300px] w-[1200px]"></div>
728+
</div>
698729
</div>
699730
}

0 commit comments

Comments
 (0)