refactor(prefs): ♻️ use literal values instead of integers in clientPref features

This commit is contained in:
alistair3149 2024-04-25 17:51:46 -04:00
parent 837eb689f6
commit efe11ed410
No known key found for this signature in database
8 changed files with 30 additions and 37 deletions

View file

@ -56,12 +56,12 @@
"citizen-feature-pure-black-1-label": "On",
"citizen-feature-custom-font-size-name": "Text",
"citizen-feature-custom-font-size-0-label": "Small",
"citizen-feature-custom-font-size-1-label": "Standard",
"citizen-feature-custom-font-size-2-label": "Large",
"citizen-feature-custom-font-size-small-label": "Small",
"citizen-feature-custom-font-size-standard-label": "Standard",
"citizen-feature-custom-font-size-large-label": "Large",
"citizen-feature-custom-width-name": "Width",
"citizen-feature-custom-width-0-label": "Standard",
"citizen-feature-custom-width-1-label": "Wide",
"citizen-feature-custom-width-2-label": "Full"
"citizen-feature-custom-width-standard-label": "Standard",
"citizen-feature-custom-width-wide-label": "Wide",
"citizen-feature-custom-width-full-label": "Full"
}

View file

@ -56,11 +56,11 @@
"citizen-feature-pure-black-0-label": "Label for turning off pure black mode",
"citizen-feature-pure-black-1-label": "Label for turning on pure black mode",
"citizen-feature-custom-font-size-name": "Heading label for font size",
"citizen-feature-custom-font-size-0-label": "Label for small font size. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-font-size-name}}).",
"citizen-feature-custom-font-size-1-label": "Label for standard font size. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-font-size-name}})",
"citizen-feature-custom-font-size-2-label": "Label for large font size. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-font-size-name}}).",
"citizen-feature-custom-font-size-small-label": "Label for small font size. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-font-size-name}}).",
"citizen-feature-custom-font-size-standard-label": "Label for standard font size. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-font-size-name}})",
"citizen-feature-custom-font-size-large-label": "Label for large font size. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-font-size-name}}).",
"citizen-feature-custom-width-name": "Heading label for page width",
"citizen-feature-custom-width-0-label": "Label for standard page width. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-width-name}}).",
"citizen-feature-custom-width-1-label": "Label for wide page width. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-width-name}}).",
"citizen-feature-custom-width-2-label": "Label for full page width. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-width-name}})."
"citizen-feature-custom-width-standard-label": "Label for standard page width. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-width-name}}).",
"citizen-feature-custom-width-wide-label": "Label for wide page width. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-width-name}}).",
"citizen-feature-custom-width-full-label": "Label for full page width. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-width-name}})."
}

View file

@ -149,7 +149,7 @@ class SkinCitizen extends SkinMustache {
* @param string $feature
* @param string $value
*/
private function addClientPrefFeature( string $feature, string $value ) {
private function addClientPrefFeature( string $feature, string $value = 'standard' ) {
$this->getOutput()->addHtmlClasses( $feature . '-clientpref-' . $value );
}
@ -175,8 +175,8 @@ class SkinCitizen extends SkinMustache {
// Clientprefs feature handling
$this->addClientPrefFeature( 'citizen-feature-pure-black', '0' );
$this->addClientPrefFeature( 'citizen-feature-custom-font-size', '1' );
$this->addClientPrefFeature( 'citizen-feature-custom-width', '0' );
$this->addClientPrefFeature( 'citizen-feature-custom-font-size' );
$this->addClientPrefFeature( 'citizen-feature-custom-width' );
// Collapsible sections
// Load in content pages

View file

@ -8,11 +8,11 @@
"preferenceKey": "citizen-pure-black"
},
"citizen-feature-custom-font-size": {
"options": [ "0", "1", "2" ],
"options": [ "small", "standard", "large" ],
"preferenceKey": "citizen-font-size"
},
"citizen-feature-custom-width": {
"options": [ "0", "1", "2" ],
"options": [ "standard", "wide", "full" ],
"preferenceKey": "citizen-width"
}
}

View file

@ -142,11 +142,11 @@
.citizen-client-prefs-radio__label {
font-size: var( --font-size-medium );
&[ for='skin-client-pref-citizen-feature-custom-font-size-value-0' ] {
&[ for='skin-client-pref-citizen-feature-custom-font-size-value-small' ] {
font-size: var( --font-size-small );
}
&[ for='skin-client-pref-citizen-feature-custom-font-size-value-2' ] {
&[ for='skin-client-pref-citizen-feature-custom-font-size-value-large' ] {
font-size: var( --font-size-large );
}
}

View file

@ -1,12 +1,5 @@
{{!
string msg-preferences
string msg-theme-label
string msg-prefs-citizen-theme-option-auto
string msg-prefs-citizen-theme-option-light
string msg-prefs-citizen-theme-option-dark
string msg-prefs-citizen-fontsize-label
string msg-prefs-citizen-pagewidth-label
string msg-prefs-citizen-resetbutton-label
}}
<aside id="citizen-pref-panel" class="citizen-pref-panel">

View file

@ -78,31 +78,31 @@
}
}
.citizen-feature-custom-font-size-clientpref-0 {
.citizen-feature-custom-font-size-clientpref-small {
.citizen-body {
font-size: var( --font-size-small );
}
}
.citizen-feature-custom-font-size-clientpref-2 {
.citizen-feature-custom-font-size-clientpref-large {
.citizen-body {
font-size: var( --font-size-large );
}
}
.citizen-feature-custom-width-clientpref-0 {
.citizen-feature-custom-width-clientpref-standard {
:root& {
--width-layout: 1080px;
}
}
.citizen-feature-custom-width-clientpref-1 {
.citizen-feature-custom-width-clientpref-wide {
:root& {
--width-layout: 1600px;
}
}
.citizen-feature-custom-width-clientpref-2 {
.citizen-feature-custom-width-clientpref-full {
:root& {
--width-layout: 100vw;
}

View file

@ -243,13 +243,13 @@
"citizen-feature-pure-black-0-label",
"citizen-feature-pure-black-1-label",
"citizen-feature-custom-font-size-name",
"citizen-feature-custom-font-size-0-label",
"citizen-feature-custom-font-size-1-label",
"citizen-feature-custom-font-size-2-label",
"citizen-feature-custom-font-size-small-label",
"citizen-feature-custom-font-size-standard-label",
"citizen-feature-custom-font-size-large-label",
"citizen-feature-custom-width-name",
"citizen-feature-custom-width-0-label",
"citizen-feature-custom-width-1-label",
"citizen-feature-custom-width-2-label"
"citizen-feature-custom-width-standard-label",
"citizen-feature-custom-width-wide-label",
"citizen-feature-custom-width-full-label"
],
"dependencies": [
"mediawiki.storage",