Skip to content

Commit 4c7236a

Browse files
committed
drawer: replace vaul runtime with rust
Drop vaul JS/CSS assets and move drawer behavior into Rust context and event handling. Also fix family demo text contrast and sync registry snapshots.
1 parent 8e41e2b commit 4c7236a

11 files changed

Lines changed: 1048 additions & 799 deletions

File tree

‎app/src/components/github_stars.rs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ pub async fn fetch_github_stars() -> Result<u32, ServerFnError> {
2929
let cache = STARS_CACHE.get_or_init(|| std::sync::Mutex::new(None));
3030

3131
// Return cached value if still fresh
32-
if let Some((count, fetched_at)) = *cache.lock().unwrap() {
33-
if fetched_at.elapsed().as_secs() < CACHE_TTL_SECS {
34-
return Ok(count);
35-
}
32+
if let Ok(guard) = cache.lock()
33+
&& let Some((count, fetched_at)) = *guard
34+
&& fetched_at.elapsed().as_secs() < CACHE_TTL_SECS
35+
{
36+
return Ok(count);
3637
}
3738

3839
let client = reqwest::Client::new();
@@ -52,7 +53,9 @@ pub async fn fetch_github_stars() -> Result<u32, ServerFnError> {
5253
ServerFnError::new(msg)
5354
})?;
5455

55-
*cache.lock().unwrap() = Some((repo.stargazers_count, std::time::Instant::now()));
56+
if let Ok(mut guard) = cache.lock() {
57+
*guard = Some((repo.stargazers_count, std::time::Instant::now()));
58+
}
5659

5760
Ok(repo.stargazers_count)
5861
}

‎app/src/domain/icons/page_icons.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub fn PageIcons() -> impl IntoView {
9494
selected_icon_name.set(icon_name);
9595
selected_icon_function.set(Some(icon_func));
9696

97-
// Click the hidden trigger to let JavaScript handle the drawer opening
97+
// Click the hidden trigger inside the Drawer subtree to open it reactively.
9898
let window = window();
9999
if let Some(document) = window.document()
100100
&& let Ok(Some(trigger)) = document.query_selector("[data-name=\"DrawerTrigger\"]")
@@ -294,10 +294,8 @@ pub fn PageIcons() -> impl IntoView {
294294
</div>
295295
</div>
296296

297-
// Hidden trigger for JavaScript to wire up
298-
<DrawerTrigger class="hidden">"Open"</DrawerTrigger>
299-
300297
<Drawer show_overlay=false lock_body_scroll=false>
298+
<DrawerTrigger class="hidden">"Open"</DrawerTrigger>
301299
<DrawerContent>
302300
<DrawerHandle />
303301
<DrawerBody class="justify-center items-center">

‎app_crates/registry/src/demos/demo_drawer_family.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ pub fn DemoDrawerFamily() -> impl IntoView {
1414
<h2 class="text-lg font-semibold text-foreground">"Options"</h2>
1515
<button
1616
data-name="DrawerClose"
17-
class="flex justify-center items-center rounded-full transition-colors size-8 bg-neutral-100 text-neutral-500 hover:bg-neutral-200"
17+
class="flex justify-center items-center rounded-full transition-colors size-8 bg-neutral-100 text-neutral-700 hover:bg-neutral-200"
1818
>
1919
<X class="size-3" />
2020
</button>
2121
</header>
2222

2323
<div class="space-y-3">
24-
<button class="flex gap-4 items-center px-4 w-full h-12 text-base font-medium rounded-2xl transition-colors bg-neutral-100 text-foreground hover:bg-neutral-200">
24+
<button class="flex gap-4 items-center px-4 w-full h-12 text-base font-medium rounded-2xl transition-colors bg-neutral-100 text-neutral-900 hover:bg-neutral-200">
2525
<Lock class="size-[18px]" />
2626
<span>"View Private Key"</span>
2727
</button>
2828

29-
<button class="flex gap-4 items-center px-4 w-full h-12 text-base font-medium rounded-2xl transition-colors bg-neutral-100 text-foreground hover:bg-neutral-200">
29+
<button class="flex gap-4 items-center px-4 w-full h-12 text-base font-medium rounded-2xl transition-colors bg-neutral-100 text-neutral-900 hover:bg-neutral-200">
3030
<FileText class="size-[18px]" />
3131
<span>"View Recovery Phrase"</span>
3232
</button>

‎app_crates/registry/src/demos/demo_drawer_non_dismissable.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn DemoDrawerNonDismissable() -> impl IntoView {
1111
<Drawer>
1212
<DrawerTrigger>"Open Drawer"</DrawerTrigger>
1313

14-
<DrawerContent style="--initial-transform: 100%; pointer-events: auto;" dismissible="false">
14+
<DrawerContent style="--initial-transform: 100%; pointer-events: auto;" dismissible=false>
1515
<DrawerHandle />
1616

1717
<DrawerBody>

0 commit comments

Comments
 (0)