Skip to content

Commit

Permalink
Add channels-setup alert into my-channels, my-playlist and upload page
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsible committed Aug 25, 2021
1 parent cf9dacc commit c1f29c9
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@
# Icons

* [Feather Icons](https://feathericons.com) (MIT)
* `playlist add`, `history`, `subscriptions`, `miscellaneous-services.svg` by Material UI (Apache 2.0)
* `playlist add`, `history`, `subscriptions`, `miscellaneous-services.svg`, `tip` by Material UI (Apache 2.0)
* `support` by Chocobozzz (CC-BY)
* `language` by Aaron Jin (CC-BY)
* `video-language` by Rigel Kent (CC-BY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ <h1>
<span class="badge badge-secondary">{{ totalItems }}</span>
</h1>

<my-channels-setup-message [hideLink]="true"></my-channels-setup-message>

<div class="video-channels-header d-flex justify-content-between">
<my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ <h1>
<ng-container i18n>My playlists</ng-container> <span class="badge badge-secondary">{{ pagination.totalItems }}</span>
</h1>

<my-channels-setup-message></my-channels-setup-message>

<div class="video-playlists-header d-flex justify-content-between">
<my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter>

Expand Down
2 changes: 2 additions & 0 deletions client/src/app/+videos/+video-edit/video-add.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
<ng-container *ngIf="secondStepType === 'upload'" i18n>Upload {{ videoName }}</ng-container>
</div>

<my-channels-setup-message></my-channels-setup-message>

<div ngbNav #nav="ngbNav" class="nav-tabs video-add-nav" [activeId]="activeNav" (activeIdChange)="onNavChange($event)" [ngClass]="{ 'hide-nav': !!secondStepType }">
<ng-container ngbNavItem="upload">
<a ngbNavLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const icons = {
'playlist-add': require('!!raw-loader?!../../../assets/images/misc/playlist-add.svg').default, // material ui
follower: require('!!raw-loader?!../../../assets/images/misc/account-arrow-left.svg').default, // material ui
following: require('!!raw-loader?!../../../assets/images/misc/account-arrow-right.svg').default, // material ui
tip: require('!!raw-loader?!../../../assets/images/misc/tip.svg').default, // material ui
flame: require('!!raw-loader?!../../../assets/images/misc/flame.svg').default,
local: require('!!raw-loader?!../../../assets/images/misc/local.svg').default,

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div *ngIf="hasChannelNotConfigured" class="channels-setup-message alert alert-info">
<my-global-icon iconName="tip"></my-global-icon>

<div>
<div i18n>Some of your channels are not fully set up. Make them welcoming and explicit about what you publish by adding a <strong>banner</strong>, an <strong>avatar</strong> and a <strong>description</strong>.</div>
<a *ngIf="!hideLink" class="channels-settings-link" routerLink="/my-library/video-channels" i18n>Set up my channels</a>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@use '_variables' as *;
@use '_mixins' as *;

.channels-setup-message {
display: flex;
align-items: center;
justify-content: center;

my-global-icon {
width: 32px;
align-self: flex-start;

::ng-deep {
svg {
fill: #0c5460;
}
}

&+ div {
margin-left: 10px;
text-align: center;

a.channels-settings-link {
@include peertube-button-link;
@include grey-button;

height: fit-content;
margin-top: 10px;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Component, Input, OnInit } from '@angular/core'
import { AuthService, User } from '@app/core'
import { VideoChannel } from '@app/shared/shared-main'

@Component({
selector: 'my-channels-setup-message',
templateUrl: './channels-setup-message.component.html',
styleUrls: [ './channels-setup-message.component.scss' ]
})
export class ChannelsSetupMessageComponent implements OnInit {
@Input() hideLink = false

user: User = null

constructor (
private authService: AuthService
) {}

get userInformationLoaded () {
return this.authService.userInformationLoaded
}

get hasChannelNotConfigured () {
return this.user.videoChannels
.filter((channel: VideoChannel) => (!channel.avatar || !channel.description))
.length > 0
}

ngOnInit () {
this.user = this.authService.getUser()
}
}
1 change: 1 addition & 0 deletions client/src/app/shared/shared-main/misc/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './channels-setup-message.component'
export * from './help.component'
export * from './list-overflow.component'
export * from './top-menu-dropdown.component'
Expand Down
10 changes: 9 additions & 1 deletion client/src/app/shared/shared-main/shared-main.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ import { CustomPageService } from './custom-page'
import { DateToggleComponent } from './date'
import { FeedComponent } from './feeds'
import { LoaderComponent, SmallLoaderComponent } from './loaders'
import { HelpComponent, ListOverflowComponent, SimpleSearchInputComponent, TopMenuDropdownComponent } from './misc'
import {
ChannelsSetupMessageComponent,
HelpComponent,
ListOverflowComponent,
SimpleSearchInputComponent,
TopMenuDropdownComponent
} from './misc'
import { PluginPlaceholderComponent } from './plugins'
import { ActorRedirectGuard } from './router'
import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users'
Expand Down Expand Up @@ -91,6 +97,7 @@ import { VideoChannelService } from './video-channel'
LoaderComponent,
SmallLoaderComponent,

ChannelsSetupMessageComponent,
HelpComponent,
ListOverflowComponent,
TopMenuDropdownComponent,
Expand Down Expand Up @@ -146,6 +153,7 @@ import { VideoChannelService } from './video-channel'
LoaderComponent,
SmallLoaderComponent,

ChannelsSetupMessageComponent,
HelpComponent,
ListOverflowComponent,
TopMenuDropdownComponent,
Expand Down
1 change: 1 addition & 0 deletions client/src/assets/images/misc/tip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c1f29c9

Please sign in to comment.