]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Channel/account page redesign feedbacks
authorChocobozzz <me@florianbigard.com>
Wed, 31 Mar 2021 06:59:52 +0000 (08:59 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Wed, 31 Mar 2021 07:05:51 +0000 (09:05 +0200)
Fix owner default avatar
Semi bold orange inverted button
Max width account description
Increase account's channels padding
Use owner avatar/display name links
Move "view owner account" link on mobile
Try to always display channel in video miniatures
Add small border radius for channel's avatar
Use main foreground color for the magnifying glass

20 files changed:
client/src/app/+accounts/account-video-channels/account-video-channels.component.html
client/src/app/+accounts/account-video-channels/account-video-channels.component.scss
client/src/app/+accounts/accounts.component.html
client/src/app/+accounts/accounts.component.scss
client/src/app/+accounts/accounts.component.ts
client/src/app/+my-library/my-videos/my-videos.component.html
client/src/app/+my-library/my-videos/my-videos.component.ts
client/src/app/+video-channels/video-channels.component.html
client/src/app/+video-channels/video-channels.component.scss
client/src/app/+video-channels/video-channels.component.ts
client/src/app/+videos/video-list/video-user-subscriptions.component.ts
client/src/app/shared/shared-main/account/video-avatar-channel.component.scss
client/src/app/shared/shared-main/misc/simple-search-input.component.scss
client/src/app/shared/shared-main/video-channel/video-channel.model.ts
client/src/app/shared/shared-video-miniature/abstract-video-list.html
client/src/app/shared/shared-video-miniature/abstract-video-list.ts
client/src/app/shared/shared-video-miniature/video-miniature.component.ts
client/src/app/shared/shared-video-miniature/videos-selection.component.html
client/src/app/shared/shared-video-miniature/videos-selection.component.ts
client/src/sass/include/_mixins.scss

index 0b22e7526ab937721cda0aa4b90be668ec723b1c..19a4b3c9c4888fe0c7b38e5c1f546603b6acfe97 100644 (file)
@@ -22,7 +22,7 @@
           <div class="followers" i18n>{videoChannel.followersCount, plural, =1 {1 subscriber} other {{{ videoChannel.followersCount }} subscribers}}</div>
 
           <span class="videos-count" *ngIf="getTotalVideosOf(videoChannel) !== undefined" i18n>
-            {getTotalVideosOf(videoChannel), splural, =1 {1 videos} other {{{ getTotalVideosOf(videoChannel) }} videos}}
+            {getTotalVideosOf(videoChannel), plural, =1 {1 videos} other {{{ getTotalVideosOf(videoChannel) }} videos}}
           </span>
         </div>
 
index ca4c35cb42e6da8a822b870028859e5dbd4147b8..8f1e9deb5c8cdbec14ea841c6ab0606dc40398f8 100644 (file)
@@ -9,7 +9,7 @@
 .channel {
   max-width: $max-channels-width;
   background-color: pvar(--channelBackgroundColor);
-  padding: 15px;
+  padding: 30px;
 
   margin: 30px 0;
 
@@ -120,6 +120,10 @@ my-subscribe-button {
 }
 
 @media screen and (max-width: $mobile-view) {
+  .channel {
+    padding: 15px;
+  }
+
   .channel-avatar-row {
     grid-template-columns: auto auto auto 1fr;
 
index e149d0bc65fb325237c246164308a64aba76b54c..03d083bb688d2747984a8a973ed219f2241e3e22 100644 (file)
@@ -52,7 +52,7 @@
       <div class="created-at" i18n>Account created on {{ account.createdAt | date }}</div>
     </div>
 
-    <div *ngIf="!accountDescriptionExpanded" class="show-more" role="button"
+    <div *ngIf="hasShowMoreDescription()" class="show-more" role="button"
       (click)="accountDescriptionExpanded = !accountDescriptionExpanded"
       title="Show the complete description" i18n-title i18n
     >
index 6a51dd0384c1184714828e50fb622cf6df3076a0..80f23ba6fdbac7f0eb39fb2a8548ac06c40c7be3 100644 (file)
@@ -62,6 +62,8 @@ my-user-moderation-dropdown,
 
 .description {
   grid-column: 1 / 3;
+  max-width: 1000px;
+  word-break: break-word;
 }
 
 .created-at {
index abee0b9bbb726543f2ec29416bffe4fb6675c8eb..e80314130385adc1a3cf2764497abc4be406b94f 100644 (file)
@@ -147,6 +147,10 @@ export class AccountsComponent implements OnInit, OnDestroy {
     return this.videoChannels.length !== 0
   }
 
+  hasShowMoreDescription () {
+    return !this.accountDescriptionExpanded && this.accountDescriptionHTML.length > 100
+  }
+
   private async onAccount (account: Account) {
     this.accountFollowerTitle = $localize`${account.followersCount} direct account followers`
 
index 5fa4c02eca3ac42733cc8d08fe876f7b7d2a21fc..6e6bf12f421e10c146e6ee49ee8ef7ea9809dee2 100644 (file)
@@ -34,7 +34,6 @@
   [miniatureDisplayOptions]="miniatureDisplayOptions"
   [titlePage]="titlePage"
   [getVideosObservableFunction]="getVideosObservableFunction"
-  [ownerDisplayType]="ownerDisplayType"
   [user]="user"
   #videosSelection
 >
index 6a2a626082e2e242b0c61638a658d2aadb988525..0bc923e73216f15d2a5d62dc78cee5936e1d70b8 100644 (file)
@@ -2,12 +2,12 @@ import { concat, Observable, Subject } from 'rxjs'
 import { debounceTime, tap, toArray } from 'rxjs/operators'
 import { Component, OnInit, ViewChild } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
-import { AuthService, ComponentPagination, ConfirmService, Notifier, ScreenService, ServerService, User, UserService } from '@app/core'
+import { AuthService, ComponentPagination, ConfirmService, Notifier, ScreenService, ServerService, User } from '@app/core'
 import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
 import { immutableAssign } from '@app/helpers'
 import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
 import { LiveStreamInformationComponent } from '@app/shared/shared-video-live'
-import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature'
+import { MiniatureDisplayOptions, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature'
 import { VideoSortField } from '@shared/models'
 import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component'
 
@@ -36,7 +36,6 @@ export class MyVideosComponent implements OnInit, DisableForReuseHook {
     state: true,
     blacklistInfo: true
   }
-  ownerDisplayType: OwnerDisplayType = 'videoChannel'
 
   videoActions: DropdownAction<{ video: Video }>[] = []
 
index b9ac13f0936ddc7ad82d76acc1d1daa184685cbc..87e1b294bf3342df6502057f241b130da26791e7 100644 (file)
     <ng-template #ownerTemplate>
       <div class="owner-block">
         <div class="avatar-row">
-          <img class="account-avatar" [src]="videoChannel.ownerAvatarUrl" alt="Owner account avatar" />
+          <a [routerLink]="getAccountUrl()" title="View account" i18n-title>
+            <img class="account-avatar" [src]="videoChannel.ownerAvatarUrl" alt="Owner account avatar" />
+          </a>
 
           <div class="actor-info">
-            <h4>{{ videoChannel.ownerAccount.displayName }}</h4>
+            <h4>
+              <a [routerLink]="getAccountUrl()" title="View account" i18n-title>{{ videoChannel.ownerAccount.displayName }}</a>
+            </h4>
 
             <div class="actor-handle">@{{ videoChannel.ownerBy }}</div>
           </div>
           <div class="description-html" [innerHTML]="ownerDescriptionHTML"></div>
         </div>
 
-        <a class="view-account short" [routerLink]="[ '/accounts', videoChannel.ownerBy ]" i18n>
+        <a class="view-account short" [routerLink]="getAccountUrl()" i18n>
           View account
         </a>
 
-        <a class="view-account complete" [routerLink]="[ '/accounts', videoChannel.ownerBy ]" i18n>
+        <a class="view-account complete" [routerLink]="getAccountUrl()" i18n>
           View owner account
         </a>
       </div>
@@ -83,7 +87,7 @@
       <div class="created-at" i18n>Channel created on {{ videoChannel.createdAt | date }}</div>
     </div>
 
-    <div *ngIf="!channelDescriptionExpanded" class="show-more" role="button"
+    <div *ngIf="hasShowMoreDescription()" class="show-more" role="button"
       (click)="channelDescriptionExpanded = !channelDescriptionExpanded"
       title="Show the complete description" i18n-title i18n
     >
index ec8f67a7e8a9b8ed8b6df4c3334c8158fa3f51ab..3b27f3aa1b6be00d1cc3656a6ec14917ff3eb874 100644 (file)
@@ -42,6 +42,7 @@
 
 .channel-description {
   grid-column: 1;
+  word-break: break-word;
 }
 
 .show-more {
     h4 {
       font-size: 18px;
       margin: 0;
+
+      a {
+        color: pvar(--mainForegroundColor);
+      }
     }
 
     .actor-handle {
 
   .owner-description {
     height: 140px;
+    word-break: break-word;
 
     @include fade-text(120px, pvar(--mainBackgroundColor));
   }
   }
 
   .view-account.complete {
-    display: inline-block;
+    display: block;
+    text-align: right;
     margin-top: 10px;
     color: pvar(--mainColor);
   }
index a8ca3d6fff995855074adc4bc9fb87507034e200..2739047edf9f8126874a1295dad1e210e867dda5 100644 (file)
@@ -103,10 +103,18 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
     this.notifier.success($localize`Username copied`)
   }
 
+  hasShowMoreDescription () {
+    return !this.channelDescriptionExpanded && this.channelDescriptionHTML.length > 100
+  }
+
   showSupportModal () {
     this.supportModal.show()
   }
 
+  getAccountUrl () {
+    return [ '/accounts', this.videoChannel.ownerBy ]
+  }
+
   private loadChannelVideosCount () {
     this.videoService.getVideoChannelVideos({
       videoChannel: this.videoChannel,
index e352a2b2cafdd6bcd2b461ac12436625a4071514..6aabb93a58c482a6e4afd86740d6c77cd5d95f14 100644 (file)
@@ -7,7 +7,7 @@ import { HooksService } from '@app/core/plugins/hooks.service'
 import { immutableAssign } from '@app/helpers'
 import { VideoService } from '@app/shared/shared-main'
 import { UserSubscriptionService } from '@app/shared/shared-user-subscription'
-import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature'
+import { AbstractVideoList } from '@app/shared/shared-video-miniature'
 import { FeedFormat, VideoSortField } from '@shared/models'
 import { environment } from '../../../environments/environment'
 import { copyToClipboard } from '../../../root-helpers/utils'
@@ -20,7 +20,6 @@ import { copyToClipboard } from '../../../root-helpers/utils'
 export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy {
   titlePage: string
   sort = '-publishedAt' as VideoSortField
-  ownerDisplayType: OwnerDisplayType = 'auto'
   groupByDate = true
 
   constructor (
index ea7cb2cf72b3daabc7ee7bf23ae6d8c76f22bbea..4998e85faa77e120832676298df550e2e0077843 100644 (file)
@@ -26,6 +26,7 @@
     top:50%;
     left:50%;
     transform: translate(-50%,-50%);
+    border-radius: 5px;
 
     &:not(.channel-avatar) {
       border-radius: 50%;
index 116ff7ea0988780ac32c593b0feef06d63646936..5ae48f81bd41c18584e182e207b5062c2dbef34e 100644 (file)
@@ -16,7 +16,7 @@ my-global-icon {
   }
 
   &[iconName=search] {
-    color: pvar(--mainColor);
+    color: pvar(--mainForegroundColor);
   }
 
   &[iconName=cross] {
index bd187a873665324b2eabf4e762b569928da40dbb..126e43cea95ac6ceb446c7188c2066c99541fea3 100644 (file)
@@ -1,4 +1,5 @@
-import { VideoChannel as ServerVideoChannel, ViewsPerDate, Account, Avatar } from '@shared/models'
+import { Account as ServerAccount, Avatar, VideoChannel as ServerVideoChannel, ViewsPerDate } from '@shared/models'
+import { Account } from '../account/account.model'
 import { Actor } from '../account/actor.model'
 
 export class VideoChannel extends Actor implements ServerVideoChannel {
@@ -9,7 +10,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
   nameWithHost: string
   nameWithHostForced: string
 
-  ownerAccount?: Account
+  ownerAccount?: ServerAccount
   ownerBy?: string
   ownerAvatarUrl?: string
 
@@ -46,7 +47,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
     if (hash.ownerAccount) {
       this.ownerAccount = hash.ownerAccount
       this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host)
-      this.ownerAvatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this.ownerAccount)
+      this.ownerAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.ownerAccount)
     }
   }
 
index 07f79cd6d1db192d4e0ec1105477d0e94b64a54d..41d5906cfcba042eac5773a0ec183eb445def5fb 100644 (file)
@@ -52,8 +52,7 @@
 
       <div class="video-wrapper">
         <my-video-miniature
-          [fitWidth]="true"
-          [video]="video" [user]="userMiniature" [ownerDisplayType]="ownerDisplayType"
+          [fitWidth]="true" [video]="video" [user]="userMiniature"
           [displayVideoActions]="displayVideoActions" [displayOptions]="displayOptions"
           (videoBlocked)="removeVideoFromArray(video)" (videoRemoved)="removeVideoFromArray(video)"
         >
index f41648e1c4b816f076ac8fa6e1ef9dd6962c978a..18615c37a115a9931f69137f79bcbd0792e26291 100644 (file)
@@ -28,8 +28,8 @@ import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@sha
 import { ServerConfig, UserRight, VideoFilter, VideoSortField } from '@shared/models'
 import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'
 import { Syndication, Video } from '../shared-main'
-import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component'
 import { GenericHeaderComponent, VideoListHeaderComponent } from './video-list-header.component'
+import { MiniatureDisplayOptions } from './video-miniature.component'
 
 enum GroupDate {
   UNKNOWN = 0,
@@ -65,7 +65,6 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte
   loadOnInit = true
   loadUserVideoPreferences = false
 
-  ownerDisplayType: OwnerDisplayType = 'auto'
   displayModerationBlock = false
   titleTooltip: string
   displayVideoActions = true
index f08be9c25d672a16acc41c5532301d796197f33d..987a65e4021801facf38549571c4fe46c3fbcff7 100644 (file)
@@ -16,7 +16,7 @@ import { Video } from '../shared-main'
 import { VideoPlaylistService } from '../shared-video-playlist'
 import { VideoActionsDisplayType } from './video-actions-dropdown.component'
 
-export type OwnerDisplayType = 'account' | 'videoChannel' | 'auto'
+export type OwnerDisplayType = 'account' | 'videoChannel'
 export type MiniatureDisplayOptions = {
   date?: boolean
   views?: boolean
@@ -40,7 +40,6 @@ export class VideoMiniatureComponent implements OnInit {
   @Input() user: User
   @Input() video: Video
 
-  @Input() ownerDisplayType: OwnerDisplayType = 'account'
   @Input() displayOptions: MiniatureDisplayOptions = {
     date: true,
     views: true,
@@ -89,7 +88,7 @@ export class VideoMiniatureComponent implements OnInit {
   videoHref: string
   videoTarget: string
 
-  private ownerDisplayTypeChosen: 'account' | 'videoChannel'
+  private ownerDisplayType: 'account' | 'videoChannel'
 
   constructor (
     private screenService: ScreenService,
@@ -140,11 +139,11 @@ export class VideoMiniatureComponent implements OnInit {
   }
 
   displayOwnerAccount () {
-    return this.ownerDisplayTypeChosen === 'account'
+    return this.ownerDisplayType === 'account'
   }
 
   displayOwnerVideoChannel () {
-    return this.ownerDisplayTypeChosen === 'videoChannel'
+    return this.ownerDisplayType === 'videoChannel'
   }
 
   isUnlistedVideo () {
@@ -245,21 +244,19 @@ export class VideoMiniatureComponent implements OnInit {
   }
 
   private setUpBy () {
-    if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') {
-      this.ownerDisplayTypeChosen = this.ownerDisplayType
-      return
-    }
+    const accountName = this.video.account.name
 
     // If the video channel name is an UUID (not really displayable, we changed this behaviour in v1.0.0-beta.12)
-    // Or is just a suffix of the account (default created channel)
+    // Or has not been customized (default created channel display name)
     // -> Use the account name
     if (
-      this.video.channel.name === `${this.video.account.name}_channel` ||
+      this.video.channel.displayName === `Default ${accountName} channel` ||
+      this.video.channel.displayName === `Main ${accountName} channel` ||
       this.video.channel.name.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/)
     ) {
-      this.ownerDisplayTypeChosen = 'account'
+      this.ownerDisplayType = 'account'
     } else {
-      this.ownerDisplayTypeChosen = 'videoChannel'
+      this.ownerDisplayType = 'videoChannel'
     }
   }
 
index 8caeaf0921556d4d2406b6f253563af1a6a7b57a..dec9e99f335e5ea79250c612dfda89c31e3626ba 100644 (file)
@@ -9,8 +9,7 @@
 
     <my-video-miniature
       [video]="video" [displayAsRow]="true" [displayOptions]="miniatureDisplayOptions"
-      [displayVideoActions]="false" [ownerDisplayType]="ownerDisplayType"
-      [user]="user"
+      [displayVideoActions]="false" [user]="user"
     ></my-video-miniature>
 
     <!-- Display only once -->
index ca1cf22640c7635d06a3f6668e710c25ef154887..f8c3800d7fa1e96a77da3a5b2083e26172b79b4e 100644 (file)
@@ -17,7 +17,7 @@ import { AuthService, ComponentPagination, LocalStorageService, Notifier, Screen
 import { ResultList, VideoSortField } from '@shared/models'
 import { PeerTubeTemplateDirective, Video } from '../shared-main'
 import { AbstractVideoList } from './abstract-video-list'
-import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component'
+import { MiniatureDisplayOptions } from './video-miniature.component'
 
 export type SelectionType = { [ id: number ]: boolean }
 
@@ -31,7 +31,6 @@ export class VideosSelectionComponent extends AbstractVideoList implements OnIni
   @Input() pagination: ComponentPagination
   @Input() titlePage: string
   @Input() miniatureDisplayOptions: MiniatureDisplayOptions
-  @Input() ownerDisplayType: OwnerDisplayType
 
   @Input() getVideosObservableFunction: (page: number, sort?: VideoSortField) => Observable<ResultList<Video>>
 
index 7b862a156a4f3ed343a7d393b3cb208aa7d51a08..affffc4cc869a471c3356daa8b8651e0c9ace953 100644 (file)
   @include button-focus(pvar(--mainColorLightest));
 
   border: 2px solid pvar(--mainColor);
-  font-weight: $font-regular;
+  font-weight: $font-semibold;
 
   &, &:active, &:focus {
     color: pvar(--mainColor);
   height: $size;
   min-width: $size;
   min-height: $size;
+  border-radius: 5px;
 }
 
 @mixin chevron ($size, $border-width) {