Improved UX in share dialog and video info dialog

pull/809/head
Tzahi12345 3 years ago
parent cebf8c3d36
commit 6c8b7d0052

@ -2463,6 +2463,8 @@ components:
type: string type: string
uid: uid:
type: string type: string
user_uid:
type: string
sharingEnabled: sharingEnabled:
type: boolean type: boolean
category: category:

@ -26,6 +26,7 @@ export type DatabaseFile = {
path: string; path: string;
upload_date: string; upload_date: string;
uid: string; uid: string;
user_uid?: string;
sharingEnabled?: boolean; sharingEnabled?: boolean;
category?: Category; category?: Category;
view_count?: number; view_count?: number;

@ -6,7 +6,7 @@
<mat-dialog-content> <mat-dialog-content>
<div> <div>
<div> <div>
<mat-checkbox [checked]="sharing_enabled" (change)="sharingChanged($event)"><ng-container i18n="Enable sharing checkbox">Enable sharing</ng-container></mat-checkbox> <mat-checkbox [checked]="sharing_enabled" (change)="sharingChanged($event)" [disabled]="uuid && (!postsService.isLoggedIn || postsService.user?.uid !== uuid)"><ng-container i18n="Enable sharing checkbox">Enable sharing</ng-container></mat-checkbox>
</div> </div>
<div> <div>
<mat-checkbox style="margin-right: 15px;" (change)="useTimestampChanged()" [(ngModel)]="timestamp_enabled"><ng-container i18n="Use timestamp">Use timestamp</ng-container></mat-checkbox> <mat-checkbox style="margin-right: 15px;" (change)="useTimestampChanged()" [(ngModel)]="timestamp_enabled"><ng-container i18n="Use timestamp">Use timestamp</ng-container></mat-checkbox>

@ -21,7 +21,7 @@ export class ShareMediaDialogComponent implements OnInit {
timestamp_enabled = false; timestamp_enabled = false;
constructor(@Inject(MAT_DIALOG_DATA) public data: any, public router: Router, private snackBar: MatSnackBar, constructor(@Inject(MAT_DIALOG_DATA) public data: any, public router: Router, private snackBar: MatSnackBar,
private postsService: PostsService) { } public postsService: PostsService) { }
ngOnInit(): void { ngOnInit(): void {
if (this.data) { if (this.data) {

@ -1,8 +1,8 @@
<h4 mat-dialog-title> <h4 mat-dialog-title>
{{file.title}} {{file.title}}
<div class="favorite-button"> <div class="favorite-button">
<button mat-icon-button (click)="editing = !editing"><mat-icon>edit</mat-icon></button> <button [disabled]="!initialized || retrieving_file || !write_access" mat-icon-button (click)="editing = !editing"><mat-icon>edit</mat-icon></button>
<button [disabled]="!initialized || retrieving_file" (click)="toggleFavorite()" mat-icon-button ><mat-icon>{{file.favorite ? 'favorite_filled' : 'favorite_outline'}}</mat-icon></button> <button [disabled]="!initialized || retrieving_file || !write_access" (click)="toggleFavorite()" mat-icon-button ><mat-icon>{{file.favorite ? 'favorite_filled' : 'favorite_outline'}}</mat-icon></button>
</div> </div>
</h4> </h4>

@ -20,6 +20,7 @@ export class VideoInfoDialogComponent implements OnInit {
editing = false; editing = false;
initialized = false; initialized = false;
retrieving_file = false; retrieving_file = false;
write_access = false;
constructor(@Inject(MAT_DIALOG_DATA) public data: any, public postsService: PostsService, private datePipe: DatePipe) { } constructor(@Inject(MAT_DIALOG_DATA) public data: any, public postsService: PostsService, private datePipe: DatePipe) { }
@ -29,6 +30,7 @@ export class VideoInfoDialogComponent implements OnInit {
this.initializeFile(this.data.file); this.initializeFile(this.data.file);
} }
this.postsService.reloadCategories(); this.postsService.reloadCategories();
this.write_access = !this.file.user_uid || (this.file.user_uid && this.postsService.user?.uid === this.file.user_uid);
} }
initializeFile(file: DatabaseFile): void { initializeFile(file: DatabaseFile): void {

@ -353,7 +353,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy {
uid: this.playlist_id ? this.playlist_id : this.uid, uid: this.playlist_id ? this.playlist_id : this.uid,
sharing_enabled: this.playlist_id ? this.db_playlist.sharingEnabled : this.db_file.sharingEnabled, sharing_enabled: this.playlist_id ? this.db_playlist.sharingEnabled : this.db_file.sharingEnabled,
is_playlist: !!this.playlist_id, is_playlist: !!this.playlist_id,
uuid: this.postsService.isLoggedIn ? this.postsService.user.uid : null, uuid: this.postsService.isLoggedIn ? this.postsService.user.uid : this.uuid,
current_timestamp: this.api.time.current current_timestamp: this.api.time.current
}, },
width: '60vw' width: '60vw'

Loading…
Cancel
Save