Skip to content

Commit

Permalink
remove fallback url form backbtn
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi-sawlani-yral committed May 15, 2024
1 parent 7eae679 commit da95707
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/component/back_btn.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use gloo::history::{BrowserHistory, History};
use leptos::{component, expect_context, view, window, Callback, IntoView};
use leptos::{component, view, Callback, IntoView};
use leptos_icons::Icon;

#[component]
pub fn BackButton(fallback: String) -> impl IntoView {
pub fn BackButton() -> impl IntoView {
let go_back = Callback::new(move |_| {
let history = BrowserHistory::new();
history.back();
Expand Down
2 changes: 1 addition & 1 deletion src/page/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub fn Menu() -> impl IntoView {
<div class="flex flex-col items-center w-full gap-20 pb-16">
<Title justify_center=false>
<div class="flex flex-row justify-between">
<BackButton fallback="/".to_string()/>
<BackButton/>
<span class="font-bold text-2xl">Menu</span>
<div></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/page/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn PrivacyPolicy() -> impl IntoView {
// </Title>
<Title justify_center=false>
<div class="flex flex-row justify-between">
<BackButton fallback="/menu".to_string()/>
<BackButton/>
<div>
<span class="font-bold">Privacy Policy</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/page/profile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn ProfileViewInner(user: ProfileDetails, user_canister: Principal) -> impl Into
view! {
<div class="min-h-screen bg-black text-white overflow-y-scroll pt-10 pb-12">
<div class="flex ml-4">
<BackButton fallback="/".to_string()/>
<BackButton/>
</div>
<div class="grid grid-cols-1 gap-5 justify-normal justify-items-center w-full">
<div
Expand Down
4 changes: 2 additions & 2 deletions src/page/profile/profile_post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub fn ProfilePostWithUpdates(initial_post: PostDetails) -> impl IntoView {
let Some((canister_id, post_id)) = current_post_base.get() else {
return;
};

if recovering_state.get_untracked() {
return;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ pub fn ProfilePost() -> impl IntoView {
Some(
view! {
<div class="absolute left-4 top-4 bg-transparent z-10 text-white">
<BackButton fallback="/".to_string()/>
<BackButton/>
</div>
<ProfilePostWithUpdates initial_post=pd/>
},
Expand Down
55 changes: 32 additions & 23 deletions src/page/profile/your_profile_post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,31 +78,40 @@ pub fn YourProfilePost() -> impl IntoView {
});

view! {
<Suspense fallback = FullScreenSpinner >
{move || {
post_details.get()
.flatten().map(|pd| {

Some(view!{
<div class ="absolute left-4 top-4 bg-transparent z-10 text-white">
<BackButton fallback="/".to_string()/>
</div>
<YourProfileOverlay/>
<div class="snap-always snap-end w-dvh h-dvh">
<div class="bg-transparent w-full h-full relative overflow-hidden">
<div
class="absolute top-0 left-0 bg-cover bg-center w-full h-full z-[1] blur-lg"
style:background-color="rgb(0, 0, 0)"
style:background-image=move || format!("url({})", view_bg_url().unwrap_or_default())
></div>
<Suspense fallback=FullScreenSpinner>
{move || {
post_details
.get()
.flatten()
.map(|pd| {
Some(
view! {
<div class="absolute left-4 top-4 bg-transparent z-10 text-white">
<BackButton/>
</div>
<YourProfileOverlay/>
<div class="snap-always snap-end w-dvh h-dvh">
<div class="bg-transparent w-full h-full relative overflow-hidden">
<div
class="absolute top-0 left-0 bg-cover bg-center w-full h-full z-[1] blur-lg"
style:background-color="rgb(0, 0, 0)"
style:background-image=move || {
format!("url({})", view_bg_url().unwrap_or_default())
}
></div>
</div>
<VideoDetailsOverlay post = pd/>
<VideoPlayer node_ref=video_node_ref view_bg_url view_video_url/>
</div>
})
<VideoDetailsOverlay post=pd/>
<VideoPlayer
node_ref=video_node_ref
view_bg_url
view_video_url
/>
</div>
},
)
})
}
}
}}

</Suspense>
}
}
2 changes: 1 addition & 1 deletion src/page/refer_earn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ pub fn ReferEarn() -> impl IntoView {
<div class="flex flex-col items-center min-w-dvw min-h-dvh bg-black pt-2 pb-12 gap-6">
<Title justify_center=false>
<div class="flex flex-row justify-between">
<BackButton fallback="/menu".to_string()/>
<BackButton/>
<span class="text-lg font-bold text-white">Refer & Earn</span>
<div></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/page/terms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn TermsOfService() -> impl IntoView {
// </Title>
<Title justify_center=false>
<div class="flex flex-row justify-between">
<BackButton fallback="/menu".to_string()/>
<BackButton/>
<span class="font-bold">Terms of Service</span>
<div></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/page/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub fn Wallet() -> impl IntoView {
<div>
<div class="top-0 bg-black text-white w-full items-center z-50 pt-4 pl-4">
<div class="flex flex-row justify-start">
<BackButton fallback="/".to_string()/>
<BackButton/>
</div>
</div>
<div class="flex flex-col w-dvw min-h-dvh bg-black gap-4 px-4 pt-4 pb-12">
Expand Down
2 changes: 1 addition & 1 deletion src/page/wallet/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn Transactions() -> impl IntoView {
<div class="flex items-center flex-col w-dvw min-h-dvh gap-10 bg-black pt-4 px-4 pb-12">
<Title justify_center=false>
<div class="flex flex-row justify-between">
<BackButton fallback="/wallet".to_string()/>
<BackButton/>
<span class="text-xl text-white font-bold">Transactions</span>
<div></div>
</div>
Expand Down

0 comments on commit da95707

Please sign in to comment.