diff options
Diffstat (limited to 'client/src/app/menu')
-rw-r--r-- | client/src/app/menu/language-chooser.component.ts | 7 | ||||
-rw-r--r-- | client/src/app/menu/menu.component.html | 28 | ||||
-rw-r--r-- | client/src/app/menu/menu.component.scss | 45 |
3 files changed, 35 insertions, 45 deletions
diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts index b42e41855..f7ae69717 100644 --- a/client/src/app/menu/language-chooser.component.ts +++ b/client/src/app/menu/language-chooser.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' |
2 | import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers' | 2 | import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { objectKeysTyped } from '@shared/core-utils' | ||
4 | import { getCompleteLocale, getShortLocale, I18N_LOCALES } from '@shared/core-utils/i18n' | 5 | import { getCompleteLocale, getShortLocale, I18N_LOCALES } from '@shared/core-utils/i18n' |
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
@@ -17,8 +18,8 @@ export class LanguageChooserComponent { | |||
17 | private modalService: NgbModal, | 18 | private modalService: NgbModal, |
18 | @Inject(LOCALE_ID) private localeId: string | 19 | @Inject(LOCALE_ID) private localeId: string |
19 | ) { | 20 | ) { |
20 | const l = Object.keys(I18N_LOCALES) | 21 | const l = objectKeysTyped(I18N_LOCALES) |
21 | .map(k => ({ id: k, label: I18N_LOCALES[k], iso: getShortLocale(k) })) | 22 | .map(k => ({ id: k, label: I18N_LOCALES[k], iso: getShortLocale(k) })) |
22 | 23 | ||
23 | this.languages = sortBy(l, 'label') | 24 | this.languages = sortBy(l, 'label') |
24 | } | 25 | } |
@@ -35,7 +36,7 @@ export class LanguageChooserComponent { | |||
35 | const english = 'English' | 36 | const english = 'English' |
36 | const locale = isOnDevLocale() ? getDevLocale() : getCompleteLocale(this.localeId) | 37 | const locale = isOnDevLocale() ? getDevLocale() : getCompleteLocale(this.localeId) |
37 | 38 | ||
38 | if (locale) return I18N_LOCALES[locale] || english | 39 | if (locale) return I18N_LOCALES[locale as keyof typeof I18N_LOCALES] || english |
39 | return english | 40 | return english |
40 | } | 41 | } |
41 | } | 42 | } |
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html index 8b90fb78b..c23bb4f5b 100644 --- a/client/src/app/menu/menu.component.html +++ b/client/src/app/menu/menu.component.html | |||
@@ -5,7 +5,7 @@ | |||
5 | <div> | 5 | <div> |
6 | <div | 6 | <div |
7 | class="logged-in-more" ngbDropdown #dropdown="ngbDropdown" placement="bottom-left auto" | 7 | class="logged-in-more" ngbDropdown #dropdown="ngbDropdown" placement="bottom-left auto" |
8 | container="body" (openChange)="onDropdownOpenChange($event)" autoClose="outside" | 8 | container="body" (openChange)="onDropdownOpenChange($event)" |
9 | > | 9 | > |
10 | <button class="border-0 text-start" ngbDropdownToggle> | 10 | <button class="border-0 text-start" ngbDropdownToggle> |
11 | <my-actor-avatar [actor]="user.account" actorType="account" size="34"></my-actor-avatar> | 11 | <my-actor-avatar [actor]="user.account" actorType="account" size="34"></my-actor-avatar> |
@@ -33,21 +33,21 @@ | |||
33 | 33 | ||
34 | <button | 34 | <button |
35 | myPluginSelector pluginSelectorId="menu-user-dropdown-language-item" | 35 | myPluginSelector pluginSelectorId="menu-user-dropdown-language-item" |
36 | ngbDropdownItem ngbDropdownToggle class="dropdown-item" (click)="openLanguageChooser()" | 36 | ngbDropdownItem class="dropdown-item" (click)="openLanguageChooser()" |
37 | > | 37 | > |
38 | <my-global-icon iconName="language" aria-hidden="true"></my-global-icon> | 38 | <my-global-icon iconName="language" aria-hidden="true"></my-global-icon> |
39 | <span i18n>Interface:</span> | 39 | <span i18n>Interface:</span> |
40 | <span class="ms-auto muted">{{ currentInterfaceLanguage }}</span> | 40 | <span class="ms-auto muted">{{ currentInterfaceLanguage }}</span> |
41 | </button> | 41 | </button> |
42 | 42 | ||
43 | <a ngbDropdownItem ngbDropdownToggle class="dropdown-item" routerLink="/my-account/settings" fragment="video-languages-subtitles" | 43 | <a ngbDropdownItem class="dropdown-item" routerLink="/my-account/settings" fragment="video-languages-subtitles" |
44 | #settingsLanguagesSubtitles (click)="onActiveLinkScrollToAnchor(settingsLanguagesSubtitles)"> | 44 | #settingsLanguagesSubtitles (click)="onActiveLinkScrollToAnchor(settingsLanguagesSubtitles)"> |
45 | <my-global-icon iconName="video-lang" aria-hidden="true"></my-global-icon> | 45 | <my-global-icon iconName="video-lang" aria-hidden="true"></my-global-icon> |
46 | <span i18n>Videos:</span> | 46 | <span i18n>Videos:</span> |
47 | <span class="ms-auto muted">{{ videoLanguages.join(', ') }}</span> | 47 | <span class="ms-auto muted">{{ videoLanguages.join(', ') }}</span> |
48 | </a> | 48 | </a> |
49 | 49 | ||
50 | <a ngbDropdownItem ngbDropdownToggle class="dropdown-item settings-sensitive" routerLink="/my-account/settings" | 50 | <a ngbDropdownItem class="dropdown-item settings-sensitive" routerLink="/my-account/settings" |
51 | fragment="video-sensitive-content-policy" #settingsSensitiveContentPolicy | 51 | fragment="video-sensitive-content-policy" #settingsSensitiveContentPolicy |
52 | (click)="onActiveLinkScrollToAnchor(settingsSensitiveContentPolicy)" | 52 | (click)="onActiveLinkScrollToAnchor(settingsSensitiveContentPolicy)" |
53 | > | 53 | > |
@@ -57,24 +57,24 @@ | |||
57 | <span class="ms-auto muted">{{ nsfwPolicy }}</span> | 57 | <span class="ms-auto muted">{{ nsfwPolicy }}</span> |
58 | </a> | 58 | </a> |
59 | 59 | ||
60 | <button ngbDropdownItem class="dropdown-item" (click)="toggleUseP2P()"> | 60 | <button class="dropdown-item" (click)="toggleUseP2P()" (mousedown)="$event.stopPropagation()" ngbDropdownItem> |
61 | <my-global-icon iconName="p2p" aria-hidden="true"></my-global-icon> | 61 | <my-global-icon iconName="p2p" aria-hidden="true"></my-global-icon> |
62 | <ng-container i18n>Help share videos</ng-container> | 62 | <ng-container i18n>Help share videos</ng-container> |
63 | 63 | ||
64 | <my-input-switch class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch> | 64 | <my-input-switch inputName="p2p-enabled" class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch> |
65 | </button> | 65 | </button> |
66 | 66 | ||
67 | <div class="dropdown-divider"></div> | 67 | <div class="dropdown-divider"></div> |
68 | 68 | ||
69 | <a *ngIf="!isInMobileView" ngbDropdownItem ngbDropdownToggle class="dropdown-item" (click)="openHotkeysCheatSheet()"> | 69 | <button *ngIf="!isInMobileView" ngbDropdownItem class="dropdown-item" (click)="openHotkeysCheatSheet()"> |
70 | <my-global-icon iconName="command" aria-hidden="true"></my-global-icon> | 70 | <my-global-icon iconName="command" aria-hidden="true"></my-global-icon> |
71 | <ng-container i18n>Keyboard shortcuts</ng-container> | 71 | <ng-container i18n>Keyboard shortcuts</ng-container> |
72 | </a> | 72 | </button> |
73 | 73 | ||
74 | <a ngbDropdownItem ngbDropdownToggle (click)="logout($event)" class="dropdown-item" href="#"> | 74 | <button ngbDropdownItem (click)="logout($event)" class="dropdown-item"> |
75 | <my-global-icon iconName="sign-out" aria-hidden="true"></my-global-icon> | 75 | <my-global-icon iconName="sign-out" aria-hidden="true"></my-global-icon> |
76 | <ng-container i18n>Log out</ng-container> | 76 | <ng-container i18n>Log out</ng-container> |
77 | </a> | 77 | </button> |
78 | </div> | 78 | </div> |
79 | </div> | 79 | </div> |
80 | 80 | ||
@@ -121,10 +121,10 @@ | |||
121 | 121 | ||
122 | <div class="footer"> | 122 | <div class="footer"> |
123 | <div class="footer-block"> | 123 | <div class="footer-block"> |
124 | <a *ngIf="!isLoggedIn" class="menu-link" (click)="openQuickSettings()"> | 124 | <button *ngIf="!isLoggedIn" class="menu-link button-unstyle" (click)="openQuickSettings()"> |
125 | <my-global-icon iconName="cog" aria-hidden="true"></my-global-icon> | 125 | <my-global-icon iconName="cog" aria-hidden="true"></my-global-icon> |
126 | <ng-container i18n>My settings</ng-container> | 126 | <ng-container i18n>My settings</ng-container> |
127 | </a> | 127 | </button> |
128 | 128 | ||
129 | <a class="menu-link" routerLink="/about" routerLinkActive="active"> | 129 | <a class="menu-link" routerLink="/about" routerLinkActive="active"> |
130 | <my-global-icon iconName="help" aria-hidden="true"></my-global-icon> | 130 | <my-global-icon iconName="help" aria-hidden="true"></my-global-icon> |
@@ -135,7 +135,7 @@ | |||
135 | <div class="footer-bottom"> | 135 | <div class="footer-bottom"> |
136 | 136 | ||
137 | <div class="footer-links"> | 137 | <div class="footer-links"> |
138 | <span *ngIf="isLoggedIn === false" role="button" (click)="openLanguageChooser()" class="c-hand" i18n>Interface: {{ currentInterfaceLanguage }}</span> | 138 | <button *ngIf="isLoggedIn === false" (click)="openLanguageChooser()" class="button-unstyle" i18n>Interface: {{ currentInterfaceLanguage }}</button> |
139 | 139 | ||
140 | <div> | 140 | <div> |
141 | <a i18n routerLink="/about/instance">Contact</a> | 141 | <a i18n routerLink="/about/instance">Contact</a> |
@@ -143,7 +143,7 @@ | |||
143 | <a i18n href="https://joinpeertube.org/faq" i18n-title title="Frequently asked questions about PeerTube" target="_blank" rel="noopener noreferrer">FAQ</a> | 143 | <a i18n href="https://joinpeertube.org/faq" i18n-title title="Frequently asked questions about PeerTube" target="_blank" rel="noopener noreferrer">FAQ</a> |
144 | <a i18n routerLink="/about/instance" fragment="statistics">Stats</a> | 144 | <a i18n routerLink="/about/instance" fragment="statistics">Stats</a> |
145 | <a i18n href="https://docs.joinpeertube.org/api/rest-reference.html" i18n-title title="API documentation" target="_blank" rel="noopener noreferrer">API</a> | 145 | <a i18n href="https://docs.joinpeertube.org/api/rest-reference.html" i18n-title title="API documentation" target="_blank" rel="noopener noreferrer">API</a> |
146 | <a role="button" (click)="openHotkeysCheatSheet()" class="c-hand" i18n>Keyboard shortcuts</a> | 146 | <button (click)="openHotkeysCheatSheet()" class="button-unstyle" i18n>Keyboard shortcuts</button> |
147 | </div> | 147 | </div> |
148 | </div> | 148 | </div> |
149 | 149 | ||
diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss index d88025c33..08d6fb900 100644 --- a/client/src/app/menu/menu.component.scss +++ b/client/src/app/menu/menu.component.scss | |||
@@ -20,6 +20,7 @@ $footer-links-base-opacity: .8; | |||
20 | word-break: break-word; | 20 | word-break: break-word; |
21 | transition: background-color .1s ease-in-out; | 21 | transition: background-color .1s ease-in-out; |
22 | line-height: $line-height-normal; | 22 | line-height: $line-height-normal; |
23 | width: 100%; | ||
23 | 24 | ||
24 | &.active { | 25 | &.active { |
25 | background-color: rgba(255, 255, 255, 0.15); | 26 | background-color: rgba(255, 255, 255, 0.15); |
@@ -113,16 +114,13 @@ my-notification { | |||
113 | .dropdown-toggle-indicator { | 114 | .dropdown-toggle-indicator { |
114 | display: inherit !important; | 115 | display: inherit !important; |
115 | } | 116 | } |
116 | |||
117 | &.dropdown-toggle { | ||
118 | max-width: 88% !important; | ||
119 | } | ||
120 | } | 117 | } |
121 | } | 118 | } |
122 | 119 | ||
123 | @include margin-left(13px); | 120 | @include margin-left(13px); |
124 | 121 | ||
125 | flex: 1; | 122 | flex: 1; |
123 | min-width: 1px; | ||
126 | border-radius: 25px; | 124 | border-radius: 25px; |
127 | transition: all .1s ease-in-out; | 125 | transition: all .1s ease-in-out; |
128 | cursor: pointer; | 126 | cursor: pointer; |
@@ -140,22 +138,24 @@ my-notification { | |||
140 | /* smartphones and touchscreens */ | 138 | /* smartphones and touchscreens */ |
141 | @media (hover: none) and (pointer: coarse) { | 139 | @media (hover: none) and (pointer: coarse) { |
142 | @include display-hints($is-mobile: true); | 140 | @include display-hints($is-mobile: true); |
141 | } | ||
143 | 142 | ||
144 | /* fill space when on mobile */ | 143 | > .dropdown-toggle { |
145 | max-width: calc(100% - 80px); | 144 | display: flex; |
146 | 145 | align-items: center; | |
147 | &.dropdown-toggle { | 146 | width: 100%; |
148 | max-width: 100%; | 147 | padding: 5px 7px; |
149 | } | ||
150 | 148 | ||
151 | .logged-in-info { | 149 | &::after { |
152 | max-width: calc(100% - 45px) !important; | 150 | // Disable bootstrap toggle |
151 | border: 0; | ||
153 | } | 152 | } |
154 | } | 153 | } |
155 | 154 | ||
156 | .dropdown-toggle-indicator { | 155 | .dropdown-toggle-indicator { |
157 | position: relative; | 156 | position: relative; |
158 | display: none; | 157 | display: none; |
158 | width: 17px; | ||
159 | 159 | ||
160 | span { | 160 | span { |
161 | position: absolute; | 161 | position: absolute; |
@@ -163,17 +163,6 @@ my-notification { | |||
163 | color: #808080; | 163 | color: #808080; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | |||
167 | .dropdown-toggle::after { | ||
168 | border: 0; | ||
169 | } | ||
170 | |||
171 | > .dropdown-toggle:first-child { | ||
172 | display: flex; | ||
173 | align-items: center; | ||
174 | width: 100%; | ||
175 | padding: 5px 25px 5px 7px; | ||
176 | } | ||
177 | } | 166 | } |
178 | 167 | ||
179 | my-actor-avatar { | 168 | my-actor-avatar { |
@@ -181,9 +170,8 @@ my-actor-avatar { | |||
181 | } | 170 | } |
182 | 171 | ||
183 | .logged-in-info { | 172 | .logged-in-info { |
184 | max-width: 105px; | 173 | flex-shrink: 1; |
185 | 174 | min-width: 1px; | |
186 | flex-grow: 1; | ||
187 | } | 175 | } |
188 | 176 | ||
189 | .logged-in-display-name, | 177 | .logged-in-display-name, |
@@ -286,7 +274,8 @@ my-actor-avatar { | |||
286 | margin-bottom: 25px; | 274 | margin-bottom: 25px; |
287 | } | 275 | } |
288 | 276 | ||
289 | a { | 277 | a, |
278 | button { | ||
290 | min-height: 40px; | 279 | min-height: 40px; |
291 | } | 280 | } |
292 | } | 281 | } |
@@ -306,7 +295,7 @@ my-actor-avatar { | |||
306 | } | 295 | } |
307 | 296 | ||
308 | a, | 297 | a, |
309 | span[role=button] { | 298 | button { |
310 | @include margin-right(8px); | 299 | @include margin-right(8px); |
311 | @include disable-default-a-behaviour; | 300 | @include disable-default-a-behaviour; |
312 | 301 | ||