From 8d3dc3a16e462eaac653b61b9881c352c179f959 Mon Sep 17 00:00:00 2001 From: Kayla Glick Date: Thu, 26 Jan 2023 23:12:58 -0500 Subject: [PATCH 1/5] temp --- ui/core/components/base_modal.ts | 7 +- ui/core/components/boolean_picker.ts | 5 +- ui/core/components/detailed_results.ts | 37 ++---- .../detailed_results/color_settings.ts | 4 - .../detailed_results/result_component.ts | 6 - .../components/detailed_results/timeline.ts | 2 +- ui/core/components/encounter_picker.ts | 6 +- ui/core/components/exporters.ts | 4 +- ui/core/components/gear_picker.ts | 11 +- ui/core/components/importers.ts | 4 +- ui/core/components/item_swap_picker.ts | 4 +- ui/core/components/list_picker.ts | 2 +- ui/core/components/log_runner.ts | 2 +- ui/core/components/popup.ts | 6 - ui/core/components/saved_data_manager.ts | 4 +- ui/core/components/settings_menu.ts | 2 +- ui/core/components/sim_title_dropdown.ts | 2 +- ui/core/components/stat_weights_action.ts | 4 +- ui/core/individual_sim_ui.ts | 3 +- ui/core/sim_ui.ts | 10 +- ui/detailed_results/index.ts | 11 +- ui/raid/raid_picker.ts | 2 +- ui/raid/raid_sim_ui.ts | 2 +- .../core/components/_detailed_results.scss | 1 - ui/scss/core/components/_gear_picker.scss | 4 +- ui/scss/core/components/_icon_picker.scss | 1 + ui/scss/core/components/_list_picker.scss | 2 +- ui/scss/core/components/_popup.scss | 2 +- .../core/components/_saved_data_manager.scss | 10 ++ ui/scss/core/components/_sim_tab.scss | 2 +- .../core/components/_sim_title_dropdown.scss | 1 + .../detailed_results/_timeline.scss | 4 - ui/scss/core/individual_sim_ui/_shared.scss | 125 +----------------- ui/scss/core/sim_ui/_header.scss | 1 - ui/scss/core/sim_ui/_main.scss | 3 - ui/scss/core/sim_ui/_shared.scss | 14 +- ui/scss/core/sim_ui/_sidebar.scss | 7 +- ui/scss/homepage/_homepage.scss | 1 - ui/scss/index.scss | 9 +- .../_bootstrap_style_overrides.scss} | 40 +++--- ui/scss/{global.scss => shared/_global.scss} | 39 +++++- .../_global_old.scss} | 12 +- ui/scss/shared/_mixins.scss | 47 +++++++ ui/scss/shared/_sim_links.scss | 4 +- .../_variables.scss} | 28 ++-- ui/scss/sims/balance_druid/_sim.scss | 12 +- ui/scss/sims/balance_druid/index.scss | 2 +- ui/scss/sims/deathknight/_sim.scss | 12 +- ui/scss/sims/deathknight/index.scss | 2 +- ui/scss/sims/detailed_results/index.scss | 11 +- ui/scss/sims/elemental_shaman/_sim.scss | 12 +- ui/scss/sims/elemental_shaman/index.scss | 2 +- ui/scss/sims/enhancement_shaman/_sim.scss | 12 +- ui/scss/sims/enhancement_shaman/index.scss | 2 +- ui/scss/sims/feral_druid/_sim.scss | 11 +- ui/scss/sims/feral_druid/index.scss | 2 +- ui/scss/sims/feral_tank_druid/_sim.scss | 11 +- ui/scss/sims/feral_tank_druid/index.scss | 2 +- ui/scss/sims/healing_priest/_sim.scss | 12 +- ui/scss/sims/healing_priest/index.scss | 2 +- ui/scss/sims/holy_paladin/_sim.scss | 12 +- ui/scss/sims/holy_paladin/index.scss | 2 +- ui/scss/sims/hunter/_sim.scss | 12 +- ui/scss/sims/hunter/index.scss | 2 +- ui/scss/sims/mage/_sim.scss | 12 +- ui/scss/sims/mage/index.scss | 2 +- ui/scss/sims/protection_paladin/_sim.scss | 12 +- ui/scss/sims/protection_paladin/index.scss | 2 +- ui/scss/sims/protection_warrior/_sim.scss | 12 +- ui/scss/sims/protection_warrior/index.scss | 2 +- ui/scss/sims/raid/_sim.scss | 10 +- ui/scss/sims/raid/index.scss | 2 +- ui/scss/sims/restoration_druid/_sim.scss | 12 +- ui/scss/sims/restoration_druid/index.scss | 2 +- ui/scss/sims/restoration_shaman/_sim.scss | 12 +- ui/scss/sims/restoration_shaman/index.scss | 2 +- ui/scss/sims/retribution_paladin/_sim.scss | 12 +- ui/scss/sims/retribution_paladin/index.scss | 2 +- ui/scss/sims/rogue/_sim.scss | 12 +- ui/scss/sims/rogue/index.scss | 2 +- ui/scss/sims/shadow_priest/_sim.scss | 12 +- ui/scss/sims/shadow_priest/index.scss | 2 +- ui/scss/sims/smite_priest/_sim.scss | 12 +- ui/scss/sims/smite_priest/index.scss | 2 +- ui/scss/sims/tank_deathknight/_sim.scss | 12 +- ui/scss/sims/tank_deathknight/index.scss | 2 +- ui/scss/sims/warlock/_sim.scss | 12 +- ui/scss/sims/warlock/index.scss | 2 +- ui/scss/sims/warrior/_sim.scss | 12 +- ui/scss/sims/warrior/index.scss | 2 +- 90 files changed, 350 insertions(+), 462 deletions(-) rename ui/scss/{bootstrap_style_overrides.scss => shared/_bootstrap_style_overrides.scss} (76%) rename ui/scss/{global.scss => shared/_global.scss} (53%) rename ui/scss/{global_old.scss => shared/_global_old.scss} (94%) create mode 100644 ui/scss/shared/_mixins.scss rename ui/scss/{variables.scss => shared/_variables.scss} (93%) diff --git a/ui/core/components/base_modal.ts b/ui/core/components/base_modal.ts index 46e8b07e6d..52deee2c6b 100644 --- a/ui/core/components/base_modal.ts +++ b/ui/core/components/base_modal.ts @@ -20,8 +20,8 @@ export class BaseModal extends Component { readonly header: HTMLElement | undefined; readonly body: HTMLElement; - constructor(cssClass: string, config: BaseModalConfig = {}) { - super(document.body, 'modal'); + constructor(parent: HTMLElement, cssClass: string, config: BaseModalConfig = {}) { + super(parent, 'modal'); this.config = {...DEFAULT_CONFIG, ...config}; this.rootElem.classList.add('fade'); @@ -69,7 +69,8 @@ export class BaseModal extends Component { this.rootElem.addEventListener('hide.bs.modal', () => { const modals = this.rootElem.parentElement?.querySelectorAll('.modal') as NodeListOf; const siblingModals = Array.from(modals).filter((e) => e != this.rootElem); - siblingModals[siblingModals.length - 1].style.zIndex = '1055'; + const modalIndex = siblingModals.length - 1 < 0 ? 0 : siblingModals.length - 1; + siblingModals[modalIndex].style.zIndex = '1055'; }); this.modal.show(); diff --git a/ui/core/components/boolean_picker.ts b/ui/core/components/boolean_picker.ts index ba965e8c6b..f83e806f87 100644 --- a/ui/core/components/boolean_picker.ts +++ b/ui/core/components/boolean_picker.ts @@ -16,10 +16,7 @@ export class BooleanPicker extends Input { constructor(parent: HTMLElement, modObject: ModObject, config: BooleanPickerConfig) { super(parent, 'boolean-picker-root', modObject, config); - this.rootElem.classList.add( - config.cssScheme ? `form-check-${config.cssScheme}` : 'form-check', - 'form-check-reverse' - ); + this.rootElem.classList.add('form-check', 'form-check-reverse'); this.inputElem = document.createElement('input'); this.inputElem.type = 'checkbox'; diff --git a/ui/core/components/detailed_results.ts b/ui/core/components/detailed_results.ts index d08ecde68f..d4d340d1fc 100644 --- a/ui/core/components/detailed_results.ts +++ b/ui/core/components/detailed_results.ts @@ -210,49 +210,39 @@ export abstract class DetailedResults extends Component { this.simUI?.sim.settingsChangeEmitter.on(async () => await this.updateSettings()); - const computedStyles = window.getComputedStyle(this.rootElem); - - const colorSettings = { - mainTextColor: computedStyles.getPropertyValue('--main-text-color'), - }; - - Chart.defaults.color = colorSettings.mainTextColor; + Chart.defaults.color = 'white'; this.resultsFilter = new ResultsFilter({ parent: this.rootElem.getElementsByClassName('results-filter')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, - colorSettings: colorSettings, }); (Array.from(this.rootElem.getElementsByClassName('topline-results')) as Array).forEach(toplineResultsDiv => { - new ToplineResults({ parent: toplineResultsDiv, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }); + new ToplineResults({ parent: toplineResultsDiv, resultsEmitter: this.resultsEmitter }); }); - const castMetrics = new CastMetricsTable({ parent: this.rootElem.getElementsByClassName('cast-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }); - const meleeMetrics = new MeleeMetricsTable({ parent: this.rootElem.getElementsByClassName('melee-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }); - const spellMetrics = new SpellMetricsTable({ parent: this.rootElem.getElementsByClassName('spell-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }); - const healingMetrics = new HealingMetricsTable({ parent: this.rootElem.getElementsByClassName('healing-spell-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }); - const resourceMetrics = new ResourceMetricsTable({ parent: this.rootElem.getElementsByClassName('resource-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }); - const playerDamageMetrics = new PlayerDamageMetricsTable({ parent: this.rootElem.getElementsByClassName('player-damage-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }, this.resultsFilter); + const castMetrics = new CastMetricsTable({ parent: this.rootElem.getElementsByClassName('cast-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter }); + const meleeMetrics = new MeleeMetricsTable({ parent: this.rootElem.getElementsByClassName('melee-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter }); + const spellMetrics = new SpellMetricsTable({ parent: this.rootElem.getElementsByClassName('spell-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter }); + const healingMetrics = new HealingMetricsTable({ parent: this.rootElem.getElementsByClassName('healing-spell-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter }); + const resourceMetrics = new ResourceMetricsTable({ parent: this.rootElem.getElementsByClassName('resource-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter }); + const playerDamageMetrics = new PlayerDamageMetricsTable({ parent: this.rootElem.getElementsByClassName('player-damage-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter }, this.resultsFilter); const buffAuraMetrics = new AuraMetricsTable({ parent: this.rootElem.getElementsByClassName('buff-aura-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, - colorSettings: colorSettings, }, false); const debuffAuraMetrics = new AuraMetricsTable({ parent: this.rootElem.getElementsByClassName('debuff-aura-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, - colorSettings: colorSettings, }, true); - const dpsHistogram = new DpsHistogram({ parent: this.rootElem.getElementsByClassName('dps-histogram')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }); + const dpsHistogram = new DpsHistogram({ parent: this.rootElem.getElementsByClassName('dps-histogram')[0] as HTMLElement, resultsEmitter: this.resultsEmitter }); - const dtpsMeleeMetrics = new DtpsMeleeMetricsTable({ parent: this.rootElem.getElementsByClassName('dtps-melee-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter, colorSettings: colorSettings }); + const dtpsMeleeMetrics = new DtpsMeleeMetricsTable({ parent: this.rootElem.getElementsByClassName('dtps-melee-metrics')[0] as HTMLElement, resultsEmitter: this.resultsEmitter }); const timeline = new Timeline({ parent: this.rootElem.getElementsByClassName('timeline')[0] as HTMLElement, cssScheme: cssScheme, resultsEmitter: this.resultsEmitter, - colorSettings: colorSettings, }); document.getElementById('timelineTabTab')?.addEventListener('click', event => timeline.render()); @@ -374,7 +364,7 @@ export class EmbeddedDetailedResults extends DetailedResults { const newTabBtn = document.createElement('div'); newTabBtn.classList.add('detailed-results-controls-div'); - newTabBtn.innerHTML = ``; + newTabBtn.innerHTML = ``; this.rootElem.prepend(newTabBtn); @@ -382,11 +372,10 @@ export class EmbeddedDetailedResults extends DetailedResults { const url = new URL(`${window.location.protocol}//${window.location.host}/${REPO_NAME}/detailed_results/index.html`); url.searchParams.append('cssScheme', simUI.cssScheme); - url.searchParams.append('mainTextColor', computedStyles.getPropertyValue('--main-text-color').trim()); - url.searchParams.append('themeColorBackground', computedStyles.getPropertyValue('--theme-color-background').trim()); - url.searchParams.append('themeColorBackgroundRaw', computedStyles.getPropertyValue('--theme-color-background-raw').trim()); + url.searchParams.append('themeBackgroundColor', computedStyles.getPropertyValue('--theme-background-color').trim()); url.searchParams.append('themeBackgroundImage', computedStyles.getPropertyValue('--theme-background-image').trim()); url.searchParams.append('themeBackgroundOpacity', computedStyles.getPropertyValue('--theme-background-opacity').trim()); + if (simUI.isIndividualSim()) { url.searchParams.append('isIndividualSim', ''); this.rootElem.classList.add('individual-sim'); diff --git a/ui/core/components/detailed_results/color_settings.ts b/ui/core/components/detailed_results/color_settings.ts index 53a479fa96..52c73b504b 100644 --- a/ui/core/components/detailed_results/color_settings.ts +++ b/ui/core/components/detailed_results/color_settings.ts @@ -1,7 +1,3 @@ -export type ColorSettings = { - mainTextColor: string, -}; - export const actionColors: Array = [ '#dd9933', '#67074e', diff --git a/ui/core/components/detailed_results/result_component.ts b/ui/core/components/detailed_results/result_component.ts index 0589468e93..30f4eba8a2 100644 --- a/ui/core/components/detailed_results/result_component.ts +++ b/ui/core/components/detailed_results/result_component.ts @@ -3,8 +3,6 @@ import { SimResult, SimResultFilter } from '../..//proto_utils/sim_result.js'; import { Component } from '../../components/component.js'; import { EventID, TypedEvent } from '../../typed_event.js'; -import { ColorSettings } from './color_settings.js'; - export interface SimResultData { eventID: EventID, result: SimResult, @@ -16,17 +14,13 @@ export interface ResultComponentConfig { rootCssClass?: string, cssScheme?: String | null, resultsEmitter: TypedEvent, - colorSettings: ColorSettings, }; export abstract class ResultComponent extends Component { - private readonly colorSettings: ColorSettings; - private lastSimResult: SimResultData | null; constructor(config: ResultComponentConfig) { super(config.parent, config.rootCssClass || ''); - this.colorSettings = config.colorSettings; this.lastSimResult = null; config.resultsEmitter.on((eventID, resultData) => { diff --git a/ui/core/components/detailed_results/timeline.ts b/ui/core/components/detailed_results/timeline.ts index a023be7311..6feeeb11b2 100644 --- a/ui/core/components/detailed_results/timeline.ts +++ b/ui/core/components/detailed_results/timeline.ts @@ -58,7 +58,7 @@ export class Timeline extends ResultComponent {
Timeline data visualizes only 1 sim iteration. -
Sim 1 Iteration
+
Sim 1 Iteration
- - + +
`; diff --git a/ui/core/components/gear_picker.ts b/ui/core/components/gear_picker.ts index 76e2b53a89..c36d587b57 100644 --- a/ui/core/components/gear_picker.ts +++ b/ui/core/components/gear_picker.ts @@ -29,6 +29,7 @@ import { makeShowMatchingGemsSelector } from './other_inputs.js'; import { Input, InputConfig } from './input.js'; import {ItemSwapGear } from '../proto_utils/gear.js' import { SimUI } from '../sim_ui.js'; +import { BaseModal } from './base_modal.js'; declare var $: any; declare var tippy: any; @@ -401,28 +402,26 @@ interface GearData { changeEvent: TypedEvent, } -class SelectorModal extends Popup { +class SelectorModal extends BaseModal { private readonly simUI: SimUI; private player: Player; private readonly tabsElem: HTMLElement; private readonly contentElem: HTMLElement; constructor(parent: HTMLElement, simUI: SimUI, player: Player, slot: ItemSlot, equippedItem: EquippedItem | null, eligibleItems: Array, eligibleEnchants: Array, gearData: GearData) { - super(parent); + super(parent, 'selector-modal', {header: false}); this.simUI = simUI; this.player = player; window.scrollTo({top: 0}); - this.rootElem.classList.add('selector-modal'); - this.rootElem.innerHTML = ` + this.body.innerHTML = `
`; - this.addCloseButton(); this.tabsElem = this.rootElem.getElementsByClassName('selector-modal-tabs')[0] as HTMLElement; this.contentElem = this.rootElem.getElementsByClassName('selector-modal-tab-content')[0] as HTMLElement; @@ -644,7 +643,7 @@ class SelectorModal extends Popup { >
- +
diff --git a/ui/core/components/importers.ts b/ui/core/components/importers.ts index 7ade26bea9..7bbb77c2a7 100644 --- a/ui/core/components/importers.ts +++ b/ui/core/components/importers.ts @@ -39,11 +39,11 @@ export abstract class Importer extends Popup {
`; if (this.includeFile) { - htmlVal += ` + htmlVal += ` ` } - htmlVal += ` + htmlVal += `
`; diff --git a/ui/core/components/item_swap_picker.ts b/ui/core/components/item_swap_picker.ts index fc66b94a7f..6d73a9a437 100644 --- a/ui/core/components/item_swap_picker.ts +++ b/ui/core/components/item_swap_picker.ts @@ -38,11 +38,11 @@ export class ItemSwapPicker extends Component { let swapButtonFragment = document.createElement('fragment'); swapButtonFragment.innerHTML = ` diff --git a/ui/core/components/list_picker.ts b/ui/core/components/list_picker.ts index 45d7935380..fd898cd1ea 100644 --- a/ui/core/components/list_picker.ts +++ b/ui/core/components/list_picker.ts @@ -41,7 +41,7 @@ export class ListPicker extends Input${config.title}` : '' }
- + `; if (this.config.titleTooltip) diff --git a/ui/core/components/log_runner.ts b/ui/core/components/log_runner.ts index 5db3188f68..024219519d 100644 --- a/ui/core/components/log_runner.ts +++ b/ui/core/components/log_runner.ts @@ -12,7 +12,7 @@ export class LogRunner extends Component { this.rootElem.appendChild(controlBar); const simButton = document.createElement('button'); - simButton.classList.add('log-runner-button', 'btn', `btn-${simUI.cssScheme}`); + simButton.classList.add('log-runner-button', 'btn'); simButton.textContent = 'Sim 1 Iteration'; controlBar.appendChild(simButton); diff --git a/ui/core/components/popup.ts b/ui/core/components/popup.ts index b44789427d..0c4136976f 100644 --- a/ui/core/components/popup.ts +++ b/ui/core/components/popup.ts @@ -4,15 +4,9 @@ import { Component } from './component.js'; declare var $: any; export class Popup extends Component { - constructor(parent: HTMLElement) { super(parent, 'popup'); - const computedStyles = window.getComputedStyle(parent); - this.rootElem.style.setProperty('--main-text-color', computedStyles.getPropertyValue('--main-text-color').trim()); - this.rootElem.style.setProperty('--theme-color-background', computedStyles.getPropertyValue('--theme-color-background').trim()); - this.rootElem.style.setProperty('--theme-color-background-raw', computedStyles.getPropertyValue('--theme-color-background-raw').trim()); - if (parent.closest('.hide-damage-metrics')) { this.rootElem.classList.add('hide-damage-metrics'); } diff --git a/ui/core/components/saved_data_manager.ts b/ui/core/components/saved_data_manager.ts index 9d49cbd455..6ba3a827be 100644 --- a/ui/core/components/saved_data_manager.ts +++ b/ui/core/components/saved_data_manager.ts @@ -92,7 +92,7 @@ export class SavedDataManager extends Component { private makeSavedData(config: SavedDataConfig): SavedData { const dataElemFragment = document.createElement('fragment'); dataElemFragment.innerHTML = ` -
+ `; @@ -212,7 +212,7 @@ export class SavedDataManager extends Component {
- +
`; diff --git a/ui/core/components/settings_menu.ts b/ui/core/components/settings_menu.ts index 02daaebd4e..728cb11730 100644 --- a/ui/core/components/settings_menu.ts +++ b/ui/core/components/settings_menu.ts @@ -36,7 +36,7 @@ export class SettingsMenu extends Popup {