update downloads page & deps

This commit is contained in:
Sacha Weatherstone 2022-12-10 16:54:44 +10:00
parent f8fb0ddb92
commit 37cba0e8c8
No known key found for this signature in database
GPG key ID: 7AB2D7E206124B31
7 changed files with 314 additions and 420 deletions

View file

@ -17,11 +17,11 @@
"@docusaurus/core": "2.2.0",
"@docusaurus/plugin-content-docs": "2.2.0",
"@docusaurus/preset-classic": "2.2.0",
"@headlessui/react": "^1.7.4",
"@headlessui/react": "^1.7.5",
"@heroicons/react": "^2.0.13",
"@leenguyen/react-flip-clock-countdown": "^1.3.1",
"@mdx-js/react": "^1.6.22",
"@meshtastic/meshtasticjs": "^0.6.115",
"@meshtastic/meshtasticjs": "^0.7.2",
"autoprefixer": "^10.4.13",
"base64-js": "^1.5.1",
"dotenv": "^16.0.3",
@ -31,20 +31,20 @@
"react-dom": "^17.0.2",
"react-icons": "^4.7.1",
"react-responsive-carousel": "^3.2.23",
"swr": "^1.3.0",
"swr": "^2.0.0",
"tailwindcss": "^3.2.4",
"url-search-params-polyfill": "^8.1.1",
"use-breakpoint": "^3.0.4"
"use-breakpoint": "^3.0.6"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.2.0",
"@meshtastic/eslint-config": "^1.0.8",
"@tailwindcss/typography": "^0.5.8",
"@tsconfig/docusaurus": "^1.0.6",
"@types/node": "^18.11.9",
"@types/react": "^18.0.25",
"@types/node": "^18.11.12",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"prettier": "^2.8.0",
"typescript": "^4.9.3"
"prettier": "^2.8.1",
"typescript": "^4.9.4"
}
}

File diff suppressed because it is too large Load diff

@ -1 +1 @@
Subproject commit c82c15aac71b9134d96c03dbe319916739cc8314
Subproject commit b4677e35ca44ed80394f90c2e60703add8ff4f5b

View file

@ -1,11 +1,11 @@
import React from 'react';
import { Release } from '@site/src/utils/github';
import { DeviceFirmwareResource } from '../../../utils/apiTypes.js';
export interface releaseCardProps {
variant: string;
description: string;
release?: Release[];
release?: DeviceFirmwareResource[];
}
export const FirmwareCard = ({
@ -21,33 +21,29 @@ export const FirmwareCard = ({
>
<h3>{variant}</h3>
{release?.length && (
<a href={release[0].html_url}>{release[0].tag_name}</a>
<a href={release[0].page_url}>{release[0].title}</a>
)}
</div>
<div className="card__body">
<p>{description}</p>
</div>
<div className="card__footer mt-auto">
<div className="margin-top--sm">
<details>
<summary>
Older Versions
</summary>
{release.slice(1, 6).map((release) => {
return (
<div key={release.id}>
<a href={release.assets[1]?.browser_download_url}>
{release.tag_name}
</a>
</div>
);
})}
</details>
</div>
<div className="margin-top--sm">
<details>
<summary>Older Versions</summary>
{release.slice(1, 6).map((release) => {
return (
<div key={release.id}>
<a href={release.zip_url}>{release.title}</a>
</div>
);
})}
</details>
</div>
{release?.length ? (
<>
<a
href={release[0].assets[1]?.browser_download_url}
href={release[0].zip_url}
className="button button--secondary button--block margin-top--sm"
>
Download {variant}

View file

@ -12,7 +12,7 @@ import {
} from '@heroicons/react/24/solid';
import Layout from '@theme/Layout';
import { Release } from '../../utils/github';
import { FirmwareReleases } from '../../utils/apiTypes.js';
import { fetcher } from '../../utils/swr';
import {
FirmwareCard,
@ -20,14 +20,11 @@ import {
} from './_components/FirmwareCard';
const Firmware = (): JSX.Element => {
const { data, error } = useSWR<Release[]>(
'https://api.github.com/repos/meshtastic/firmware/releases',
const { data, error } = useSWR<FirmwareReleases>(
'http://localhost:4000/github/firmware/list',
fetcher,
);
const beta = data?.filter((release) => release.prerelease === false);
const alpha = data?.filter((release) => release.prerelease === true);
return (
<Layout
title="Downloads"
@ -104,7 +101,7 @@ const Firmware = (): JSX.Element => {
<div className="flex w-1/5 bg-gradient-to-r from-rose-500 to-primary">
<ComputerDesktopIcon className="m-auto h-20" />
</div>
<div className="flex w-full flex-col columns-3 bg-primary lg:flex-row">
<div className="flex w-full columns-3 flex-col bg-primary lg:flex-row">
<div className="card m-4 border-2 border-secondary">
<div className="card__header">
<h3>Apple</h3>
@ -138,9 +135,7 @@ const Firmware = (): JSX.Element => {
<FaAndroid className="h-20 w-20" />
</div>
</div>
<div className="card__body">
Sideloading also available.
</div>
<div className="card__body">Sideloading also available.</div>
<div className="card__footer mt-auto">
<a
target="_blank"
@ -198,14 +193,14 @@ const Firmware = (): JSX.Element => {
{data && !error ? (
<>
<FirmwareCard
variant="Beta"
variant="Stable"
description="Tested feature set. For those who want stability."
release={beta}
release={data.releases.stable}
/>
<FirmwareCard
variant="Alpha"
description="Upcoming changes for testing. For those who want new features."
release={alpha}
release={data.releases.alpha}
/>
<div className="card m-4 border-2 border-secondary">
<div className="card__header">

View file

@ -48,3 +48,18 @@ export interface Author {
showcase?: Showcase[];
}
export interface DeviceFirmwareResource {
id: string;
title: string;
page_url?: string;
zip_url?: string;
}
export interface FirmwareReleases {
releases: {
stable: DeviceFirmwareResource[];
alpha: DeviceFirmwareResource[];
};
pullRequests: DeviceFirmwareResource[];
}

View file

@ -1,128 +0,0 @@
export interface User {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
name: string;
company: string | null;
blog: string;
location: string;
email: string | null;
hireable: string | null;
bio: string | null;
twitter_username: string | null;
public_repos: number;
public_gists: number;
followers: number;
following: number;
created_at: string;
updated_at: string;
}
export interface Author {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
}
export interface Uploader {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
}
export interface Asset {
url: string;
id: number;
node_id: string;
name: string;
label: string;
uploader: Uploader;
content_type: string;
state: string;
size: number;
download_count: number;
created_at: Date;
updated_at: Date;
browser_download_url: string;
}
export interface Reactions {
url: string;
total_count: number;
'+1': number;
'-1': number;
laugh: number;
hooray: number;
confused: number;
heart: number;
rocket: number;
eyes: number;
}
export interface Release {
url: string;
assets_url: string;
upload_url: string;
html_url: string;
id: number;
author: Author;
node_id: string;
tag_name: string;
target_commitish: string;
name: string;
draft: boolean;
prerelease: boolean;
created_at: Date;
published_at: Date;
assets: Asset[];
tarball_url: string;
zipball_url: string;
body: string;
reactions: Reactions;
mentions_count: number;
}