SPB Git

Repository Public

DownloadShelf.tsx 5.8 KB 105 lines tsx

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : ORIX App Universe8 * File             : src/components/downloads/DownloadShelf.tsx9 * Module           : components10 * Repository       : https://git.spboucher.ai/orix-spboucher-ai11 * Project Website  : https://www.orixlab.dev12 * Created          : 2026-11-2113 * Last Modified    : 2026-11-2114 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: support@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import Image from "next/image";44import Link from "next/link";45import type { MacDownload } from "@/lib/downloads/list";46import { dict, fmtBytes, fmtDate, type Locale } from "@/lib/i18n";47import { AppIcon } from "../ui/AppIcon";48import { Arrow, Down } from "../ui/Badges";49import { Reveal } from "../ui/Reveal";50import { TrackedLink } from "../ui/TrackedLink";5152const Seal = () => (53  <svg width="15" height="15" viewBox="0 0 16 16" fill="none" aria-hidden className="flex-none text-[var(--ok)]"><circle cx="8" cy="8" r="7" stroke="currentColor" strokeWidth="1.4" /><path d="m4.8 8.2 2.2 2.2 4.2-4.6" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" /></svg>54);5556/** A release card: the real icon, the verified facts of the image, one download button. */57function Card({ d, locale, wide, heading: H }: { d: MacDownload; locale: Locale; wide: boolean; heading: "h2" | "h3" }) {58  const t = dict(locale);59  const facts = [`v${d.version}`, d.size ? fmtBytes(d.size, locale) : null, d.minOS ? `macOS ${d.minOS}+` : null, d.architectures.length ? d.architectures.join(" · ") : null].filter(Boolean);60  return (61    <article className={`card release group grid h-full min-w-0 grid-cols-1 overflow-hidden ${wide && d.shot ? "lg:grid-cols-[minmax(0,0.92fr)_minmax(0,1.08fr)]" : ""}`} style={{ "--accent": d.accent ?? "var(--blue)" } as React.CSSProperties} data-testid="release-card" data-slug={d.slug}>62      <div className="relative z-10 flex min-w-0 flex-col p-7 sm:p-9">63        <div className="flex items-center gap-4">64          <AppIcon name={d.name} src={d.icon} size={wide ? 84 : 68} />65          <div className="min-w-0">66            <H className="h3 !text-[1.45rem]"><Link href={d.page} className="hover:underline">{d.name}</Link></H>67            <p className="mono mt-1 text-[0.74rem] uppercase tracking-[0.12em] text-ink3">{facts.join(" · ")}</p>68          </div>69        </div>70        <p className={`mt-6 text-ink2 ${wide ? "text-[1.12rem] leading-relaxed" : "text-[0.98rem] leading-relaxed"}`}>{wide ? d.summary : d.tagline}</p>71        <ul className="mt-5 grid gap-1.5 text-[0.86rem] text-ink2">72          {d.notarized && <li className="flex items-center gap-2"><Seal />{t.dl.notarized}</li>}73          <li className="flex items-center gap-2"><Seal />{t.dl.integrity}</li>74        </ul>75        <div className="mt-auto flex flex-wrap items-center gap-x-5 gap-y-3 pt-8">76          <TrackedLink href={d.href} slug={d.slug} version={d.version} className="btn btn-primary btn-glow" download><Down />{t.action.download}</TrackedLink>77          <Link href={d.page} className="inline-flex items-center gap-2 text-sm font-semibold text-ink2 transition-colors hover:text-ink">{t.action.learn}<Arrow /></Link>78        </div>79        {d.sha256 && <p className="mono mt-5 truncate text-[0.68rem] text-ink3" title={d.sha256}>SHA-256 {d.sha256}</p>}80        {d.date && <p className="mt-1 text-[0.76rem] text-ink3">{t.dl.date} · {fmtDate(d.date, locale)}</p>}81      </div>82      {wide && d.shot && (83        <div className="relative min-h-[16rem] overflow-hidden border-t border-line lg:border-l lg:border-t-0" aria-hidden>84          <div className="release-glow" />85          <div className="frame frame-mac release-shot"><Image src={d.shot.src} alt="" width={d.shot.width} height={d.shot.height} sizes="(max-width: 1024px) 92vw, 760px" /></div>86        </div>87      )}88    </article>89  );90}9192/** Every macOS application that can be downloaded right now. The first one is given the wide card. */93export function DownloadShelf({ items, locale, heading = "h3" }: { items: MacDownload[]; locale: Locale; heading?: "h2" | "h3" }) {94  const lead = items.findIndex((d) => d.shot);95  return (96    <ul className="grid gap-5 lg:grid-cols-6" data-testid="download-shelf">97      {items.map((d, i) => {98        const wide = i === lead;99        const rest = items.length - (lead >= 0 ? 1 : 0);100        return <Reveal as="li" key={d.slug} delay={(i % 3) * 90} className={"min-w-0 " + (wide ? "lg:col-span-6" : rest % 3 === 0 ? "lg:col-span-2" : rest === 1 ? "lg:col-span-6" : "lg:col-span-3")}><Card d={d} locale={locale} wide={wide} heading={heading} /></Reveal>;101      })}102    </ul>103  );104}105
Files main
Menu

Theme