Xianbao QIAN commited on
Commit
d4a7cd9
1 Parent(s): a2242ea

update styling and fix a few links

Browse files
content/policies.json CHANGED
@@ -67,7 +67,7 @@
67
  "en": "Artificial Intelligence Law of the People's Republic of China (Scholar Proposal Draft)",
68
  "link": {
69
  "zh": "http://iolaw.cssn.cn/zxzp/202309/W020230907361599893636.pdf",
70
- "en": "https://m.21jingji.com/article/20240416/herald/4df710ffed0ffe037cdf6c54aa369961_zaker.html"
71
  },
72
  "releaseDate": "2024-04-16"
73
  },
@@ -112,10 +112,19 @@
112
  "en": "Interim Measures for the Management of Generative Artificial Intelligence Services",
113
  "link": {
114
  "zh": "https://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm",
115
- "en": ""
116
  },
117
  "releaseDate": "2023-07-13"
118
  },
 
 
 
 
 
 
 
 
 
119
  {
120
  "zh": "工业和信息化部关于印发《促进新一代人工智能产业发展三年行动计划(2018-2020年)》的通知",
121
  "en": "Notice of the Ministry of Industry and Information Technology on Printing and Distributing the Three-Year Action Plan for Promoting the Development of New Generation Artificial Intelligence Industry (2018-2020)",
 
67
  "en": "Artificial Intelligence Law of the People's Republic of China (Scholar Proposal Draft)",
68
  "link": {
69
  "zh": "http://iolaw.cssn.cn/zxzp/202309/W020230907361599893636.pdf",
70
+ "en": "https://digichina.stanford.edu/work/translation-artificial-intelligence-law-model-law-v-1-0-expert-suggestion-draft-aug-2023/"
71
  },
72
  "releaseDate": "2024-04-16"
73
  },
 
112
  "en": "Interim Measures for the Management of Generative Artificial Intelligence Services",
113
  "link": {
114
  "zh": "https://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm",
115
+ "en": "https://digichina.stanford.edu/work/translation-measures-for-the-management-of-generative-artificial-intelligence-services-draft-for-comment-april-2023/"
116
  },
117
  "releaseDate": "2023-07-13"
118
  },
