Skip to content

Commit

Permalink
Fix redirection from search page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovenoboyo committed Dec 18, 2024
1 parent c9014c8 commit 47e14a4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"withGlobalTauri": true
},
"build": {
"beforeDevCommand": "trunk serve --config ../Trunk.toml",
"beforeDevCommand": "trunk serve",
"beforeBuildCommand": "pwd && trunk build --release",
"devUrl": "http://localhost:1420",
"frontendDist": "../dist"
Expand Down
2 changes: 2 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{
components::{
better_animated_outlet::AnimatedOutletSimultaneous, prefs::static_components::SettingRoutes,
},
console_info,
pages::explore::Explore,
players::librespot::LibrespotPlayer,
store::ui_store::UiStore,
Expand Down Expand Up @@ -50,6 +51,7 @@ use crate::{
#[tracing::instrument(level = "trace", skip())]
#[component]
pub fn RedirectAll() -> impl IntoView {
tracing::info!("Current location {:?}", window().location().href());
view! { <Redirect path="/main/allsongs" /> }
}

Expand Down
7 changes: 6 additions & 1 deletion src/components/cardview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub fn CardView<T, S, C>(
#[prop()] card_item: C,
#[prop(optional, default = false)] songs_view: bool,
#[prop(optional)] on_click: Option<Box<dyn Fn(T)>>,
#[prop(optional, default = "")] redirect_root: &'static str,
) -> impl IntoView
where
T: 'static + Clone,
Expand Down Expand Up @@ -140,7 +141,11 @@ where
}
} else {
view! {
<A href=format!("single?id={}", card_item_data.id.clone())>
<A href=format!(
"{}/single?id={}",
redirect_root,
card_item_data.id.clone(),
)>
<CardItem
on:contextmenu=move |ev| {
if let Some(cb) = &card_item_data1.context_menu {
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fn main() {
.pretty()
.with_target(true)
.without_time()
.with_ansi(false)
.with_writer(MakeConsoleWriter::default());

let layer = fmt::layer()
Expand Down
3 changes: 3 additions & 0 deletions src/pages/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ pub fn Search() -> impl IntoView {
view! {
<CardView
items=create_rw_signal(res.albums.clone())
redirect_root="/main/albums"
card_item=move |(_, item)| {
SimplifiedCardItem {
title: item.album_name.clone().unwrap_or_default(),
Expand All @@ -324,6 +325,7 @@ pub fn Search() -> impl IntoView {
view! {
<CardView
items=create_rw_signal(res.artists.clone())
redirect_root="/main/artists"
card_item=move |(_, item)| {
SimplifiedCardItem {
title: item.artist_name.clone().unwrap_or_default(),
Expand All @@ -341,6 +343,7 @@ pub fn Search() -> impl IntoView {
view! {
<CardView
items=create_rw_signal(res.playlists.clone())
redirect_root="/main/playlists/"
card_item=move |(_, item)| {
SimplifiedCardItem {
title: item.playlist_name.clone(),
Expand Down

0 comments on commit 47e14a4

Please sign in to comment.