Added theme setting
This commit is contained in:
parent
7c9d1c3c31
commit
382fc804d1
@ -28,7 +28,7 @@ component Layout(app *aero.Application, ctx *aero.Context, user *arn.User, openG
|
|||||||
LoadingAnimation
|
LoadingAnimation
|
||||||
StatusMessage
|
StatusMessage
|
||||||
if user != nil
|
if user != nil
|
||||||
#user(data-id=user.ID)
|
#user(data-id=user.ID, data-theme=user.Settings().Theme)
|
||||||
script(src="/scripts")
|
script(src="/scripts")
|
||||||
|
|
||||||
component Content(content string)
|
component Content(content string)
|
||||||
|
@ -121,6 +121,12 @@ component SettingsFormatting(user *arn.User)
|
|||||||
Icon("font")
|
Icon("font")
|
||||||
span Formatting
|
span Formatting
|
||||||
|
|
||||||
|
.widget-section
|
||||||
|
label(for="Theme")= "Theme:"
|
||||||
|
select.widget-ui-element.action(id="Theme", data-field="Theme", value=user.Settings().Theme, title="Language of anime titles", data-action="save", data-trigger="change")
|
||||||
|
option(value="light") Light
|
||||||
|
option(value="dark") Dark
|
||||||
|
|
||||||
.widget-section
|
.widget-section
|
||||||
label(for="TitleLanguage")= "Title language:"
|
label(for="TitleLanguage")= "Title language:"
|
||||||
select.widget-ui-element.action(id="TitleLanguage", data-field="TitleLanguage", value=user.Settings().TitleLanguage, title="Language of anime titles", data-action="save", data-trigger="change")
|
select.widget-ui-element.action(id="TitleLanguage", data-field="TitleLanguage", value=user.Settings().TitleLanguage, title="Language of anime titles", data-action="save", data-trigger="change")
|
||||||
|
@ -14,6 +14,7 @@ var items = []*arn.Item{
|
|||||||
Includes:
|
Includes:
|
||||||
|
|
||||||
* Chrome extension for quick list access
|
* Chrome extension for quick list access
|
||||||
|
* Dark theme for the site (persistent)
|
||||||
* Special highlight on the forums
|
* Special highlight on the forums
|
||||||
* Access to the VIP channel on Discord
|
* Access to the VIP channel on Discord
|
||||||
* PRO star on your profile
|
* PRO star on your profile
|
||||||
@ -35,6 +36,7 @@ Includes:
|
|||||||
Includes:
|
Includes:
|
||||||
|
|
||||||
* Chrome extension for quick list access
|
* Chrome extension for quick list access
|
||||||
|
* Dark theme for the site (persistent)
|
||||||
* Special highlight on the forums
|
* Special highlight on the forums
|
||||||
* Access to the VIP channel on Discord
|
* Access to the VIP channel on Discord
|
||||||
* PRO star on your profile
|
* PRO star on your profile
|
||||||
@ -56,6 +58,7 @@ Includes:
|
|||||||
Includes:
|
Includes:
|
||||||
|
|
||||||
* Chrome extension for quick list access
|
* Chrome extension for quick list access
|
||||||
|
* Dark theme for the site (persistent)
|
||||||
* Special highlight on the forums
|
* Special highlight on the forums
|
||||||
* Access to the VIP channel on Discord
|
* Access to the VIP channel on Discord
|
||||||
* PRO star on your profile
|
* PRO star on your profile
|
||||||
@ -77,6 +80,7 @@ Includes:
|
|||||||
Includes:
|
Includes:
|
||||||
|
|
||||||
* Chrome extension for quick list access
|
* Chrome extension for quick list access
|
||||||
|
* Dark theme for the site (persistent)
|
||||||
* Special highlight on the forums
|
* Special highlight on the forums
|
||||||
* Access to the VIP channel on Discord
|
* Access to the VIP channel on Discord
|
||||||
* PRO star on your profile
|
* PRO star on your profile
|
||||||
|
21
patches/add-theme/add-theme.go
Normal file
21
patches/add-theme/add-theme.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
defer arn.Node.Close()
|
||||||
|
|
||||||
|
for user := range arn.StreamUsers() {
|
||||||
|
settings := user.Settings()
|
||||||
|
|
||||||
|
if user.IsPro() {
|
||||||
|
settings.Theme = "dark"
|
||||||
|
} else {
|
||||||
|
settings.Theme = "light"
|
||||||
|
}
|
||||||
|
|
||||||
|
settings.Save()
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ import { ServiceWorkerManager } from "./ServiceWorkerManager"
|
|||||||
import { displayAiringDate, displayDate } from "./DateView"
|
import { displayAiringDate, displayDate } from "./DateView"
|
||||||
import { findAll, delay, canUseWebP, swapElements } from "./Utils"
|
import { findAll, delay, canUseWebP, swapElements } from "./Utils"
|
||||||
import * as actions from "./Actions"
|
import * as actions from "./Actions"
|
||||||
|
import { darkTheme } from "./Actions";
|
||||||
|
|
||||||
export class AnimeNotifier {
|
export class AnimeNotifier {
|
||||||
app: Application
|
app: Application
|
||||||
@ -115,6 +116,11 @@ export class AnimeNotifier {
|
|||||||
this.app.content = this.app.find("content")
|
this.app.content = this.app.find("content")
|
||||||
this.app.loading = this.app.find("loading")
|
this.app.loading = this.app.find("loading")
|
||||||
|
|
||||||
|
// Theme
|
||||||
|
if(this.user.dataset.theme !== "light") {
|
||||||
|
darkTheme()
|
||||||
|
}
|
||||||
|
|
||||||
// Status message
|
// Status message
|
||||||
this.statusMessage = new StatusMessage(
|
this.statusMessage = new StatusMessage(
|
||||||
this.app.find("status-message"),
|
this.app.find("status-message"),
|
||||||
|
Loading…
Reference in New Issue
Block a user