GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(app): refactor help button and add tabs info popup persistence (… · argszero/opencode@c6c599b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • bun.lock
  • package.json
  • packages/app
    • package.json
    • src
      • assets/help
        • introducing-tabs.mp4
        • placeholder.png
      • components
        • help-button.tsx
        • ui
          • drawer.tsx
      • env.d.ts
      • pages
        • layout-new.tsx
        • layout.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bun.lock‎

Copy file name to clipboardExpand all lines: bun.lock
+16Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@shikijs/stream": "4.2.0",
4848
"ulid": "3.0.1",
4949
"@kobalte/core": "0.13.11",
50+
"@corvu/drawer": "0.2.4",
5051
"@types/luxon": "3.7.1",
5152
"@types/node": "24.12.2",
5253
"@types/semver": "7.7.1",
Collapse file

‎packages/app/package.json‎

Copy file name to clipboardExpand all lines: packages/app/package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"vite-plugin-solid": "catalog:"
4848
},
4949
"dependencies": {
50+
"@corvu/drawer": "catalog:",
5051
"@dnd-kit/abstract": "0.5.0",
5152
"@dnd-kit/dom": "0.5.0",
5253
"@dnd-kit/helpers": "0.5.0",
Collapse file

‎packages/app/src/assets/help/introducing-tabs.mp4‎

Copy file name to clipboard
12.4 MB
Binary file not shown.
Collapse file

‎packages/app/src/assets/help/placeholder.png‎

Copy file name to clipboard
23 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎packages/app/src/components/help-button.tsx‎

Copy file name to clipboard
+131-41Lines changed: 131 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,144 @@
1-
import { Icon } from "@opencode-ai/ui/v2/icon"
2-
import { Popover } from "@opencode-ai/ui/popover"
1+
import { Icon as IconV2 } from "@opencode-ai/ui/v2/icon"
2+
import { IconButtonV2 } from "@opencode-ai/ui/v2/icon-button-v2"
33
import { createSignal, Show } from "solid-js"
44
import { createStore } from "solid-js/store"
5+
import { Drawer, DrawerClose, DrawerContent } from "@/components/ui/drawer"
6+
import { usePlatform } from "@/context/platform"
7+
import introducingTabsVideo from "@/assets/help/introducing-tabs.mp4"
8+
import { Persist, persisted } from "@/utils/persist"
9+
10+
const helpIcon = (
11+
<svg
12+
width="16"
13+
height="16"
14+
viewBox="0 0 16 16"
15+
fill="none"
16+
xmlns="http://www.w3.org/2000/svg"
17+
aria-hidden="true"
18+
data-slot="icon-svg"
19+
>
20+
<path
21+
d="M6.94235 10.5714V10.4854C6.94617 9.76302 7.01879 9.18777 7.16022 8.75968C7.30546 8.33158 7.50804 7.98567 7.76796 7.72193C8.02787 7.45819 8.34321 7.21548 8.71397 6.99379C8.93948 6.85619 9.14206 6.69374 9.32171 6.50645C9.50518 6.31916 9.64851 6.10511 9.75171 5.86431C9.85874 5.62351 9.91225 5.35404 9.91225 5.0559C9.91225 4.69661 9.82625 4.38509 9.65424 4.12136C9.48607 3.85762 9.26055 3.65504 8.9777 3.51362C8.69486 3.36837 8.38143 3.29575 8.03743 3.29575C7.73165 3.29575 7.43733 3.35882 7.15448 3.48495C6.87546 3.61108 6.6423 3.80984 6.45501 4.08122C6.26772 4.3526 6.15878 4.70425 6.12821 5.13617H4.56299C4.59357 4.47109 4.76557 3.9054 5.07899 3.43908C5.39242 2.96894 5.80522 2.61156 6.31741 2.36694C6.83341 2.12231 7.40675 2 8.03743 2C8.72161 2 9.31789 2.13378 9.82625 2.40134C10.3384 2.66507 10.734 3.0301 11.0131 3.49642C11.2959 3.96273 11.4373 4.49976 11.4373 5.1075C11.4373 5.53177 11.3724 5.914 11.2424 6.25418C11.1124 6.59436 10.9251 6.89823 10.6805 7.16579C10.4397 7.43335 10.1492 7.67033 9.80905 7.87673C9.48033 8.08313 9.21468 8.301 9.0121 8.53034C8.80952 8.75585 8.66237 9.02341 8.57063 9.33302C8.4789 9.64262 8.42921 10.0268 8.42156 10.4854V10.5714H6.94235ZM7.72782 14C7.43351 14 7.17933 13.8949 6.96528 13.6847C6.75506 13.4744 6.64994 13.2203 6.64994 12.9221C6.64994 12.6278 6.75506 12.3755 6.96528 12.1653C7.17933 11.9551 7.43351 11.85 7.72782 11.85C8.02214 11.85 8.27441 11.9551 8.48463 12.1653C8.69868 12.3755 8.8057 12.6278 8.8057 12.9221C8.8057 13.1209 8.75601 13.3024 8.65663 13.4668C8.55726 13.6273 8.4273 13.7573 8.26676 13.8567C8.10623 13.9522 7.92658 14 7.72782 14Z"
22+
fill="var(--v2-icon-icon-base)"
23+
/>
24+
</svg>
25+
)
26+
27+
const triggerClass =
28+
"size-7 !rounded-full shrink-0 bg-v2-background-bg-base shadow-[var(--v2-elevation-button-neutral)]"
29+
30+
// TODO: wire to changelog / seen-state when available
31+
const showPopover = () => true
532

633
export function HelpButton() {
734
if (import.meta.env.VITE_OPENCODE_CHANNEL !== "dev") return null
835

9-
const [state, setState] = /* persisted(Persist.global("help-button"), */ createStore({ dismissed: false }) /* ) */
10-
const [shown, setShown] = createSignal(false)
36+
const platform = usePlatform()
1137

1238
return (
13-
<Show when={!state.dismissed}>
14-
<div class="fixed bottom-4 right-4 z-50 hidden md:block">
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"
39+
<a
40+
href="https://opencode.ai"
41+
aria-label="Open the OpenCode website"
42+
data-component="icon-button-v2"
43+
data-size="large"
44+
class={`${triggerClass} fixed bottom-5 right-5 z-50 flex items-center justify-center`}
45+
onClick={(event) => {
46+
event.preventDefault()
47+
platform.openLink(event.currentTarget.href)
48+
}}
49+
>
50+
{helpIcon}
51+
</a>
52+
)
53+
}
54+
55+
// can remove this after the tabs rollout has been out for a while
56+
export function TabsInfoPopup() {
57+
if (import.meta.env.VITE_OPENCODE_CHANNEL !== "dev") return null
58+
59+
const [state, setState] = persisted(Persist.global("tabsInfoPopup"), createStore({ dismissed: false }))
60+
// setState({ dismissed: false }) // for testing
61+
const [drawerOpen, setDrawerOpen] = createSignal(false)
62+
63+
return (
64+
<Drawer open={drawerOpen()} onOpenChange={setDrawerOpen} side="right">
65+
<Show when={!state.dismissed}>
66+
<div
67+
class="fixed bottom-14 right-5 z-50 h-[240px] w-[192px] rounded-[8px] bg-v2-background-bg-base p-1 shadow-[var(--v2-elevation-floating)]"
68+
aria-label="Introducing Tabs. A faster, more intuitive way to work."
2969
>
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.
70+
<button
71+
type="button"
72+
aria-label="Dismiss Tabs information"
73+
class="absolute top-3 right-3 z-10 size-5 flex items-center justify-center rounded-[4px] bg-[rgba(0,0,0,0.4)]"
74+
onClick={() => setState("dismissed", true)}
75+
>
76+
<svg
77+
width="16"
78+
height="16"
79+
viewBox="0 0 16 16"
80+
fill="none"
81+
xmlns="http://www.w3.org/2000/svg"
82+
aria-hidden="true"
83+
>
84+
<path d="M4.25 11.75L11.75 4.25M11.75 11.75L4.25 4.25" stroke="white" />
85+
</svg>
86+
</button>
87+
<button
88+
type="button"
89+
class="relative block h-[232px] w-[184px] cursor-pointer overflow-hidden rounded-[4px] text-left"
90+
onClick={() => {
91+
setState("dismissed", true)
92+
setDrawerOpen(true)
93+
}}
94+
>
95+
<video
96+
src={introducingTabsVideo}
97+
class="absolute inset-0 h-full w-full object-cover"
98+
loop
99+
muted
100+
autoplay
101+
playsinline
102+
aria-hidden="true"
103+
onContextMenu={(event) => event.preventDefault()}
104+
/>
105+
<div class="absolute inset-x-0 bottom-0 flex w-full flex-col items-start gap-1.5 bg-[linear-gradient(180deg,rgba(0,0,0,0)_0%,#000000_100%)] px-3 py-5">
106+
<p class="w-full select-none text-[13px] font-[530] leading-none tracking-[-0.04px] text-[#FFFFFF]">
107+
Introducing Tabs
108+
</p>
109+
<p class="w-full select-none text-[13px] font-[440] leading-[140%] tracking-[-0.04px] text-[#808080]">
110+
A faster, more intuitive way to work.
47111
</p>
48112
</div>
49-
</Show>
50-
</Popover>
51-
</div>
52-
</Show>
113+
</button>
114+
</div>
115+
</Show>
116+
<DrawerContent>
117+
<div class="flex h-[52px] w-full shrink-0 items-center gap-4 self-stretch border-b border-v2-border-border-muted p-4">
118+
<p class="min-h-0 min-w-0 flex-1 text-[13px] font-[530] leading-5 tracking-[-0.04px] tabular-nums text-v2-text-text-muted">
119+
June 16
120+
</p>
121+
<DrawerClose
122+
as={IconButtonV2}
123+
type="button"
124+
size="small"
125+
variant="ghost-muted"
126+
aria-label="Close"
127+
icon={<IconV2 name="xmark-small" />}
128+
/>
129+
</div>
130+
<div class="relative flex w-full flex-col items-start gap-6 p-8">
131+
<p class="w-full shrink-0 self-stretch text-[21px] font-[610] leading-6 tracking-[-0.37px] tabular-nums text-v2-text-text-base">
132+
Introducing Tabs Navigation.
133+
</p>
134+
<p class="w-full flex-1 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-base">
135+
We've introduced tabs as the primary navigation in OpenCode. Your most important session are now pinned at
136+
the top of your screen at all times. No more hunting through menus or losing your place mid-session. Switch
137+
contexts instantly, pick up exactly where you left off, and keep your focus where it belongs: on the
138+
sessions.
139+
</p>
140+
</div>
141+
</DrawerContent>
142+
</Drawer>
53143
)
54144
}
Collapse file

‎packages/app/src/components/ui/drawer.tsx‎

Copy file name to clipboard
+121Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/**
2+
* Taken from https://www.solid-ui.com/docs/components/drawer
3+
* Only used in one place hence not a v2 component yet... can be promoted to ui/v2 later
4+
*/
5+
6+
import type { Component, ComponentProps, JSX, ValidComponent } from "solid-js"
7+
import { splitProps } from "solid-js"
8+
import type { ContentProps, DescriptionProps, DynamicProps, LabelProps, OverlayProps } from "@corvu/drawer"
9+
import DrawerPrimitive from "@corvu/drawer"
10+
11+
const Drawer = DrawerPrimitive
12+
13+
const DrawerTrigger = DrawerPrimitive.Trigger
14+
15+
const DrawerPortal = DrawerPrimitive.Portal
16+
17+
const DrawerClose = DrawerPrimitive.Close
18+
19+
type DrawerOverlayProps<T extends ValidComponent = "div"> = OverlayProps<T> & { class?: string }
20+
21+
const DrawerOverlay = <T extends ValidComponent = "div">(props: DynamicProps<T, DrawerOverlayProps<T>>) => {
22+
const [, rest] = splitProps(props as DrawerOverlayProps, ["class"])
23+
const drawerContext = DrawerPrimitive.useContext()
24+
const overlayStyle = () => {
25+
const state = drawerContext.transitionState()
26+
if (state === "opening" || state === "closing") return undefined
27+
const open = drawerContext.openPercentage()
28+
return {
29+
opacity: open,
30+
"backdrop-filter": `blur(${4 * open}px)`,
31+
}
32+
}
33+
return (
34+
<DrawerPrimitive.Overlay
35+
class={props.class}
36+
classList={{
37+
"fixed inset-0 z-[100] bg-v2-overlay-simple-overlay-scrim opacity-0 backdrop-blur-none transition-[opacity,backdrop-filter] duration-300 data-[opening]:opacity-100 data-[opening]:backdrop-blur-[4px] data-[closing]:opacity-0 data-[closing]:backdrop-blur-none": true,
38+
}}
39+
style={overlayStyle()}
40+
{...rest}
41+
/>
42+
)
43+
}
44+
45+
type DrawerContentProps<T extends ValidComponent = "div"> = ContentProps<T> & {
46+
class?: string
47+
children?: JSX.Element
48+
}
49+
50+
const DrawerContent = <T extends ValidComponent = "div">(props: DynamicProps<T, DrawerContentProps<T>>) => {
51+
const [, rest] = splitProps(props as DrawerContentProps, ["class", "children"])
52+
return (
53+
<DrawerPortal>
54+
<DrawerOverlay />
55+
<DrawerPrimitive.Content
56+
class={props.class}
57+
classList={{
58+
"group/drawer-content fixed inset-y-[6px] right-[6px] left-auto z-[100] flex h-auto max-h-[calc(100vh-12px)] w-[560px] max-w-[calc(100vw-12px)] flex-col items-start rounded-[8px] bg-v2-background-bg-base p-0 shadow-[var(--v2-elevation-overlay)] data-[transitioning]:transition-transform data-[transitioning]:duration-300 md:select-none": true,
59+
}}
60+
{...rest}
61+
>
62+
{props.children}
63+
</DrawerPrimitive.Content>
64+
</DrawerPortal>
65+
)
66+
}
67+
68+
const DrawerHeader: Component<ComponentProps<"div">> = (props) => {
69+
const [, rest] = splitProps(props, ["class"])
70+
return <div class={props.class} classList={{ "grid gap-1.5 p-4 text-center sm:text-left": true }} {...rest} />
71+
}
72+
73+
const DrawerFooter: Component<ComponentProps<"div">> = (props) => {
74+
const [, rest] = splitProps(props, ["class"])
75+
return <div class={props.class} classList={{ "mt-auto flex flex-col gap-2 p-4": true }} {...rest} />
76+
}
77+
78+
type DrawerTitleProps<T extends ValidComponent = "div"> = LabelProps<T> & { class?: string }
79+
80+
const DrawerTitle = <T extends ValidComponent = "div">(props: DynamicProps<T, DrawerTitleProps<T>>) => {
81+
const [, rest] = splitProps(props as DrawerTitleProps, ["class"])
82+
return (
83+
<DrawerPrimitive.Label
84+
class={props.class}
85+
classList={{ "text-base font-[530] leading-none tracking-[-0.04px] text-v2-text-text-base": true }}
86+
{...rest}
87+
/>
88+
)
89+
}
90+
91+
type DrawerDescriptionProps<T extends ValidComponent = "div"> = DescriptionProps<T> & {
92+
class?: string
93+
}
94+
95+
const DrawerDescription = <T extends ValidComponent = "div">(
96+
props: DynamicProps<T, DrawerDescriptionProps<T>>,
97+
) => {
98+
const [, rest] = splitProps(props as DrawerDescriptionProps, ["class"])
99+
return (
100+
<DrawerPrimitive.Description
101+
class={props.class}
102+
classList={{
103+
"text-[13px] font-[440] leading-[140%] tracking-[-0.04px] text-v2-text-text-muted": true,
104+
}}
105+
{...rest}
106+
/>
107+
)
108+
}
109+
110+
export {
111+
Drawer,
112+
DrawerPortal,
113+
DrawerOverlay,
114+
DrawerTrigger,
115+
DrawerClose,
116+
DrawerContent,
117+
DrawerHeader,
118+
DrawerFooter,
119+
DrawerTitle,
120+
DrawerDescription,
121+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.