mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix: types
This commit is contained in:
parent
a9700c8773
commit
e5b3f796e4
2 changed files with 9 additions and 7 deletions
|
|
@ -27,6 +27,8 @@ type SessionTabs = {
|
||||||
all: string[]
|
all: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type LocalProject = Partial<Project> & { worktree: string; expanded: boolean }
|
||||||
|
|
||||||
export const { use: useLayout, provider: LayoutProvider } = createSimpleContext({
|
export const { use: useLayout, provider: LayoutProvider } = createSimpleContext({
|
||||||
name: "Layout",
|
name: "Layout",
|
||||||
init: () => {
|
init: () => {
|
||||||
|
|
@ -69,7 +71,7 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorize(project: Partial<Project> & { worktree: string; expanded: boolean }) {
|
function colorize(project: LocalProject) {
|
||||||
if (project.icon?.color) return project
|
if (project.icon?.color) return project
|
||||||
const color = pickAvailableColor()
|
const color = pickAvailableColor()
|
||||||
usedColors.add(color)
|
usedColors.add(color)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
||||||
} from "solid-js"
|
} from "solid-js"
|
||||||
import { DateTime } from "luxon"
|
import { DateTime } from "luxon"
|
||||||
import { A, useNavigate, useParams } from "@solidjs/router"
|
import { A, useNavigate, useParams } from "@solidjs/router"
|
||||||
import { useLayout, getAvatarColors } from "@/context/layout"
|
import { useLayout, getAvatarColors, LocalProject } from "@/context/layout"
|
||||||
import { useGlobalSync } from "@/context/global-sync"
|
import { useGlobalSync } from "@/context/global-sync"
|
||||||
import { base64Decode, base64Encode } from "@opencode-ai/util/encode"
|
import { base64Decode, base64Encode } from "@opencode-ai/util/encode"
|
||||||
import { Avatar } from "@opencode-ai/ui/avatar"
|
import { Avatar } from "@opencode-ai/ui/avatar"
|
||||||
|
|
@ -26,7 +26,7 @@ import { DiffChanges } from "@opencode-ai/ui/diff-changes"
|
||||||
import { Spinner } from "@opencode-ai/ui/spinner"
|
import { Spinner } from "@opencode-ai/ui/spinner"
|
||||||
import { getFilename } from "@opencode-ai/util/path"
|
import { getFilename } from "@opencode-ai/util/path"
|
||||||
import { DropdownMenu } from "@opencode-ai/ui/dropdown-menu"
|
import { DropdownMenu } from "@opencode-ai/ui/dropdown-menu"
|
||||||
import { Session, Project } from "@opencode-ai/sdk/v2/client"
|
import { Session } from "@opencode-ai/sdk/v2/client"
|
||||||
import { usePlatform } from "@/context/platform"
|
import { usePlatform } from "@/context/platform"
|
||||||
import { createStore, produce } from "solid-js/store"
|
import { createStore, produce } from "solid-js/store"
|
||||||
import {
|
import {
|
||||||
|
|
@ -348,7 +348,7 @@ export default function Layout(props: ParentProps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProjectAvatar = (props: {
|
const ProjectAvatar = (props: {
|
||||||
project: Project
|
project: LocalProject
|
||||||
class?: string
|
class?: string
|
||||||
expandable?: boolean
|
expandable?: boolean
|
||||||
notify?: boolean
|
notify?: boolean
|
||||||
|
|
@ -391,7 +391,7 @@ export default function Layout(props: ParentProps) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProjectVisual = (props: { project: Project & { expanded: boolean }; class?: string }): JSX.Element => {
|
const ProjectVisual = (props: { project: LocalProject; class?: string }): JSX.Element => {
|
||||||
const name = createMemo(() => getFilename(props.project.worktree))
|
const name = createMemo(() => getFilename(props.project.worktree))
|
||||||
const current = createMemo(() => base64Decode(params.dir ?? ""))
|
const current = createMemo(() => base64Decode(params.dir ?? ""))
|
||||||
return (
|
return (
|
||||||
|
|
@ -427,7 +427,7 @@ export default function Layout(props: ParentProps) {
|
||||||
const SessionItem = (props: {
|
const SessionItem = (props: {
|
||||||
session: Session
|
session: Session
|
||||||
slug: string
|
slug: string
|
||||||
project: Project
|
project: LocalProject
|
||||||
depth?: number
|
depth?: number
|
||||||
childrenMap: Map<string, Session[]>
|
childrenMap: Map<string, Session[]>
|
||||||
}): JSX.Element => {
|
}): JSX.Element => {
|
||||||
|
|
@ -517,7 +517,7 @@ export default function Layout(props: ParentProps) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const SortableProject = (props: { project: Project & { worktree: string; expanded: boolean } }): JSX.Element => {
|
const SortableProject = (props: { project: LocalProject }): JSX.Element => {
|
||||||
const sortable = createSortable(props.project.worktree)
|
const sortable = createSortable(props.project.worktree)
|
||||||
const slug = createMemo(() => base64Encode(props.project.worktree))
|
const slug = createMemo(() => base64Encode(props.project.worktree))
|
||||||
const name = createMemo(() => getFilename(props.project.worktree))
|
const name = createMemo(() => getFilename(props.project.worktree))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue