From f706709c3422ea92cc78a5b307421c5d7fe9cb08 Mon Sep 17 00:00:00 2001 From: Asaf Gartner Date: Thu, 4 Jul 2024 05:22:50 +0300 Subject: [PATCH] Removed whenisit --- src/hmnurl/hmnurl_test.go | 4 - src/hmnurl/urls.go | 7 -- src/templates/src/whenisit.html | 138 -------------------------- src/templates/src/whenisit_setup.html | 65 ------------ src/website/routes.go | 1 - src/website/whenisit.go | 67 ------------- todo-styles.md | 2 +- 7 files changed, 1 insertion(+), 283 deletions(-) delete mode 100644 src/templates/src/whenisit.html delete mode 100644 src/templates/src/whenisit_setup.html delete mode 100644 src/website/whenisit.go diff --git a/src/hmnurl/hmnurl_test.go b/src/hmnurl/hmnurl_test.go index 7b451f08..f8acb314 100644 --- a/src/hmnurl/hmnurl_test.go +++ b/src/hmnurl/hmnurl_test.go @@ -40,10 +40,6 @@ func TestHomepage(t *testing.T) { AssertSubdomain(t, hero.BuildHomepage(), "hero") } -func TestWhenIsIt(t *testing.T) { - AssertRegexMatch(t, BuildWhenIsIt(), RegexWhenIsIt, nil) -} - func TestAtomFeed(t *testing.T) { AssertRegexMatch(t, BuildAtomFeed(), RegexAtomFeed, nil) AssertRegexMatch(t, BuildAtomFeedForProjects(), RegexAtomFeed, map[string]string{"feedtype": "projects"}) diff --git a/src/hmnurl/urls.go b/src/hmnurl/urls.go index 0dfeb0e9..d3bc00d7 100644 --- a/src/hmnurl/urls.go +++ b/src/hmnurl/urls.go @@ -28,13 +28,6 @@ func (c *UrlContext) BuildHomepage() string { return c.Url("/", nil) } -var RegexWhenIsIt = regexp.MustCompile("^/whenisit$") - -func BuildWhenIsIt() string { - defer CatchPanic() - return Url("/whenisit", nil) -} - var RegexJamsIndex = regexp.MustCompile("^/jams$") func BuildJamsIndex() string { diff --git a/src/templates/src/whenisit.html b/src/templates/src/whenisit.html deleted file mode 100644 index b93be77e..00000000 --- a/src/templates/src/whenisit.html +++ /dev/null @@ -1,138 +0,0 @@ -{{ template "base.html" . }} - -{{ define "extrahead" }} - -{{ end }} - -{{ define "content" }} -
-

- -

-

-

-

ago

-
-
- -{{ end }} diff --git a/src/templates/src/whenisit_setup.html b/src/templates/src/whenisit_setup.html deleted file mode 100644 index f4d8b05c..00000000 --- a/src/templates/src/whenisit_setup.html +++ /dev/null @@ -1,65 +0,0 @@ -{{ template "base.html" . }} - -{{ define "extrahead" }} - -{{ end }} - -{{ define "content" }} -
-

Make a timer

-
-
-
-
- -
- -{{ end }} diff --git a/src/website/routes.go b/src/website/routes.go index 1fc8b824..bef844ec 100644 --- a/src/website/routes.go +++ b/src/website/routes.go @@ -105,7 +105,6 @@ func NewWebsiteRoutes(conn *pgxpool.Pool) http.Handler { hmnOnly.GET(hmnurl.RegexMonthlyUpdatePolicy, MonthlyUpdatePolicy) hmnOnly.GET(hmnurl.RegexProjectSubmissionGuidelines, ProjectSubmissionGuidelines) hmnOnly.GET(hmnurl.RegexConferences, Conferences) - hmnOnly.GET(hmnurl.RegexWhenIsIt, WhenIsIt) hmnOnly.GET(hmnurl.RegexJamsIndex, JamsIndex) hmnOnly.GET(hmnurl.RegexJamIndex, func(c *RequestContext) ResponseData { diff --git a/src/website/whenisit.go b/src/website/whenisit.go deleted file mode 100644 index eadf590c..00000000 --- a/src/website/whenisit.go +++ /dev/null @@ -1,67 +0,0 @@ -package website - -import ( - "fmt" - "strconv" - - "git.handmade.network/hmn/hmn/src/templates" -) - -type WhenIsItData struct { - templates.BaseData - Timestamp int - Name string - Url string -} - -func WhenIsIt(c *RequestContext) ResponseData { - timestampStr := c.Req.URL.Query().Get("t") - timestamp := 0 - hasTimestamp := false - - if timestampStr != "" { - var err error - timestamp, err = strconv.Atoi(timestampStr) - hasTimestamp = (err == nil) - } - - baseData := getBaseDataAutocrumb(c, "When is it?") - - baseData.OpenGraphItems = append(baseData.OpenGraphItems, templates.OpenGraphItem{ - Property: "og:title", - Value: baseData.Title, - }) - baseData.OpenGraphItems = append(baseData.OpenGraphItems, templates.OpenGraphItem{ - Property: "og:url", - Value: c.FullUrl(), - }) - - if hasTimestamp { - name := c.Req.URL.Query().Get("n") - url := c.Req.URL.Query().Get("u") - - if name != "" { - baseData.OpenGraphItems = append(baseData.OpenGraphItems, templates.OpenGraphItem{ - Property: "og:description", - Value: fmt.Sprintf("Find out when %s starts.", name), - }) - } - - var res ResponseData - res.MustWriteTemplate("whenisit.html", WhenIsItData{ - BaseData: baseData, - Timestamp: timestamp, - Name: name, - Url: url, - }, c.Perf) - return res - } else { - baseData.OpenGraphItems = append(baseData.OpenGraphItems, templates.OpenGraphItem{ - Property: "og:description", - Value: "A countdown timer", - }) - var res ResponseData - res.MustWriteTemplate("whenisit_setup.html", baseData, c.Perf) - return res - } -} diff --git a/todo-styles.md b/todo-styles.md index 9a4c954f..bff3a652 100644 --- a/todo-styles.md +++ b/todo-styles.md @@ -21,7 +21,7 @@ - [x] theme-color-light is used only for buttons - [x] center-layout vs. margin-center - [x] Make sure old projects look ok (background images are gone) -- [ ] Audit or delete whenisit +- [x] Audit or delete whenisit - [ ] optionbar fixes - [ ] Remove "external" styles (width, padding, etc.) - [ ] Fix options (no more "buttons")