|
| 1 | +import { Icon } from "@opencode-ai/ui/v2/icon" |
| 2 | +import { Popover } from "@opencode-ai/ui/popover" |
| 3 | +import { createSignal, Show } from "solid-js" |
| 4 | +import { createStore } from "solid-js/store" |
| 5 | + |
| 6 | +export function HelpButton() { |
| 7 | + if (import.meta.env.VITE_OPENCODE_CHANNEL !== "dev") return null |
| 8 | + |
| 9 | + const [state, setState] = /* persisted(Persist.global("help-button"), */ createStore({ dismissed: false }) /* ) */ |
| 10 | + const [shown, setShown] = createSignal(false) |
| 11 | + |
| 12 | + return ( |
| 13 | + <Show when={!state.dismissed}> |
| 14 | + <div class="fixed bottom-4 right-4 z-50"> |
| 15 | + <Popover |
| 16 | + open={shown()} |
| 17 | + onOpenChange={setShown} |
| 18 | + triggerAs="button" |
| 19 | + triggerProps={{ |
| 20 | + type: "button", |
| 21 | + "aria-label": "Help", |
| 22 | + class: |
| 23 | + "size-7 rounded-full bg-background-base shadow-[var(--shadow-lg-border-base)] flex items-center justify-center text-text-base hover:text-text-strong transition-colors", |
| 24 | + }} |
| 25 | + trigger={<span aria-hidden="true">?</span>} |
| 26 | + class="[&_[data-slot=popover-body]]:p-0 w-[320px] max-w-[calc(100vw-40px)] bg-transparent border-0 shadow-none rounded-xl" |
| 27 | + gutter={8} |
| 28 | + placement="top-end" |
| 29 | + > |
| 30 | + <Show when={shown()}> |
| 31 | + <div class="relative flex flex-col gap-1 w-[320px] p-4 rounded-xl bg-background-strong shadow-[var(--shadow-lg-border-base)]"> |
| 32 | + <button |
| 33 | + type="button" |
| 34 | + aria-label="Close" |
| 35 | + class="absolute top-3.5 right-3.5 size-6 rounded-md flex items-center justify-center text-text-base hover:text-text-strong hover:bg-surface-raised-base-hover transition-colors" |
| 36 | + onClick={() => { |
| 37 | + setShown(false) |
| 38 | + setState("dismissed", true) |
| 39 | + }} |
| 40 | + > |
| 41 | + <Icon name="xmark-small" /> |
| 42 | + </button> |
| 43 | + <span class="text-14-regular text-text-strong">Lorem ipsum dolor sit amet</span> |
| 44 | + <p class="text-12-regular text-text-weak"> |
| 45 | + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et |
| 46 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. |
| 47 | + </p> |
| 48 | + </div> |
| 49 | + </Show> |
| 50 | + </Popover> |
| 51 | + </div> |
| 52 | + </Show> |
| 53 | + ) |
| 54 | +} |
0 commit comments