Skip to content

Commit

Permalink
[web] Display most representative country in timezone selector
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Dec 21, 2023
1 parent 2036046 commit 17d00fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions web/src/assets/styles/blocks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,14 @@ ul[data-of="agama/keymaps"] {
ul[data-of="agama/timezones"] {
li {
display: grid;
grid-template-columns: 1fr 2fr 1fr;
grid-template-columns: 1fr 2fr 1fr 1fr;

> :last-child {
grid-column: 1 / -1;
font-size: 80%;
}

> :nth-child(3) {
> :nth-child(4) {
color: var(--color-gray-dimmed);
text-align: end;
}
Expand Down
7 changes: 4 additions & 3 deletions web/src/client/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const LOCALE_PATH = "/org/opensuse/Agama1/Locale";
* @typedef {object} Timezone
* @property {string} id - Timezone id (e.g., "Atlantic/Canary").
* @property {Array<string>} parts - Name of the timezone parts (e.g., ["Atlantic", "Canary"]).
* @property {string} country - Name of the country associated to the zone or empty string (e.g., "Spain").
* @property {number} utcOffset - UTC offset.
*/

Expand Down Expand Up @@ -230,13 +231,13 @@ class L10nClient {
/**
* @private
*
* @param {[string, Array<string>]} dbusTimezone
* @param {[string, Array<string>, string]} dbusTimezone
* @returns {Timezone}
*/
buildTimezone([id, parts]) {
buildTimezone([id, parts, country]) {
const utcOffset = timezoneUTCOffset(id);

return ({ id, parts, utcOffset });
return ({ id, parts, country, utcOffset });
}

/**
Expand Down
1 change: 1 addition & 0 deletions web/src/components/l10n/TimezoneSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const TimezoneItem = ({ timezone, date }) => {
<>
<div>{part1}</div>
<div>{restParts.join('-')}</div>
<div>{timezone.country}</div>
<div>{time || ""}</div>
<div>{timezone.details}</div>
</>
Expand Down

0 comments on commit 17d00fc

Please sign in to comment.