Compare commits
9 Commits
145-clean-
...
148-create
Author | SHA1 | Date | |
---|---|---|---|
d73a114d35 | |||
f8a28ca75c | |||
0afdbf2ad5 | |||
03889d4efe | |||
f6fb92e361 | |||
00f4b2e28f | |||
340129a859 | |||
7828992e80 | |||
9600e8c442 |
@ -18,4 +18,3 @@ DATABASE_URL=postgresql://libretunes:password@localhost:5432/libretunes
|
|||||||
|
|
||||||
LIBRETUNES_AUDIO_PATH=assets/audio
|
LIBRETUNES_AUDIO_PATH=assets/audio
|
||||||
LIBRETUNES_IMAGE_PATH=assets/images
|
LIBRETUNES_IMAGE_PATH=assets/images
|
||||||
LIBRETUNES_DISABLE_SIGNUP=true
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM rust:slim AS builder
|
FROM rust:slim as builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ name: libretunes
|
|||||||
services:
|
services:
|
||||||
libretunes:
|
libretunes:
|
||||||
container_name: libretunes
|
container_name: libretunes
|
||||||
# image: git.libretunes.xyz/libretunes/libretunes:latest
|
# image: registry.mregirouard.com/libretunes/libretunes:latest
|
||||||
build: .
|
build: .
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
@ -15,7 +15,6 @@ services:
|
|||||||
POSTGRES_DB: ${POSTGRES_DB}
|
POSTGRES_DB: ${POSTGRES_DB}
|
||||||
LIBRETUNES_AUDIO_PATH: /assets/audio
|
LIBRETUNES_AUDIO_PATH: /assets/audio
|
||||||
LIBRETUNES_IMAGE_PATH: /assets/images
|
LIBRETUNES_IMAGE_PATH: /assets/images
|
||||||
LIBRETUNES_DISABLE_SIGNUP: "true"
|
|
||||||
volumes:
|
volumes:
|
||||||
- libretunes-audio:/assets/audio
|
- libretunes-audio:/assets/audio
|
||||||
- libretunes-images:/assets/images
|
- libretunes-images:/assets/images
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
use crate::models::Artist;
|
use crate::models::Artist;
|
||||||
use crate::components::dashboard_tile::DashboardTile;
|
use crate::components::dashboard_tile::DashboardTile;
|
||||||
use serde::{Serialize, Deserialize};
|
|
||||||
|
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
|
|
||||||
/// Holds information about an album
|
/// Holds information about an album
|
||||||
///
|
///
|
||||||
/// Intended to be used in the front-end
|
/// Intended to be used in the front-end
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
|
||||||
pub struct AlbumData {
|
pub struct AlbumData {
|
||||||
/// Album id
|
/// Album id
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
use leptos::*;
|
|
||||||
use crate::albumdata::AlbumData;
|
|
||||||
use crate::songdata::SongData;
|
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
|
||||||
|
|
||||||
cfg_if! {
|
|
||||||
if #[cfg(feature = "ssr")] {
|
|
||||||
use leptos::server_fn::error::NoCustomError;
|
|
||||||
use crate::database::get_db_conn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[server(endpoint = "album/get")]
|
|
||||||
pub async fn get_album(id: i32) -> Result<AlbumData, ServerFnError> {
|
|
||||||
use crate::models::Album;
|
|
||||||
let db_con = &mut get_db_conn();
|
|
||||||
let album = Album::get_album_data(id,db_con)
|
|
||||||
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error getting album: {}", e)))?;
|
|
||||||
Ok(album)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[server(endpoint = "album/get_songs")]
|
|
||||||
pub async fn get_songs(id: i32) -> Result<Vec<SongData>, ServerFnError> {
|
|
||||||
use crate::models::Album;
|
|
||||||
use crate::auth::get_logged_in_user;
|
|
||||||
let user = get_logged_in_user().await?;
|
|
||||||
let db_con = &mut get_db_conn();
|
|
||||||
// TODO: NEEDS SONG DATA QUERIES
|
|
||||||
let songdata = Album::get_song_data(id,user,db_con)
|
|
||||||
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error getting song data: {}", e)))?;
|
|
||||||
Ok(songdata)
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
pub mod history;
|
pub mod history;
|
||||||
pub mod profile;
|
pub mod profile;
|
||||||
pub mod songs;
|
pub mod songs;
|
||||||
pub mod album;
|
|
||||||
|
@ -7,7 +7,6 @@ use leptos_router::*;
|
|||||||
use crate::pages::login::*;
|
use crate::pages::login::*;
|
||||||
use crate::pages::signup::*;
|
use crate::pages::signup::*;
|
||||||
use crate::pages::profile::*;
|
use crate::pages::profile::*;
|
||||||
use crate::pages::albumpage::*;
|
|
||||||
use crate::error_template::{AppError, ErrorTemplate};
|
use crate::error_template::{AppError, ErrorTemplate};
|
||||||
use crate::util::state::GlobalState;
|
use crate::util::state::GlobalState;
|
||||||
|
|
||||||
@ -45,7 +44,6 @@ pub fn App() -> impl IntoView {
|
|||||||
<Route path="search" view=Search />
|
<Route path="search" view=Search />
|
||||||
<Route path="user/:id" view=Profile />
|
<Route path="user/:id" view=Profile />
|
||||||
<Route path="user" view=Profile />
|
<Route path="user" view=Profile />
|
||||||
<Route path="album/:id" view=AlbumPage />
|
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/login" view=Login />
|
<Route path="/login" view=Login />
|
||||||
<Route path="/signup" view=Signup />
|
<Route path="/signup" view=Signup />
|
||||||
|
@ -19,11 +19,6 @@ use crate::users::UserCredentials;
|
|||||||
/// Returns a Result with the error message if the user could not be created
|
/// Returns a Result with the error message if the user could not be created
|
||||||
#[server(endpoint = "signup")]
|
#[server(endpoint = "signup")]
|
||||||
pub async fn signup(new_user: User) -> Result<(), ServerFnError> {
|
pub async fn signup(new_user: User) -> Result<(), ServerFnError> {
|
||||||
// Check LIBRETUNES_DISABLE_SIGNUP env var
|
|
||||||
if std::env::var("LIBRETUNES_DISABLE_SIGNUP").is_ok_and(|v| v == "true") {
|
|
||||||
return Err(ServerFnError::<NoCustomError>::ServerError("Signup is disabled".to_string()));
|
|
||||||
}
|
|
||||||
|
|
||||||
use crate::users::create_user;
|
use crate::users::create_user;
|
||||||
|
|
||||||
// Ensure the user has no id, and is not a self-proclaimed admin
|
// Ensure the user has no id, and is not a self-proclaimed admin
|
||||||
@ -92,7 +87,6 @@ pub async fn logout() -> Result<(), ServerFnError> {
|
|||||||
auth_session.logout().await
|
auth_session.logout().await
|
||||||
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error getting auth session: {}", e)))?;
|
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error getting auth session: {}", e)))?;
|
||||||
|
|
||||||
leptos_axum::redirect("/login");
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,4 +8,3 @@ pub mod upload;
|
|||||||
pub mod song_list;
|
pub mod song_list;
|
||||||
pub mod loading;
|
pub mod loading;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod album_info;
|
|
@ -1,25 +0,0 @@
|
|||||||
use leptos::leptos_dom::*;
|
|
||||||
use leptos::*;
|
|
||||||
use crate::albumdata::AlbumData;
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
pub fn AlbumInfo(albumdata: AlbumData) -> impl IntoView {
|
|
||||||
view! {
|
|
||||||
<div class="album-info">
|
|
||||||
<img class="album-image" src={albumdata.image_path} alt="dashboard-tile" />
|
|
||||||
<div class="album-body">
|
|
||||||
<p class="album-title">{albumdata.title}</p>
|
|
||||||
<div class="album-artists">
|
|
||||||
{
|
|
||||||
albumdata.artists.iter().map(|artist| {
|
|
||||||
view! {
|
|
||||||
<a class="album-artist" href={format!("/artist/{}", artist.id.unwrap())}>{artist.name.clone()}</a>
|
|
||||||
}
|
|
||||||
}).collect::<Vec<_>>()
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}.into_view()
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
|||||||
use leptos::leptos_dom::*;
|
use leptos::leptos_dom::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_icons::*;
|
use leptos_icons::*;
|
||||||
use crate::auth::logout;
|
|
||||||
use crate::util::state::GlobalState;
|
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Personal() -> impl IntoView {
|
pub fn Personal() -> impl IntoView {
|
||||||
@ -16,66 +14,18 @@ pub fn Personal() -> impl IntoView {
|
|||||||
#[component]
|
#[component]
|
||||||
pub fn Profile() -> impl IntoView {
|
pub fn Profile() -> impl IntoView {
|
||||||
let (dropdown_open, set_dropdown_open) = create_signal(false);
|
let (dropdown_open, set_dropdown_open) = create_signal(false);
|
||||||
let user = GlobalState::logged_in_user();
|
|
||||||
|
|
||||||
let open_dropdown = move |_| {
|
let open_dropdown = move |_| {
|
||||||
set_dropdown_open.update(|value| *value = !*value);
|
set_dropdown_open.update(|value| *value = !*value);
|
||||||
|
log!("opened dropdown");
|
||||||
};
|
};
|
||||||
|
|
||||||
let user_profile_picture = move || {
|
|
||||||
user.get().and_then(|user| {
|
|
||||||
if let Some(user) = user {
|
|
||||||
if user.id.is_none() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
Some(format!("/assets/images/profile/{}.webp", user.id.unwrap()))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<div class="profile-container">
|
<div class="profile-container">
|
||||||
<div class="profile-name">
|
|
||||||
<Suspense
|
|
||||||
fallback=|| view!{
|
|
||||||
<h1>Not Logged In</h1>
|
|
||||||
}>
|
|
||||||
<Show
|
|
||||||
when=move || user.get().map(|user| user.is_some()).unwrap_or(false)
|
|
||||||
fallback=|| view!{
|
|
||||||
<h1>Not Logged In</h1>
|
|
||||||
}>
|
|
||||||
<h1>{move || user.get().map(|user| user.map(|user| user.username))}</h1>
|
|
||||||
</Show>
|
|
||||||
</Suspense>
|
|
||||||
</div>
|
|
||||||
<div class="profile-icon" on:click=open_dropdown>
|
<div class="profile-icon" on:click=open_dropdown>
|
||||||
<Suspense fallback=|| view! { <Icon icon=icondata::CgProfile width="45" height="45"/> }>
|
<Icon icon=icondata::CgProfile />
|
||||||
<Show
|
|
||||||
when=move || user.get().map(|user| user.is_some()).unwrap_or(false)
|
|
||||||
fallback=|| view! { <Icon icon=icondata::CgProfile width="45" height="45"/> }
|
|
||||||
>
|
|
||||||
<object class="profile-image" data={user_profile_picture} type="image/webp">
|
|
||||||
<Icon class="profile-image" icon=icondata::CgProfile width="45" height="45"/>
|
|
||||||
</object>
|
|
||||||
</Show>
|
|
||||||
</Suspense>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown-container" style={move || if dropdown_open() {"display: flex"} else {"display: none"}}>
|
<div class="dropdown-container" style={move || if dropdown_open() {"display: flex"} else {"display: none"}}>
|
||||||
<Suspense
|
|
||||||
fallback=|| view!{
|
|
||||||
<DropDownNotLoggedIn />
|
<DropDownNotLoggedIn />
|
||||||
}>
|
|
||||||
<Show
|
|
||||||
when=move || user.get().map(|user| user.is_some()).unwrap_or(false)
|
|
||||||
fallback=|| view!{
|
|
||||||
<DropDownNotLoggedIn />
|
|
||||||
}>
|
|
||||||
<DropDownLoggedIn />
|
|
||||||
</Show>
|
|
||||||
</Suspense>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@ -83,33 +33,10 @@ pub fn Profile() -> impl IntoView {
|
|||||||
#[component]
|
#[component]
|
||||||
pub fn DropDownNotLoggedIn() -> impl IntoView {
|
pub fn DropDownNotLoggedIn() -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<div class="dropdown-logged">
|
<div class="dropdown-not-logged">
|
||||||
<h1>Not Logged In</h1>
|
<h1>Not Logged in!</h1>
|
||||||
<a href="/login"><button class="auth-button">Log In</button></a>
|
<a href="/login"><button class="auth-button">Log In</button></a>
|
||||||
<a href="/signup"><button class="auth-button">Sign Up</button></a>
|
<a href="/signup"><button class="auth-button">Sign up</button></a>
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[component]
|
|
||||||
pub fn DropDownLoggedIn() -> impl IntoView {
|
|
||||||
|
|
||||||
let logout = move |_| {
|
|
||||||
spawn_local(async move {
|
|
||||||
let result = logout().await;
|
|
||||||
if let Err(err) = result {
|
|
||||||
log!("Error logging out: {:?}", err);
|
|
||||||
} else {
|
|
||||||
let user = GlobalState::logged_in_user();
|
|
||||||
user.refetch();
|
|
||||||
log!("Logged out successfully");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
view! {
|
|
||||||
<div class="dropdown-logged">
|
|
||||||
<h1>"Logged In"</h1>
|
|
||||||
<button on:click=logout class="auth-button">Log Out</button>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,152 @@
|
|||||||
|
use html::Li;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use crate::search::search;
|
||||||
|
use crate::song::Song;
|
||||||
|
use crate::models::Album;
|
||||||
|
use crate::models::Artist;
|
||||||
|
use crate::models::Song;
|
||||||
|
use crate::util::state::GlobalState;
|
||||||
|
use leptos::ev::*;
|
||||||
|
use leptos::leptos_dom::*;
|
||||||
|
use leptos_icons::*;
|
||||||
|
|
||||||
|
const OPTIONS_BTN_SIZE: &str = "2.5rem";
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Search() -> impl IntoView {
|
pub fn Search() -> impl IntoView {
|
||||||
|
|
||||||
|
let status = GlobalState::play_status();
|
||||||
|
|
||||||
|
let search_query = create_rw_signal(String::new());
|
||||||
|
let search_results = create_rw_signal((Vec::<(Album, f32)>::new(), Vec::<(Artist, f32)>::new(), Vec::<(Song, f32)>::new()));
|
||||||
|
let search_limit = 10;
|
||||||
|
|
||||||
|
let on_input = move |e: Event| {
|
||||||
|
search_query.set(event_target_value(&e));
|
||||||
|
|
||||||
|
log!("Search Query: {:?}", search_query.get_untracked());
|
||||||
|
|
||||||
|
spawn_local(async move {
|
||||||
|
log!("Searching for: {:?}", search_query.get_untracked());
|
||||||
|
let results = search(search_query.get_untracked(), search_limit).await;
|
||||||
|
|
||||||
|
match results {
|
||||||
|
Ok((albums, artists, songs)) => {
|
||||||
|
search_results.set((albums, artists, songs));
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
log!("Error searching albums: {:?}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
let on_disabled = move |_e: FocusEvent| {
|
||||||
|
status.update(|status| {
|
||||||
|
status.search_active = false;
|
||||||
|
});
|
||||||
|
log!("Search Bar Disabled");
|
||||||
|
};
|
||||||
|
|
||||||
|
let on_enabled = move |_e: FocusEvent| {
|
||||||
|
status.update(|status| {
|
||||||
|
status.search_active = true;
|
||||||
|
});
|
||||||
|
log!("Search Bar Enabled");
|
||||||
|
};
|
||||||
|
|
||||||
|
let prevent_focus = move |e: MouseEvent| {
|
||||||
|
e.prevent_default();
|
||||||
|
};
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<div class="search-container home-component">
|
<div class="search-container home-component">
|
||||||
<h1>Searching...</h1>
|
<div class="search-bar">
|
||||||
|
<input type="search" placeholder="Search" on:input=on_input on:blur=on_disabled on:focus=on_enabled/>
|
||||||
|
</div>
|
||||||
|
<div class="search-results">
|
||||||
|
// Display 3 columns of search results: songs, albums, and artists
|
||||||
|
<ul class="search-result-list">
|
||||||
|
{move || search_results.with(|results| -> Vec<leptos::HtmlElement<Li>> {
|
||||||
|
let mut song_list = Vec::new();
|
||||||
|
for (song, _) in results.2.clone() {
|
||||||
|
song_list.push(view! {
|
||||||
|
<li class="search-result">
|
||||||
|
<div class="result-container">
|
||||||
|
<Song song_image_path=match song.image_path.clone() {
|
||||||
|
Some(path) => path,
|
||||||
|
None => "".to_string()
|
||||||
|
} song_title=song.title.clone() song_artist="".to_string() />
|
||||||
|
<div class="right-side-result">
|
||||||
|
<div class="search-item-type">
|
||||||
|
"(Song)"
|
||||||
|
</div>
|
||||||
|
<button class="search-result-options" on:mousedown=prevent_focus>
|
||||||
|
<Icon class="search-result-options-icon" width=OPTIONS_BTN_SIZE height=OPTIONS_BTN_SIZE icon=icondata::BsThreeDotsVertical />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
});
|
||||||
|
}
|
||||||
|
song_list
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
<ul class="search-result-list">
|
||||||
|
{move || search_results.with(|results| -> Vec<leptos::HtmlElement<Li>> {
|
||||||
|
let mut album_list = Vec::new();
|
||||||
|
for (album, _) in results.0.clone() {
|
||||||
|
album_list.push(view! {
|
||||||
|
<li class="search-result">
|
||||||
|
<div class="result-container">
|
||||||
|
<div class="search-result-album">
|
||||||
|
{album.title.clone()}
|
||||||
|
{match album.release_date {
|
||||||
|
Some(date) => format!(" ({})", date),
|
||||||
|
None => "".to_string()
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
<div class="right-side-result">
|
||||||
|
<div class="search-item-type">
|
||||||
|
"(Album)"
|
||||||
|
</div>
|
||||||
|
<button class="search-result-options" on:mousedown=prevent_focus>
|
||||||
|
<Icon class="search-result-options-icon" width=OPTIONS_BTN_SIZE height=OPTIONS_BTN_SIZE icon=icondata::BsThreeDotsVertical />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
});
|
||||||
|
}
|
||||||
|
album_list
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
<ul class="search-result-list">
|
||||||
|
{move || search_results.with(|results| -> Vec<leptos::HtmlElement<Li>> {
|
||||||
|
let mut artist_list = Vec::new();
|
||||||
|
for (artist, _) in results.1.clone() {
|
||||||
|
artist_list.push(view! {
|
||||||
|
<li class="search-result">
|
||||||
|
<div class="result-container">
|
||||||
|
<div class="search-result-artist">
|
||||||
|
{artist.name.clone()}
|
||||||
|
</div>
|
||||||
|
<div class="right-side-result">
|
||||||
|
<div class="search-item-type">
|
||||||
|
"(Artist)"
|
||||||
|
</div>
|
||||||
|
<button class="search-result-options" on:mousedown=prevent_focus>
|
||||||
|
<Icon class="search-result-options-icon" width=OPTIONS_BTN_SIZE height=OPTIONS_BTN_SIZE icon=icondata::BsThreeDotsVertical />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
});
|
||||||
|
}
|
||||||
|
artist_list
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -124,7 +124,7 @@ pub fn Upload(open: RwSignal<bool>) -> impl IntoView {
|
|||||||
>
|
>
|
||||||
<ul class="artist_results search-results">
|
<ul class="artist_results search-results">
|
||||||
{
|
{
|
||||||
move || filtered_artists.get().iter().enumerate().map(|(_index,filtered_artist)| view! {
|
move || filtered_artists.get().iter().enumerate().map(|(_index,(filtered_artist, _score))| view! {
|
||||||
<Artist artist=filtered_artist.clone() artists=artists set_artists=set_artists set_filtered=set_filtered_artists/>
|
<Artist artist=filtered_artist.clone() artists=artists set_artists=set_artists set_filtered=set_filtered_artists/>
|
||||||
}).collect::<Vec<_>>()
|
}).collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ pub fn Upload(open: RwSignal<bool>) -> impl IntoView {
|
|||||||
>
|
>
|
||||||
<ul class="album_results search-results">
|
<ul class="album_results search-results">
|
||||||
{
|
{
|
||||||
move || filtered_albums.get().iter().enumerate().map(|(_index,filtered_album)| view! {
|
move || filtered_albums.get().iter().enumerate().map(|(_index,(filtered_album, _score))| view! {
|
||||||
<Album album=filtered_album.clone() _albums=albums set_albums=set_albums set_filtered=set_filtered_albums/>
|
<Album album=filtered_album.clone() _albums=albums set_albums=set_albums set_filtered=set_filtered_albums/>
|
||||||
}).collect::<Vec<_>>()
|
}).collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
@ -182,15 +182,15 @@ pub fn Upload(open: RwSignal<bool>) -> impl IntoView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Artist(artist: Artist, artists: ReadSignal<String>, set_artists: WriteSignal<String>, set_filtered: WriteSignal<Vec<Artist>>) -> impl IntoView {
|
pub fn Artist(artist: Artist, artists: ReadSignal<String>, set_artists: WriteSignal<String>, set_filtered: WriteSignal<Vec<(Artist, f32)>>) -> impl IntoView {
|
||||||
// Converts artist name to artist id and adds it to the artist input
|
// Converts artist name to artist id and adds it to the artist input
|
||||||
let add_artist = move |_| {
|
let add_artist = move |_| {
|
||||||
//Create an empty string to hold previous artist ids
|
//Create an empty string to hold previous artist ids
|
||||||
let mut s: String = String::from("");
|
let mut s: String = String::from("");
|
||||||
//Get the current artist input
|
//Get the current artist input
|
||||||
let all_artirts: String = artists.get();
|
let all_artists: String = artists.get();
|
||||||
//Split the input into a vector of artists separated by commas
|
//Split the input into a vector of artists separated by commas
|
||||||
let mut ids: Vec<&str> = all_artirts.split(",").collect();
|
let mut ids: Vec<&str> = all_artists.split(",").collect();
|
||||||
//If there is only one artist in the input, get their id equivalent and add it to the string
|
//If there is only one artist in the input, get their id equivalent and add it to the string
|
||||||
if ids.len() == 1 {
|
if ids.len() == 1 {
|
||||||
let value_str = match artist.id.clone() {
|
let value_str = match artist.id.clone() {
|
||||||
@ -227,7 +227,7 @@ pub fn Artist(artist: Artist, artists: ReadSignal<String>, set_artists: WriteSig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Album(album: Album, _albums: ReadSignal<String>, set_albums: WriteSignal<String>, set_filtered: WriteSignal<Vec<Album>>) -> impl IntoView {
|
pub fn Album(album: Album, _albums: ReadSignal<String>, set_albums: WriteSignal<String>, set_filtered: WriteSignal<Vec<(Album, f32)>>) -> impl IntoView {
|
||||||
//Converts album title to album id to upload a song
|
//Converts album title to album id to upload a song
|
||||||
let add_album = move |_| {
|
let add_album = move |_| {
|
||||||
let value_str = match album.id.clone() {
|
let value_str = match album.id.clone() {
|
||||||
|
@ -14,11 +14,10 @@ extern crate diesel_migrations;
|
|||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
use axum::{routing::get, Router, extract::Path, middleware::from_fn};
|
use axum::{routing::get, Router, extract::Path};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||||
use libretunes::app::*;
|
use libretunes::app::*;
|
||||||
use libretunes::util::require_auth::require_auth_middleware;
|
|
||||||
use libretunes::fileserv::{file_and_error_handler, get_asset_file, get_static_file, AssetType};
|
use libretunes::fileserv::{file_and_error_handler, get_asset_file, get_static_file, AssetType};
|
||||||
use axum_login::tower_sessions::SessionManagerLayer;
|
use axum_login::tower_sessions::SessionManagerLayer;
|
||||||
use tower_sessions_redis_store::{fred::prelude::*, RedisStore};
|
use tower_sessions_redis_store::{fred::prelude::*, RedisStore};
|
||||||
@ -64,7 +63,6 @@ async fn main() {
|
|||||||
.route("/assets/audio/:song", get(|Path(song) : Path<String>| get_asset_file(song, AssetType::Audio)))
|
.route("/assets/audio/:song", get(|Path(song) : Path<String>| get_asset_file(song, AssetType::Audio)))
|
||||||
.route("/assets/images/:image", get(|Path(image) : Path<String>| get_asset_file(image, AssetType::Image)))
|
.route("/assets/images/:image", get(|Path(image) : Path<String>| get_asset_file(image, AssetType::Image)))
|
||||||
.route("/assets/*uri", get(|uri| get_static_file(uri, "")))
|
.route("/assets/*uri", get(|uri| get_static_file(uri, "")))
|
||||||
.layer(from_fn(require_auth_middleware))
|
|
||||||
.layer(auth_layer)
|
.layer(auth_layer)
|
||||||
.fallback(file_and_error_handler)
|
.fallback(file_and_error_handler)
|
||||||
.with_state(leptos_options);
|
.with_state(leptos_options);
|
||||||
|
145
src/models.rs
145
src/models.rs
@ -6,10 +6,8 @@ use cfg_if::cfg_if;
|
|||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "ssr")] {
|
if #[cfg(feature = "ssr")] {
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use crate::database::*;
|
use crate::database::PgPooledConn;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use crate::songdata::SongData;
|
|
||||||
use crate::albumdata::AlbumData;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +498,7 @@ impl Album {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get songs by this album from the database
|
/// Get songs by this artist from the database
|
||||||
///
|
///
|
||||||
/// The `id` field of this album must be present (Some) to get songs
|
/// The `id` field of this album must be present (Some) to get songs
|
||||||
///
|
///
|
||||||
@ -527,150 +525,13 @@ impl Album {
|
|||||||
|
|
||||||
Ok(my_songs)
|
Ok(my_songs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Obtain an album from its albumid
|
|
||||||
/// # Arguments
|
|
||||||
///
|
|
||||||
/// * `album_id` - The id of the album to select
|
|
||||||
/// * `conn` - A mutable reference to a database connection
|
|
||||||
///
|
|
||||||
/// # Returns
|
|
||||||
///
|
|
||||||
/// * `Result<Album, Box<dyn Error>>` - A result indicating success with the desired album, or an error
|
|
||||||
///
|
|
||||||
#[cfg(feature = "ssr")]
|
|
||||||
pub fn get_album_data(album_id: i32, conn: &mut PgPooledConn) -> Result<AlbumData, Box<dyn Error>> {
|
|
||||||
use crate::schema::*;
|
|
||||||
|
|
||||||
let artist_list: Vec<Artist> = album_artists::table
|
|
||||||
.filter(album_artists::album_id.eq(album_id))
|
|
||||||
.inner_join(artists::table.on(album_artists::artist_id.eq(artists::id)))
|
|
||||||
.select(
|
|
||||||
artists::all_columns
|
|
||||||
)
|
|
||||||
.load(conn)?;
|
|
||||||
|
|
||||||
// Get info of album
|
|
||||||
let albuminfo = albums::table
|
|
||||||
.filter(albums::id.eq(album_id))
|
|
||||||
.first::<Album>(conn)?;
|
|
||||||
|
|
||||||
let img = albuminfo.image_path.unwrap_or("/assets/images/placeholders/MusicPlaceholder.svg".to_string());
|
|
||||||
|
|
||||||
let albumdata = AlbumData {
|
|
||||||
id: albuminfo.id.unwrap(),
|
|
||||||
title: albuminfo.title,
|
|
||||||
artists: artist_list,
|
|
||||||
release_date: albuminfo.release_date,
|
|
||||||
image_path: img
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(albumdata)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Obtain an album from its albumid
|
|
||||||
/// # Arguments
|
|
||||||
///
|
|
||||||
/// * `album_id` - The id of the album to select
|
|
||||||
/// * `conn` - A mutable reference to a database connection
|
|
||||||
///
|
|
||||||
/// # Returns
|
|
||||||
///
|
|
||||||
/// * `Result<Album, Box<dyn Error>>` - A result indicating success with the desired album, or an error
|
|
||||||
///
|
|
||||||
#[cfg(feature = "ssr")]
|
|
||||||
pub fn get_song_data(album_id: i32, user_like_dislike: Option<User>, conn: &mut PgPooledConn) -> Result<Vec<SongData>, Box<dyn Error>> {
|
|
||||||
use crate::schema::*;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
let song_list = if let Some(user_like_dislike) = user_like_dislike {
|
|
||||||
let user_like_dislike_id = user_like_dislike.id.unwrap();
|
|
||||||
let song_list: Vec<(Album, Option<Song>, Option<Artist>, Option<(i32, i32)>, Option<(i32, i32)>)> =
|
|
||||||
albums::table
|
|
||||||
.find(album_id)
|
|
||||||
.left_join(songs::table.on(albums::id.nullable().eq(songs::album_id)))
|
|
||||||
.left_join(song_artists::table.inner_join(artists::table).on(songs::id.eq(song_artists::song_id)))
|
|
||||||
.left_join(song_likes::table.on(songs::id.eq(song_likes::song_id).and(song_likes::user_id.eq(user_like_dislike_id))))
|
|
||||||
.left_join(song_dislikes::table.on(songs::id.eq(song_dislikes::song_id).and(song_dislikes::user_id.eq(user_like_dislike_id))))
|
|
||||||
.select((
|
|
||||||
albums::all_columns,
|
|
||||||
songs::all_columns.nullable(),
|
|
||||||
artists::all_columns.nullable(),
|
|
||||||
song_likes::all_columns.nullable(),
|
|
||||||
song_dislikes::all_columns.nullable()
|
|
||||||
))
|
|
||||||
.order(songs::track.asc())
|
|
||||||
.load(conn)?;
|
|
||||||
song_list
|
|
||||||
} else {
|
|
||||||
let song_list: Vec<(Album, Option<Song>, Option<Artist>)> =
|
|
||||||
albums::table
|
|
||||||
.find(album_id)
|
|
||||||
.left_join(songs::table.on(albums::id.nullable().eq(songs::album_id)))
|
|
||||||
.left_join(song_artists::table.inner_join(artists::table).on(songs::id.eq(song_artists::song_id)))
|
|
||||||
.select((
|
|
||||||
albums::all_columns,
|
|
||||||
songs::all_columns.nullable(),
|
|
||||||
artists::all_columns.nullable()
|
|
||||||
))
|
|
||||||
.order(songs::track.asc())
|
|
||||||
.load(conn)?;
|
|
||||||
|
|
||||||
let song_list: Vec<(Album, Option<Song>, Option<Artist>, Option<(i32, i32)>, Option<(i32, i32)>)> =
|
|
||||||
song_list.into_iter().map( |(album, song, artist)| (album, song, artist, None, None) ).collect();
|
|
||||||
song_list
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut album_songs: HashMap<i32, SongData> = HashMap::with_capacity(song_list.len());
|
|
||||||
|
|
||||||
for (album, song, artist, like, dislike) in song_list {
|
|
||||||
if let Some(song) = song {
|
|
||||||
if let Some(stored_songdata) = album_songs.get_mut(&song.id.unwrap()) {
|
|
||||||
// If the song is already in the map, update the artists
|
|
||||||
if let Some(artist) = artist {
|
|
||||||
stored_songdata.artists.push(artist);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let like_dislike = match (like, dislike) {
|
|
||||||
(Some(_), Some(_)) => Some((true, true)),
|
|
||||||
(Some(_), None) => Some((true, false)),
|
|
||||||
(None, Some(_)) => Some((false, true)),
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let image_path = song.image_path.unwrap_or(
|
|
||||||
album.image_path.clone().unwrap_or("/assets/images/placeholders/MusicPlaceholder.svg".to_string()));
|
|
||||||
|
|
||||||
let songdata = SongData {
|
|
||||||
id: song.id.unwrap(),
|
|
||||||
title: song.title,
|
|
||||||
artists: artist.map(|artist| vec![artist]).unwrap_or_default(),
|
|
||||||
album: Some(album),
|
|
||||||
track: song.track,
|
|
||||||
duration: song.duration,
|
|
||||||
release_date: song.release_date,
|
|
||||||
song_path: song.storage_path,
|
|
||||||
image_path: image_path,
|
|
||||||
like_dislike: like_dislike,
|
|
||||||
};
|
|
||||||
|
|
||||||
album_songs.insert(song.id.unwrap(), songdata);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort the songs by date
|
|
||||||
let mut songdata: Vec<SongData> = album_songs.into_values().collect();
|
|
||||||
songdata.sort_by(|a, b| a.track.cmp(&b.track));
|
|
||||||
Ok(songdata)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Model for a song
|
/// Model for a song
|
||||||
#[cfg_attr(feature = "ssr", derive(Queryable, Selectable, Insertable))]
|
#[cfg_attr(feature = "ssr", derive(Queryable, Selectable, Insertable))]
|
||||||
#[cfg_attr(feature = "ssr", diesel(table_name = crate::schema::songs))]
|
#[cfg_attr(feature = "ssr", diesel(table_name = crate::schema::songs))]
|
||||||
#[cfg_attr(feature = "ssr", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "ssr", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct Song {
|
pub struct Song {
|
||||||
/// A unique id for the song
|
/// A unique id for the song
|
||||||
#[cfg_attr(feature = "ssr", diesel(deserialize_as = i32))]
|
#[cfg_attr(feature = "ssr", diesel(deserialize_as = i32))]
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
pub mod login;
|
pub mod login;
|
||||||
pub mod signup;
|
pub mod signup;
|
||||||
pub mod profile;
|
pub mod profile;
|
||||||
pub mod albumpage;
|
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
use leptos::leptos_dom::*;
|
|
||||||
use leptos::*;
|
|
||||||
use leptos_router::*;
|
|
||||||
use crate::components::song_list::*;
|
|
||||||
use crate::api::album::*;
|
|
||||||
use crate::components::album_info::*;
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Params, PartialEq)]
|
|
||||||
struct AlbumParams {
|
|
||||||
id: i32
|
|
||||||
}
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
pub fn AlbumPage() -> impl IntoView {
|
|
||||||
let params = use_params::<AlbumParams>();
|
|
||||||
|
|
||||||
let id = move || {params.with(|params| {
|
|
||||||
params.as_ref()
|
|
||||||
.map(|params| params.id)
|
|
||||||
.map_err(|e| e.clone())
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
let song_list = create_resource(
|
|
||||||
id,
|
|
||||||
|value| async move {
|
|
||||||
match value {
|
|
||||||
Ok(v) => {get_songs(v).await},
|
|
||||||
Err(e) => {Err(ServerFnError::Request(format!("Error getting song data: {}", e).into()))},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
let albumdata = create_resource(
|
|
||||||
id,
|
|
||||||
|value| async move {
|
|
||||||
match value {
|
|
||||||
Ok(v) => {get_album(v).await},
|
|
||||||
Err(e) => {Err(ServerFnError::Request(format!("Error getting song data: {}", e).into()))},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
view! {
|
|
||||||
<div class="album-page-container">
|
|
||||||
<div class="album-header">
|
|
||||||
<Suspense
|
|
||||||
fallback=move || view! { <p class="loading">"Loading..."</p> }
|
|
||||||
>
|
|
||||||
{move || {
|
|
||||||
albumdata.with( |albumdata| {
|
|
||||||
match albumdata {
|
|
||||||
Some(Ok(s)) => {
|
|
||||||
view! { <AlbumInfo albumdata=(*s).clone() /> }
|
|
||||||
},
|
|
||||||
Some(Err(e)) => {
|
|
||||||
view! { <div class="error">{format!("Error loading album : {}",e)}</div> }.into_view()
|
|
||||||
},
|
|
||||||
None => {view! { }.into_view()}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
</Suspense>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Suspense
|
|
||||||
fallback=move || view! { <p class="loading">"Loading..."</p> }
|
|
||||||
>
|
|
||||||
{move || {
|
|
||||||
song_list.with( |song_list| {
|
|
||||||
match song_list {
|
|
||||||
Some(Ok(s)) => {
|
|
||||||
view! { <SongList songs=(*s).clone()/> }
|
|
||||||
},
|
|
||||||
Some(Err(e)) => {
|
|
||||||
view! { <div class="error">{format!("Error loading albums: : {}",e)}</div> }.into_view()
|
|
||||||
},
|
|
||||||
None => {view! { }.into_view()}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
</Suspense>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -4,7 +4,6 @@ use leptos::leptos_dom::*;
|
|||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_icons::*;
|
use leptos_icons::*;
|
||||||
use crate::users::UserCredentials;
|
use crate::users::UserCredentials;
|
||||||
use crate::components::loading::Loading;
|
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Login() -> impl IntoView {
|
pub fn Login() -> impl IntoView {
|
||||||
@ -13,9 +12,6 @@ pub fn Login() -> impl IntoView {
|
|||||||
|
|
||||||
let (show_password, set_show_password) = create_signal(false);
|
let (show_password, set_show_password) = create_signal(false);
|
||||||
|
|
||||||
let loading = create_rw_signal(false);
|
|
||||||
let error_msg = create_rw_signal(None);
|
|
||||||
|
|
||||||
let toggle_password = move |_| {
|
let toggle_password = move |_| {
|
||||||
set_show_password.update(|show_password| *show_password = !*show_password);
|
set_show_password.update(|show_password| *show_password = !*show_password);
|
||||||
log!("showing password");
|
log!("showing password");
|
||||||
@ -28,9 +24,6 @@ pub fn Login() -> impl IntoView {
|
|||||||
let password1 = password.get();
|
let password1 = password.get();
|
||||||
|
|
||||||
spawn_local(async move {
|
spawn_local(async move {
|
||||||
loading.set(true);
|
|
||||||
error_msg.set(None);
|
|
||||||
|
|
||||||
let user_credentials = UserCredentials {
|
let user_credentials = UserCredentials {
|
||||||
username_or_email: username_or_email1,
|
username_or_email: username_or_email1,
|
||||||
password: password1
|
password: password1
|
||||||
@ -42,7 +35,6 @@ pub fn Login() -> impl IntoView {
|
|||||||
if let Err(err) = login_result {
|
if let Err(err) = login_result {
|
||||||
// Handle the error here, e.g., log it or display to the user
|
// Handle the error here, e.g., log it or display to the user
|
||||||
log!("Error logging in: {:?}", err);
|
log!("Error logging in: {:?}", err);
|
||||||
error_msg.set(Some(err.to_string()));
|
|
||||||
|
|
||||||
// Since we're not sure what the state is, manually refetch the user
|
// Since we're not sure what the state is, manually refetch the user
|
||||||
user.refetch();
|
user.refetch();
|
||||||
@ -56,13 +48,10 @@ pub fn Login() -> impl IntoView {
|
|||||||
log!("Navigated to home page after login");
|
log!("Navigated to home page after login");
|
||||||
} else if let Ok(None) = login_result {
|
} else if let Ok(None) = login_result {
|
||||||
log!("Invalid username or password");
|
log!("Invalid username or password");
|
||||||
error_msg.set(Some("Invalid username or password".to_string()));
|
|
||||||
|
|
||||||
// User could be already logged in or not, so refetch the user
|
// User could be already logged in or not, so refetch the user
|
||||||
user.refetch();
|
user.refetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
loading.set(false);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -107,13 +96,7 @@ pub fn Login() -> impl IntoView {
|
|||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
<a href="" class="forgot-pw">Forgot Password?</a>
|
<a href="" class="forgot-pw">Forgot Password?</a>
|
||||||
<div class="error-msg" >{ move || error_msg.get() }</div>
|
|
||||||
<Show
|
|
||||||
when=move || !loading.get()
|
|
||||||
fallback=move || view! { <Loading /> }
|
|
||||||
>
|
|
||||||
<input type="submit" value="Login" />
|
<input type="submit" value="Login" />
|
||||||
</Show>
|
|
||||||
<span class="go-to-signup">
|
<span class="go-to-signup">
|
||||||
New here? <a href="/signup">Create an Account</a>
|
New here? <a href="/signup">Create an Account</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -4,7 +4,6 @@ use crate::util::state::GlobalState;
|
|||||||
use leptos::leptos_dom::*;
|
use leptos::leptos_dom::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_icons::*;
|
use leptos_icons::*;
|
||||||
use crate::components::loading::Loading;
|
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Signup() -> impl IntoView {
|
pub fn Signup() -> impl IntoView {
|
||||||
@ -14,9 +13,6 @@ pub fn Signup() -> impl IntoView {
|
|||||||
|
|
||||||
let (show_password, set_show_password) = create_signal(false);
|
let (show_password, set_show_password) = create_signal(false);
|
||||||
|
|
||||||
let loading = create_rw_signal(false);
|
|
||||||
let error_msg = create_rw_signal(None);
|
|
||||||
|
|
||||||
let toggle_password = move |_| {
|
let toggle_password = move |_| {
|
||||||
set_show_password.update(|show_password| *show_password = !*show_password);
|
set_show_password.update(|show_password| *show_password = !*show_password);
|
||||||
log!("showing password");
|
log!("showing password");
|
||||||
@ -34,16 +30,12 @@ pub fn Signup() -> impl IntoView {
|
|||||||
};
|
};
|
||||||
log!("new user: {:?}", new_user);
|
log!("new user: {:?}", new_user);
|
||||||
|
|
||||||
loading.set(true);
|
|
||||||
error_msg.set(None);
|
|
||||||
|
|
||||||
let user = GlobalState::logged_in_user();
|
let user = GlobalState::logged_in_user();
|
||||||
|
|
||||||
spawn_local(async move {
|
spawn_local(async move {
|
||||||
if let Err(err) = signup(new_user.clone()).await {
|
if let Err(err) = signup(new_user.clone()).await {
|
||||||
// Handle the error here, e.g., log it or display to the user
|
// Handle the error here, e.g., log it or display to the user
|
||||||
log!("Error signing up: {:?}", err);
|
log!("Error signing up: {:?}", err);
|
||||||
error_msg.set(Some(err.to_string()));
|
|
||||||
|
|
||||||
// Since we're not sure what the state is, manually refetch the user
|
// Since we're not sure what the state is, manually refetch the user
|
||||||
user.refetch();
|
user.refetch();
|
||||||
@ -57,8 +49,6 @@ pub fn Signup() -> impl IntoView {
|
|||||||
leptos_router::use_navigate()("/", Default::default());
|
leptos_router::use_navigate()("/", Default::default());
|
||||||
log!("Navigated to home page after signup")
|
log!("Navigated to home page after signup")
|
||||||
}
|
}
|
||||||
|
|
||||||
loading.set(false);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -109,13 +99,7 @@ pub fn Signup() -> impl IntoView {
|
|||||||
</button>
|
</button>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
<div class="error-msg">{ move || error_msg.get() }</div>
|
|
||||||
<Show
|
|
||||||
when=move || !loading.get()
|
|
||||||
fallback=move || view!{ <Loading /> }
|
|
||||||
>
|
|
||||||
<input type="submit" value="Sign Up" />
|
<input type="submit" value="Sign Up" />
|
||||||
</Show>
|
|
||||||
<span class="go-to-login">
|
<span class="go-to-login">
|
||||||
Already Have an Account? <a href="/login" class="link" >Go to Login</a>
|
Already Have an Account? <a href="/login" class="link" >Go to Login</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -489,7 +489,7 @@ pub fn PlayBar() -> impl IntoView {
|
|||||||
|
|
||||||
// Listen for key down events -- arrow keys don't seem to trigger key press events
|
// Listen for key down events -- arrow keys don't seem to trigger key press events
|
||||||
let _arrow_key_handle = window_event_listener(ev::keydown, move |e: ev::KeyboardEvent| {
|
let _arrow_key_handle = window_event_listener(ev::keydown, move |e: ev::KeyboardEvent| {
|
||||||
if e.key() == "ArrowRight" {
|
if e.key() == "ArrowRight" && status.with_untracked(|status| status.search_active) == false {
|
||||||
e.prevent_default();
|
e.prevent_default();
|
||||||
log!("Right arrow key pressed, skipping forward by {} seconds", ARROW_KEY_SKIP_TIME);
|
log!("Right arrow key pressed, skipping forward by {} seconds", ARROW_KEY_SKIP_TIME);
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ pub fn PlayBar() -> impl IntoView {
|
|||||||
error!("Unable to skip forward: Unable to get current duration");
|
error!("Unable to skip forward: Unable to get current duration");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if e.key() == "ArrowLeft" {
|
} else if e.key() == "ArrowLeft" && status.with_untracked(|status| status.search_active) == false {
|
||||||
e.prevent_default();
|
e.prevent_default();
|
||||||
log!("Left arrow key pressed, skipping backward by {} seconds", ARROW_KEY_SKIP_TIME);
|
log!("Left arrow key pressed, skipping backward by {} seconds", ARROW_KEY_SKIP_TIME);
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ pub fn PlayBar() -> impl IntoView {
|
|||||||
|
|
||||||
// Listen for space bar presses to play/pause
|
// Listen for space bar presses to play/pause
|
||||||
let _space_bar_handle = window_event_listener(ev::keypress, move |e: ev::KeyboardEvent| {
|
let _space_bar_handle = window_event_listener(ev::keypress, move |e: ev::KeyboardEvent| {
|
||||||
if e.key() == " " {
|
if e.key() == " " && status.with_untracked(|status| status.search_active) == false {
|
||||||
e.prevent_default();
|
e.prevent_default();
|
||||||
log!("Space bar pressed, toggling play/pause");
|
log!("Space bar pressed, toggling play/pause");
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ pub struct PlayStatus {
|
|||||||
pub playing: bool,
|
pub playing: bool,
|
||||||
/// Whether or not the queue is open
|
/// Whether or not the queue is open
|
||||||
pub queue_open: bool,
|
pub queue_open: bool,
|
||||||
|
/// Whether or not the search bar is active (useful for knowing when spacebar to play/pause, etc should be disabled)
|
||||||
|
pub search_active: bool,
|
||||||
/// A reference to the HTML audio element
|
/// A reference to the HTML audio element
|
||||||
pub audio_player: Option<NodeRef<Audio>>,
|
pub audio_player: Option<NodeRef<Audio>>,
|
||||||
/// A queue of songs that have been played, ordered from oldest to newest
|
/// A queue of songs that have been played, ordered from oldest to newest
|
||||||
@ -56,6 +58,7 @@ impl Default for PlayStatus {
|
|||||||
Self {
|
Self {
|
||||||
playing: false,
|
playing: false,
|
||||||
queue_open: false,
|
queue_open: false,
|
||||||
|
search_active: false,
|
||||||
audio_player: None,
|
audio_player: None,
|
||||||
history: VecDeque::new(),
|
history: VecDeque::new(),
|
||||||
queue: VecDeque::new(),
|
queue: VecDeque::new(),
|
||||||
|
@ -39,10 +39,11 @@ if #[cfg(feature = "ssr")] {
|
|||||||
/// # Returns
|
/// # Returns
|
||||||
/// A Result containing a vector of albums if the search was successful, or an error if the search failed
|
/// A Result containing a vector of albums if the search was successful, or an error if the search failed
|
||||||
#[server(endpoint = "search_albums")]
|
#[server(endpoint = "search_albums")]
|
||||||
pub async fn search_albums(query: String, limit: i64) -> Result<Vec<Album>, ServerFnError> {
|
pub async fn search_albums(query: String, limit: i64) -> Result<Vec<(Album, f32)>, ServerFnError> {
|
||||||
use crate::schema::albums::dsl::*;
|
use crate::schema::albums::dsl::*;
|
||||||
|
|
||||||
Ok(albums
|
Ok(albums
|
||||||
|
.select((albums::all_columns(), trgm_distance(title, query.clone())))
|
||||||
.filter(trgm_similar(title, query.clone()))
|
.filter(trgm_similar(title, query.clone()))
|
||||||
.order_by(trgm_distance(title, query))
|
.order_by(trgm_distance(title, query))
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
@ -58,10 +59,11 @@ pub async fn search_albums(query: String, limit: i64) -> Result<Vec<Album>, Serv
|
|||||||
/// # Returns
|
/// # Returns
|
||||||
/// A Result containing a vector of artists if the search was successful, or an error if the search failed
|
/// A Result containing a vector of artists if the search was successful, or an error if the search failed
|
||||||
#[server(endpoint = "search_artists")]
|
#[server(endpoint = "search_artists")]
|
||||||
pub async fn search_artists(query: String, limit: i64) -> Result<Vec<Artist>, ServerFnError> {
|
pub async fn search_artists(query: String, limit: i64) -> Result<Vec<(Artist, f32)>, ServerFnError> {
|
||||||
use crate::schema::artists::dsl::*;
|
use crate::schema::artists::dsl::*;
|
||||||
|
|
||||||
Ok(artists
|
Ok(artists
|
||||||
|
.select((artists::all_columns(), trgm_distance(name, query.clone())))
|
||||||
.filter(trgm_similar(name, query.clone()))
|
.filter(trgm_similar(name, query.clone()))
|
||||||
.order_by(trgm_distance(name, query))
|
.order_by(trgm_distance(name, query))
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
@ -77,10 +79,11 @@ pub async fn search_artists(query: String, limit: i64) -> Result<Vec<Artist>, Se
|
|||||||
/// # Returns
|
/// # Returns
|
||||||
/// A Result containing a vector of songs if the search was successful, or an error if the search failed
|
/// A Result containing a vector of songs if the search was successful, or an error if the search failed
|
||||||
#[server(endpoint = "search_songs")]
|
#[server(endpoint = "search_songs")]
|
||||||
pub async fn search_songs(query: String, limit: i64) -> Result<Vec<Song>, ServerFnError> {
|
pub async fn search_songs(query: String, limit: i64) -> Result<Vec<(Song, f32)>, ServerFnError> {
|
||||||
use crate::schema::songs::dsl::*;
|
use crate::schema::songs::dsl::*;
|
||||||
|
|
||||||
Ok(songs
|
Ok(songs
|
||||||
|
.select((songs::all_columns(), trgm_distance(title, query.clone())))
|
||||||
.filter(trgm_similar(title, query.clone()))
|
.filter(trgm_similar(title, query.clone()))
|
||||||
.order_by(trgm_distance(title, query))
|
.order_by(trgm_distance(title, query))
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
@ -95,9 +98,10 @@ pub async fn search_songs(query: String, limit: i64) -> Result<Vec<Song>, Server
|
|||||||
/// `limit` - The maximum number of results to return for each type
|
/// `limit` - The maximum number of results to return for each type
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// A Result containing a tuple of vectors of albums, artists, and songs if the search was successful,
|
/// A Result containing a tuple of vectors of albums, artists, and songs,
|
||||||
|
/// along with respective similarity scores, if the search was successful.
|
||||||
#[server(endpoint = "search")]
|
#[server(endpoint = "search")]
|
||||||
pub async fn search(query: String, limit: i64) -> Result<(Vec<Album>, Vec<Artist>, Vec<Song>), ServerFnError> {
|
pub async fn search(query: String, limit: i64) -> Result<(Vec<(Album, f32)>, Vec<(Artist, f32)>, Vec<(Song, f32)>), ServerFnError> {
|
||||||
let albums = search_albums(query.clone(), limit);
|
let albums = search_albums(query.clone(), limit);
|
||||||
let artists = search_artists(query.clone(), limit);
|
let artists = search_artists(query.clone(), limit);
|
||||||
let songs = search_songs(query.clone(), limit);
|
let songs = search_songs(query.clone(), limit);
|
||||||
|
@ -3,9 +3,9 @@ use leptos::*;
|
|||||||
#[component]
|
#[component]
|
||||||
pub fn Song(song_image_path: String, song_title: String, song_artist: String) -> impl IntoView {
|
pub fn Song(song_image_path: String, song_title: String, song_artist: String) -> impl IntoView {
|
||||||
view!{
|
view!{
|
||||||
<div class="queue-song">
|
<div class="song">
|
||||||
<img src={song_image_path} alt={song_title.clone()} />
|
<img src={song_image_path} alt={song_title.clone()} />
|
||||||
<div class="queue-song-info">
|
<div class="song-info">
|
||||||
<h3>{song_title}</h3>
|
<h3>{song_title}</h3>
|
||||||
<p>{song_artist}</p>
|
<p>{song_artist}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -117,7 +117,7 @@ pub async fn validate_user(credentials: UserCredentials) -> Result<Option<User>,
|
|||||||
|
|
||||||
/// Get a user from the database by username or email
|
/// Get a user from the database by username or email
|
||||||
/// Returns a Result with the user if found, None if not found, or an error if there was a problem
|
/// Returns a Result with the user if found, None if not found, or an error if there was a problem
|
||||||
#[server(endpoint = "find_user")]
|
#[server(endpoint = "get_user")]
|
||||||
pub async fn get_user(username_or_email: String) -> Result<Option<User>, ServerFnError> {
|
pub async fn get_user(username_or_email: String) -> Result<Option<User>, ServerFnError> {
|
||||||
let mut user = find_user(username_or_email).await?;
|
let mut user = find_user(username_or_email).await?;
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ use cfg_if::cfg_if;
|
|||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "ssr")] {
|
if #[cfg(feature = "ssr")] {
|
||||||
pub mod audio;
|
pub mod audio;
|
||||||
pub mod require_auth;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
use axum::extract::Request;
|
|
||||||
use axum::response::Response;
|
|
||||||
use axum::body::Body;
|
|
||||||
use axum::middleware::Next;
|
|
||||||
use axum_login::AuthSession;
|
|
||||||
use http::StatusCode;
|
|
||||||
|
|
||||||
use crate::auth_backend::AuthBackend;
|
|
||||||
|
|
||||||
use axum::extract::FromRequestParts;
|
|
||||||
|
|
||||||
// Things in pkg/ are allowed automatically. This includes the CSS/JS/WASM files
|
|
||||||
const ALLOWED_PATHS: [&str; 5] = ["/login", "/signup", "/api/login", "/api/signup", "/favicon.ico"];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Middleware to require authentication for all paths except those in ALLOWED_PATHS
|
|
||||||
*
|
|
||||||
* If a user is not authenticated, they will be redirected to the login page
|
|
||||||
*/
|
|
||||||
pub async fn require_auth_middleware(req: Request, next: Next) -> Result<Response<Body>, (StatusCode, &'static str)> {
|
|
||||||
let path = req.uri().path();
|
|
||||||
|
|
||||||
if !ALLOWED_PATHS.iter().any(|&x| x == path) {
|
|
||||||
let (mut parts, body) = req.into_parts();
|
|
||||||
|
|
||||||
let auth_session = AuthSession::<AuthBackend>::from_request_parts(&mut parts, &())
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
if auth_session.user.is_none() {
|
|
||||||
let response = Response::builder()
|
|
||||||
.status(StatusCode::TEMPORARY_REDIRECT)
|
|
||||||
.header("Location", "/login")
|
|
||||||
.body(Body::empty())
|
|
||||||
.map_err(|_| (StatusCode::INTERNAL_SERVER_ERROR, "Failed to build response"))?;
|
|
||||||
|
|
||||||
return Ok(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
let req = Request::from_parts(parts, body);
|
|
||||||
let response = next.run(req).await;
|
|
||||||
Ok(response)
|
|
||||||
} else {
|
|
||||||
let response = next.run(req).await;
|
|
||||||
Ok(response)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
@import 'theme.scss';
|
|
||||||
|
|
||||||
.album-page-container {
|
|
||||||
width: 90vw;
|
|
||||||
|
|
||||||
.album-header {
|
|
||||||
height: 40vh;
|
|
||||||
width: 65vw;
|
|
||||||
margin: auto;
|
|
||||||
|
|
||||||
|
|
||||||
padding:20px;
|
|
||||||
|
|
||||||
background-image: linear-gradient($accent-color, $background-color);
|
|
||||||
border-radius: 15px;
|
|
||||||
|
|
||||||
.album-info {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-info {
|
|
||||||
display: flex;
|
|
||||||
flex-flow: row nowrap;
|
|
||||||
justify-content: space-around;
|
|
||||||
|
|
||||||
.album-image {
|
|
||||||
max-width: 80%;
|
|
||||||
max-height: 80%;
|
|
||||||
box-shadow: 10px 10px 50px -10px $background-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-body {
|
|
||||||
display: flex;
|
|
||||||
flex-flow: column nowrap;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
.album-title {
|
|
||||||
color: $text-controls-color;
|
|
||||||
font-size: 40px;
|
|
||||||
font-weight: bold;
|
|
||||||
margin:15px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-artists {
|
|
||||||
display: flex;
|
|
||||||
flex-flow: row wrap;
|
|
||||||
justify-content: space-around;
|
|
||||||
align-content: space-around;
|
|
||||||
margin:15px;
|
|
||||||
|
|
||||||
color: $text-controls-color;
|
|
||||||
font-size: 20px;
|
|
||||||
|
|
||||||
.album-artist {
|
|
||||||
margin: 5px;
|
|
||||||
text-align: center;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: $text-controls-color;
|
|
||||||
}
|
|
||||||
a:visited {
|
|
||||||
color: $text-controls-color;
|
|
||||||
}
|
|
||||||
a:hover {
|
|
||||||
color: $controls-hover-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:active {
|
|
||||||
color: $controls-click-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
140
style/login.scss
140
style/login.scss
@ -8,56 +8,144 @@
|
|||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
width: 27rem;
|
width: 27rem;
|
||||||
height: 30rem; /* Slightly adjusted height for better layout */
|
height: 30rem;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
background: $auth-containers;
|
background: $auth-containers;
|
||||||
z-index: 10; /* Increased z-index for better stacking context */
|
z-index: 1;
|
||||||
border-radius: 0.5rem; /* Adjusted unit */
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1); /* Added subtle shadow */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-container .header h1 {
|
.login-container .header h1 {
|
||||||
margin-top: 2.5rem; /* Adjusted margin for alignment */
|
margin-top: 3rem;
|
||||||
font-size: 2.4rem; /* Slightly smaller for consistency */
|
font-size: 2.5rem;
|
||||||
color: $accent-color;
|
color: $accent-color;
|
||||||
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2); /* Added slight text shadow */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-container .login-form {
|
.login-container .login-form {
|
||||||
width: 80%; /* Adjusted width for responsiveness */
|
width: 75%;
|
||||||
|
}
|
||||||
|
.login-form .input-box:first-child {
|
||||||
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form .input-box {
|
.login-form .input-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 2.5rem; /* Adjusted spacing */
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form .input-box input {
|
.login-form .input-box input {
|
||||||
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 1.1rem 0 0.6rem; /* Adjusted padding */
|
max-width: 34vw;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.2); /* Added subtle border */
|
padding: 17px 0px 10px;
|
||||||
border-radius: 0.3rem; /* Added border radius */
|
background: transparent;
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
color: #23242a;
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
font-weight: 400;
|
||||||
|
letter-spacing: 0px;
|
||||||
|
text-indent: 10px;
|
||||||
|
vertical-align: middle;
|
||||||
|
z-index: 10;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form .input-box span {
|
.login-form .input-box span {
|
||||||
padding: 0.8rem 0 0.5rem; /* Adjusted padding */
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
padding: 15px 0px 10px;
|
||||||
|
pointer-events: none;
|
||||||
|
color: black;
|
||||||
|
font-size: 1.19em;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
transition: 0.5s;
|
||||||
|
}
|
||||||
|
.login-form .input-box input:valid ~ span,
|
||||||
|
.login-form .input-box input:focus ~ span {
|
||||||
|
color: rgb(94, 93, 93);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
transform: translateY(-30px);
|
||||||
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form .input-box i {
|
.login-form .input-box i {
|
||||||
height: 0.2rem; /* Adjusted height for better visual hierarchy */
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 2px;
|
||||||
|
background: $auth-inputs;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: 0.5s;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login-form .input-box input:valid ~ i,
|
||||||
|
.login-form .input-box input:focus ~ i {
|
||||||
|
height: 2.6rem;
|
||||||
|
}
|
||||||
|
.login-form .forgot-pw {
|
||||||
|
display: inline-flex;
|
||||||
|
margin-top: 3px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #8f8f8f;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.login-form .forgot-pw:hover {
|
||||||
|
color: #fff;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
.login-form input[type="submit"] {
|
.login-form input[type="submit"] {
|
||||||
margin-top: 2.5rem; /* Adjusted spacing */
|
margin-top: 3rem;
|
||||||
|
width: 100%;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
color: rgb(210, 207, 207);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 600;
|
||||||
background-color: $accent-color;
|
background-color: $accent-color;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3); /* Added border for consistency */
|
|
||||||
}
|
}
|
||||||
|
.login-form .go-to-signup {
|
||||||
|
color: #8f8f8f;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
.login-form .go-to-signup a {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #8f8f8f;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.login-form .go-to-signup a:hover {
|
||||||
|
color: black;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
.login-container .return {
|
.login-container .return {
|
||||||
top: 15px; /* Adjusted position for better alignment */
|
position: absolute;
|
||||||
left: 15px; /* Adjusted position for better alignment */
|
left: 10px;
|
||||||
padding: 0.4rem; /* Adjusted padding */
|
top: 10px;
|
||||||
background-color: rgba(255, 255, 255, 0.1); /* Added subtle background */
|
font-size: 1.8rem;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0.3rem;
|
||||||
|
}
|
||||||
|
.login-container .return:hover {
|
||||||
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
|
}
|
||||||
|
.login-password-visibility {
|
||||||
|
position: absolute;
|
||||||
|
font-size: 1.7rem;
|
||||||
|
top: 28%;
|
||||||
|
right: 5px;
|
||||||
|
z-index: 5;
|
||||||
|
cursor: pointer;
|
||||||
|
border: none;
|
||||||
|
background-color: transparent;
|
||||||
|
color: white;
|
||||||
}
|
}
|
@ -15,7 +15,6 @@
|
|||||||
@import 'song_list.scss';
|
@import 'song_list.scss';
|
||||||
@import 'profile.scss';
|
@import 'profile.scss';
|
||||||
@import 'loading.scss';
|
@import 'loading.scss';
|
||||||
@import 'album_page.scss';
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
|
@ -11,19 +11,9 @@
|
|||||||
border-radius: 0.4rem;
|
border-radius: 0.4rem;
|
||||||
margin: 0.2rem;
|
margin: 0.2rem;
|
||||||
min-height: 6rem;
|
min-height: 6rem;
|
||||||
border: 0.2rem solid rgba(89, 89, 89, 0.199);
|
border: 2px solid rgba(89, 89, 89, 0.199);
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
|
|
||||||
.profile-name {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
margin-left: 0.5rem;
|
|
||||||
h1 {
|
|
||||||
font-size: 1.2rem;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile-icon {
|
.profile-icon {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
padding: 0.2rem;
|
padding: 0.2rem;
|
||||||
@ -31,23 +21,17 @@
|
|||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
height: 45;
|
height: max-content;
|
||||||
width: 45;
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
.profile-image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-icon:hover {
|
.profile-icon:hover {
|
||||||
transform: scale(1.05);
|
transform: scale(1.1);
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-icon:active {
|
.profile-icon:active {
|
||||||
transform: scale(0.95);
|
transform: scale(0.8);
|
||||||
}
|
}
|
||||||
.dropdown-container {
|
.dropdown-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -57,10 +41,10 @@
|
|||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
width: 10rem;
|
width: 10rem;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
background-color: #1c1c1c;
|
background-color: red;
|
||||||
border: 0.2rem solid rgba(89, 89, 89, 0.199);
|
border: 1px solid grey;
|
||||||
|
|
||||||
.dropdown-logged {
|
.dropdown-not-logged {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -69,29 +53,21 @@
|
|||||||
h1 {
|
h1 {
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
.profile-info {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
border-top: 0.2rem solid rgba(89, 89, 89, 0.199);
|
|
||||||
border-bottom: 0.2rem solid rgba(89, 89, 89, 0.199);
|
|
||||||
h1 {
|
|
||||||
font-size: 1rem;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.auth-button {
|
.auth-button {
|
||||||
margin-top: 0.5rem;
|
|
||||||
padding: 0.5rem;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
background-color: #1c1c1c;
|
|
||||||
border: 0.2rem solid rgba(89, 89, 89, 0.199);
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.3s;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.dropdown-container:before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: -0.4rem;
|
||||||
|
right: 0.92rem;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
background-color: red;
|
||||||
|
border-left: 1px solid grey;
|
||||||
|
border-top: 1px solid grey;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@import "theme.scss";
|
@import 'theme.scss';
|
||||||
|
|
||||||
.playbar {
|
.playbar {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: $playbar-size;
|
height: $playbar-size;
|
||||||
@ -6,81 +7,101 @@
|
|||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
||||||
.invisible-media-progress {
|
.invisible-media-progress {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 0.875rem;
|
height: 14px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
padding-top: 0.4375rem;
|
padding-top: 7px;
|
||||||
|
|
||||||
.media-progress {
|
.media-progress {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 0.1875rem;
|
height: 3px;
|
||||||
background-color: $controls-click-color;
|
background-color: $controls-click-color;
|
||||||
|
|
||||||
.media-progress-solid {
|
.media-progress-solid {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 0.1875rem;
|
height: 3px;
|
||||||
background: linear-gradient(90deg, $play-grad-start, $play-grad-end);
|
background: linear-gradient(90deg, $play-grad-start, $play-grad-end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-progress-solid::before {
|
.media-progress-solid::before {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: 0.1875rem;
|
height: 3px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: linear-gradient(90deg, $play-grad-start, $play-grad-end);
|
background: linear-gradient(90deg, $play-grad-start, $play-grad-end);
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
filter: blur(0.1875rem);
|
filter: blur(3px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.playbar-left-group {
|
.playbar-left-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
margin-left: 0.625rem;
|
margin-left: 10px;
|
||||||
|
|
||||||
.media-info-img {
|
.media-info-img {
|
||||||
width: 3.125rem;
|
width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-info-text {
|
.media-info-text {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin-left: 0.625rem;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.like-dislike {
|
.like-dislike {
|
||||||
margin-left: 1.25rem;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.playcontrols {
|
.playcontrols {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.playduration {
|
.playduration {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0.625rem;
|
right: 10px;
|
||||||
top: 0.8125rem;
|
top: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.queue-toggle {
|
.queue-toggle {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0.8125rem;
|
bottom: 13px;
|
||||||
top: 0.8125rem;
|
top: 13px;
|
||||||
right: 5.625rem;
|
right: 90px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
.hmirror {
|
.hmirror {
|
||||||
|
-moz-transform: scale(-1, 1);
|
||||||
|
-webkit-transform: scale(-1, 1);
|
||||||
|
-o-transform: scale(-1, 1);
|
||||||
|
-ms-transform: scale(-1, 1);
|
||||||
transform: scale(-1, 1);
|
transform: scale(-1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.controlbtn {
|
.controlbtn {
|
||||||
color: $text-controls-color;
|
color: $text-controls-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.controlbtn:hover {
|
.controlbtn:hover {
|
||||||
color: $controls-hover-color;
|
color: $controls-hover-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.controlbtn:active {
|
.controlbtn:active {
|
||||||
color: $controls-click-color;
|
color: $controls-click-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: none;
|
border: transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: calc(100% - 78.9px); /* Adjust height to fit the queue */
|
height: calc(100% - 87px); /* Adjust height to fit the queue */
|
||||||
background-color: #424242; /* Queue background color */
|
background-color: #424242; /* Queue background color */
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||||
overflow-y: auto; /* Add scroll bar when queue is too long */
|
overflow-y: auto; /* Add scroll bar when queue is too long */
|
||||||
|
margin: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
|
||||||
.queue-header {
|
.queue-header {
|
||||||
background-color: #333; /* Header background color */
|
background-color: #333; /* Header background color */
|
||||||
@ -30,31 +32,6 @@
|
|||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
|
|
||||||
.queue-song {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 10px;
|
|
||||||
border-bottom: 1px solid #ccc; /* Separator line color */
|
|
||||||
|
|
||||||
img {
|
|
||||||
max-width: 50px; /* Adjust maximum width for images */
|
|
||||||
margin-right: 10px; /* Add spacing between image and text */
|
|
||||||
border-radius: 5px; /* Add border radius to image */
|
|
||||||
}
|
|
||||||
|
|
||||||
.queue-song-info {
|
|
||||||
h3 {
|
|
||||||
margin: 0; /* Remove default margin for heading */
|
|
||||||
color: #fff; /* Adjust text color for song */
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 0; /* Remove default margin for paragraph */
|
|
||||||
color: #aaa; /* Adjust text color for artist */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
button {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -1,4 +1,92 @@
|
|||||||
@import "theme.scss";
|
@import "theme.scss";
|
||||||
|
|
||||||
.search-container {
|
.search-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
.search-bar {
|
||||||
|
input[type="search"] {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
border: 1px solid $search-border;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: border-color 0.2s;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
border-color: $accent-color;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-results {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
.search-result-list {
|
||||||
|
flex: 1;
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.search-result {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border: 1px solid $search-border;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: $search-background;
|
||||||
|
transition: box-shadow 0.2s;
|
||||||
|
margin: 0.2rem;
|
||||||
|
min-height: 6rem;
|
||||||
|
|
||||||
|
.result-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.search-result-album,
|
||||||
|
.search-result-artist {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-item-type {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: $text-controls-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-side-result {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
|
||||||
|
.search-result-options {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.search-result-options-icon {
|
||||||
|
fill: $text-controls-color;
|
||||||
|
transition: fill 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
fill: $controls-hover-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
fill: $controls-click-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,154 +17,135 @@
|
|||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
width: 27rem;
|
width: 27rem;
|
||||||
height: 36rem;
|
height: 35rem;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
background: $auth-containers;
|
background: $auth-containers;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
border-radius: 0.5rem;
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-container .header h1 {
|
.signup-container .header h1 {
|
||||||
margin-top: 3rem;
|
margin-top: 3rem;
|
||||||
font-size: 2.5rem;
|
font-size: 2.5rem;
|
||||||
color: $accent-color;
|
color: $accent-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-container .signup-form {
|
.signup-container .signup-form {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .input-box {
|
.signup-form .input-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 3rem;
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .input-box:first-child {
|
.signup-form .input-box:first-child {
|
||||||
margin-top: 0.7rem;
|
margin-top: 0.7rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .input-box input {
|
.signup-form .input-box input {
|
||||||
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 1.0625rem 0 0.625rem;
|
max-width: 34vw;
|
||||||
|
padding: 17px 0px 10px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
outline: none;
|
outline: none;
|
||||||
border: none;
|
border: none;
|
||||||
color: #fff;
|
box-shadow: none;
|
||||||
font-size: 1.1rem;
|
color: #23242a;
|
||||||
|
font-size: 1.1em;
|
||||||
font-family: "Roboto", sans-serif;
|
font-family: "Roboto", sans-serif;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
text-indent: 0.625rem;
|
letter-spacing: 0px;
|
||||||
|
text-indent: 10px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
z-index: 10;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .input-box span {
|
.signup-form .input-box span {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
padding: 0.9375rem 0 0.625rem;
|
padding: 15px 0px 10px;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
color: black;
|
color: black;
|
||||||
font-size: 1.19rem;
|
font-size: 1.19em;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
transition: 0.5s;
|
transition: 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .input-box input:valid ~ span,
|
.signup-form .input-box input:valid ~ span,
|
||||||
.signup-form .input-box input:focus ~ span {
|
.signup-form .input-box input:focus ~ span {
|
||||||
color: rgb(94, 93, 93);
|
color: rgb(94, 93, 93);
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
transform: translateY(-1.875rem);
|
transform: translateY(-30px);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .input-box i {
|
.signup-form .input-box i {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 0.125rem;
|
height: 2px;
|
||||||
background: $auth-inputs;
|
background: $auth-inputs;
|
||||||
border-radius: 0.25rem;
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
transition: 0.5s;
|
transition: 0.5s;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .input-box input:valid ~ i,
|
.signup-form .input-box input:valid ~ i,
|
||||||
.signup-form .input-box input:focus ~ i {
|
.signup-form .input-box input:focus ~ i {
|
||||||
height: 1.625rem;
|
height: 2.6rem;
|
||||||
}
|
|
||||||
|
|
||||||
.signup-form .error-msg {
|
|
||||||
color: $error-color;
|
|
||||||
margin-top: 1rem;
|
|
||||||
height: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.signup-form .loading {
|
|
||||||
margin-top: 4.5rem;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
margin-bottom: calc(1.5rem - 10px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form input[type="submit"] {
|
.signup-form input[type="submit"] {
|
||||||
margin-top: 3.5rem;
|
margin-top: 3.5rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 2.8125rem;
|
height: 45px;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0.5rem;
|
border-radius: 8px;
|
||||||
color: white;
|
color: white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
background-color: $accent-color;
|
background-color: $accent-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .go-to-login {
|
.signup-form .go-to-login {
|
||||||
color: #8f8f8f;
|
color: #8f8f8f;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .go-to-login a {
|
.signup-form .go-to-login a {
|
||||||
|
cursor: pointer;
|
||||||
color: #8f8f8f;
|
color: #8f8f8f;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-form .go-to-login a:hover {
|
.signup-form .go-to-login a:hover {
|
||||||
color: black;
|
color: black;
|
||||||
transition: color 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-container .return {
|
.signup-container .return {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0.625rem;
|
left: 10px;
|
||||||
top: 0.625rem;
|
top: 10px;
|
||||||
font-size: 1.8rem;
|
font-size: 1.8rem;
|
||||||
color: white;
|
color: white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 0.5rem;
|
transition: all 0.3s;
|
||||||
|
border-radius: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 0.3rem;
|
padding: 0.3rem;
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.signup-container .return:hover {
|
.signup-container .return:hover {
|
||||||
background-color: rgba(0, 0, 0, 0.4);
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.password-visibility {
|
.password-visibility {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
font-size: 1.7rem;
|
font-size: 1.7rem;
|
||||||
top: 28%;
|
top: 28%;
|
||||||
right: 0.3125rem;
|
right: 5px;
|
||||||
|
z-index: 5;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pw-requirements {
|
.pw-requirements {
|
||||||
font-size: 0.7rem;
|
font-size: 0.7rem;
|
||||||
}
|
}
|
||||||
|
22
style/song.scss
Normal file
22
style/song.scss
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
.song {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 50px; /* Adjust maximum width for images */
|
||||||
|
margin-right: 10px; /* Add spacing between image and text */
|
||||||
|
border-radius: 5px; /* Add border radius to image */
|
||||||
|
}
|
||||||
|
|
||||||
|
.song-info {
|
||||||
|
h3 {
|
||||||
|
margin: 0;
|
||||||
|
color: #fff; /* Adjust text color for song */
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
color: #aaa; /* Adjust text color for artist */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,13 +3,16 @@ table.song-list {
|
|||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
|
||||||
tr.song-list-item {
|
tr.song-list-item {
|
||||||
border: 1px solid #303030; /* Simplified border shorthand */
|
border: solid;
|
||||||
|
border-width: 1px 0;
|
||||||
|
border-color: #303030;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
td {
|
td {
|
||||||
color: $text-controls-color;
|
color: $text-controls-color;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding: 0.6rem; /* Adjusted padding for consistency */
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -22,25 +25,27 @@ table.song-list {
|
|||||||
}
|
}
|
||||||
|
|
||||||
td.song-image {
|
td.song-image {
|
||||||
width: 2.2rem; /* Replaced static px with rem */
|
width: 35px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
img.song-image {
|
img.song-image {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
-ms-transform: translateY(-50%);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
width: 2.2rem; /* Adjusted to rem */
|
width: 35px;
|
||||||
height: 2.2rem; /* Adjusted to rem */
|
height: 35px;
|
||||||
border-radius: 0.3rem; /* Adjusted radius */
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
svg.song-image-overlay {
|
svg.song-image-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
-ms-transform: translateY(-50%);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
width: 2.2rem; /* Adjusted to rem */
|
width: 35px;
|
||||||
height: 2.2rem; /* Adjusted to rem */
|
height: 35px;
|
||||||
border-radius: 0.3rem; /* Adjusted radius */
|
border-radius: 5px;
|
||||||
fill: $text-controls-color;
|
fill: $text-controls-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +68,11 @@ table.song-list {
|
|||||||
|
|
||||||
button {
|
button {
|
||||||
svg.hmirror {
|
svg.hmirror {
|
||||||
transform: scale(-1, 1); /* Removed redundant prefixes */
|
-moz-transform: scale(-1, 1);
|
||||||
|
-webkit-transform: scale(-1, 1);
|
||||||
|
-o-transform: scale(-1, 1);
|
||||||
|
-ms-transform: scale(-1, 1);
|
||||||
|
transform: scale(-1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.controlbtn {
|
.controlbtn {
|
||||||
@ -79,7 +88,7 @@ table.song-list {
|
|||||||
}
|
}
|
||||||
|
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: none; /* Simplified border */
|
border: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide-until-hover {
|
.hide-until-hover {
|
||||||
@ -112,4 +121,4 @@ table.song-list {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ $controls-click-color: #909090;
|
|||||||
$play-bar-background-color: #212121;
|
$play-bar-background-color: #212121;
|
||||||
$play-grad-start: #0a0533;
|
$play-grad-start: #0a0533;
|
||||||
$play-grad-end: $accent-color;
|
$play-grad-end: $accent-color;
|
||||||
$border-color: #7851ed;
|
|
||||||
$queue-background-color: $play-bar-background-color;
|
$queue-background-color: $play-bar-background-color;
|
||||||
$error-color: red;
|
$search-background: $play-bar-background-color;
|
||||||
|
$search-border: #3f3f3f;
|
||||||
|
|
||||||
$auth-inputs: #796dd4;
|
$auth-inputs: #796dd4;
|
||||||
$auth-containers: white;
|
$auth-containers: white;
|
||||||
|
Reference in New Issue
Block a user