1- import { CommonModule , Location } from '@angular/common'
1+ import { CommonModule } from '@angular/common'
22import {
33 ChangeDetectionStrategy ,
44 Component ,
@@ -8,20 +8,17 @@ import {
88 ViewChild ,
99 inject ,
1010} from '@angular/core'
11- import { Router } from '@angular/router'
1211import { marker } from '@biesbjerg/ngx-translate-extract-marker'
1312import { DatasetRecord } from '@geonetwork-ui/common/domain/model/record'
14- import { FavoriteStarComponent } from '@geonetwork-ui/feature/search'
15- import { LanguageSwitcherComponent } from '@geonetwork-ui/ui/catalog'
1613import { ButtonComponent } from '@geonetwork-ui/ui/inputs'
1714import { AnchorLinkDirective } from '@geonetwork-ui/ui/layout'
18- import { getGlobalConfig } from '@geonetwork-ui/util/app-config'
1915import { getIsMobile } from '@geonetwork-ui/util/shared'
20- import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface'
2116import { NgIcon , provideIcons , provideNgIconsConfig } from '@ng-icons/core'
2217import { iconoirMenu } from '@ng-icons/iconoir'
2318import { matArrowBack } from '@ng-icons/material-icons/baseline'
2419import { TranslateDirective } from '@ngx-translate/core'
20+ import { RecordActionsComponent } from '../record-actions/record-actions.component'
21+ import { RecordHeaderService } from '../record-header.service'
2522
2623marker ( 'record.metadata.about' )
2724marker ( 'record.metadata.capabilities' )
@@ -41,9 +38,8 @@ marker('record.metadata.userFeedbacks')
4138 CommonModule ,
4239 TranslateDirective ,
4340 ButtonComponent ,
44- LanguageSwitcherComponent ,
45- FavoriteStarComponent ,
4641 AnchorLinkDirective ,
42+ RecordActionsComponent ,
4743 ] ,
4844 viewProviders : [
4945 provideIcons ( { iconoirMenu, matArrowBack } ) ,
@@ -53,9 +49,7 @@ marker('record.metadata.userFeedbacks')
5349 ] ,
5450} )
5551export class NavigationBarComponent {
56- private router = inject ( Router )
57- private location = inject ( Location )
58- private platformServiceInterface = inject ( PlatformServiceInterface )
52+ private headerService = inject ( RecordHeaderService )
5953
6054 @Input ( ) metadata : DatasetRecord
6155 @ViewChild ( 'navBar' , { static : false } ) mobileMenuRef : ElementRef
@@ -90,13 +84,8 @@ export class NavigationBarComponent {
9084 label : 'record.metadata.userFeedbacks' ,
9185 } ,
9286 ]
93- showLanguageSwitcher = getGlobalConfig ( ) . LANGUAGES ?. length > 0
9487 isMobile$ = getIsMobile ( )
9588
96- get isAuthDisabled ( ) : boolean {
97- return ! this . platformServiceInterface . supportsAuthentication ( )
98- }
99-
10089 @HostListener ( 'window:scroll' , [ ] )
10190 onWindowScroll ( ) {
10291 this . displayMobileMenu = false
@@ -115,9 +104,8 @@ export class NavigationBarComponent {
115104 toggleMobileMenu ( ) {
116105 this . displayMobileMenu = ! this . displayMobileMenu
117106 }
107+
118108 back ( ) {
119- this . router . lastSuccessfulNavigation . previousNavigation
120- ? this . location . back ( )
121- : this . router . navigateByUrl ( '/search' )
109+ this . headerService . back ( )
122110 }
123111}
0 commit comments