diff --git a/internal/router/frontend.go b/internal/router/frontend.go
index d55c911..cbcb871 100644
--- a/internal/router/frontend.go
+++ b/internal/router/frontend.go
@@ -238,6 +238,63 @@ func registerFrontendRoutes(cfg *Config) {
return c.HTML(http.StatusOK, buf.String())
})
+ // Collection create modal
+ frontendProtected.GET("/collections/create-modal", func(c echo.Context) error {
+ var buf bytes.Buffer
+ err := templates.CollectionModal(templates.CollectionData{}).Render(c.Request().Context(), &buf)
+ if err != nil {
+ return err
+ }
+ return c.HTML(http.StatusOK, buf.String())
+ })
+
+ // Collection edit modal
+ frontendProtected.GET("/collections/:id/edit-modal", func(c echo.Context) error {
+ // Parse collection ID
+ collectionID := c.Param("id")
+ collUUID, err := uuid.Parse(collectionID)
+ if err != nil {
+ return c.HTML(http.StatusBadRequest, "
Invalid collection ID
")
+ }
+
+ // Fetch collection data
+ collection, err := cfg.Queries.GetCollection(c.Request().Context(), pgtype.UUID{Bytes: collUUID, Valid: true})
+ if err != nil {
+ return c.HTML(http.StatusNotFound, "Collection not found
")
+ }
+
+ // Convert to template type
+ colData := templates.CollectionData{
+ ID: uuid.UUID(collection.ID.Bytes).String(),
+ Name: collection.Name,
+ Description: getText(collection.Description),
+ Color: getText(collection.Color),
+ Icon: getText(collection.Icon),
+ }
+
+ // Ensure default color if empty
+ if colData.Color == "" {
+ colData.Color = "blue"
+ }
+
+ var buf bytes.Buffer
+ err = templates.CollectionModal(colData).Render(c.Request().Context(), &buf)
+ if err != nil {
+ return err
+ }
+ return c.HTML(http.StatusOK, buf.String())
+ })
+
+ // Restore system collection modal
+ frontendProtected.GET("/collections/restore-modal", func(c echo.Context) error {
+ var buf bytes.Buffer
+ err := templates.RestoreSystemCollectionModal().Render(c.Request().Context(), &buf)
+ if err != nil {
+ return err
+ }
+ return c.HTML(http.StatusOK, buf.String())
+ })
+
// Collection detail page (works for both system and user collections)
frontendProtected.GET("/collections/:id", func(c echo.Context) error {
user, err := getTemplateUserWithTheme(c, cfg)