Skip to content

Commit

Permalink
refactor(core): ♻️ handle anon
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed May 15, 2024
1 parent 862fa63 commit 9efb492
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
4 changes: 3 additions & 1 deletion i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@
"citizen-feature-custom-width-name": "Width",
"citizen-feature-custom-width-standard-label": "Standard",
"citizen-feature-custom-width-wide-label": "Wide",
"citizen-feature-custom-width-full-label": "Full"
"citizen-feature-custom-width-full-label": "Full",

"citizen-user-info-text-anon": "Your IP address will be publicly visible if you make any edits."
}
3 changes: 2 additions & 1 deletion i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@
"citizen-feature-custom-width-name": "Heading label for page width",
"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}})."
"citizen-feature-custom-width-full-label": "Label for full page width. An adjective that describes \"text\" ({{msg-mw|Citizen-feature-custom-width-name}}).",
"citizen-user-info-text-anon": "Description in the user menu when user is not logged in."
}
6 changes: 6 additions & 0 deletions includes/Components/CitizenComponentUserInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ private function getUserPage(): array {
* @inheritDoc
*/
public function getTemplateData(): array {
$localizer = $this->localizer;
$data = [];

if ( $this->isRegistered ) {
Expand All @@ -162,6 +163,11 @@ public function getTemplateData(): array {
'data-user-page' => $this->getUserPage(),
'data-user-edit' => $this->getUserEditCount()
];
} else {
$data = [
'title' => $localizer->msg( 'notloggedin' ),
'text' => $localizer->msg( 'citizen-user-info-text-anon' )
];
}

return $data;
Expand Down
11 changes: 10 additions & 1 deletion resources/skins.citizen.styles/components/UserInfo.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
.citizen-userInfo {
padding: var( --space-sm ) var( --space-md );
padding: var( --space-sm ) var( --space-md ) var( --space-md );
margin-bottom: var( --space-xs );
border-bottom: 1px solid var( --border-color-base );

&-title {
font-weight: var( --font-weight-medium );

> div {
padding-top: var( --space-xs );
padding-bottom: var( --space-xs );
}
}

&-title,
#pt-userpage-2 > a {
font-size: var( --font-size-medium );
Expand Down
2 changes: 1 addition & 1 deletion skin.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"citizen-drawer-toggle",
"citizen-jumptotop",
"citizen-languages-toggle",
"citizen-usermenu-toggle",
"citizen-search-toggle",
"citizen-usermenu-toggle",
"randompage",
"search",
"sitetitle",
Expand Down
2 changes: 2 additions & 0 deletions templates/UserInfo.mustache
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<div class="citizen-userInfo">
<div class="citizen-userInfo-title">
{{#title}}<div>{{.}}</div>{{/title}}
{{#data-user-page}}{{>Menu}}{{/data-user-page}}
</div>
<div class="citizen-userInfo-text">
{{#text}}<div>{{.}}</div>{{/text}}
{{#data-user-groups}}
<ul class="citizen-userInfo-usergroups">
{{#array-list-items}}{{>MenuListItem}}{{/array-list-items}}
Expand Down

0 comments on commit 9efb492

Please sign in to comment.