* fix: 🐛 remove theme from main menu bar and move to settings pag * chore: 🤖 move toggletheme to app controller
49 lines
939 B
JavaScript
49 lines
939 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Controller, { inject as controller } from '@ember/controller';
|
|
import { inject as service } from '@ember/service';
|
|
import { action } from '@ember/object';
|
|
|
|
const THEMES = [
|
|
{
|
|
label: 'system',
|
|
value: 'system-default-theme',
|
|
},
|
|
{
|
|
label: 'light',
|
|
value: 'light',
|
|
},
|
|
{
|
|
label: 'dark',
|
|
value: 'dark',
|
|
},
|
|
];
|
|
|
|
export default class ScopesScopeProjectsSettingsIndexController extends Controller {
|
|
@controller('application') application;
|
|
// Services
|
|
|
|
@service session;
|
|
|
|
// Methods
|
|
|
|
/**
|
|
* Returns available themes
|
|
*/
|
|
get themes() {
|
|
return THEMES;
|
|
}
|
|
|
|
/**
|
|
* Calls the Application controller's toggleTheme method
|
|
* @param {string} theme - "light", "dark", or nullish (system default)
|
|
*/
|
|
@action
|
|
toggleTheme({ target: { value: theme } }) {
|
|
return this.application.toggleTheme(theme);
|
|
}
|
|
}
|