From d410366433b9bc6325fd1d975194792711d0351c Mon Sep 17 00:00:00 2001
From: marcantoinem <marc-antoine.m@outlook.com>
Date: Wed, 31 Jul 2024 20:20:10 -0400
Subject: [PATCH] feat: Add beta banner for release preparation

---
 aep-schedule-website/src/frontend/app.rs       | 17 +++++++----------
 aep-schedule-website/src/frontend/state/mod.rs |  2 +-
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/aep-schedule-website/src/frontend/app.rs b/aep-schedule-website/src/frontend/app.rs
index eca8392..8e96a4a 100644
--- a/aep-schedule-website/src/frontend/app.rs
+++ b/aep-schedule-website/src/frontend/app.rs
@@ -13,7 +13,7 @@ pub fn App() -> impl IntoView {
     // Provides context that manages stylesheets, titles, meta tags, etc.
     provide_meta_context();
 
-    let (is_active, set_active) = create_signal(String::new());
+    let (is_active, set_active) = create_signal(false);
 
     view! {
 
@@ -27,10 +27,11 @@ pub fn App() -> impl IntoView {
         // content for this welcome page
         <Router>
             <header>
-                <nav class=is_active>
+                <nav class=("active", is_active) class="flex-wrap overflow-x-hidden">
                     <span class="text-2xl font-semibold leading-none font-sans tracking-tight">"Générateur d'horaire de l'AEP"
                         <span class="text-amber-600">"v2"</span>
                     </span>
+                    <span class="bg-red-200 text-red-800 text-lg font-sans tracking-tight font-medium me-2 px-2.5 py-0.5 rounded-full shrink">"Beta - "<a class="text-gray-800" href="https://horaires.aep.polymtl.ca/">"Retourner à l'ancien générateur"</a></span>
                     <A class="rounded-md font-medium text-gray-700 text-lg font-sans tracking-tight" href="/">"Générateur d'horaire"</A>
                     <A class="rounded-md font-medium text-gray-700 text-lg font-sans tracking-tight" href="/local">"Horaire d'un local"</A>
                     <A class="rounded-md font-medium text-gray-700 text-lg font-sans tracking-tight" href="/apropos">"À propos"</A>
@@ -40,15 +41,11 @@ pub fn App() -> impl IntoView {
                         <span class="rounded-md font-medium text-gray-700 text-lg font-sans tracking-tight">"Signaler un bug"</span>
                         <Bug weight=IconWeight::Regular size="3vh"/>
                     </a>
-                    <a href="https://git.step.polymtl.ca/Lemark/aep-schedule-generator-rusty" class="sources"  target="_blank" ><span class="rounded-md font-medium text-gray-700 text-lg font-sans tracking-tight">"Sources "</span><GitlabLogo weight=IconWeight::Regular size="3vh"/></a>
+                    <a href="https://git.step.polymtl.ca/Lemark/aep-schedule-generator-rusty" class="sources" target="_blank" ><span class="rounded-md font-medium text-gray-700 text-lg font-sans tracking-tight">"Sources "</span><GitlabLogo weight=IconWeight::Regular size="3vh"/></a>
                 </nav>
-                <div class=move || is_active.get() + " hamburger" on:click=move |_| {
-                    set_active.update(|text| {
-                        if text == "active" {
-                            text.clear();
-                        } else {
-                            text.push_str("active");
-                        }
+                <div class=("active", is_active) class="hamburger" on:click=move |_| {
+                    set_active.update(|active| {
+                        *active = !*active;
                     });
                 }>
                     <span class="hamburger-bar"></span>
diff --git a/aep-schedule-website/src/frontend/state/mod.rs b/aep-schedule-website/src/frontend/state/mod.rs
index 7ba4287..6904f0a 100644
--- a/aep-schedule-website/src/frontend/state/mod.rs
+++ b/aep-schedule-website/src/frontend/state/mod.rs
@@ -84,7 +84,7 @@ impl OptionState {
     pub fn regenerate(&self) {
         self.max_size.update_value(|size| {
             let _ = size.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |v| {
-                Some(std::cmp::min(v * 2, 2usize.pow(12)))
+                Some(std::cmp::min(v * 2, 2usize.pow(10)))
             });
         });
         self.gen();
-- 
GitLab