young_account_banner.rs

 1use gpui::{IntoElement, ParentElement};
 2use ui::{Banner, prelude::*};
 3
 4#[derive(IntoElement)]
 5pub struct YoungAccountBanner {
 6    is_v2: bool,
 7}
 8
 9impl YoungAccountBanner {
10    pub fn new(is_v2: bool) -> Self {
11        Self { is_v2 }
12    }
13}
14
15impl RenderOnce for YoungAccountBanner {
16    fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
17        const YOUNG_ACCOUNT_DISCLAIMER: &str = "To prevent abuse of our service, GitHub accounts created fewer than 30 days ago are not eligible for free plan usage or Pro plan free trial. You can request an exception by reaching out to billing-support@zed.dev";
18        const YOUNG_ACCOUNT_DISCLAIMER_V2: &str = "To prevent abuse of our service, GitHub accounts created fewer than 30 days ago are not eligible for the Pro trial. You can request an exception by reaching out to billing-support@zed.dev";
19
20        let label = div()
21            .w_full()
22            .text_sm()
23            .text_color(cx.theme().colors().text_muted)
24            .child(if self.is_v2 {
25                YOUNG_ACCOUNT_DISCLAIMER_V2
26            } else {
27                YOUNG_ACCOUNT_DISCLAIMER
28            });
29
30        div()
31            .max_w_full()
32            .my_1()
33            .child(Banner::new().severity(Severity::Warning).child(label))
34    }
35}