Skip to content

The swiss army knife of lossless video/audio editing

Website redesign: review fixes

Claude835758965cbb
diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml
index 0580bf5c..e7420204 100644
--- a/.github/workflows/website.yml
+++ b/.github/workflows/website.yml
@@ -35,3 +35,6 @@ jobs:
- run: yarn check
# also fails on links in the docs that point to a missing page or heading
- run: yarn build
+ env:
+ # for the homepage's GitHub star count (website/src/githubStars.ts), so it isn't rate limited
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/website/src/components/Home.tsx b/website/src/components/Home.tsx
index 038d1be5..e090c628 100644
--- a/website/src/components/Home.tsx
+++ b/website/src/components/Home.tsx
@@ -44,7 +44,7 @@ const features: { text: string, Icon: LucideIcon }[] = [
{ text: 'Change rotation/orientation metadata in videos', Icon: RotateCw },
{ text: 'Powerful timeline with zoom and frame/keyframe jumping', Icon: ZoomIn },
{ text: 'Auto-saves per project cut segments to file', Icon: Save },
- { text: 'View ffmpeg last command log so you can modify and re-run modify recent commands on the command line', Icon: Terminal },
+ { text: 'View ffmpeg last command log so you can modify and re-run recent commands on the command line', Icon: Terminal },
{ text: 'Give labels to cut segments', Icon: Tag },
{ text: 'Segment panel showing segments with details, export/import cut segments as CSV', Icon: ListOrdered },
{ text: 'Video thumbnails and audio waveform', Icon: AudioWaveform },
@@ -92,7 +92,7 @@ function ScreenshotSection({ background, screenshot, alt, width, borderRadius, s
}
function WhiteSection({ children }: { children: ReactNode }) {
- return <div className="white-section">{children}</div>;
+ return <section className="white-section">{children}</section>;
}
function List({ items }: { items: string[] }) {
@@ -119,8 +119,8 @@ function StoreBadges({ height }: { height: number }) {
const formatStars = (stars: number) => (stars >= 1000 ? `${Math.floor(stars / 1000)}k+` : String(stars));
-// stars: the GitHub star count, fetched at build time by index.astro (undefined if that failed)
-export default function Home({ stars }: { stars?: number | undefined }) {
+// stars: the GitHub star count, fetched at build time by index.astro (see githubStars.ts)
+export default function Home({ stars }: { stars: number }) {
return (
<div className="page">
<header className="hero" style={{ backgroundImage: `linear-gradient(160deg, rgba(11, 52, 56, 0.93), rgba(40, 40, 40, 0.96) 65%), url(${background1})` }}>
@@ -140,7 +140,7 @@ export default function Home({ stars }: { stars?: number | undefined }) {
</div>
<StoreBadges height={40} />
<ul className="proof">
- {stars != null && <li><Star aria-hidden size={16} className="star" /> {formatStars(stars)} stars on <a href={githubUrl}>GitHub</a></li>}
+ <li><Star aria-hidden size={16} className="star" /> {formatStars(stars)} stars on <a href={githubUrl}>GitHub</a></li>
<li><CodeXml aria-hidden size={16} /> Free and open source</li>
<li><Monitor aria-hidden size={16} /> Windows, macOS, Linux</li>
</ul>
@@ -149,11 +149,12 @@ export default function Home({ stars }: { stars?: number | undefined }) {
<div className="hero-media">
{demoSources.length > 0 ? (
- <video autoPlay muted loop playsInline poster={mainScreenshot} aria-label="LosslessCut cutting a video">
+ // controls: a looping video must be pausable (WCAG 2.2.2), and the page has no JavaScript for a custom button
+ <video autoPlay muted loop playsInline controls width={1000} height={624} poster={mainScreenshot} aria-label="LosslessCut cutting a video">
{demoSources.map(({ url, type }) => <source key={url} src={url} type={type} />)}
</video>
) : (
- <img src={mainScreenshot} alt="LosslessCut main window" />
+ <img src={mainScreenshot} alt="LosslessCut main window" width={1000} height={624} fetchPriority="high" />
)}
</div>
</div>
diff --git a/website/src/githubStars.ts b/website/src/githubStars.ts
new file mode 100644
index 00000000..23773212
--- /dev/null
+++ b/website/src/githubStars.ts
@@ -0,0 +1,28 @@
+// The GitHub star count for the homepage, fetched once per build (or dev server).
+// Without a token, the GitHub API allows only 60 requests per hour per IP, which CI and Cloudflare's build servers share
+// with others, so GITHUB_TOKEN is used when set. If the request fails anyway, the last known count is shown instead.
+const fallbackStars = 44_000;
+
+async function fetchStars() {
+ try {
+ const token = process.env['GITHUB_TOKEN'];
+ const response = await fetch('https://api.github.com/repos/mifi/lossless-cut', {
+ headers: { accept: 'application/vnd.github+json', ...(token && { authorization: `Bearer ${token}` }) },
+ signal: AbortSignal.timeout(10_000),
+ });
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
+ const { stargazers_count: stars } = await response.json();
+ if (typeof stars !== 'number') throw new Error('No stargazers_count');
+ return stars;
+ } catch (err) {
+ console.warn(`Could not get the GitHub star count, using ${fallbackStars}:`, err instanceof Error ? err.message : err);
+ return fallbackStars;
+ }
+}
+
+let starsPromise: Promise<number> | undefined;
+
+export default function getGithubStars() {
+ starsPromise ??= fetchStars();
+ return starsPromise;
+}
diff --git a/website/src/pages/index.astro b/website/src/pages/index.astro
index 6bf667fd..0182c778 100644
--- a/website/src/pages/index.astro
+++ b/website/src/pages/index.astro
@@ -1,21 +1,10 @@
---
import Home from '../components/Home.tsx';
+import getGithubStars from '../githubStars.ts';
import { mastodonUrl } from '../links.ts';
import structuredData from '../structuredData.ts';
import '../styles/home.css';
-// The GitHub star count for the homepage, at build time. Optional: the build doesn't fail if GitHub doesn't answer.
-async function getGithubStars() {
- try {
- const response = await fetch('https://api.github.com/repos/mifi/lossless-cut', { headers: { accept: 'application/vnd.github+json' }, signal: AbortSignal.timeout(10_000) });
- if (!response.ok) throw new Error(`HTTP ${response.status}`);
- const { stargazers_count: stars } = await response.json();
- return typeof stars === 'number' ? stars : undefined;
- } catch (err) {
- console.warn('Could not get the GitHub star count:', err instanceof Error ? err.message : err);
- return undefined;
- }
-}
const stars = await getGithubStars();
const title = 'LosslessCut – Free Lossless Video Cutter for Mac, Windows & Linux';
diff --git a/website/src/styles/home.css b/website/src/styles/home.css
index e9b27331..b5340bb2 100644
--- a/website/src/styles/home.css
+++ b/website/src/styles/home.css
@@ -70,6 +70,7 @@ body {
.tagline {
font-size: 22px;
font-weight: 300;
+ text-wrap: balance;
}
.hero-subtitle {
margin-top: 14px;
@@ -185,7 +186,8 @@ body {
line-height: 1.5;
}
.quote-card::before {
- content: '\201C';
+ /* decorative, not read out by screen readers */
+ content: '\201C' / '';
position: absolute;
left: 16px;
top: 6px;
@@ -258,10 +260,10 @@ body {
display: flex;
flex-wrap: wrap;
justify-content: center;
+ gap: 6px 4px;
}
.app-store {
overflow: hidden;
- margin: 0 2px;
}
.app-store img {
display: block;