Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@ for simplicity, I keep todo list and progress here for now

**Before release**:
- [ ] Review "TODO!"s
- [ ] Homepage
- [x] Homepage
- [ ] Licence
- [ ] RELEASE
- [x] RELEASE
---

AFTER RELEASE CHECKLIST:
- [x] Setup & test email
- [x] Setup & test auth & registration with google
- [x] Setup & test auth & registration with github
- [x] Setup & test tracing
- [ ] Enable linting and testing on CI/CD
- [ ] Disable push to main without MR
Tweaks & fixes:
- [ ] Add description to upload book cover input
- [ ] When book cover upload ends with error, another cannot be added

NEXT:

TODO:
- [ ] Resend verification link (Sometimes email is lost in somewhere between the woods (Not mailman to blame))
- [ ] Create new topic when creating/editing entity
- [ ] Pages
- [ ] Add meta to page (Who created, last edit by who and list of activities on page (api call))
- [ ] Content chips
- [ ] Books
- [ ] Add subtitle
- [ ] Sort
Expand Down Expand Up @@ -53,3 +51,4 @@ NEXT:
- [ ] Let user continue work on reject entity and proposed changes
- [ ] Review "delete account" test. Right now, it passes even if models belonging to the user still exist.
- [ ] Order of props when reviewing changes and public diffs should be constant and predefined
- [ ] Sitemap
16 changes: 16 additions & 0 deletions app/repo/page_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ func (r *Repo) GetPageByPublicID(ctx context.Context, publicID string) (*ds.Page
return page, err
}

// GetPagesByPublicID retrieves pages by given public ID.
func (r *Repo) GetPagesByPublicID(ctx context.Context, publicIDs ...string) (pages []ds.Page, err error) {
_, span := r.tracer.Start(ctx, "GetPageByPublicID")
defer span.End()

if len(publicIDs) == 0 {
return
}

pages = make([]ds.Page, 0, len(publicIDs))
const query = `SELECT * FROM entities e JOIN pages p USING (id) WHERE e.public_id = ANY($1) AND e.type = $2 AND e.deleted_at IS NULL`

err = pgxscan.Select(ctx, r.getDB(ctx), &pages, query, publicIDs, ds.EntityTypePage)
return
}

