-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathImageLinks.tsx
68 lines (63 loc) · 1.96 KB
/
ImageLinks.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from "react";
interface ImageLink {
device: string;
version: string;
downloadLink: string;
sdCardSupport?: boolean;
}
export const imageLinks = [
{
device: "Lichee Pi 4A",
version: "20250323",
downloadLink: "https://mirror.iscas.ac.cn/revyos/extra/images/lpi4a/20250323/",
sdCardSupport: true,
},
{
device: "Milk-V Meles",
version: "20250323",
downloadLink: "https://mirror.iscas.ac.cn/revyos/extra/images/meles/20250323/",
sdCardSupport: true,
},
{
device: "Milk-V Pioneer",
version: "20241230",
downloadLink: "https://mirror.iscas.ac.cn/revyos/extra/images/sg2042/20241230/",
sdCardSupport: true,
},
{
device: "Lichee Cluster 4A",
version: "20240720",
downloadLink: "https://mirror.iscas.ac.cn/revyos/extra/images/lpi4a/",
},
{
device: "Lichee Console 4A",
version: "20240720",
downloadLink: "https://mirror.iscas.ac.cn/revyos/extra/images/lcon4a/20240720/",
},
{
device: "Lichee Book 4A",
version: "20240720",
downloadLink: "https://mirror.iscas.ac.cn/revyos/extra/images/laptop4a/",
},
{
device: "Beagle-Ahead",
version: "20231210",
downloadLink: "https://mirror.iscas.ac.cn/revyos/extra/images/beagle/20231210/",
},
{
device: "Huiwei book",
version: "20240617",
downloadLink: "https://mirror.iscas.ac.cn/revyos/extra/images/huiwei/test/20240617/",
},
] as const satisfies readonly ImageLink[];
/**
* 根据设备名称查找对应的下载链接,并渲染为 `<a>` 标签。
*
* @param device 设备名称,仅允许 `DeviceName` 类型的值。
* @returns 如果找到匹配的设备,则返回对应版本的下载链接;否则显示 "$device 暂无镜像"。
*/
export const DownloadLink: React.FC<{device: string}> = ({ device }) => {
const link = imageLinks.find((item) => item.device === device);
if (!link) return <span>${device} 暂无镜像</span>;
return <a href={link.downloadLink}>{link.version}</a>;
};