diff --git a/client/public/stylesheets/olympus.css b/client/public/stylesheets/olympus.css index e300f89f..3c8e0805 100644 --- a/client/public/stylesheets/olympus.css +++ b/client/public/stylesheets/olympus.css @@ -3,7 +3,11 @@ --active-coalition-color: var(--blue-coalition-color); --background-color-dark: #202831; --background-color-light: #AAA; + --border-radius-sm:5px; + --border-radius-md:10px; + --border-radius-lg:15px; --blue-coalition-color: #247be2; + --font-weight-bolder:600; --highlight-color: #FFF5; --neutral-coalition-color: whitesmoke; --neutral-coalition-text: #202831; @@ -25,6 +29,29 @@ html { } +button { + background-color:var(--background-color-dark); + border:1px solid var( --background-color-dark ); + border-radius: var( --border-radius-sm ); + color:whitesmoke; + cursor:pointer; + font-weight: var( --font-weight-bolder ); + padding:8px; +} + +button[disabled="disabled"] { + color: var( --highlight-color ); + cursor:not-allowed; +} + + +.pill { + border-radius: var( --border-radius-sm ); + display:inline-block; + padding:6px; +} + + .ol-panel { background-color: var(--background-color-dark); @@ -39,17 +66,17 @@ html { .ol-panel-list { + border-radius: var( --border-radius-sm ); display: flex; flex-direction: column; height: fit-content; row-gap: 5px; text-align: center; width: fit-content; - border-radius: 5px; } .ol-panel-list .list-item { - border-radius: 10px; + border-radius: var( --border-radius-md ); display:flex; justify-content: space-between; padding: 6px 10px; @@ -72,21 +99,33 @@ html { } -.ol-panel-info { +.ol-panel-board { display:flex; flex-direction: row; justify-content: space-evenly; } -.ol-panel-info > .panel-section { +.ol-panel-board > .panel-section { border-right: 1px solid #555; padding:10px; } -.ol-panel-info > .panel-section:last-of-type { +.ol-panel-board > .panel-section:last-of-type { border-right-width: 0; } +.ol-panel-board h1, .ol-panel-board h2 { + font-size:18px; + font-weight: var( --font-weight-bolder ); + margin: 0; + padding:0 0 5px 0; +} + +.ol-panel-board h2 { + font-size:14px; +} + + .highlight-primary { background-color: var(--highlight-color); diff --git a/client/public/uikit.html b/client/public/uikit.html index c8620198..24aa6f26 100644 --- a/client/public/uikit.html +++ b/client/public/uikit.html @@ -55,6 +55,30 @@ + + +
Buttons
+
+ +
+ +
Buttons
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
.ol-panel
@@ -144,22 +168,24 @@
-
.ol-panel > .ol-panel-info
+
Panel board
-
+
- Info panel number 1 +

Unit Callsign

+
Airframe
+
Group
- Info panel number 2 +

Flight data

- Info panel number 3 +

Loadout

@@ -172,6 +198,7 @@
+ diff --git a/client/src/FeatureSwitches.ts b/client/src/FeatureSwitches.ts index 6cf723d0..a39b8530 100644 --- a/client/src/FeatureSwitches.ts +++ b/client/src/FeatureSwitches.ts @@ -1,6 +1,7 @@ export interface FeatureSwitchInterface { - "enabled": boolean, + "defaultEnabled": boolean, // default on/off state (if allowed by masterSwitch) "label": string, + "masterSwitch": boolean, // on/off regardless of user preference "name": string, "options"?: object, "removeArtifactsIfDisabled"?: boolean @@ -8,22 +9,46 @@ export interface FeatureSwitchInterface { class FeatureSwitch { - enabled; + + // From config param + defaultEnabled; label; + masterSwitch; name; removeArtifactsIfDisabled = true; + // Self-set + userPreference; + + constructor( config:FeatureSwitchInterface ) { - this.enabled = config.enabled; - this.label = config.label; - this.name = config.name; + this.defaultEnabled = config.defaultEnabled; + this.label = config.label; + this.masterSwitch = config.masterSwitch; + this.name = config.name; + + this.userPreference = this.getUserPreference(); + + } + + + getUserPreference() { + + let preferences = JSON.parse( localStorage.getItem( "featureSwitches" ) || "{}" ); + + return ( preferences.hasOwnProperty( this.name ) ) ? preferences[ this.name ] : this.defaultEnabled; } isEnabled() { - return this.enabled; + + if ( !this.masterSwitch ) { + return false; + } + + return this.userPreference; } } @@ -33,18 +58,25 @@ export class FeatureSwitches { #featureSwitches:FeatureSwitch[] = [ new FeatureSwitch({ - "enabled": false, + "defaultEnabled": false, "label": "AIC", + "masterSwitch": true, "name": "aic" }), new FeatureSwitch({ - "enabled": false, + "defaultEnabled": false, + "label": "AI Formations", + "masterSwitch": true, + "name": "ai-formations", + "removeArtifactsIfDisabled": false + }), + + new FeatureSwitch({ + "defaultEnabled": false, "label": "ATC", - "name": "atc", - "options": { - "key": "value" - } + "masterSwitch": true, + "name": "atc" }) ]; @@ -54,6 +86,8 @@ export class FeatureSwitches { this.#removeArtifacts(); + this.savePreferences(); + } @@ -67,11 +101,34 @@ export class FeatureSwitches { #removeArtifacts() { for ( const featureSwitch of this.#featureSwitches ) { - if ( !featureSwitch.isEnabled() && featureSwitch.removeArtifactsIfDisabled !== false ) { - document.querySelectorAll( "[data-feature-switch='" + featureSwitch.name + "']" ).forEach( el => el.remove() ); + if ( !featureSwitch.isEnabled() ) { + + document.querySelectorAll( "[data-feature-switch='" + featureSwitch.name + "']" ).forEach( el => { + + if ( featureSwitch.removeArtifactsIfDisabled === false ) { + el.remove(); + } else { + el.classList.add( "hide" ); + } + + }); + } } } + + savePreferences() { + + let preferences:any = {}; + + for ( const featureSwitch of this.#featureSwitches ) { + preferences[ featureSwitch.name ] = featureSwitch.isEnabled(); + } + + localStorage.setItem( "featureSwitches", JSON.stringify( preferences ) ); + + } + } \ No newline at end of file diff --git a/client/src/index.ts b/client/src/index.ts index de4c3ae4..708986e7 100644 --- a/client/src/index.ts +++ b/client/src/index.ts @@ -146,14 +146,6 @@ function requestUpdate() { /* Main update rate = 250ms is minimum time, equal to server update time. */ setTimeout(() => requestUpdate(), getConnected() ? 250 : 1000); - setInterval( () => { - /* - gtag( "event", "heartbeat", { - - }); - //*/ - }, 60000); - connectionStatusPanel.update(getConnected()); } diff --git a/client/views/unitcontrolpanel.ejs b/client/views/unitcontrolpanel.ejs index b589f4ec..a8fa1a89 100644 --- a/client/views/unitcontrolpanel.ejs +++ b/client/views/unitcontrolpanel.ejs @@ -12,7 +12,7 @@ -
+
Create formation
Undo formation
@@ -32,8 +32,8 @@
-
Formation
-
+
Formation
+
Echelon
Fingertip
Trail