// GetPageByID retrieves a page by its ID.
func (r *Repo) GetPageByID(ctx context.Context, id ds.ID) (*ds.Page, error) {
_, span := r.tracer.Start(ctx, "GetPageByID")
Expand Down
10 changes: 9 additions & 1 deletion app/service/page_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,22 @@ import (
"github.com/gopl-dev/server/email"
)

// GetPageByPublicID retrieves a page by its public identifier.
// GetPageByPublicID retrieves a page by its public ID.
func (s *Service) GetPageByPublicID(ctx context.Context, id string) (*ds.Page, error) {
ctx, span := s.tracer.Start(ctx, "GetPageByPublicID")
defer span.End()

return s.db.GetPageByPublicID(ctx, id)
}

// GetPagesByPublicID retrieves pages by given public IDs.
func (s *Service) GetPagesByPublicID(ctx context.Context, id ...string) ([]ds.Page, error) {
ctx, span := s.tracer.Start(ctx, "GetPagesByPublicID")
defer span.End()

return s.db.GetPagesByPublicID(ctx, id...)
}

// GetPageByID retrieves a page by its ID from the database.
func (s *Service) GetPageByID(ctx context.Context, id ds.ID) (*ds.Page, error) {
ctx, span := s.tracer.Start(ctx, "GetBookByID")
Expand Down
33 changes: 11 additions & 22 deletions frontend/assets/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -3590,9 +3590,6 @@
.left-0 {
left: calc(var(--spacing) * 0);
}
.left-1 {
left: calc(var(--spacing) * 1);
}
.left-1\/2 {
left: calc(1/2 * 100%);
}
Expand Down Expand Up @@ -5151,6 +5148,9 @@
.mb-4 {
margin-bottom: calc(var(--spacing) * 4);
}
.mb-5 {
margin-bottom: calc(var(--spacing) * 5);
}
.mb-10 {
margin-bottom: calc(var(--spacing) * 10);
}
Expand Down Expand Up @@ -5920,15 +5920,9 @@
.w-6 {
width: calc(var(--spacing) * 6);
}
.w-11 {
width: calc(var(--spacing) * 11);
}
.w-11\/12 {
width: calc(11/12 * 100%);
}
.w-32 {
width: calc(var(--spacing) * 32);
}
.w-40 {
width: calc(var(--spacing) * 40);
}
Expand Down Expand Up @@ -5983,10 +5977,6 @@
.border-collapse {
border-collapse: collapse;
}
.-translate-x-1 {
--tw-translate-x: calc(var(--spacing) * -1);
translate: var(--tw-translate-x) var(--tw-translate-y);
}
.-translate-x-1\/2 {
--tw-translate-x: calc(calc(1/2 * 100%) * -1);
translate: var(--tw-translate-x) var(--tw-translate-y);
Expand Down Expand Up @@ -6195,9 +6185,6 @@
.gap-8 {
gap: calc(var(--spacing) * 8);
}
.self-start {
align-self: flex-start;
}
.overflow-x-auto {
overflow-x: auto;
}
Expand Down Expand Up @@ -6628,9 +6615,6 @@
.border-info {
border-color: var(--color-info);
}
.border-neutral-content {
border-color: var(--color-neutral-content);
}
.border-neutral-content\/30 {
border-color: var(--color-neutral-content);
@supports (color: color-mix(in lab, red, red)) {
Expand Down Expand Up @@ -7043,6 +7027,9 @@
.py-2 {
padding-block: calc(var(--spacing) * 2);
}
.py-4 {
padding-block: calc(var(--spacing) * 4);
}
.py-8 {
padding-block: calc(var(--spacing) * 8);
}
Expand All @@ -7055,9 +7042,6 @@
font-size: 1.375rem;
}
}
.pt-1 {
padding-top: calc(var(--spacing) * 1);
}
.pt-6 {
padding-top: calc(var(--spacing) * 6);
}
Expand Down Expand Up @@ -8381,6 +8365,11 @@
width: auto;
}
}
.lg\:grid-cols-2 {
@media (width >= 64rem) {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
.lg\:grid-cols-4 {
@media (width >= 64rem) {
grid-template-columns: repeat(4, minmax(0, 1fr));
Expand Down
2 changes: 1 addition & 1 deletion frontend/component/form.templ
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const (
const (
LabelClass = "text-gray-900"
InputClassDefault = "input input-xl w-full"
TextareaClassDefault = "textarea textarea-xl w-full"
TextareaClassDefault = "textarea w-full"
InputClassError = "input-error"
)

Expand Down
2 changes: 1 addition & 1 deletion frontend/component/form_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/page/edit_page.templ
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ templ EditPageForm(pageID string) {
Model: "form.content",
ErrorModel: "errors.content",
Type: "textarea",
Rows: 15,
Rows: 25,
Description: "You can use Markdown.",
})
<div class="p-2">
Expand Down
2 changes: 1 addition & 1 deletion frontend/page/edit_page_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 69 additions & 8 deletions frontend/page/home.templ
Original file line number Diff line number Diff line change
@@ -1,13 +1,74 @@
package page

templ Home() {
<script>
</script>
<div id="app">hello world</div>
<div x-data="{ count: 0 }">
<button x-on:click="count++">Increment</button>

<span x-text="count"></span>
import "github.com/gopl-dev/server/frontend/component/icon"

type HomeData struct {
Title string
Data map[string]string
}

templ Home(d HomeData) {
<div class="bg-base-100 card-body">
<div class="flex items-start justify-between gap-3">
<h2 class="text-3xl">
{ d.Title }
</h2>
<a
class="btn btn-ghost btn-sm btn-circle btn-success"
title="Edit"
href="/edit-page/intro/"
>
@icon.Pencil("w-4")
</a>
</div>
<div class="prose">
@templ.Raw(d.Data["intro"])
</div>
</div>
<div class="bg-base-100 card-body">
<div class="flex items-start justify-between gap-3">
<h2 class="text-3xl">From zero to hero</h2>
<a
class="btn btn-ghost btn-sm btn-circle btn-success"
title="Edit"
href="/edit-page/getting-started/"
>
@icon.Pencil("w-4")
</a>
</div>
<div class="prose">
@templ.Raw(d.Data["getting-started"])
</div>
</div>
<div class="bg-base-100 card-body">
<div class="flex items-start justify-between gap-3">
<h2 class="text-3xl">Tools</h2>
<a
class="btn btn-ghost btn-sm btn-circle btn-success"
title="Edit"
href="/edit-page/tools/"
>
@icon.Pencil("w-4")
</a>
</div>
<div class="prose">
@templ.Raw(d.Data["tools"])
</div>
</div>
<div class="bg-base-100 card-body">
<div class="flex items-start justify-between gap-3">
<h2 class="text-3xl">Community</h2>
<a
class="btn btn-ghost btn-sm btn-circle btn-success"
title="Edit"
href="/edit-page/community/"
>
@icon.Pencil("w-4")
</a>
</div>
<div class="prose">
@templ.Raw(d.Data["community"])
</div>
</div>
}

Loading