Improved CSS significantly

This commit is contained in:
G2-Games 2024-12-27 21:06:48 -06:00
parent 4e3967021a
commit f51650f4d2
3 changed files with 105 additions and 40 deletions

View file

@ -37,7 +37,7 @@ pub async fn pause(app: AppHandle<Wry>, ctrl_handle: State<'_, ControllerHandle>
#[tauri::command] #[tauri::command]
pub async fn set_volume(ctrl_handle: State<'_, ControllerHandle>, volume: String) -> Result<(), String> { pub async fn set_volume(ctrl_handle: State<'_, ControllerHandle>, volume: String) -> Result<(), String> {
let volume = volume.parse::<f32>().unwrap() / 1000.0; let volume = volume.parse::<f32>().unwrap() / 100.0;
ctrl_handle.player_mail.send(dmp_core::music_controller::controller::PlayerCommand::SetVolume(volume)).await.unwrap(); ctrl_handle.player_mail.send(dmp_core::music_controller::controller::PlayerCommand::SetVolume(volume)).await.unwrap();
let PlayerResponse::Empty = ctrl_handle.player_mail.recv().await.unwrap() else { let PlayerResponse::Empty = ctrl_handle.player_mail.recv().await.unwrap() else {
unreachable!() unreachable!()

View file

@ -1,6 +1,11 @@
* {
padding: 0;
margin: 0;
}
.container { .container {
position: absolute; position: absolute;
top: -1px; top: 0px;
left: 0; left: 0;
height: 100%; height: 100%;
width: 100%; width: 100%;
@ -11,34 +16,66 @@
} }
.leftSide { .leftSide {
width: 80%; flex-shrink: 2;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.rightSide {
position: relative; .rightSide {
align-self:flex-end; display: flex;
width: 20%; flex-grow: 2;
height: 100%; flex-direction: column;
background-color: #c1bcd1; position: relative;
display: flex; box-sizing: border-box;
flex-direction: column;
} align-self: flex-end;
height: 100%;
background-color: #c1bcd1;
/* Change to resize width */
min-width: 380px;
width: 380px;
}
.playlistHead { .playlistHead {
position: relative; position: relative;
height: 3.5%; height: 40px;
width: 100%; width: 100%;
background-color: #876765; background-color: #876765;
} }
.mainView { .mainView {
background-color: #f5eab2; background-color: #f5eab2;
height: 91.5%; height: 100%;
overflow-y: scroll; overflow-y: scroll;
} }
.mainView > div {
display: flex;
flex-direction: column;
}
.song {
display: grid;
cursor: default;
/* This needs to be adjusted when adding or removing columns */
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 30px;
/* For tags */
p {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
.song:hover {
background-color: grey;
}
#playBar { #playBar {
position:relative; position:relative;
bottom: 0; bottom: 0;
@ -53,24 +90,37 @@
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
} }
#seekBar { #seekBar {
width: 100%; width: 100%;
} }
.nowPlaying { .nowPlaying {
text-align: center; font-size: 14pt;
height: 25%; width: 100%;
} padding: 10px;
#nowPlayingArtwork { box-sizing: border-box;
width: 90%; margin-bottom: 5px;
padding: 5%;
p, h3 {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
img {
aspect-ratio: 1;
object-fit: contain;
width: 100%;
padding: 5%;
display: block;
box-sizing: border-box;
}
} }
.Queue { .Queue {
position: relative; position: relative;
bottom: -25%;
background-color: burlywood; background-color: burlywood;
height: 50%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: scroll; overflow-y: scroll;
@ -83,23 +133,32 @@
} }
.queueSong { .queueSong {
height: 15%; height: 100px;
width: 90%; width: 100%;
display: flex; display: flex;
} }
.queueSongCoverArt { .queueSongCoverArt {
width: 25%; aspect-ratio: 1;
height: 100%; object-fit: contain;
max-width: 75px;
padding: 5px;
box-sizing: border-box;
} }
.queueSongTags { .queueSongTags {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} margin: 0;
margin-left: 5px;
font-size: 14pt;
padding: 5px 0;
.song { p:first-child {
display: flex; font-weight: bold;
justify-content: left; }
gap: 1%;
} p {
margin: 0;
}
}

View file

@ -249,18 +249,24 @@ function Song(props: SongProps) {
// console.log(props.tags); // console.log(props.tags);
return( return(
<div className="song"> <div onClick={() => {
invoke("play_now", { uuid: props.uuid, location: props.playerLocation }).then(() => {})
}} className="song">
<p className="title">{ props.tags.TrackTitle }</p> <p className="title">{ props.tags.TrackTitle }</p>
<p className="album">{ props.tags.Album }</p> <p className="album">{ props.tags.AlbumTitle }</p>
<p className="artist">{ props.tags.AlbumArtist }</p> <p className="artist">{ props.tags.AlbumArtist }</p>
<p className="duration">{ props.duration }</p> <p className="duration">
<button onClick={(_) => { { Math.round(+props.duration / 60) }:
{ (+props.duration % 60).toString().padStart(2, "0") }
</p>
{/*<button onClick={(_) => {
invoke('add_song_to_queue', { uuid: props.uuid, location: props.playerLocation }).then(() => {} ) invoke('add_song_to_queue', { uuid: props.uuid, location: props.playerLocation }).then(() => {} )
}} }}
>Add to Queue</button> >Add to Queue</button>
<button onClick={() => { <button onClick={() => {
invoke("play_now", { uuid: props.uuid, location: props.playerLocation }).then(() => {}) invoke("play_now", { uuid: props.uuid, location: props.playerLocation }).then(() => {})
}}>Play Now</button> }}>Play Now</button>*/}
</div> </div>
) )
} }
@ -304,7 +310,7 @@ function NowPlaying({ title, artist, album, artwork }: NowPlayingProps) {
return ( return (
<section className="nowPlaying"> <section className="nowPlaying">
{ artwork } { artwork }
<h2>{ title }</h2> <h3>{ title }</h3>
<p>{ artist }</p> <p>{ artist }</p>
<p>{ album }</p> <p>{ album }</p>
</section> </section>
@ -334,8 +340,8 @@ function QueueSong({ song }: QueueSongProps) {
<div className="queueSong"> <div className="queueSong">
<img className="queueSongCoverArt" src={ convertFileSrc('abc') + '?' + song.uuid } key={ 'coverArt_' + song.uuid }/> <img className="queueSongCoverArt" src={ convertFileSrc('abc') + '?' + song.uuid } key={ 'coverArt_' + song.uuid }/>
<div className="queueSongTags"> <div className="queueSongTags">
<h3 className="queueSongTitle">{ song.tags.TrackTitle }</h3> <p className="queueSongTitle">{ song.tags.TrackTitle }</p>
<h4 className="queueSongArtist">{ song.tags.TrackArtist }</h4> <p className="queueSongArtist">{ song.tags.TrackArtist }</p>
</div> </div>
</div> </div>
// </button> // </button>