Have a single place to define the repo url

This commit is contained in:
Misode
2025-01-04 19:05:23 +01:00
parent 0b73a6056a
commit 55dc606ddc
4 changed files with 8 additions and 5 deletions

View File

@@ -11,6 +11,8 @@ import config from './Config.js'
import type { VersionId } from './services/index.js'
import { checkVersion } from './services/index.js'
export const SOURCE_REPO_URL = 'https://github.com/misode/misode.github.io'
export function isPromise(obj: any): obj is Promise<any> {
return typeof (obj as any)?.then === 'function'
}

View File

@@ -6,7 +6,7 @@ import { useSpyglass } from '../contexts/Spyglass.jsx'
import { useVersion } from '../contexts/Version.jsx'
import { useAsync } from '../hooks/useAsync.js'
import { latestVersion } from '../services/DataFetcher.js'
import { getGenerator } from '../Utils.js'
import { getGenerator, SOURCE_REPO_URL } from '../Utils.js'
import { Octicon } from './index.js'
type ErrorPanelProps = {
@@ -55,7 +55,7 @@ export function ErrorPanel({ error, prefix, reportable, onDismiss, body: body_,
}, [error])
const url = useMemo(() => {
let url ='https://github.com/misode/misode.github.io/issues/new'
let url =`${SOURCE_REPO_URL}/issues/new`
const fullName = (error instanceof Error ? `${error.name}: ` : '') + name
url += `?title=${encodeURIComponent(fullName)}`
let body = ''

View File

@@ -1,4 +1,5 @@
import { useLocale } from '../contexts/index.js'
import { SOURCE_REPO_URL } from '../Utils.js'
import { Octicon } from './index.js'
interface Props {
@@ -17,7 +18,7 @@ export function Footer({ donate }: Props) {
</p>}
<p>
{Octicon.mark_github}
<span>{locale('source_code_on')} <a href="https://github.com/misode/misode.github.io" target="_blank" rel="noreferrer">{locale('github')}</a></span>
<span>{locale('source_code_on')} <a href={SOURCE_REPO_URL} target="_blank" rel="noreferrer">{locale('github')}</a></span>
</p>
</footer>
}

View File

@@ -2,7 +2,7 @@ import { getCurrentUrl, Link, route } from 'preact-router'
import config from '../Config.js'
import { useLocale, useTheme, useTitle, useVersion } from '../contexts/index.js'
import { checkVersion } from '../services/index.js'
import { cleanUrl, getGenerator } from '../Utils.js'
import { cleanUrl, getGenerator, SOURCE_REPO_URL } from '../Utils.js'
import { Btn, BtnMenu, Icons, Octicon } from './index.js'
const Themes: Record<string, keyof typeof Octicon> = {
@@ -50,7 +50,7 @@ export function Header() {
</BtnMenu>
</li>
<li class="dimmed">
<a href="https://github.com/misode/misode.github.io" target="_blank" rel="noreferrer" class="tooltipped tip-sw" aria-label={locale('github')}>
<a href={SOURCE_REPO_URL} target="_blank" rel="noreferrer" class="tooltipped tip-sw" aria-label={locale('github')}>
{Octicon.mark_github}
</a>
</li>