119
+ {
120
+ "zh": "国家互联网信息办公室关于《生成式人工智能服务管理办法(征求意见稿)》公开征求意见的通知",
121
+ "en": "Notice on Public Consultation for the Draft Measures for the Management of Generative Artificial Intelligence Services",
122
+ "link": {
123
+ "zh": "https://www.cac.gov.cn/2023-04/11/c_1682854275475410.htm",
124
+ "en": "https://digichina.stanford.edu/work/translation-measures-for-the-management-of-generative-artificial-intelligence-services-draft-for-comment-april-2023/"
125
+ },
126
+ "releaseDate": "2023-04-11"
127
+ },
128
  {
129
  "zh": "工业和信息化部关于印发《促进新一代人工智能产业发展三年行动计划(2018-2020年)》的通知",
130
  "en": "Notice of the Ministry of Industry and Information Technology on Printing and Distributing the Three-Year Action Plan for Promoting the Development of New Generation Artificial Intelligence Industry (2018-2020)",
src/components/AIPoliciesTable.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React from "react";
2
  import { PolicyData } from "../types";
3
 
4
  interface AIPoliciesTableProps {
@@ -6,6 +6,18 @@ interface AIPoliciesTableProps {
6
  }
7
 
8
  const AIPoliciesTable: React.FC<AIPoliciesTableProps> = ({ policies }) => {
 
 
 
 
 
 
 
 
 
 
 
 
9
  const groupedPolicies = policies.reduce((acc, policy) => {
10
  const year = new Date(policy.releaseDate).getFullYear();
11
  if (!acc[year]) {
@@ -26,56 +38,63 @@ const AIPoliciesTable: React.FC<AIPoliciesTableProps> = ({ policies }) => {
26
  };
27
 
28
  return (
29
- <div>
30
  {sortedYears.map((year) => (
31
- <div key={year} className="mb-8">
32
- <button className="text-xl font-bold mb-2 focus:outline-none">
33
- {year}
 
 
 
34
  </button>
35
- <table className="w-full border-collapse table-auto">
36
- <tbody>
37
- {groupedPolicies[year].map((policy, index) => (
38
- <tr
39
- key={`${year}-${index}`}
40
- className={`${
41
- index % 2 === 0 ? "bg-white" : "bg-gray-50"
42
- } dark:bg-gray-${index % 2 === 0 ? "700" : "800"}`}
43
- >
44
- <td className="py-2 px-4 dark:text-white">
45
- <div>{policy.zh}</div>
46
- <div className="text-sm text-gray-500 dark:text-gray-400">
47
- {policy.en}
48
- </div>
49
- <div className="text-xs text-gray-400 dark:text-gray-500">
50
- {formatDate(policy.releaseDate)}
51
- </div>
52
- </td>
53
- <td className="py-2 px-4">
54
- {policy.link.zh && (
55
- <a
56
- href={policy.link.zh}
57
- target="_blank"
58
- rel="noopener noreferrer"
59
- className="text-blue-500 hover:underline dark:text-blue-400 mr-4"
60
- >
61
- 中文
62
- </a>
63
- )}
64
- {policy.link.en && (
65
- <a
66
- href={policy.link.en}
67
- target="_blank"
68
- rel="noopener noreferrer"
69
- className="text-blue-500 hover:underline dark:text-blue-400 mr-4"
70
- >
71
- English
72
- </a>
73
- )}
74
- </td>
75
- </tr>
76
- ))}
77
- </tbody>
78
- </table>
 
 
 
 
79
  </div>
80
  ))}
81
  </div>
 
1
+ import React, { useState } from "react";
2
  import { PolicyData } from "../types";
3
 
4
  interface AIPoliciesTableProps {
 
6
  }
7
 
8
  const AIPoliciesTable: React.FC<AIPoliciesTableProps> = ({ policies }) => {
9
+ const initialOpenYears = policies.reduce((acc, policy) => {
10
+ const year = new Date(policy.releaseDate).getFullYear();
11
+ acc[year] = true;
12
+ return acc;
13
+ }, {} as { [key: number]: boolean });
14
+
15
+ const [openYears, setOpenYears] = useState<{ [key: number]: boolean }>(initialOpenYears);
16
+
17
+ const toggleYear = (year: number) => {
18
+ setOpenYears((prev) => ({ ...prev, [year]: !prev[year] }));
19
+ };
20
+
21
  const groupedPolicies = policies.reduce((acc, policy) => {
22
  const year = new Date(policy.releaseDate).getFullYear();
23
  if (!acc[year]) {
 
38
  };
39
 
40
  return (
41
+ <div className="container mx-auto p-6">
42
  {sortedYears.map((year) => (
43
+ <div key={year} className="mb-12">
44
+ <button
45
+ onClick={() => toggleYear(year)}
46
+ className="text-2xl font-semibold mb-6 focus:outline-none text-gray-800 dark:text-white"
47
+ >
48
+ {year} {openYears[year] ? "▲" : "▼"}
49
  </button>
50
+ {openYears[year] && (
51
+ <table className="w-full border-collapse table-auto shadow-lg rounded-lg">
52
+ <tbody>
53
+ {groupedPolicies[year].map((policy, index) => (
54
+ <tr
55
+ key={`${year}-${index}`}
56
+ className={`${
57
+ index % 2 === 0 ? "bg-gray-300" : "bg-gray-500"
58
+ } dark:${
59
+ index % 2 === 0 ? "bg-gray-700" : "bg-gray-900"
60
+ } border-b border-gray-200 dark:border-gray-700`}
61
+ >
62
+ <td className="py-6 px-6 text-gray-900 dark:text-white">
63
+ <div className="text-lg font-medium">{policy.zh}</div>
64
+ <div className="text-sm text-gray-500 dark:text-gray-400 mt-2">
65
+ {policy.en}
66
+ </div>
67
+ <div className="text-xs text-gray-400 dark:text-gray-500 mt-2">
68
+ {formatDate(policy.releaseDate)}
69
+ </div>
70
+ </td>
71
+ <td className="py-6 px-6 text-right">
72
+ {policy.link.zh && (
73
+ <a
74
+ href={policy.link.zh}
75
+ target="_blank"
76
+ rel="noopener noreferrer"
77
+ className="text-blue-500 hover:underline dark:text-blue-400 mr-4"
78
+ >
79
+ 中文
80
+ </a>
81
+ )}
82
+ {policy.link.en && (
83
+ <a
84
+ href={policy.link.en}
85
+ target="_blank"
86
+ rel="noopener noreferrer"
87
+ className="text-blue-500 hover:underline dark:text-blue-400"
88
+ >
89
+ English
90
+ </a>
91
+ )}
92
+ </td>
93
+ </tr>
94
+ ))}
95
+ </tbody>
96
+ </table>
97
+ )}
98
  </div>
99
  ))}
100
  </div>
src/pages/index.tsx CHANGED
@@ -44,8 +44,8 @@ export async function getStaticProps() {
44
  zh: policy.zh,
45
  en: policy.en,
46
  link: {
47
- zh: policy.link,
48
- en: policy.link,
49
  },
50
  releaseDate: policy.releaseDate,
51
  }));
 
44
  zh: policy.zh,
45
  en: policy.en,
46
  link: {
47
+ zh: policy.link.zh || null, // Only include link if provided
48
+ en: policy.link.en || null, // Only include link if provided
49
  },
50
  releaseDate: policy.releaseDate,
51
  }));