sync
This commit is contained in:
parent
f928325a1b
commit
33d5809157
1 changed files with 5 additions and 3 deletions
|
|
@ -8,8 +8,10 @@ import { Faq } from "~/component/faq"
|
||||||
import desktopAppIcon from "../../asset/lander/opencode-desktop-icon.png"
|
import desktopAppIcon from "../../asset/lander/opencode-desktop-icon.png"
|
||||||
import { Legal } from "~/component/legal"
|
import { Legal } from "~/component/legal"
|
||||||
import { config } from "~/config"
|
import { config } from "~/config"
|
||||||
|
import { createMemo } from "solid-js"
|
||||||
|
|
||||||
const getLatestRelease = query(async () => {
|
const getLatestRelease = query(async () => {
|
||||||
|
"use server"
|
||||||
const response = await fetch("https://api.github.com/repos/sst/opencode/releases/latest")
|
const response = await fetch("https://api.github.com/repos/sst/opencode/releases/latest")
|
||||||
if (!response.ok) return null
|
if (!response.ok) return null
|
||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
|
|
@ -29,11 +31,11 @@ export default function Download() {
|
||||||
const release = createAsync(() => getLatestRelease(), {
|
const release = createAsync(() => getLatestRelease(), {
|
||||||
deferStream: true,
|
deferStream: true,
|
||||||
})
|
})
|
||||||
const download = () => {
|
const download = createMemo(() => {
|
||||||
const version = release()
|
const version = release() ?? "v1.0.150"
|
||||||
if (!version) return null
|
if (!version) return null
|
||||||
return `https://github.com/sst/opencode/releases/download/${version}`
|
return `https://github.com/sst/opencode/releases/download/${version}`
|
||||||
}
|
})
|
||||||
const handleCopyClick = (command: string) => (event: Event) => {
|
const handleCopyClick = (command: string) => (event: Event) => {
|
||||||
const button = event.currentTarget as HTMLButtonElement
|
const button = event.currentTarget as HTMLButtonElement
|
||||||
navigator.clipboard.writeText(command)
|
navigator.clipboard.writeText(command)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue