Download packages/tui/src/feature-plugins/sidebar/todo.tsx from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/feature-plugins/sidebar/todo.tsx
- Command line
-
hf download hf://SaylorTwift/opencode/packages/tui/src/feature-plugins/sidebar/todo.tsx
-
curl -L -o todo.tsx https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/feature-plugins/sidebar/todo.tsx
1.48 kB
| import type { TuiPlugin, TuiPluginApi } from "@opencode-ai/plugin/tui" | |
| import type { BuiltinTuiPlugin } from "../builtins" | |
| import { createMemo, For, Show, createSignal } from "solid-js" | |
| import { TodoItem } from "../../component/todo-item" | |
| const id = "internal:sidebar-todo" | |
| function View(props: { api: TuiPluginApi; session_id: string }) { | |
| const [open, setOpen] = createSignal(true) | |
| const theme = () => props.api.theme.current | |
| const list = createMemo(() => props.api.state.session.todo(props.session_id)) | |
| const show = createMemo(() => list().length > 0 && list().some((item) => item.status !== "completed")) | |
| return ( | |
| <Show when={show()}> | |
| <box> | |
| <box flexDirection="row" gap={1} onMouseDown={() => list().length > 2 && setOpen((x) => !x)}> | |
| <Show when={list().length > 2}> | |
| <text fg={theme().text}>{open() ? "▼" : "▶"}</text> | |
| </Show> | |
| <text fg={theme().text}> | |
| <b>Todo</b> | |
| </text> | |
| </box> | |
| <Show when={list().length <= 2 || open()}> | |
| <For each={list()}>{(item) => <TodoItem status={item.status} content={item.content} />}</For> | |
| </Show> | |
| </box> | |
| </Show> | |
| ) | |
| } | |
| const tui: TuiPlugin = async (api) => { | |
| api.slots.register({ | |
| order: 400, | |
| slots: { | |
| sidebar_content(_ctx, props) { | |
| return <View api={api} session_id={props.session_id} /> | |
| }, | |
| }, | |
| }) | |
| } | |
| const plugin: BuiltinTuiPlugin = { | |
| id, | |
| tui, | |
| } | |
| export default plugin | |