This commit is contained in:
MrDulfin 2024-12-29 00:58:34 -05:00
commit eda7e6f200
4 changed files with 103 additions and 53 deletions

View file

@ -37,4 +37,4 @@ futures = "0.3.30"
async-channel = "2.3.1" async-channel = "2.3.1"
ciborium = "0.2.2" ciborium = "0.2.2"
itertools = "0.13.0" itertools = "0.13.0"
prismriver = { git = "https://github.com/Dangoware/prismriver.git", features = ["ffmpeg"]} prismriver = { git = "https://github.com/Dangoware/prismriver.git" }

View file

@ -43,7 +43,6 @@ pub async fn set_volume(ctrl_handle: State<'_, ControllerHandle>, volume: String
#[tauri::command] #[tauri::command]
pub async fn get_volume(ctrl_handle: State<'_, ControllerHandle>) -> Result<(), String> { pub async fn get_volume(ctrl_handle: State<'_, ControllerHandle>) -> Result<(), String> {
Ok(()) Ok(())
} }

View file

@ -13,31 +13,30 @@
--lightTextColor: #7a7a6f; --lightTextColor: #7a7a6f;
--mediumTextColor: #cacab8; --mediumTextColor: #cacab8;
--highlightTextColor: #FFF; --highlightTextColor: #FFF;
--bottomBarHeight: 52px;
} }
.elidedText { main {
text-overflow: ellipsis; height: 100vh;
overflow: hidden; width: 100vw;
white-space: nowrap; display: flex;
flex-direction: column;
} }
.container { .container {
position: absolute;
top: 0px;
left: 0;
height: 100%;
width: 100%;
display: flex; display: flex;
position: relative;
flex-direction: row; flex-direction: row;
justify-content: center; height: calc(100% - var(--bottomBarHeight));
align-items: stretch; width: 100%;
} }
.leftSide { .leftSide {
flex-shrink: 2;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%;
} }
.rightSide { .rightSide {
@ -46,15 +45,18 @@
flex-direction: column; flex-direction: column;
position: relative; position: relative;
box-sizing: border-box; box-sizing: border-box;
align-self: flex-end;
height: 100%; height: 100%;
background-color: var(--baseColor); background-color: var(--baseColor);
color: var(--highlightTextColor); color: var(--highlightTextColor);
/* Change to resize width */ /* Change to resize width */
min-width: 380px; width: 350px;
width: 380px; }
.bottom {
display: block;
width: 100%;
} }
.playlistHead { .playlistHead {
@ -74,6 +76,7 @@
.mainView > div { .mainView > div {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: 20px;
} }
.song { .song {
@ -96,18 +99,55 @@
background-color: var(--highlightColor); background-color: var(--highlightColor);
} }
#playBar { .playBar {
position:relative; position: relative;
bottom: 0;
left: 0;
background-color: var(--playBarColor); background-color: var(--playBarColor);
width: 100%; width: 100%;
height: 58px; height: var(--bottomBarHeight);
}
.topHalf {
display: flex; display: flex;
justify-content: space-around;
.seekBar {
display: block;
width: calc(100% - 300px);
background-color: rgba(255, 255, 255, .2);
position: absolute;
left: 300px;
height: 15px;
}
.seekOverlay {
display: block;
width: 50%;
background-color: rgba(255, 255, 255, 1);
height: 100%;
}
.bottomSpaced {
display: flex;
width: 100%;
justify-content: space-between;
}
.bottomLeft {
display: flex;
justify-content: space-around;
margin-left: 10px;
}
.bottomRight {
display: flex;
justify-content: space-around;
}
button {
background: unset;
border: unset;
font-size: 30px;
width: 50px;
height: 100%;
margin-right: 15px;
color: #FFF;
}
} }
#seekBar { #seekBar {

View file

