File tree Expand file tree Collapse file tree
shared/validation/song/dto
web/src/modules/song/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010import { SongStats } from '@shared/validation/song/dto/SongStats' ;
1111
12- import type { CategoryType } from './types' ;
12+ import type { CategoryType , VisibilityType } from './types' ;
1313import { SongDocument } from '../../../../server/src/song/entity/song.entity' ;
1414
1515export type SongViewUploader = {
@@ -59,6 +59,10 @@ export class SongViewDto {
5959 @IsString ( )
6060 description : string ;
6161
62+ @IsString ( )
63+ @IsNotEmpty ( )
64+ visibility : VisibilityType ;
65+
6266 @IsString ( )
6367 @IsNotEmpty ( )
6468 category : CategoryType ;
@@ -90,6 +94,7 @@ export class SongViewDto {
9094 originalAuthor : song . originalAuthor ,
9195 description : song . description ,
9296 category : song . category ,
97+ visibility : song . visibility ,
9398 license : song . license ,
9499 customInstruments : song . customInstruments ,
95100 fileSize : song . fileSize ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 OpenSongInNBSButton ,
1313 ShareButton ,
1414 UploaderBadge ,
15+ VisibilityBadge ,
1516} from './SongPageButtons' ;
1617import SongCard from '../../browse/components/SongCard' ;
1718import SongCardGroup from '../../browse/components/SongCardGroup' ;
@@ -73,7 +74,15 @@ export async function SongPage({ id }: { id: string }) {
7374 />
7475 </ picture >
7576
76- < h1 className = 'text-xl font-bold' > { song . title } </ h1 >
77+ < div className = 'text-xl font-bold inline' >
78+ < h1 className = 'inline' > { song . title } </ h1 >
79+ { song . visibility === 'private' && (
80+ < >
81+ < span className = 'inline-block w-3 align-middle' />
82+ < VisibilityBadge />
83+ </ >
84+ ) }
85+ </ div >
7786
7887 { /* Uploader and actions */ }
7988 < div className = 'flex flex-row flex-wrap justify-start items-center gap-8 w-full' >
Original file line number Diff line number Diff line change 55 faDownload ,
66 faExternalLink ,
77 faHeart ,
8+ faLock ,
89 faPlay ,
910 faPlus ,
1011 faShare ,
@@ -27,6 +28,15 @@ import {
2728} from '../../shared/components/tooltip' ;
2829import { downloadSongFile , openSongInNBS } from '../util/downloadSong' ;
2930
31+ const VisibilityBadge = ( ) => {
32+ return (
33+ < span className = 'inline-flex items-center bg-zinc-700 text-zinc-400 px-1.5 py-0.5 rounded-md text-sm font-semibold' >
34+ < FontAwesomeIcon icon = { faLock } className = 'w-3' />
35+ < span className = 'ml-1.5' > Private</ span >
36+ </ span >
37+ ) ;
38+ } ;
39+
3040const UploaderBadge = ( { user } : { user : SongViewDtoType [ 'uploader' ] } ) => {
3141 return (
3242 < div className = 'flex flex-row items-center gap-3' >
@@ -276,6 +286,7 @@ const DownloadButton = ({
276286} ;
277287
278288export {
289+ VisibilityBadge ,
279290 UploaderBadge ,
280291 FollowButton ,
281292 LikeButton ,
You can’t perform that action at this time.
0 commit comments