-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inform user to fill account profile and channels (#4352)
* Add account-setup modal when login * Add channels-setup alert into my-channels, my-playlists and upload page Co-authored-by: Ms Kimsible <[email protected]>
- Loading branch information
Showing
17 changed files
with
232 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<ng-template #modal let-hide="close"> | ||
<div class="modal-header"> | ||
<h4 i18n class="modal-title">Welcome to {{ instanceName }}, dear user!</h4> | ||
<my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hide()"></my-global-icon> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
<img class="mascot" src="/client/assets/images/mascot/happy.svg" alt="mascot"> | ||
|
||
<div i18n class="subtitle">It's time to set up your account profile!</div> | ||
|
||
<p i18n>Help moderators and other users to know <strong>who you are</strong> by:</p> | ||
|
||
<ul> | ||
<li *ngIf="!hasAccountAvatar" i18n>Uploading an <strong>avatar</strong></li> | ||
<li *ngIf="!hasAccountDescription" i18n>Writing a <strong>description</strong></li> | ||
</ul> | ||
</div> | ||
|
||
<div class="modal-footer inputs"> | ||
<input | ||
type="button" role="button" i18n-value value="Remind me later" class="peertube-button grey-button" | ||
(click)="hide()" (key.enter)="hide()" | ||
> | ||
|
||
<a i18n (click)="hide()" (key.enter)="hide()" | ||
class="peertube-button-link orange-button" routerLink="/my-account" | ||
rel="noopener noreferrer" ngbAutofocus> | ||
Set up | ||
</a> | ||
</div> | ||
|
||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@use '_mixins' as *; | ||
@use '_variables' as *; | ||
|
||
.modal-body { | ||
font-size: 15px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.mascot-fw { | ||
width: 170px; | ||
} | ||
|
||
.mascot { | ||
@include margin-right(2rem); | ||
|
||
display: block; | ||
min-width: 170px; | ||
} | ||
|
||
.subtitle { | ||
font-weight: $font-semibold; | ||
margin-bottom: 10px; | ||
font-size: 16px; | ||
} | ||
|
||
li { | ||
margin-bottom: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | ||
import { AuthService, ServerService, User } from '@app/core' | ||
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' | ||
import { HTMLServerConfig } from '@shared/models' | ||
|
||
@Component({ | ||
selector: 'my-account-setup-modal', | ||
templateUrl: './account-setup-modal.component.html', | ||
styleUrls: [ './account-setup-modal.component.scss' ] | ||
}) | ||
export class AccountSetupModalComponent implements OnInit { | ||
@ViewChild('modal', { static: true }) modal: ElementRef | ||
|
||
user: User = null | ||
ref: NgbModalRef = null | ||
|
||
private serverConfig: HTMLServerConfig | ||
|
||
constructor ( | ||
private authService: AuthService, | ||
private modalService: NgbModal, | ||
private serverService: ServerService | ||
) { } | ||
|
||
get userInformationLoaded () { | ||
return this.authService.userInformationLoaded | ||
} | ||
|
||
get instanceName () { | ||
return this.serverConfig.instance.name | ||
} | ||
|
||
get isUserRoot () { | ||
return this.user.username === 'root' | ||
} | ||
|
||
get hasAccountAvatar () { | ||
return !!this.user.account.avatar | ||
} | ||
|
||
get hasAccountDescription () { | ||
return !!this.user.account.description | ||
} | ||
|
||
ngOnInit () { | ||
this.serverConfig = this.serverService.getHTMLConfig() | ||
this.user = this.authService.getUser() | ||
|
||
this.authService.userInformationLoaded | ||
.subscribe( | ||
() => { | ||
if (this.isUserRoot) return false | ||
if (this.hasAccountAvatar && this.hasAccountDescription) return false | ||
|
||
this.show() | ||
} | ||
) | ||
} | ||
|
||
show () { | ||
if (this.ref) return false | ||
|
||
this.ref = this.modalService.open(this.modal, { | ||
centered: true, | ||
backdrop: 'static', | ||
keyboard: false, | ||
size: 'md' | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
client/src/app/shared/shared-main/misc/channels-setup-message.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
32 changes: 32 additions & 0 deletions
32
client/src/app/shared/shared-main/misc/channels-setup-message.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
client/src/app/shared/shared-main/misc/channels-setup-message.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.