@ -70,6 +70,7 @@ function App() {
}) })
return () => { unlisten.then((f) => f()) } return () => { unlisten.then((f) => f()) }
}, []); }, []);
useEffect(() => { useEffect(() => {
const unlisten = appWindow.listen<any>("paused", (_) => { const unlisten = appWindow.listen<any>("paused", (_) => {
setPlaying(false) setPlaying(false)
@ -82,17 +83,20 @@ function App() {
}, []) }, [])
return ( return (
<main className="container"> <main>
<div className="leftSide"> <div className="container">
<PlaylistHead playlists={ playlists } setPlaylists={ setPlaylists } setViewName={ setViewName } setLibrary={ library[1] } /> <div className="leftSide">
<MainView lib_ref={ library } viewName={ viewName } /> <PlaylistHead playlists={ playlists } setPlaylists={ setPlaylists } setViewName={ setViewName } setLibrary={ library[1] } />
<MainView lib_ref={ library } viewName={ viewName } />
</div>
<div className="rightSide">
{ nowPlaying }
<Queue songs={ queue } />
</div>
</div>
<div className="bottom">
<PlayBar playing={ playing } setPlaying={ setPlaying } /> <PlayBar playing={ playing } setPlaying={ setPlaying } />
</div> </div>
<div className="rightSide">
{ nowPlaying }
<Queue songs={ queue } />
</div>
</main> </main>
); );
} }
@ -281,30 +285,36 @@ function Song(props: SongProps) {
) )
} }
interface PlayBarProps { interface PlayBarProps {
playing: boolean, playing: boolean,
setPlaying: React.Dispatch<React.SetStateAction<boolean>> setPlaying: React.Dispatch<React.SetStateAction<boolean>>
} }
function PlayBar({ playing, setPlaying }: PlayBarProps) { function PlayBar({ playing, setPlaying }: PlayBarProps) {
return ( return (
<section id="playBar" className="playBar"> <section id="playBar" className="playBar">
<div className="topHalf"> <div className="seekBar">
<div> <div className="seekOverlay" id="seekOverlay"></div>
<button>shuffle</button> </div>
<button>loop</button> <div className="bottomSpaced">
</div> <div className="bottomLeft">
<button onClick={ () => invoke('prev').then(() => {}) }>prev</button> <button onClick={ (_) => {
<button onClick={ (_) => { setPlaying( playing ? false : true );
setPlaying( playing ? false : true ); invoke( playing ? 'pause' : 'play' ).then(() => {})
invoke( playing ? 'pause' : 'play' ).then(() => {}) }}>{ playing ? '⏸' : '⏵' }</button>
}}>{ playing ? 'pause' : 'play' }</button> <button onClick={ () => invoke('stop').then(() => {}) }></button>
<button onClick={ () => invoke('next').then(() => {}) }>next</button> <button onClick={ () => invoke('prev').then(() => {}) }></button>
<input type="range" name="volume" id="volumeSlider" onChange={ (volume) => { <button onClick={ () => invoke('next').then(() => {}) }></button>
invoke('set_volume', { volume: volume.target.value }).then(() => {}) </div>
}} /> <div className="bottomRight">
<button>🔀</button>
<button>🔁</button>
<input type="range" name="volume" id="volumeSlider" onChange={ (volume) => {
invoke('set_volume', { volume: volume.target.value }).then(() => {})
}} />
<p id="timeDisplay"></p>
</div>
</div> </div>
<input type="range" name="seek" id="seekBar" />
</section> </section>
) )
} }
@ -332,6 +342,7 @@ function NowPlaying({ title, artist, album, artwork }: NowPlayingProps) {
interface QueueProps { interface QueueProps {
songs: JSX.Element[], songs: JSX.Element[],
} }
function Queue({ songs }: QueueProps) { function Queue({ songs }: QueueProps) {
return ( return (
<section className="Queue"> <section className="Queue">
@ -378,4 +389,4 @@ function getConfig(): any {
invoke('lib_already_created').then(() => {}) invoke('lib_already_created').then(() => {})
} }
}) })
} }