hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { createSignal, onCleanup } from "solid-js"; |
| 2 | |
| 3 | // Surfaces that dock something at the bottom of a phone screen — the study |
| 4 | // chat's composer, the message compose sheet — put the floating action button |
| 5 | // away while they are up, the same way the shell's own overlays do. A count |
| 6 | // rather than a flag, so two holders never release each other's hold. |
| 7 | const [holds, setHolds] = createSignal(0); |
| 8 | |
| 9 | export const quickActionsSuppressed = () => holds() > 0; |
| 10 | |
| 11 | /** |
| 12 | * Hide the phone quick-action button until the calling owner (component or |
| 13 | * effect run) is disposed. Call it from a component body to hide for the |
| 14 | * component's lifetime, or inside a `createEffect` branch to hide while a |
| 15 | * condition holds. |
| 16 | */ |
| 17 | export function suppressQuickActions() { |
| 18 | setHolds((count) => count + 1); |
| 19 | onCleanup(() => setHolds((count) => count - 1)); |
| 20 | } |