-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: * removed `computed` usage from a glimmer component * converted the component to gjs * converted the connector to gjs and made it into a regular glimmer component (w/ service injections and a getter instead of `setupComponent`) * used `session` service injection instead of Session singleton wherever possible * moved prop initialization out of a constructor * removed a use of string-based action * simplified showInSidebar logic * converted the initializer to the new class-based paradigm (w/ service injections) * added an escape hatch (isDestroying/isDestroyed check) to a `later` call * add a matching `removeEventListener` to `window.matchMedia(…).addEventListener` * used qunit-dom in tests
- Loading branch information
Showing
7 changed files
with
132 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
javascripts/discourse/connectors/sidebar-footer-actions/toggler-button.gjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Component from "@glimmer/component"; | ||
import { service } from "@ember/service"; | ||
import ColorSchemeToggler from "../../components/color-scheme-toggler"; | ||
|
||
export default class TogglerButton extends Component { | ||
@service session; | ||
@service siteSettings; | ||
|
||
get showInSidebar() { | ||
return ( | ||
(this.session.darkModeAvailable || | ||
this.siteSettings.default_dark_mode_color_scheme_id >= 0) && | ||
!settings.add_color_scheme_toggle_to_header | ||
); | ||
} | ||
|
||
<template> | ||
{{#if this.showInSidebar}} | ||
<ColorSchemeToggler /> | ||
{{/if}} | ||
</template> | ||
} |
3 changes: 0 additions & 3 deletions
3
javascripts/discourse/connectors/sidebar-footer-actions/toggler-button.hbs
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
javascripts/discourse/connectors/sidebar-footer-actions/toggler-button.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters