Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(website): address requested changes
Elian Doran328e48832239
diff --git a/apps/website/src/components/Header.tsx b/apps/website/src/components/Header.tsxindex 1e77018a19..b40b2d8c27 100644--- a/apps/website/src/components/Header.tsx+++ b/apps/website/src/components/Header.tsx@@ -1,6 +1,6 @@import "./Header.css";-import { useContext, useEffect, useMemo, useState } from "preact/hooks";+import { useContext, useEffect, useState } from "preact/hooks";import { useLocation } from 'preact-iso';import { useTranslation } from "react-i18next";@@ -76,13 +76,12 @@ export function Header(props: {repoStargazersCount: number}) {<SocialButtonname="GitHub"iconSvg={githubIcon}- counter={`${(props.repoStargazersCount / 1000).toFixed(1) }K+`}+ counter={`${(props.repoStargazersCount / 1000).toFixed(1)}K+`}url="https://github.com/TriliumNext/Trilium"/></div><DownloadButton />-</div></header>);diff --git a/apps/website/src/github-utils.ts b/apps/website/src/github-utils.tsindex acf00361cf..7f95b3f8b6 100644--- a/apps/website/src/github-utils.ts+++ b/apps/website/src/github-utils.ts@@ -20,7 +20,7 @@ async function fetchRepoStargazersCount(): Promise<number> {const details = await response.json();const count = details["stargazers_count"];- if (count) {+ if (typeof count === "number" && Number.isFinite(count) && count >= 0) {console.log(`Got number of stargazers: ${count}`);return count;}diff --git a/apps/website/src/index.tsx b/apps/website/src/index.tsxindex 27d33bcd5d..1c6d70daf9 100644--- a/apps/website/src/index.tsx+++ b/apps/website/src/index.tsx@@ -7,7 +7,7 @@ import { hydrate, LocationProvider, prerender as ssr, Route, Router, useLocationimport Footer from './components/Footer.js';import { Header } from './components/Header.jsx';-import { getRepoStargazersCount } from './github-utils';+import { FALLBACK_STARGAZERS_COUNT, getRepoStargazersCount } from './github-utils';import { extractLocaleFromUrl, initTranslations, LOCALES, mapLocale } from './i18n';import { NotFound } from './pages/_404.jsx';import GetStarted from './pages/GetStarted/get-started.js';@@ -21,7 +21,7 @@ export function App({ repoStargazersCount }) {return (<LocationProvider><LocaleProvider>- <Header repoStargazersCount={repoStargazersCount} />+ <Header repoStargazersCount={repoStargazersCount ?? FALLBACK_STARGAZERS_COUNT} /><main><Router><Route path="/" component={Home} />diff --git a/apps/website/src/pages/Resources/Resources.tsx b/apps/website/src/pages/Resources/Resources.tsxindex 7658fff128..01617915cf 100644--- a/apps/website/src/pages/Resources/Resources.tsx+++ b/apps/website/src/pages/Resources/Resources.tsx@@ -15,7 +15,7 @@ interface IconPackMeta {description: string;}-const iconPacksMeta = Object.values(import.meta.glob("../../../src/resources/icon-packs/*.json", {+const iconPacksMeta = Object.values(import.meta.glob("../../resources/icon-packs/*.json", {eager: true})) as IconPackMeta[];@@ -44,8 +44,8 @@ export default function Resources() {><p className="description">{meta.description}</p><footer>- <Button href={`/resources/icon-packs/${meta.file}`} download text="Download" />- <Link href={meta.website} openExternally>Website</Link>+ <Button href={`/resources/icon-packs/${encodeURIComponent(meta.file)}`} download text={t("resources.download")} />+ <Link href={meta.website} openExternally>{t("resources.website")}</Link></footer></Card>))}diff --git a/apps/website/src/translations/en/translation.json b/apps/website/src/translations/en/translation.jsonindex b7a94f4c6c..4012fa2df3 100644--- a/apps/website/src/translations/en/translation.json+++ b/apps/website/src/translations/en/translation.json@@ -201,6 +201,8 @@"resources": {"title": "Resources","icon_packs": "Icon packs",- "icon_packs_intro": "Expand the selection of available icons for your notes by using an icon pack. For more information about icon packs, see the <DocumentationLink>official documentation</DocumentationLink>."+ "icon_packs_intro": "Expand the selection of available icons for your notes by using an icon pack. For more information about icon packs, see the <DocumentationLink>official documentation</DocumentationLink>.",+ "download": "Download",+ "website": "Website"}}