From 2741562ddac7046ea0ef0098a7874e8e3ac14e43 Mon Sep 17 00:00:00 2001 From: Will Bicks Date: Sun, 18 Dec 2022 14:51:27 -0500 Subject: [PATCH] Add dark theme (#6) --- README.md | 2 +- .../http/frontend/public/styles/app.css | 52 ++++++++ .../http/frontend/templates/base.gohtml | 7 +- .../templates/components/footer.gohtml | 4 +- .../templates/views/admin_main.gohtml | 41 +++--- .../http/frontend/templates/views/home.gohtml | 12 +- .../frontend/templates/views/privacy.gohtml | 115 ++++++++++++----- .../http/frontend/templates/views/quiz.gohtml | 11 +- .../frontend/templates/views/quotes.gohtml | 117 +++++++++--------- 9 files changed, 236 insertions(+), 125 deletions(-) diff --git a/README.md b/README.md index 58a673f..39341a4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Epigram is a simple web service for communities to immortalize the enlightening, - [x] Quotes are organized in chronological order, and in sections by year. - [x] Authorization is delegated to a configurable OpenID Connect provider. - [x] Access restricted to only those who correctly answer a few questions. -- [ ] Dark mode support. +- [x] Dark mode support. - [ ] Expanded admin control functions. ## Project Status diff --git a/internal/server/http/frontend/public/styles/app.css b/internal/server/http/frontend/public/styles/app.css index 3a2afa0..9660134 100644 --- a/internal/server/http/frontend/public/styles/app.css +++ b/internal/server/http/frontend/public/styles/app.css @@ -867,6 +867,10 @@ select { --tw-border-opacity: 1; border-color: rgb(239 68 68 / var(--tw-border-opacity)); } +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} .bg-red-100 { --tw-bg-opacity: 1; background-color: rgb(254 226 226 / var(--tw-bg-opacity)); @@ -947,10 +951,58 @@ select { --tw-text-opacity: 1; color: rgb(75 85 99 / var(--tw-text-opacity)); } +.text-gray-900 { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity)); +} .antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } + +@media (prefers-color-scheme: dark) { + + .dark\:bg-black { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + + .dark\:bg-gray-900 { + --tw-bg-opacity: 1; + background-color: rgb(17 24 39 / var(--tw-bg-opacity)); + } + + .dark\:bg-gray-800 { + --tw-bg-opacity: 1; + background-color: rgb(31 41 55 / var(--tw-bg-opacity)); + } + + .dark\:text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); + } + + .dark\:text-gray-200 { + --tw-text-opacity: 1; + color: rgb(229 231 235 / var(--tw-text-opacity)); + } + + .dark\:text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); + } + + .dark\:text-gray-100 { + --tw-text-opacity: 1; + color: rgb(243 244 246 / var(--tw-text-opacity)); + } + + .dark\:text-gray-300 { + --tw-text-opacity: 1; + color: rgb(209 213 219 / var(--tw-text-opacity)); + } +} + @media (min-width: 768px) { .md\:mb-0 { diff --git a/internal/server/http/frontend/templates/base.gohtml b/internal/server/http/frontend/templates/base.gohtml index a4a8d13..bd6ecea 100644 --- a/internal/server/http/frontend/templates/base.gohtml +++ b/internal/server/http/frontend/templates/base.gohtml @@ -1,6 +1,7 @@ {{define "base"}} + @@ -8,15 +9,17 @@ {{ .Title }} - + +
{{template "body" .}}
{{template "footer" .}}
- + {{block "scripts" .}}{{end}} + {{end}} \ No newline at end of file diff --git a/internal/server/http/frontend/templates/components/footer.gohtml b/internal/server/http/frontend/templates/components/footer.gohtml index 8f69687..b3f7847 100644 --- a/internal/server/http/frontend/templates/components/footer.gohtml +++ b/internal/server/http/frontend/templates/components/footer.gohtml @@ -1,7 +1,7 @@ {{define "footer"}} -
+

- powered by + powered by Epigram   |   privacy policy diff --git a/internal/server/http/frontend/templates/views/admin_main.gohtml b/internal/server/http/frontend/templates/views/admin_main.gohtml index 72ca18a..5f3aeaa 100644 --- a/internal/server/http/frontend/templates/views/admin_main.gohtml +++ b/internal/server/http/frontend/templates/views/admin_main.gohtml @@ -1,25 +1,26 @@ {{template "base" .}} {{define "body"}} -

-

{{.Title}} | Administration

-
-
-

Users

- {{range .Page.Users}} -
- Profile Picture -
-

{{.Name}}

-

Email: {{.Email}}

-

ID: {{.ID}}

-

Joined on: {{.Created}}

-

Quiz: - {{if .QuizPassed}}Passed{{else}}Not Passed{{end}} - ({{.QuizAttempts}} attempts) -

-
-
- {{end}} +
+

{{.Title}} | Administration

+
+
+

Users

+ {{range .Page.Users}} +
+ Profile Picture +
+

{{.Name}}

+

Email: {{ .Email }}

+

ID: {{ .ID }}

+

Joined on: {{ .Created }}

+

Quiz: + {{if .QuizPassed}}Passed{{else}}Not Passed{{end}} + ({{.QuizAttempts}} attempts) +

+
+ {{end}} +
{{end}} \ No newline at end of file diff --git a/internal/server/http/frontend/templates/views/home.gohtml b/internal/server/http/frontend/templates/views/home.gohtml index c019931..f1cd09e 100644 --- a/internal/server/http/frontend/templates/views/home.gohtml +++ b/internal/server/http/frontend/templates/views/home.gohtml @@ -1,10 +1,10 @@ {{template "base" .}} {{define "body"}} -
-

đź’¬

-

Welcome to {{.Title}}!

-

{{ .Description }}

- Login -
+
+

đź’¬

+

Welcome to {{.Title}}!

+

{{ .Description }}

+ Login +
{{end}} \ No newline at end of file diff --git a/internal/server/http/frontend/templates/views/privacy.gohtml b/internal/server/http/frontend/templates/views/privacy.gohtml index 8745597..7c1c154 100644 --- a/internal/server/http/frontend/templates/views/privacy.gohtml +++ b/internal/server/http/frontend/templates/views/privacy.gohtml @@ -1,36 +1,85 @@ {{template "base" .}} {{define "body"}} -
-

đź’¬ {{.Title}} | Privacy Policy

-

Last updated: 2022-03-11

-

This Privacy Policy describes how your personal information is collected, used, and shared when you visit and interact with our website (the “Website” or "Site").

-

This Privacy Policy applies only to our online activities and is valid for visitors to our website with regards to the information we collect or they share. This policy is not applicable to any information collected offline or via channels other than this website.

-

By using our website, you hereby consent to our Privacy Policy and agree to its Terms and Conditions.

-

Personal Information We Collect

-

When you visit the Website, we automatically collect certain information about your device, including information about your web browser, IP address, time zone, and some of the cookies that are installed on your device. Additionally, as you browse the Website, we collect information about the individual web pages that you view, what websites or search terms referred you to the Website, and information about how you interact with the Website. We refer to this automatically-collected information as “Device Information.” The purpose of the information is for analyzing trends, administering the site, tracking users' movement on the website, and gathering demographic information.

-

In addition, users may opt to provide additional personal information when interacting with the website. This information may be provided directly, or by your login with a third party login provider. This information is used to identify any actions you make on the website, and may be displayed or used in conjunction with it.

-

Cookies & local storage

-

“Cookies” are data files that are placed on your device or computer and often include an anonymous unique identifier. For more information about cookies, and how to disable cookies, visit http://www.allaboutcookies.org.

-

When you use and access the Website, cookies files may be added to your web browser. We use cookies to enable certain functions of the Website, to provide analytics, and to store your preferences.

-

In addition to our own cookies, we may also use various third-parties cookies to report usage statistics of the Website.

-

If you'd like to delete cookies and local storage items or instruct your web browser to delete or refuse cookies and local storage items, please visit the help pages of your web browser.

-

Please note, however, that if you delete cookies and local storage items or refuse to accept them, you might not be able to use all of the features we offer, the interactive applications on the Website will not function correctly, you may not be able to store your preferences, and some of our pages might not display properly.

-

Analytical Data

-

Some anonymous data regarding the usage of the Website may be collected by the Data Controller.

-

The Personal Data may be freely provided by the User, or collected automatically when using the Website. Failure to provide certain Personal Data may make it impossible for the Website to provide its services. Users are responsible for any Personal Data of third parties obtained, published or shared through the Website and confirm that they have the third party's consent to provide the Data to the Owner.

-

User Provided Data

-

Additionally, when the User uses the Website, the Data Controller collects information about the specific activities the User performs, and associates that information with information about the User. This data may be used by the Data Controller to track actions made on the website, prevent misuse, and attribute User provided data to the User.

-

Processing of Your Information

-

We use the Device Information that we collect to help us screen for errors and fraud (in particular, your IP address), and more generally to improve and optimize our Site.

-

The Data Controller processes the Data of Users in a proper manner and shall take appropriate security measures to prevent unauthorized access, disclosure, modification, or unauthorized destruction of the Data. The Data processing is carried out using computers and/or IT enabled tools, following organizational procedures and modes strictly related to the purposes indicated. In addition to the Data Controller, in some cases, the Data may be accessible to certain types of persons in charge, involved with the operation of the site (administration, sales, marketing, legal, system administration) or external parties (such as third party technical service providers, mail carriers, hosting providers, IT companies, communications agencies) appointed, if necessary, as Data Processors by the Owner. The updated list of these parties may be requested from the Data Controller at any time.

-

The Data is processed at the Data Controller's operating offices, at the locations of the third parties involved with the operation of the site, and in any other places where the parties involved with the processing are located. For further information, please contact the Data Controller.

-

The Data is kept on a secure server for an indefinite amount of time in order to provide the service requested by the User, or stated by the purposes outlined in this document, and the User can always request that the Data Controller suspend or remove the data.

-

Additional Information about Data Collection and Processing

-

For operation and maintenance purposes, the Website and any third party services may collect files that record interaction with the Website (System logs) or use for this purpose other Personal Data (such as IP Address).

-

More details concerning the collection or processing of Personal Data may be requested from the Data Controller at any time.

-

Users have the right, at any time, to know whether their Personal Data has been stored and can consult the Data Controller to learn about their contents and origin, to verify their accuracy or to ask for them to be supplemented, cancelled, updated or corrected, or for their transformation into anonymous format or to block any data held in violation of the law, as well as to oppose their treatment for any and all legitimate reasons. Requests should be sent to the Data Controller at the contact information set out above.

-

The Website does not support “Do Not Track” requests. To prevent certain data from being collected by the Website, Users should install a Google Analytics opt-out browser plugin.

-

The Data Controller reserves the right to make changes to this privacy policy at any time by giving notice to its Users on this page. It is strongly recommended to check this page often, referring to the date of the last modification listed at the top. If a User objects to any of the changes to the Policy, the User must cease using the Website and can request that the Data Controller remove the Personal Data. Unless stated otherwise, the then-current privacy policy applies to all Personal Data the Data Controller has about Users.

-
-{{end}} +
+

đź’¬ {{.Title}} | Privacy Policy

+

Last updated: 2022-03-11

+

This Privacy Policy describes how your personal information is collected, used, and shared when you visit and + interact with our website (the “Website” or "Site").

+

This Privacy Policy applies only to our online activities and is valid for visitors to our website with regards + to the information we collect or they share. This policy is not applicable to any information collected offline + or via channels other than this website.

+

By using our website, you hereby consent to our Privacy Policy and agree to its Terms and Conditions.

+

Personal Information We Collect

+

When you visit the Website, we automatically collect certain information about your device, including information + about your web browser, IP address, time zone, and some of the cookies that are installed on your device. + Additionally, as you browse the Website, we collect information about the individual web pages that you view, + what websites or search terms referred you to the Website, and information about how you interact with the + Website. We refer to this automatically-collected information as “Device Information.” The purpose of the + information is for analyzing trends, administering the site, tracking users' movement on the website, and + gathering demographic information.

+

In addition, users may opt to provide additional personal information when interacting with the website. This + information may be provided directly, or by your login with a third party login provider. This information is + used to identify any actions you make on the website, and may be displayed or used in conjunction with it.

+

Cookies & local storage

+

“Cookies” are data files that are placed on your device or computer and often include an anonymous unique + identifier. For more information about cookies, and how to disable cookies, visit http://www.allaboutcookies.org.

+

When you use and access the Website, cookies files may be added to your web browser. We use cookies to enable + certain functions of the Website, to provide analytics, and to store your preferences.

+

In addition to our own cookies, we may also use various third-parties cookies to report usage statistics of the + Website.

+

If you'd like to delete cookies and local storage items or instruct your web browser to delete or refuse cookies + and local storage items, please visit the help pages of your web browser.

+

Please note, however, that if you delete cookies and local storage items or refuse to accept them, you might not + be able to use all of the features we offer, the interactive applications on the Website will not function + correctly, you may not be able to store your preferences, and some of our pages might not display properly.

+

Analytical Data

+

Some anonymous data regarding the usage of the Website may be collected by the Data Controller.

+

The Personal Data may be freely provided by the User, or collected automatically when using the Website. Failure + to provide certain Personal Data may make it impossible for the Website to provide its services. Users are + responsible for any Personal Data of third parties obtained, published or shared through the Website and confirm + that they have the third party's consent to provide the Data to the Owner.

+

User Provided Data

+

Additionally, when the User uses the Website, the Data Controller collects information about the specific + activities the User performs, and associates that information with information about the User. This data may be + used by the Data Controller to track actions made on the website, prevent misuse, and attribute User provided + data to the User.

+

Processing of Your Information

+

We use the Device Information that we collect to help us screen for errors and fraud (in particular, your IP + address), and more generally to improve and optimize our Site.

+

The Data Controller processes the Data of Users in a proper manner and shall take appropriate security measures + to prevent unauthorized access, disclosure, modification, or unauthorized destruction of the Data. The Data + processing is carried out using computers and/or IT enabled tools, following organizational procedures and modes + strictly related to the purposes indicated. In addition to the Data Controller, in some cases, the Data may be + accessible to certain types of persons in charge, involved with the operation of the site (administration, + sales, marketing, legal, system administration) or external parties (such as third party technical service + providers, mail carriers, hosting providers, IT companies, communications agencies) appointed, if necessary, as + Data Processors by the Owner. The updated list of these parties may be requested from the Data Controller at any + time.

+

The Data is processed at the Data Controller's operating offices, at the locations of the third parties involved + with the operation of the site, and in any other places where the parties involved with the processing are + located. For further information, please contact the Data Controller.

+

The Data is kept on a secure server for an indefinite amount of time in order to provide the service requested by + the User, or stated by the purposes outlined in this document, and the User can always request that the Data + Controller suspend or remove the data.

+

Additional Information about Data + Collection and Processing

+

For operation and maintenance purposes, the Website and any third party services may collect files that record + interaction with the Website (System logs) or use for this purpose other Personal Data (such as IP Address).

+

More details concerning the collection or processing of Personal Data may be requested from the Data Controller + at any time.

+

Users have the right, at any time, to know whether their Personal Data has been stored and can consult the Data + Controller to learn about their contents and origin, to verify their accuracy or to ask for them to be + supplemented, cancelled, updated or corrected, or for their transformation into anonymous format or to block any + data held in violation of the law, as well as to oppose their treatment for any and all legitimate reasons. + Requests should be sent to the Data Controller at the contact information set out above.

+

The Website does not support “Do Not Track” requests. To prevent certain data from being collected by the + Website, Users should install a Google Analytics opt-out browser plugin.

+

The Data Controller reserves the right to make changes to this privacy policy at any time by giving notice to its + Users on this page. It is strongly recommended to check this page often, referring to the date of the last + modification listed at the top. If a User objects to any of the changes to the Policy, the User must cease using + the Website and can request that the Data Controller remove the Personal Data. Unless stated otherwise, the + then-current privacy policy applies to all Personal Data the Data Controller has about Users.

+
+{{end}} \ No newline at end of file diff --git a/internal/server/http/frontend/templates/views/quiz.gohtml b/internal/server/http/frontend/templates/views/quiz.gohtml index 067712d..7f18ffc 100644 --- a/internal/server/http/frontend/templates/views/quiz.gohtml +++ b/internal/server/http/frontend/templates/views/quiz.gohtml @@ -8,7 +8,7 @@

Entrance Examination

-

In order to verify your access, please answer the following {{ .Page.NumQuestions }} +

In order to verify your access, please answer the folloiwng {{ .Page.NumQuestions }} crossword style questions.

{{ template "error" .Page.Error }} @@ -18,9 +18,12 @@ {{range .Page.Questions}} {{end}} diff --git a/internal/server/http/frontend/templates/views/quotes.gohtml b/internal/server/http/frontend/templates/views/quotes.gohtml index d44c966..1dee440 100644 --- a/internal/server/http/frontend/templates/views/quotes.gohtml +++ b/internal/server/http/frontend/templates/views/quotes.gohtml @@ -1,69 +1,72 @@ {{template "base" .}} {{define "body"}} -
-

đź’¬ {{.Title}}

-
-
- -

Submit a new quote:

+
+

đź’¬ {{.Title}}

+
+
+ +

Submit a new quote:

- {{ template "error" .Page.Error }} + {{ template "error" .Page.Error }} -
-
- - - - -
-
- -
-
- {{ $byYear := quotesByYear .Page.Quotes }} - {{ range $year := orderedYearKeys $byYear }} -

{{ $year }}

-
-
- {{ range index $byYear $year }} -
- {{with .Context}}

{{.}}

{{end}} -

{{.Quote}}

-

- {{.Quotee}}

-
- {{ end }} +
+
+ + + +
- {{end}} +
+ +
+
+ {{ $byYear := quotesByYear .Page.Quotes }} + {{ range $year := orderedYearKeys $byYear }} +

{{ $year }}

+
+
+ {{ range index $byYear $year }} +
+ {{with .Context}}

{{.}}

{{end}} +

{{.Quote}}

+

- {{.Quotee}}

+
+ {{ end }}
+ {{end}} +
{{end}} {{define "scripts"}} - - + + document.querySelectorAll('.masonry-container').forEach((ctr) => { + //macyOptions.container = ctr + macyInstances.push(Macy({ + container: ctr, + mobileFirst: true, + columns: 1, + margin: 16, + breakAt: { + 768: 2, + 1024: 3 + } + })) + }); + {{end}} \ No newline at end of file