Skip to content

Commit

Permalink
Set upgrade route based on whether a subscription is present for a user
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnynotsolucky committed Aug 11, 2024
1 parent 2f4d9b0 commit 044915c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions frontend/apps/crates/entry/user/src/welcome/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::rc::Rc;
use super::Welcome;
use dominator::{html, Dom};
use shared::domain::billing::PlanType;
use utils::routes::UserRoute;
use utils::routes::{HomePricingRoute, UserRoute};
use utils::{
prelude::{get_plan_type, get_school_id, get_user_email, get_user_mutable},
routes::{AssetRoute, HomeRoute, Route},
Expand Down Expand Up @@ -95,6 +95,12 @@ impl Welcome {
}))
})
.apply_if(!is_school, |dom| {
let route = if plan.is_some() {
format!("{}#plan", Route::User(UserRoute::Settings))
} else {
format!("{}", Route::Home(HomeRoute::Pricing(HomePricingRoute::default())))
};

dom.child(html!("h2", {
.prop("slot", "headings")
.text("You can now create, play, and share your content.")
Expand All @@ -121,7 +127,7 @@ impl Welcome {
.prop("slot", "actions")
.prop("color", "blue")
.prop("kind", "filled")
.prop("href", format!("{}#plan", Route::User(UserRoute::Settings).to_string()))
.prop("href", route)
.text("Upgrade account")
}))
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/elements/src/entry/user/profile/landing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class _ extends LitElement {
}
@media (min-width: 1024px) {
::slotted([slot=change-to-annual]) {
flex-direction: column;
flex-direction: row;
}
}
::slotted(dialog-overlay) {
Expand Down

0 comments on commit 044915c

Please sign in to comment.