Add local videos homepage
This commit is contained in:
parent
efc013bead
commit
54aad475b0
|
@ -165,7 +165,8 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
links = links.concat([
|
links = links.concat([
|
||||||
{ label: $localize`Discover`, path: '/videos/overview' },
|
{ label: $localize`Discover`, path: '/videos/overview' },
|
||||||
{ label: $localize`Browse videos`, path: '/videos/browse' }
|
{ label: $localize`Browse all videos`, path: '/videos/browse' },
|
||||||
|
{ label: $localize`Browse local videos`, path: '/videos/browse?scope=local' }
|
||||||
])
|
])
|
||||||
|
|
||||||
this.defaultLandingPageOptions = links.map(o => ({
|
this.defaultLandingPageOptions = links.map(o => ({
|
||||||
|
|
|
@ -67,7 +67,11 @@ export class RedirectService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultRoute () {
|
getDefaultRoute () {
|
||||||
return this.defaultRoute
|
return this.defaultRoute.split('?')[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
getDefaultRouteQuery () {
|
||||||
|
return this.router.parseUrl(this.defaultRoute).queryParams
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultTrendingSort () {
|
getDefaultTrendingSort () {
|
||||||
|
|
|
@ -138,11 +138,11 @@ export class HeaderComponent implements OnInit, OnDestroy {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
getDefaultRoute () {
|
getDefaultRoute () {
|
||||||
return this.redirectService.getDefaultRoute().split('?')[0]
|
return this.redirectService.getDefaultRoute()
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultRouteQuery () {
|
getDefaultRouteQuery () {
|
||||||
return this.router.parseUrl(this.redirectService.getDefaultRoute()).queryParams
|
return this.redirectService.getDefaultRouteQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
@ -54,13 +54,13 @@
|
||||||
<ul class="ul-unstyle">
|
<ul class="ul-unstyle">
|
||||||
<li *ngFor="let link of menuSection.links">
|
<li *ngFor="let link of menuSection.links">
|
||||||
@if (link.isPrimaryButton === true) {
|
@if (link.isPrimaryButton === true) {
|
||||||
<my-button class="d-block menu-button" [ngClass]="link.ngClass" theme="primary" [icon]="link.icon" [title]="link.label" [ptRouterLink]="link.path">
|
<my-button class="d-block menu-button" [ngClass]="link.ngClass" theme="primary" [icon]="link.icon" [title]="link.label" [ptRouterLink]="link.path" [ptQueryParams]="link.query">
|
||||||
@if (!collapsed) {
|
@if (!collapsed) {
|
||||||
{{ link.label }}
|
{{ link.label }}
|
||||||
}
|
}
|
||||||
</my-button>
|
</my-button>
|
||||||
} @else {
|
} @else {
|
||||||
<a class="menu-link ellipsis" [routerLink]="link.path" routerLinkActive="active" [ngClass]="link.ngClass" [title]="link.label">
|
<a class="menu-link ellipsis" [routerLink]="link.path" [queryParams]="link.query" routerLinkActive="active" [ngClass]="link.ngClass" [title]="link.label">
|
||||||
<my-global-icon *ngIf="link.icon" [iconName]="link.icon" [ngClass]="link.iconClass" aria-hidden="true"></my-global-icon>
|
<my-global-icon *ngIf="link.icon" [iconName]="link.icon" [ngClass]="link.iconClass" aria-hidden="true"></my-global-icon>
|
||||||
<span [ngClass]="{ 'visually-hidden': collapsed }">{{ link.label }}</span>
|
<span [ngClass]="{ 'visually-hidden': collapsed }">{{ link.label }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { CommonModule } from '@angular/common'
|
import { CommonModule } from '@angular/common'
|
||||||
import { Component, OnDestroy, OnInit } from '@angular/core'
|
import { Component, OnDestroy, OnInit } from '@angular/core'
|
||||||
import { RouterLink, RouterLinkActive } from '@angular/router'
|
import { Params, RouterLink, RouterLinkActive } from '@angular/router'
|
||||||
import {
|
import {
|
||||||
AuthService,
|
AuthService,
|
||||||
AuthStatus,
|
AuthStatus,
|
||||||
|
@ -14,7 +14,7 @@ import {
|
||||||
import { GlobalIconComponent, GlobalIconName } from '@app/shared/shared-icons/global-icon.component'
|
import { GlobalIconComponent, GlobalIconName } from '@app/shared/shared-icons/global-icon.component'
|
||||||
import { ButtonComponent } from '@app/shared/shared-main/buttons/button.component'
|
import { ButtonComponent } from '@app/shared/shared-main/buttons/button.component'
|
||||||
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { ServerConfig, UserRight } from '@peertube/peertube-models'
|
import { UserRight } from '@peertube/peertube-models'
|
||||||
import debug from 'debug'
|
import debug from 'debug'
|
||||||
import { of, Subscription } from 'rxjs'
|
import { of, Subscription } from 'rxjs'
|
||||||
import { first, map, switchMap } from 'rxjs/operators'
|
import { first, map, switchMap } from 'rxjs/operators'
|
||||||
|
@ -26,6 +26,7 @@ type MenuLink = {
|
||||||
label: string
|
label: string
|
||||||
|
|
||||||
path: string
|
path: string
|
||||||
|
query?: Params
|
||||||
|
|
||||||
isPrimaryButton?: boolean // default false
|
isPrimaryButton?: boolean // default false
|
||||||
|
|
||||||
|
@ -61,8 +62,6 @@ export class MenuComponent implements OnInit, OnDestroy {
|
||||||
private user: AuthUser
|
private user: AuthUser
|
||||||
private canSeeVideoMakerBlock: boolean
|
private canSeeVideoMakerBlock: boolean
|
||||||
|
|
||||||
private serverConfig: ServerConfig
|
|
||||||
|
|
||||||
private authSub: Subscription
|
private authSub: Subscription
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
|
@ -100,9 +99,6 @@ export class MenuComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
this.onUserStateChange()
|
this.onUserStateChange()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.serverService.getConfig()
|
|
||||||
.subscribe(config => this.serverConfig = config)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy () {
|
ngOnDestroy () {
|
||||||
|
@ -130,12 +126,13 @@ export class MenuComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildQuickLinks (): MenuSection {
|
private buildQuickLinks (): MenuSection {
|
||||||
const base = {
|
const base: MenuSection = {
|
||||||
key: 'quick-access',
|
key: 'quick-access',
|
||||||
title: $localize`Quick access`,
|
title: $localize`Quick access`,
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
path: this.redirectService.getDefaultRoute(),
|
path: this.redirectService.getDefaultRoute(),
|
||||||
|
query: this.redirectService.getDefaultRouteQuery(),
|
||||||
icon: 'home' as GlobalIconName,
|
icon: 'home' as GlobalIconName,
|
||||||
label: $localize`Home`
|
label: $localize`Home`
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
: []
|
: []
|
||||||
|
|
||||||
this.filters = new VideoFilters(this.defaultSort, this.defaultScope, hiddenFilters)
|
this.filters = new VideoFilters(this.defaultSort, this.defaultScope, hiddenFilters)
|
||||||
this.filters.load({ ...this.route.snapshot.queryParams, scope: this.defaultScope })
|
this.filters.load({ scope: this.defaultScope, ...this.route.snapshot.queryParams })
|
||||||
|
|
||||||
this.groupedDateLabels = {
|
this.groupedDateLabels = {
|
||||||
[GroupDate.UNKNOWN]: null,
|
[GroupDate.UNKNOWN]: null,
|
||||||
|
|
Loading…
Reference in New Issue