-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathpage.tsx
131 lines (127 loc) · 3.84 KB
/
page.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
"use client";
import {
Container,
Group,
List,
ListItem,
Stack,
Text,
Title,
} from "@mantine/core";
import Image from "next/image";
import React, { useEffect, useState } from "react";
import classes from "./avm2.module.css";
import { ClassBox } from "@/app/compatibility/avm2/class_box";
import {
getReportByNamespace,
NamespaceStatus,
} from "@/app/compatibility/avm2/report_utils";
import {
IconDone,
IconMissing,
IconStub,
} from "@/app/compatibility/avm2/icons";
import Link from "next/link";
import { useTranslation, Trans } from "@/app/translate";
function NamespaceBox(props: NamespaceStatus) {
const { t } = useTranslation();
return (
<Stack className={classes.namespace}>
<Title order={2}>{props.name || t("compatibility.avm2.top-level")}</Title>
<Group align="baseline">
{Object.entries(props.classes).map(([classname, classinfo]) => (
<ClassBox key={classname} {...classinfo} />
))}
</Group>
</Stack>
);
}
export default function Page() {
const { t } = useTranslation();
const [byNamespace, setByNamespace] = useState<
{ [name: string]: NamespaceStatus } | undefined
>(undefined);
useEffect(() => {
const fetchData = async () => {
try {
const byNamespace = await getReportByNamespace();
setByNamespace(byNamespace);
} catch (error) {
console.error("Error fetching data", error);
}
};
fetchData();
}, []);
return (
<Container size="xl">
<Stack gap="xl">
<Group align="top" wrap="nowrap">
<Image
src="/undraw/undraw_progress_overview_re_tvcl.svg"
alt="Person viewing ActionScript classes"
width={208}
height={200}
priority
className={classes.progressImage}
/>
<Stack className={classes.actionscriptInfo}>
<Title className={classes.title}>
{t("compatibility.avm2.title")}
</Title>
<Text>{t("compatibility.avm2.description")}</Text>
<Text>{t("compatibility.avm2.classification")}</Text>
<List spacing="sm">
<ListItem icon={<IconDone />}>
<Trans
i18nKey="compatibility.avm2.implemented-description"
components={[
<b key="implemented">
{t("compatibility.avm2.implemented")}
</b>,
]}
/>
</ListItem>
<ListItem icon={<IconStub />}>
<Trans
i18nKey="compatibility.avm2.partial-description"
components={[
<b key="partial">{t("compatibility.avm2.partial")}</b>,
]}
/>
</ListItem>
<ListItem icon={<IconMissing />}>
<Trans
i18nKey="compatibility.avm2.missing-description"
components={[
<b key="missing">{t("compatibility.avm2.missing")}</b>,
]}
/>
</ListItem>
</List>
<Text>
<Trans
i18nKey="compatibility.avm2.tree"
components={[
<Link
key="link"
href="/compatibility/avm2/tree.svg"
target="_blank"
>
{t("compatibility.avm2.tree-link")}
</Link>,
]}
/>
</Text>
</Stack>
</Group>
<Stack gap="xl" className={classes.listContainer}>
{byNamespace
? Object.entries(byNamespace).map(([namespace, info]) => (
<NamespaceBox key={namespace} {...info} />
))
: ""}
</Stack>
</Stack>
</Container>
);
}