19 Commits

Author SHA1 Message Date
httpjamesm
4c971f3121
Add theme support using environment variable (#145)
* Add theme support using environment variable

* Propagate theme variable to template in options.go

Propagate the `theme` variable from the environment to the template in `src/routes/options.go`

* Retrieve the `theme` variable from the environment using `os.Getenv("THEME")`
* Set the `theme` variable in the `gin.H` map when rendering the `home.html` template


---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/httpjamesm/AnonymousOverflow/pull/145?shareId=6397c9b4-9450-425c-bbbe-019425965d2b).

* Move all theme environment variable logic to a utils function

Move theme environment variable logic to a utils function and update routes to use it.

* Add `GetThemeFromEnv` function in `src/utils/theme.go` to derive the theme from environment variables and default to "auto" if not set.
* Update `src/routes/home.go` to import and use `GetThemeFromEnv` in the `GetHome` function.
* Update `src/routes/options.go` to import and use `GetThemeFromEnv` in the `ChangeOptions` function.
* Update `src/routes/question.go` to import and use `GetThemeFromEnv` in the `ViewQuestion` function.


---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/httpjamesm/AnonymousOverflow/pull/145?shareId=a0dab6f3-027c-4f6e-85fe-60e7675d0e70).

* fix: imports removed by copilot

* fix: override theme in posthome

* style: reduced repetition in themes with common vars
2024-07-25 10:50:06 -07:00
httpjamesm
e409176642
media query theme (#139)
* feat: use css media query to derive theme

* fix: rename alt for toggle images

* feat: remove no-cache middleware
2024-06-20 00:18:22 -04:00
httpjamesm
8174f2ee44
fix: remove alt from homepage logo, add "logo" alt to question header (#116)
* fix: remove alt from homepage logo, add "logo" alt to question header

* fix: set logo alt on question.html to "AnonymousOverflow home"
2024-05-05 15:23:09 -04:00
McSinyx
b568c52999
Let title hyphenate to avoid x-overflow on mobile (#113) 2024-04-25 01:12:43 -04:00
httpjamesm
10fc103fda
perf: compress codecircles into webp (#59) 2023-09-24 00:59:54 -04:00
httpjamesm
e4d429b642 fix: set action to / for conversion 2022-12-29 14:46:47 -05:00
httpjamesm
0e9677ec61 feat: success message indicator, better UX for image toggling 2022-12-29 13:52:17 -05:00
httpjamesm
3ff8e8cb96 refactor: move theme switcher to a partial 2022-12-29 13:19:08 -05:00
httpjamesm
1d12372ea5 refactor: move shared head components to a template 2022-12-29 13:17:50 -05:00
httpjamesm
7ec73f8af8 feat: image loading and theme icon on homepage, fix view button color var 2022-12-28 12:37:04 -05:00
httpjamesm
3d53fd5806 feat: import theme icons, set color vars, option cookie 2022-12-28 11:49:14 -05:00
httpjamesm
504144c94b feat: version and back button 2022-12-28 11:33:26 -05:00
httpjamesm
ba4a9155a7 feat: OG metadata and shortened desc 2022-12-28 00:58:41 -05:00
httpjamesm
607ed44ee0 fix: link github for whatever labs 2022-12-28 00:56:03 -05:00
httpjamesm
1af311a614 feat: new logo + favicon 2022-12-28 00:34:15 -05:00
httpjamesm
10946dcafb feat: change options 2022-12-28 00:08:06 -05:00
httpjamesm
e0a4b2363f feat: add stricter CSPs 2022-12-27 23:44:17 -05:00
httpjamesm
9071bc23db feat: error handling for homepage 2022-12-27 23:42:54 -05:00
httpjamesm
2ae093b43d feat: home page with URL conversion endpoint
style: mobile optimization
2022-12-27 23:39:34 -05:00