Skip to content

Commit

Permalink
Inspiration page (#107)
Browse files Browse the repository at this point in the history
This PR adds a feature to present 20 random images from the database.

Closes #54
  • Loading branch information
blackfyre authored Apr 9, 2024
1 parent 391bc8c commit 70d9138
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 129 deletions.
12 changes: 12 additions & 0 deletions assets/templ/components/nav.templ
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ templ TopNav() {
<li>
<a>More</a>
<ul class="p-2">
<li>
<a
href="/inspire"
hx-get="/inspire"
>Inspiration</a>
</li>
<li>
<a
href="/pages/privacy-policy"
Expand All @@ -37,6 +43,12 @@ templ TopNav() {
<details>
<summary>More</summary>
<ul class="p-2">
<li>
<a
href="/inspire"
hx-get="/inspire"
>Inspiration</a>
</li>
<li>
<a
href="/pages/privacy-policy"
Expand Down
21 changes: 13 additions & 8 deletions assets/templ/error_pages/not_found.templ
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ templ NotFoundPage() {
}

templ NotFoundBlock() {
<div class="is-flex is-justify-content-center is-align-items-center">
<div class="has-text-centered">
<h1 class="is-size-1 has-text-weight-bold has-text-primary">404</h1>
<p class="is-size-5 has-text-weight-medium"><span class="has-text-danger">Opps!</span> Page not found.</p>
<p class="is-size-6 mb-4">
The page you're looking for doesn't exist.
</p>
<a href="/" hx-get="/" class="button is-primary">Go Home</a>
<div class="container">
<div class="lg:px-24 lg:py-24 md:py-20 md:px-44 px-4 py-24 items-center flex justify-center flex-col-reverse lg:flex-row md:gap-28 gap-16">
<div class="xl:pt-24 w-full xl:w-1/2 relative pb-12 lg:pb-0">
<h1 class="my-2 font-bold text-2xl">
Looks like you've found the
doorway to the great nothing
</h1>
<p class="my-2">Sorry about that! Please visit our hompage to get where you need to go.</p>
<a href="/" hx-get="/" class="sm:w-full lg:w-auto my-2 btn btn-primary">Take me there!</a>
</div>
<div>
<img src="https://i.ibb.co/ck1SGFJ/Group.png"/>
</div>
</div>
</div>
}
22 changes: 13 additions & 9 deletions assets/templ/error_pages/server_fault.templ
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ templ ServerFaultPage() {
<head>
<title>500 - Server Fault</title>
</head>
@NotFoundBlock()
@ServerFaultBlock()
}
}

templ ServerFaultBlock() {
<div class="is-flex is-justify-content-center is-align-items-center">
<div class="has-text-centered">
<h1 class="is-size-1 has-text-weight-bold has-text-primary">500</h1>
<p class="is-size-5 has-text-weight-medium"><span class="has-text-danger">Opps!</span> Internal Server Error</p>
<p class="is-size-6 mb-4">
Something went wrong on our end. We are working on it. Please try again later.
</p>
<a href="/" hx-get="/" class="button is-primary">Go Home</a>
<div class="container">
<div class="lg:px-24 lg:py-24 md:py-20 md:px-44 px-4 py-24 items-center flex justify-center flex-col-reverse lg:flex-row md:gap-28 gap-16">
<div class="xl:pt-24 w-full xl:w-1/2 relative pb-12 lg:pb-0">
<h1 class="my-2 font-bold text-2xl">
Looks like you've found something that's really broken!
</h1>
<p class="my-2">Sorry about that!</p>
<p class="my-2">Please try again a couple more times to drive the point home!</p>
</div>
<div>
<img src="https://i.ibb.co/ck1SGFJ/Group.png"/>
</div>
</div>
</div>
}
25 changes: 25 additions & 0 deletions assets/templ/pages/inspire.templ
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package pages

import (
"github.com/blackfyre/wga/assets/templ/dto"
"github.com/blackfyre/wga/assets/templ/layouts"
"github.com/blackfyre/wga/assets/templ/utils"
"github.com/blackfyre/wga/assets/templ/components"
)

templ InspirePage(c dto.ImageGrid) {
@layouts.LayoutMain() {
@InspirationContent(c)
}
}

templ InspirationContent(c dto.ImageGrid) {
<head>
<title>{ utils.GetTitle(ctx) }</title>
</head>
<section class="container">
<h1 class="text-2xl mb-6">Random inspiration</h1>
<p class="mb-6">This is a random selection from the database to inspire you! If you need new inspiration, just hit refresh!</p>
@components.ImageGridComponent(c, true)
</section>
}
34 changes: 16 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/labstack/echo/v5 v5.0.0-20230722203903-ec5b858dab61
github.com/microcosm-cc/bluemonday v1.0.26
github.com/pocketbase/dbx v1.10.1
github.com/pocketbase/pocketbase v0.22.7
github.com/pocketbase/pocketbase v0.22.8
github.com/sabloger/sitemap-generator v1.3.0
github.com/spf13/cobra v1.8.0
golang.org/x/text v0.14.0
Expand All @@ -20,13 +20,13 @@ require (
require (
github.com/AlecAivazis/survey/v2 v2.3.7 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go v1.51.13 // indirect
github.com/aws/aws-sdk-go v1.51.17 // indirect
github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.10 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.10 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.11 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.14 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
Expand All @@ -36,7 +36,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
Expand All @@ -52,7 +52,6 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
Expand All @@ -71,26 +70,25 @@ require (
github.com/valyala/fasttemplate v1.2.2 // indirect
go.opencensus.io v0.24.0 // indirect
gocloud.dev v0.37.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.19.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/api v0.172.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect
modernc.org/libc v1.49.0 // indirect
modernc.org/libc v1.49.3 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.7.2 // indirect
modernc.org/sqlite v1.29.5 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.29.6 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)
Loading

0 comments on commit 70d9138

Please sign in to comment.