Skip to content

Commit 197cf03

Browse files
committed
Remove Latest page
1 parent fc9091e commit 197cf03

File tree

6 files changed

+11
-69
lines changed

6 files changed

+11
-69
lines changed

Makefile

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,3 @@ lint:
5656
.PHONY: build
5757
build:
5858
docker build -t ghcr.io/mgnsk/calendar:edge .
59-
60-
# Install and enable the production service.
61-
.PHONY: install
62-
install:
63-
docker volume create "calendar-database" || true
64-
ln -sf $(shell pwd)/mgnsk-calendar.service /etc/systemd/system/mgnsk-calendar.service
65-
systemctl daemon-reload
66-
systemctl enable --now mgnsk-calendar.service
67-
68-
# Uninstall the production service.
69-
.PHONY: uninstall
70-
uninstall:
71-
systemctl disable --now mgnsk-calendar.service || true
72-
rm -f /etc/systemd/system/mgnsk-calendar.service
73-
# Note: This command will not remove the database volume to prevent data loss
74-
# Use 'docker volume rm calendar-database' to remove the database if needed.

handler/events.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ type EventsHandler struct {
2525
sm *scs.SessionManager
2626
}
2727

28-
// Latest handles latest events.
29-
func (h *EventsHandler) Latest(c *server.Context) error {
30-
return h.events(
31-
c,
32-
model.NewEventsQuery(),
33-
model.OrderCreatedAtDesc,
34-
)
35-
}
36-
3728
// Upcoming handles upcoming events.
3829
func (h *EventsHandler) Upcoming(c *server.Context) error {
3930
return h.events(
@@ -100,10 +91,10 @@ func (h *EventsHandler) events(c *server.Context, query model.EventsQueryBuilder
10091
var cursor int64
10192

10293
switch c.Path() {
103-
case "/", "/my-events":
94+
case "/my-events":
10495
cursor = req.LastID
10596

106-
case "/upcoming", "/past":
97+
case "/", "/past":
10798
cursor = req.Offset
10899

109100
default:
@@ -139,11 +130,8 @@ func (h *EventsHandler) events(c *server.Context, query model.EventsQueryBuilder
139130

140131
// Register the handler.
141132
func (h *EventsHandler) Register(g *echo.Group) {
142-
g.GET("/", server.Wrap(h.db, h.sm, h.Latest))
143-
g.POST("/", server.Wrap(h.db, h.sm, h.Latest)) // Fox htmx.
144-
145-
g.GET("/upcoming", server.Wrap(h.db, h.sm, h.Upcoming))
146-
g.POST("/upcoming", server.Wrap(h.db, h.sm, h.Upcoming)) // Fox htmx.
133+
g.GET("/", server.Wrap(h.db, h.sm, h.Upcoming))
134+
g.POST("/", server.Wrap(h.db, h.sm, h.Upcoming)) // Fox htmx.
147135

148136
g.GET("/past", server.Wrap(h.db, h.sm, h.Past))
149137
g.POST("/past", server.Wrap(h.db, h.sm, h.Past)) // For htmx.

html/nav.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,35 +54,30 @@ type eventNavLink struct {
5454
}
5555

5656
// EventNav renders the event navigation.
57-
func EventNav(user *domain.User, path, csrf string) Node {
57+
func EventNav(user *domain.User, currentPath, csrf string) Node {
5858
links := []eventNavLink{
59-
{
60-
Text: "Latest",
61-
URL: "/",
62-
Active: path == "/",
63-
},
6459
{
6560
Text: "Upcoming",
66-
URL: "/upcoming",
67-
Active: path == "/upcoming",
61+
URL: "/",
62+
Active: currentPath == "/",
6863
},
6964
{
7065
Text: "Past",
7166
URL: "/past",
72-
Active: path == "/past",
67+
Active: currentPath == "/past",
7368
},
7469
{
7570
Text: "Tags",
7671
URL: "/tags",
77-
Active: path == "/tags",
72+
Active: currentPath == "/tags",
7873
},
7974
}
8075

8176
if user != nil {
8277
links = append(links, eventNavLink{
8378
Text: "My events",
8479
URL: "/my-events",
85-
Active: path == "/my-events",
80+
Active: currentPath == "/my-events",
8681
})
8782
}
8883

html/page.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ func Page(props PageProps) Node {
7878
props.User,
7979
If(
8080
props.Path == "/" ||
81-
props.Path == "/upcoming" ||
8281
props.Path == "/past" ||
8382
props.Path == "/tags" ||
8483
props.Path == "/my-events",

html/tag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TagListPartial(tags []*domain.Tag, csrf string) Node {
6464
Sup(Class("text-gray-400"),
6565
Textf("(%d)", tag.EventCount),
6666
),
67-
// Show latest tagged events on click.
67+
// Show upcoming tagged events on click.
6868
hx.Post("/"),
6969
hx.Trigger("click"),
7070
Attr("onclick", fmt.Sprintf(`changeTab(document.querySelectorAll(".nav-link")[0]); setSearch("%s")`, tag.Name)),

mgnsk-calendar.service

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)