import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { I18n } from '@ngx-translate/i18n-polyfill'
-import { BroadcastMessageLevel, getShortLocale, is18nPath, ServerConfig, UserRole } from '@shared/models'
+import { getShortLocale, is18nPath } from '@shared/core-utils/i18n'
+import { BroadcastMessageLevel, ServerConfig, UserRole } from '@shared/models'
import { MenuService } from './core/menu/menu.service'
-import { peertubeLocalStorage, POP_STATE_MODAL_DISMISS } from './helpers'
+import { POP_STATE_MODAL_DISMISS } from './helpers'
+import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
import { InstanceService } from './shared/shared-instance'
@Component({
peertubeLocalStorage.setItem(AppComponent.BROADCAST_MESSAGE_KEY, this.serverConfig.broadcastMessage.message)
this.broadcastMessage = null
+ this.screenService.isBroadcastMessageDisplayed = false
}
private initRouteEvents () {
const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll))
scrollEvent.subscribe(e => {
- if (e.position) {
- return this.viewportScroller.scrollToPosition(e.position)
+ // scrollToAnchor first to preserve anchor position when using history navigation
+ if (e.anchor) {
+ setTimeout(() => {
+ this.viewportScroller.scrollToAnchor(e.anchor)
+ })
+
+ return
}
- if (e.anchor) {
- return this.viewportScroller.scrollToAnchor(e.anchor)
+ if (e.position) {
+ return this.viewportScroller.scrollToPosition(e.position)
}
if (resetScroll) {
this.serverService.configReloaded
).subscribe(async config => {
this.broadcastMessage = null
+ this.screenService.isBroadcastMessageDisplayed = false
const messageConfig = config.broadcastMessage
dismissable: messageConfig.dismissable,
class: classes[messageConfig.level]
}
+
+ this.screenService.isBroadcastMessageDisplayed = true
}
})
}