mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-24 03:04:21 +01:00
ignore: lander
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createAsync } from "@solidjs/router"
|
||||
import { createMemo } from "solid-js"
|
||||
import { github } from "~/lib/github"
|
||||
import { config } from "~/config"
|
||||
|
||||
export function Footer() {
|
||||
const githubData = createAsync(() => github())
|
||||
@@ -10,13 +11,13 @@ export function Footer() {
|
||||
notation: "compact",
|
||||
compactDisplay: "short",
|
||||
}).format(githubData()!.stars!)
|
||||
: "25K",
|
||||
: config.github.starsFormatted.compact,
|
||||
)
|
||||
|
||||
return (
|
||||
<footer data-component="footer">
|
||||
<div data-slot="cell">
|
||||
<a href="https://github.com/sst/opencode" target="_blank">
|
||||
<a href={config.github.repoUrl} target="_blank">
|
||||
GitHub <span>[{starCount()}]</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -27,7 +28,7 @@ export function Footer() {
|
||||
<a href="/discord">Discord</a>
|
||||
</div>
|
||||
<div data-slot="cell">
|
||||
<a href="https://x.com/opencode">X</a>
|
||||
<a href={config.social.twitter}>X</a>
|
||||
</div>
|
||||
</footer>
|
||||
)
|
||||
|
||||
@@ -18,6 +18,7 @@ import { createMemo, Match, Show, Switch } from "solid-js"
|
||||
import { createStore } from "solid-js/store"
|
||||
import { github } from "~/lib/github"
|
||||
import { createEffect, onCleanup } from "solid-js"
|
||||
import { config } from "~/config"
|
||||
import "./header-context-menu.css"
|
||||
|
||||
const isDarkMode = () => window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||
@@ -42,7 +43,7 @@ export function Header(props: { zen?: boolean }) {
|
||||
notation: "compact",
|
||||
compactDisplay: "short",
|
||||
}).format(githubData()?.stars!)
|
||||
: "29K",
|
||||
: config.github.starsFormatted.compact,
|
||||
)
|
||||
|
||||
const [store, setStore] = createStore({
|
||||
@@ -148,7 +149,7 @@ export function Header(props: { zen?: boolean }) {
|
||||
<nav data-component="nav-desktop">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://github.com/sst/opencode" target="_blank">
|
||||
<a href={config.github.repoUrl} target="_blank">
|
||||
GitHub <span>[{starCount()}]</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -222,7 +223,7 @@ export function Header(props: { zen?: boolean }) {
|
||||
<A href="/">Home</A>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/sst/opencode" target="_blank">
|
||||
<a href={config.github.repoUrl} target="_blank">
|
||||
GitHub <span>[{starCount()}]</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
26
packages/console/app/src/config.ts
Normal file
26
packages/console/app/src/config.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Application-wide constants and configuration
|
||||
*/
|
||||
export const config = {
|
||||
// GitHub
|
||||
github: {
|
||||
repoUrl: "https://github.com/sst/opencode",
|
||||
starsFormatted: {
|
||||
compact: "30K",
|
||||
full: "30,000",
|
||||
},
|
||||
},
|
||||
|
||||
// Social links
|
||||
social: {
|
||||
twitter: "https://x.com/opencode",
|
||||
discord: "https://discord.gg/opencode",
|
||||
},
|
||||
|
||||
// Static stats (used on landing page)
|
||||
stats: {
|
||||
contributors: "250",
|
||||
commits: "3,500",
|
||||
monthlyUsers: "300,000",
|
||||
},
|
||||
} as const
|
||||
@@ -1,4 +1,5 @@
|
||||
import { query } from "@solidjs/router"
|
||||
import { config } from "~/config"
|
||||
|
||||
export const github = query(async () => {
|
||||
"use server"
|
||||
@@ -6,11 +7,15 @@ export const github = query(async () => {
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
|
||||
}
|
||||
const apiBaseUrl = config.github.repoUrl.replace(
|
||||
"https://github.com/",
|
||||
"https://api.github.com/repos/",
|
||||
)
|
||||
try {
|
||||
const [meta, releases, contributors] = await Promise.all([
|
||||
fetch("https://api.github.com/repos/sst/opencode", { headers }).then((res) => res.json()),
|
||||
fetch("https://api.github.com/repos/sst/opencode/releases", { headers }).then((res) => res.json()),
|
||||
fetch("https://api.github.com/repos/sst/opencode/contributors?per_page=1", { headers }),
|
||||
fetch(apiBaseUrl, { headers }).then((res) => res.json()),
|
||||
fetch(`${apiBaseUrl}/releases`, { headers }).then((res) => res.json()),
|
||||
fetch(`${apiBaseUrl}/contributors?per_page=1`, { headers }),
|
||||
])
|
||||
const [release] = releases
|
||||
const contributorCount = Number.parseInt(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user