Xianbao QIAN commited on
Commit
4646723
1 Parent(s): 60d3295

use links whenever possible. Do not store markdown

Browse files
Files changed (46) hide show
  1. content/policies.json +128 -0
  2. content/policies/ai-capacity-building-inclusiveness-plan-2024/en.md +0 -6
  3. content/policies/ai-capacity-building-inclusiveness-plan-2024/zh.md +0 -7
  4. content/policies/ai-generated-synthetic-content-identification-measures-draft-2024/en.md +0 -6
  5. content/policies/ai-generated-synthetic-content-identification-measures-draft-2024/zh.md +0 -7
  6. content/policies/ai-global-governance-shanghai-declaration-2024/en.md +0 -6
  7. content/policies/ai-global-governance-shanghai-declaration-2024/zh.md +0 -7
  8. content/policies/ai-industry-development-plan-2018-2020/en.md +0 -7
  9. content/policies/ai-industry-development-plan-2018-2020/zh.md +0 -7
  10. content/policies/ai-security-governance-framework-1.0-2024/en.md +0 -6
  11. content/policies/ai-security-governance-framework-1.0-2024/zh.md +0 -7
  12. content/policies/china-ai-law-scholar-proposal-2024-alt/en.md +0 -7
  13. content/policies/china-ai-law-scholar-proposal-2024-alt/zh.md +0 -7
  14. content/policies/china-ai-law-scholar-proposal-2024/en.md +0 -6
  15. content/policies/china-ai-law-scholar-proposal-2024/zh.md +0 -7
  16. content/policies/china-france-joint-statement-ai-global-governance-2024/en.md +0 -6
  17. content/policies/china-france-joint-statement-ai-global-governance-2024/zh.md +0 -7
  18. content/policies/china-position-paper-ai-ethics-governance-2022/en.md +0 -7
  19. content/policies/china-position-paper-ai-ethics-governance-2022/zh.md +0 -7
  20. content/policies/china-position-paper-ai-military-applications-2021/en.md +0 -6
  21. content/policies/china-position-paper-ai-military-applications-2021/zh.md +0 -7
  22. content/policies/china-position-paper-laws-2024/en.md +0 -6
  23. content/policies/china-position-paper-laws-2024/zh.md +0 -7
  24. content/policies/generative-ai-service-management-interim-measures-2023-press-qa/en.md +0 -6
  25. content/policies/generative-ai-service-management-interim-measures-2023-press-qa/zh.md +0 -7
  26. content/policies/generative-ai-service-management-interim-measures-2023/en.md +0 -7
  27. content/policies/generative-ai-service-management-interim-measures-2023/zh.md +0 -7
  28. content/policies/generative-ai-service-management-measures-draft-2023/en.md +0 -6
  29. content/policies/generative-ai-service-management-measures-draft-2023/zh.md +0 -7
  30. content/policies/generative-ai-service-security-basic-requirements-2024/en.md +0 -6
  31. content/policies/generative-ai-service-security-basic-requirements-2024/zh.md +0 -7
  32. content/policies/global-ai-governance-initiative-2023/en.md +0 -6
  33. content/policies/global-ai-governance-initiative-2023/zh.md +0 -7
  34. content/policies/internet-deep-synthesis-management-provisions-2022/en.md +0 -7
  35. content/policies/internet-deep-synthesis-management-provisions-2022/zh.md +0 -7
  36. content/policies/national-ai-industry-standardization-system-construction-guidelines-2024/en.md +0 -6
  37. content/policies/national-ai-industry-standardization-system-construction-guidelines-2024/zh.md +0 -7
  38. content/policies/network-data-security-management-regulations-2024/en.md +0 -7
  39. content/policies/network-data-security-management-regulations-2024/zh.md +0 -7
  40. src/components/AIPoliciesTable.tsx +69 -71
  41. src/components/Heatmap.tsx +0 -56
  42. src/components/UserSearchDialog.tsx +0 -157
  43. src/pages/[author]/index.tsx +0 -96
  44. src/pages/index.tsx +4 -39
  45. src/pages/policies/[slug].tsx +0 -40
  46. src/pages/policies/[slug]/[fileName].tsx +0 -50
content/policies.json ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "zh": "国家发展改革委等部门关于印发《国家数据标准体系建设指南》的通知",
4
+ "en": "Notice on Issuing the 'Guidelines for the Construction of National Data Standard System' by the National Development and Reform Commission and Other Departments",
5
+ "link": {
6
+ "zh": "https://www.cac.gov.cn/2024-10/11/c_1730337907916423.htm",
7
+ "en": ""
8
+ },
9
+ "releaseDate": "2024-10-11"
10
+ },
11
+ {
12
+ "zh": "网络数据安全管理条例",
13
+ "en": "Network Data Security Management Regulations",
14
+ "link": {
15
+ "zh": "https://www.gov.cn/zhengce/content/202409/content_6977766.htm",
16
+ "en": ""
17
+ },
18
+ "releaseDate": "2024-09-01"
19
+ },
20
+ {
21
+ "zh": "人工智能生成合成内容标识办法(征求意见稿)",
22
+ "en": "Measures for the Identification of Artificial Intelligence Generated Synthetic Content (Draft for Comments)",
23
+ "link": {
24
+ "zh": "https://www.cac.gov.cn/2024-09/14/c_1728000676244628.htm",
25
+ "en": ""
26
+ },
27
+ "releaseDate": "2024-09-14"
28
+ },
29
+ {
30
+ "zh": "人工智能全球治理上海宣言(全文)",
31
+ "en": "Shanghai Declaration on Global Governance of Artificial Intelligence (Full Text)",
32
+ "link": {
33
+ "zh": "https://www.gov.cn/yaowen/liebiao/202407/content_6961358.htm",
34
+ "en": ""
35
+ },
36
+ "releaseDate": "2024-07-04"
37
+ },
38
+ {
39
+ "zh": "《人工智能安全治理框架》1.0版发布",
40
+ "en": "Release of 'Artificial Intelligence Security Governance Framework' Version 1.0",
41
+ "link": {
42
+ "zh": "https://www.cac.gov.cn/2024-09/09/c_1727567886199789.htm",
43
+ "en": ""
44
+ },
45
+ "releaseDate": "2024-09-09"
46
+ },
47
+ {
48
+ "zh": "人工智能能力建设普惠计划",
49
+ "en": "Artificial Intelligence Capacity Building Inclusiveness Plan",
50
+ "link": {
51
+ "zh": "https://www.mfa.gov.cn/web/wjbzhd/202409/t20240927_11498463.shtml",
52
+ "en": ""
53
+ },
54
+ "releaseDate": "2024-09-27"
55
+ },
56
+ {
57
+ "zh": "《中华人民共和国人工智能法(学者建议稿)》",
58
+ "en": "Artificial Intelligence Law of the People's Republic of China (Scholar Proposal Draft)",
59
+ "link": {
60
+ "zh": "http://www.fxcxw.org.cn/dyna/content.php?id=26910",
61
+ "en": ""
62
+ },
63
+ "releaseDate": "2024-03-18"
64
+ },
65
+ {
66
+ "zh": "《中华人民共和国人工智能法(学者建议稿)》(中国社会科学院国情调研重大项目)",
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
+ },
74
+ {
75
+ "zh": "中华人民共和国和法兰西共和国关于人工智能和全球治理的联合声明",
76
+ "en": "Joint Statement of the People's Republic of China and the French Republic on Artificial Intelligence and Global Governance",
77
+ "link": {
78
+ "zh": "https://www.mfa.gov.cn/zyxw/202405/t20240507_11293821.shtml",
79
+ "en": ""
80
+ },
81
+ "releaseDate": "2024-05-07"
82
+ },
83
+ {
84
+ "zh": "中国关于加强人工智能伦理治理的立场文件",
85
+ "en": "China's Position Paper on Strengthening Ethical Governance of Artificial Intelligence",
86
+ "link": {
87
+ "zh": "https://www.mfa.gov.cn/web/ziliao_674904/zcwj_674915/202211/t20221117_10976728.shtml",
88
+ "en": ""
89
+ },
90
+ "releaseDate": "2022-11-17"
91
+ },
92
+ {
93
+ "zh": "中国关于规范人工智能军事应用的立场文件",
94
+ "en": "China's Position Paper on Regulating Military Applications of Artificial Intelligence",
95
+ "link": {
96
+ "zh": "https://www.mfa.gov.cn/web/ziliao_674904/zcwj_674915/202112/t20211214_10469511.shtml",
97
+ "en": ""
98
+ },
99
+ "releaseDate": "2021-12-14"
100
+ },
101
+ {
102
+ "zh": "中国就'致命性自主武器系统'问题向联合国秘书长提交的文件",
103
+ "en": "China's Position Paper Submitted to the UN Secretary-General on the Issue of 'Lethal Autonomous Weapons Systems'",
104
+ "link": {
105
+ "zh": "https://www.mfa.gov.cn/web/wjb_673085/zzjg_673183/jks_674633/fywj_674643/202405/t20240523_11310587.shtml",
106
+ "en": ""
107
+ },
108
+ "releaseDate": "2024-05-23"
109
+ },
110
+ {
111
+ "zh": "生成式人工智能服务管理暂行办法",
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)",
122
+ "link": {
123
+ "zh": "https://www.cac.gov.cn/2017-12/15/c_1122114520.htm",
124
+ "en": ""
125
+ },
126
+ "releaseDate": "2017-12-15"
127
+ }
128
+ ]
content/policies/ai-capacity-building-inclusiveness-plan-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Artificial Intelligence Capacity Building Inclusiveness Plan
3
- releaseDate: 2024-09-27
4
- ---
5
-
6
- September 27, 2024
 
 
 
 
 
 
 
content/policies/ai-capacity-building-inclusiveness-plan-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 人工智能能力建设普惠计划
3
- originalLink: https://www.mfa.gov.cn/web/wjbzhd/202409/t20240927_11498463.shtml
4
- releaseDate: 2024-09-27
5
- ---
6
-
7
- 2024年9月27日
 
 
 
 
 
 
 
 
content/policies/ai-generated-synthetic-content-identification-measures-draft-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Notice of the Cyberspace Administration of China on Public Consultation on the "Measures for the Identification of Artificial Intelligence Generated Synthetic Content (Draft for Comments)"
3
- releaseDate: 2024-09-14
4
- ---
5
-
6
- September 14, 2024
 
 
 
 
 
 
 
content/policies/ai-generated-synthetic-content-identification-measures-draft-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 国家互联网信息办公室关于《人工智能生成合成内容标识办法(征求意见稿)》公开征求意见的通知
3
- originalLink: https://www.cac.gov.cn/2024-09/14/c_1728000676244628.htm
4
- releaseDate: 2024-09-14
5
- ---
6
-
7
- 2024年9月14日
 
 
 
 
 
 
 
 
content/policies/ai-global-governance-shanghai-declaration-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Shanghai Declaration on Global Governance of Artificial Intelligence (Full Text)
3
- releaseDate: 2024-07-04
4
- ---
5
-
6
- July 4, 2024
 
 
 
 
 
 
 
content/policies/ai-global-governance-shanghai-declaration-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 人工智能全球治理上海宣言(全文)
3
- originalLink: https://www.gov.cn/yaowen/liebiao/202407/content_6961358.htm
4
- releaseDate: 2024-07-04
5
- ---
6
-
7
- 2024年7月4日
 
 
 
 
 
 
 
 
content/policies/ai-industry-development-plan-2018-2020/en.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 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)
3
- releaseDate: 2017-12-15
4
- ---
5
-
6
- Full text of the notice
7
-
 
 
 
 
 
 
 
 
content/policies/ai-industry-development-plan-2018-2020/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 工业和信息化部关于印发《促进新一代人工智能产业发展三年行动计划(2018-2020年)》的通知
3
- originalLink: https://www.cac.gov.cn/2017-12/15/c_1122114520.htm
4
- releaseDate: 2017-12-15
5
- ---
6
-
7
- 通知全文
 
 
 
 
 
 
 
 
content/policies/ai-security-governance-framework-1.0-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Release of "Artificial Intelligence Security Governance Framework" Version 1.0
3
- releaseDate: 2024-09-09
4
- ---
5
-
6
- September 9, 2024
 
 
 
 
 
 
 
content/policies/ai-security-governance-framework-1.0-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 《人工智能安全治理框架》1.0版发布
3
- originalLink: https://www.cac.gov.cn/2024-09/09/c_1727567886199789.htm
4
- releaseDate: 2024-09-09
5
- ---
6
-
7
- 2024年9月9日
 
 
 
 
 
 
 
 
content/policies/china-ai-law-scholar-proposal-2024-alt/en.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: "Artificial Intelligence Law of the People's Republic of China (Scholar Proposal Draft)"
3
- originalLink: https://m.21jingji.com/article/20240416/herald/4df710ffed0ffe037cdf6c54aa369961_zaker.html
4
- releaseDate: 2024-04-16
5
- ---
6
-
7
- Another version
 
 
 
 
 
 
 
 
content/policies/china-ai-law-scholar-proposal-2024-alt/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 《中华人民共和国人工智能法(学者建议稿)》
3
- releaseDate: 2024-04-16
4
- originalLink: http://iolaw.cssn.cn/zxzp/202309/W020230907361599893636.pdf
5
- ---
6
-
7
- 另一个版本
 
 
 
 
 
 
 
 
content/policies/china-ai-law-scholar-proposal-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: "Artificial Intelligence Law of the People's Republic of China (Scholar Proposal Draft)"
3
- releaseDate: 2024-03-18
4
- ---
5
-
6
- March 18, 2024
 
 
 
 
 
 
 
content/policies/china-ai-law-scholar-proposal-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 《中华人民共和国人工智能法(学者建议稿)》
3
- originalLink: http://www.fxcxw.org.cn/dyna/content.php?id=26910
4
- releaseDate: 2024-03-18
5
- ---
6
-
7
- 2024年3月18日
 
 
 
 
 
 
 
 
content/policies/china-france-joint-statement-ai-global-governance-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Joint Statement of the People's Republic of China and the French Republic on Artificial Intelligence and Global Governance
3
- releaseDate: 2024-05-07
4
- ---
5
-
6
- May 7, 2024
 
 
 
 
 
 
 
content/policies/china-france-joint-statement-ai-global-governance-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 中华人民共和国和法兰西共和国关于人工智能和全球治理的联合声明
3
- originalLink: https://www.mfa.gov.cn/zyxw/202405/t20240507_11293821.shtml
4
- releaseDate: 2024-05-07
5
- ---
6
-
7
- 2024年5月7日
 
 
 
 
 
 
 
 
content/policies/china-position-paper-ai-ethics-governance-2022/en.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: China's Position Paper on Strengthening Ethical Governance of Artificial Intelligence
3
- releaseDate: 2022-11-17
4
- ---
5
-
6
- November 17, 2022
7
-
 
 
 
 
 
 
 
 
content/policies/china-position-paper-ai-ethics-governance-2022/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 中国关于加强人工智能伦理治理的立场文件
3
- originalLink: https://www.mfa.gov.cn/web/ziliao_674904/zcwj_674915/202211/t20221117_10976728.shtml
4
- releaseDate: 2022-11-17
5
- ---
6
-
7
- 2022年11月17日
 
 
 
 
 
 
 
 
content/policies/china-position-paper-ai-military-applications-2021/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: China's Position Paper on Regulating Military Applications of Artificial Intelligence
3
- releaseDate: 2021-12-14
4
- ---
5
-
6
- December 14, 2021
 
 
 
 
 
 
 
content/policies/china-position-paper-ai-military-applications-2021/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 中国关于规范人工智能军事应用的立场文件
3
- originalLink: https://www.mfa.gov.cn/web/ziliao_674904/zcwj_674915/202112/t20211214_10469511.shtml
4
- releaseDate: 2021-12-14
5
- ---
6
-
7
- 2021年12月14日
 
 
 
 
 
 
 
 
content/policies/china-position-paper-laws-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: China's Position Paper Submitted to the UN Secretary-General on the Issue of "Lethal Autonomous Weapons Systems"
3
- releaseDate: 2024-05-23
4
- ---
5
-
6
- May 23, 2024
 
 
 
 
 
 
 
content/policies/china-position-paper-laws-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 中国就"致命性自主武器系统"问题向联合国秘书长提交的文件
3
- originalLink: https://www.mfa.gov.cn/web/wjb_673085/zzjg_673183/jks_674633/fywj_674643/202405/t20240523_11310587.shtml
4
- releaseDate: 2024-05-23
5
- ---
6
-
7
- 2024年5月23日
 
 
 
 
 
 
 
 
content/policies/generative-ai-service-management-interim-measures-2023-press-qa/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: National Internet Information Office Spokesperson on the Interim Measures for the Management of Generative AI Services
3
- releaseDate: 2023-07-13
4
- ---
5
-
6
- July 13, 2023
 
 
 
 
 
 
 
content/policies/generative-ai-service-management-interim-measures-2023-press-qa/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 国家互联网信息办公室有关负责人就《生成式人工智能服务管理暂行办法》答记者问
3
- originalLink: https://www.cac.gov.cn/2023-07/13/c_1690898326863363.htm
4
- releaseDate: 2023-07-13
5
- ---
6
-
7
- 2023年07月13日
 
 
 
 
 
 
 
 
content/policies/generative-ai-service-management-interim-measures-2023/en.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: Interim Measures for the Management of Generative Artificial Intelligence Services
3
- releaseDate: 2023-07-13
4
- ---
5
-
6
- July 13, 2023
7
-
 
 
 
 
 
 
 
 
content/policies/generative-ai-service-management-interim-measures-2023/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 生成式人工智能服务管理暂行办法
3
- originalLink: https://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm
4
- releaseDate: 2023-07-13
5
- ---
6
-
7
- 2023年07月13日
 
 
 
 
 
 
 
 
content/policies/generative-ai-service-management-measures-draft-2023/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Notice of the Cyberspace Administration of China on Public Consultation on the "Measures for the Management of Generative Artificial Intelligence Services (Draft for Comments)"
3
- releaseDate: 2023-04-11
4
- ---
5
-
6
- April 11, 2023
 
 
 
 
 
 
 
content/policies/generative-ai-service-management-measures-draft-2023/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 国家互联网信息办公室关于《生成式人工智能服务管理办法(征求意见稿)》公开征求意见的通知
3
- originalLink: https://www.cac.gov.cn/2023-04/11/c_1682854275475410.htm
4
- releaseDate: 2023-04-11
5
- ---
6
-
7
- 2023年04月11日
 
 
 
 
 
 
 
 
content/policies/generative-ai-service-security-basic-requirements-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Basic Security Requirements for Generative Artificial Intelligence Services
3
- releaseDate: 2024-02-29
4
- ---
5
-
6
- February 29, 2024
 
 
 
 
 
 
 
content/policies/generative-ai-service-security-basic-requirements-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 生成式人工智能服务安全基本要求
3
- originalLink: https://www.tc260.org.cn/upload/2023-10-11/1697008495851003865.pdf
4
- releaseDate: 2024-02-29
5
- ---
6
-
7
- 2024年2月29日
 
 
 
 
 
 
 
 
content/policies/global-ai-governance-initiative-2023/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Global Initiative on Artificial Intelligence Governance
3
- releaseDate: 2023-10-18
4
- ---
5
-
6
- October 18, 2023
 
 
 
 
 
 
 
content/policies/global-ai-governance-initiative-2023/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 全球人工智能治理倡议
3
- originalLink: https://www.cac.gov.cn/2023-10/18/c_1699291032884978.htm
4
- releaseDate: 2023-10-18
5
- ---
6
-
7
- 2023年10月18日
 
 
 
 
 
 
 
 
content/policies/internet-deep-synthesis-management-provisions-2022/en.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: Provisions on the Management of Deep Synthesis of Internet Information Services
3
- releaseDate: 2022-12-11
4
- ---
5
-
6
- December 11, 2022
7
-
 
 
 
 
 
 
 
 
content/policies/internet-deep-synthesis-management-provisions-2022/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 互联网信息服务深度合成管理规定
3
- originalLink: https://www.cac.gov.cn/2022-12/11/c_1672221949354811.htm
4
- releaseDate: 2022-12-11
5
- ---
6
-
7
- 2022年12月11日
 
 
 
 
 
 
 
 
content/policies/national-ai-industry-standardization-system-construction-guidelines-2024/en.md DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- title: Notice of Four Departments on Printing and Distributing the Guidelines for the Construction of National Artificial Intelligence Industry Comprehensive Standardization System (2024 Edition)
3
- releaseDate: 2024-07-03
4
- ---
5
-
6
- July 3, 2024
 
 
 
 
 
 
 
content/policies/national-ai-industry-standardization-system-construction-guidelines-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 四部门关于印发国家人工智能产业综合标准化体系建设指南(2024版)的通知
3
- originalLink: https://www.cac.gov.cn/2024-07/03/c_1721686809220407.htm
4
- releaseDate: 2024-07-03
5
- ---
6
-
7
- 2024年7月3日
 
 
 
 
 
 
 
 
content/policies/network-data-security-management-regulations-2024/en.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: Network Data Security Management Regulations
3
- releaseDate: 2024-09-01
4
- ---
5
-
6
- September 1, 2024
7
-
 
 
 
 
 
 
 
 
content/policies/network-data-security-management-regulations-2024/zh.md DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- title: 网络数据安全管理条例
3
- originalLink: https://www.gov.cn/zhengce/content/202409/content_6977766.htm
4
- releaseDate: 2024-09-01
5
- ---
6
-
7
- 2024年9月1日
 
 
 
 
 
 
 
 
src/components/AIPoliciesTable.tsx CHANGED
@@ -1,11 +1,12 @@
1
- import React, { useState } from 'react';
2
- import Link from 'next/link';
3
 
4
  interface PolicyData {
5
- title: string;
6
- slug: string;
7
- fileName: string;
8
- originalLink?: string;
 
 
9
  releaseDate: string;
10
  }
11
 
@@ -14,81 +15,78 @@ interface AIPoliciesTableProps {
14
  }
15
 
16
  const AIPoliciesTable: React.FC<AIPoliciesTableProps> = ({ policies }) => {
17
- const groupedPoliciesByYear: { [year: string]: { [slug: string]: PolicyData[] } } = {};
18
-
19
- policies.forEach((policy) => {
20
- const year = new Date(policy.releaseDate).getFullYear().toString();
21
- if (!groupedPoliciesByYear[year]) {
22
- groupedPoliciesByYear[year] = {};
23
- }
24
- if (!groupedPoliciesByYear[year][policy.slug]) {
25
- groupedPoliciesByYear[year][policy.slug] = [];
26
  }
27
- groupedPoliciesByYear[year][policy.slug].push(policy);
28
- });
29
-
30
- const sortedYears = Object.keys(groupedPoliciesByYear).sort((a, b) => parseInt(b) - parseInt(a));
31
-
32
- return (
33
- <div className="my-8">
34
- {sortedYears.map((year) => (
35
- <YearSection key={year} year={year} groupedPolicies={groupedPoliciesByYear[year]} />
36
- ))}
37
- </div>
38
- );
39
- };
40
 
41
- interface YearSectionProps {
42
- year: string;
43
- groupedPolicies: { [slug: string]: PolicyData[] };
44
- }
45
 
46
- const YearSection: React.FC<YearSectionProps> = ({ year, groupedPolicies }) => {
47
- const [isOpen, setIsOpen] = useState(true);
 
 
 
48
 
49
  return (
50
- <div className="mb-8">
51
- <button
52
- className="text-xl font-bold mb-2 focus:outline-none"
53
- onClick={() => setIsOpen(!isOpen)}
54
- >
55
- {year} {isOpen ? '▼' : '▶'}
56
- </button>
57
- {isOpen && (
58
- <table className="w-full border-collapse table-auto">
59
- <tbody>
60
- {Object.entries(groupedPolicies).map(([slug, policies], index) => {
61
- const zhPolicy = policies.find((policy) => policy.fileName === 'zh.md');
62
- const enPolicy = policies.find((policy) => policy.fileName === 'en.md');
63
-
64
- return (
65
- <tr key={slug} className={`${index % 2 === 0 ? 'bg-white dark:bg-gray-700' : 'bg-gray-50 dark:bg-gray-800'}`}>
66
  <td className="py-2 px-4 dark:text-white">
67
- <div>{zhPolicy?.title}</div>
68
- <div className="text-sm text-gray-500 dark:text-gray-400">{enPolicy?.title}</div>
69
- <div className="text-xs text-gray-400 dark:text-gray-500">{new Date(zhPolicy?.releaseDate || '').toLocaleDateString()}</div>
 
 
 
 
70
  </td>
71
  <td className="py-2 px-4">
72
- {policies.map((policy) => (
73
- policy.originalLink ? (
74
- <a key={policy.fileName} href={policy.originalLink} target="_blank" rel="noopener noreferrer" className="text-blue-500 hover:underline dark:text-blue-400 mr-4">
75
- {policy.fileName === 'zh.md' ? '中文' : 'English'}
76
- </a>
77
- ) : (
78
- <Link key={policy.fileName} href={`/policies/${slug}/${policy.fileName}`}>
79
- <span className="text-blue-500 hover:underline dark:text-blue-400 mr-4 cursor-pointer">
80
- {policy.fileName === 'zh.md' ? '中文' : 'English'}
81
- </span>
82
- </Link>
83
- )
84
- ))}
 
 
 
 
 
 
 
85
  </td>
86
  </tr>
87
- );
88
- })}
89
- </tbody>
90
- </table>
91
- )}
92
  </div>
93
  );
94
  };
 
1
+ import React from "react";
 
2
 
3
  interface PolicyData {
4
+ zh: string;
5
+ en: string;
6
+ link: {
7
+ zh: string;
8
+ en: string;
9
+ };
10
  releaseDate: string;
11
  }
12
 
 
15
  }
16
 
17
  const AIPoliciesTable: React.FC<AIPoliciesTableProps> = ({ policies }) => {
18
+ const groupedPolicies = policies.reduce((acc, policy) => {
19
+ const year = new Date(policy.releaseDate).getFullYear();
20
+ if (!acc[year]) {
21
+ acc[year] = [];
 
 
 
 
 
22
  }
23
+ acc[year].push(policy);
24
+ return acc;
25
+ }, {} as { [key: number]: PolicyData[] });
 
 
 
 
 
 
 
 
 
 
26
 
27
+ const sortedYears = Object.keys(groupedPolicies)
28
+ .map(Number)
29
+ .sort((a, b) => b - a);
 
30
 
31
+ const formatDate = (dateString: string) => {
32
+ const date = new Date(dateString);
33
+ const options: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric', year: 'numeric' };
34
+ return date.toLocaleDateString('en-US', options);
35
+ };
36
 
37
  return (
38
+ <div>
39
+ {sortedYears.map((year) => (
40
+ <div key={year} className="mb-8">
41
+ <button className="text-xl font-bold mb-2 focus:outline-none">
42
+ {year} ▼
43
+ </button>
44
+ <table className="w-full border-collapse table-auto">
45
+ <tbody>
46
+ {groupedPolicies[year].map((policy, index) => (
47
+ <tr
48
+ key={`${year}-${index}`}
49
+ className={`${
50
+ index % 2 === 0 ? "bg-white" : "bg-gray-50"
51
+ } dark:bg-gray-${index % 2 === 0 ? "700" : "800"}`}
52
+ >
 
53
  <td className="py-2 px-4 dark:text-white">
54
+ <div>{policy.zh}</div>
55
+ <div className="text-sm text-gray-500 dark:text-gray-400">
56
+ {policy.en}
57
+ </div>
58
+ <div className="text-xs text-gray-400 dark:text-gray-500">
59
+ {formatDate(policy.releaseDate)}
60
+ </div>
61
  </td>
62
  <td className="py-2 px-4">
63
+ {policy.link.zh && (
64
+ <a
65
+ href={policy.link.zh}
66
+ target="_blank"
67
+ rel="noopener noreferrer"
68
+ className="text-blue-500 hover:underline dark:text-blue-400 mr-4"
69
+ >
70
+ 中文
71
+ </a>
72
+ )}
73
+ {policy.link.en && (
74
+ <a
75
+ href={policy.link.en}
76
+ target="_blank"
77
+ rel="noopener noreferrer"
78
+ className="text-blue-500 hover:underline dark:text-blue-400 mr-4"
79
+ >
80
+ English
81
+ </a>
82
+ )}
83
  </td>
84
  </tr>
85
+ ))}
86
+ </tbody>
87
+ </table>
88
+ </div>
89
+ ))}
90
  </div>
91
  );
92
  };
src/components/Heatmap.tsx DELETED
@@ -1,56 +0,0 @@
1
- import React from "react";
2
- import ActivityCalendar from "react-activity-calendar";
3
- import { Tooltip, Avatar } from "@mui/material";
4
- import Link from "next/link";
5
-
6
- type HeatmapProps = {
7
- data: Array<{ date: string; count: number; level: number }>;
8
- color: string;
9
- providerName: string;
10
- fullName: string;
11
- avatarUrl: string;
12
- };
13
-
14
- const Heatmap: React.FC<HeatmapProps> = ({ data, color, providerName, fullName, avatarUrl }) => {
15
- return (
16
- <div className="flex flex-col items-center w-full mx-auto">
17
- <div className="flex flex-col sm:flex-row items-center mb-4 w-full justify-center">
18
- {avatarUrl && (
19
- <Avatar src={avatarUrl} alt={fullName} className="mb-2 sm:mb-0 sm:mr-4" sx={{ width: 48, height: 48 }} />
20
- )}
21
- <div className="text-center sm:text-left">
22
- <h2 className="text-lg font-semibold">
23
- <Link
24
- href={`https://huggingface.co/${providerName}`}
25
- target="_blank"
26
- rel="noopener noreferrer"
27
- className="hover:text-blue-500 hover:underline"
28
- >
29
- {fullName}
30
- </Link>
31
- </h2>
32
- </div>
33
- </div>
34
- <div className="w-full overflow-x-auto flex justify-center">
35
- <ActivityCalendar
36
- data={data}
37
- theme={{
38
- dark: ["#161b22", color],
39
- light: ["#e0e0e0", color],
40
- }}
41
- hideTotalCount
42
- renderBlock={(block, activity) => (
43
- <Tooltip
44
- title={`${activity.count} events on ${activity.date}`}
45
- arrow
46
- >
47
- {block}
48
- </Tooltip>
49
- )}
50
- />
51
- </div>
52
- </div>
53
- );
54
- };
55
-
56
- export default Heatmap;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/components/UserSearchDialog.tsx DELETED
@@ -1,157 +0,0 @@
1
- import React, { useState, useMemo } from "react";
2
- import { Input } from "./ui/input";
3
- import {
4
- Dialog,
5
- DialogContent,
6
- DialogHeader,
7
- DialogTitle,
8
- DialogTrigger,
9
- } from "./ui/dialog";
10
- import { Button } from "./ui/button";
11
- import { fetchAllAuthorsData } from "../utils/authors";
12
- import { generateCalendarData } from "../utils/calendar";
13
- import Heatmap from "./Heatmap";
14
- import { ModelData } from "../types/heatmap";
15
- import { fetchAuthorData, fetchUserData } from "@/utils/authors";
16
-
17
- const UserSearchDialog = () => {
18
- const [isOpen, setIsOpen] = useState(false);
19
- const [isLoading, setIsLoading] = useState(false);
20
- const [searchInput, setSearchInput] = useState("");
21
- const [searchedData, setSearchedData] = useState<ModelData[] | null>(null);
22
- const [isCopied, setIsCopied] = useState(false);
23
- const [currentSearchTerm, setCurrentSearchTerm] = useState("");
24
- const [userInfo, setUserInfo] = useState<{ fullName: string; avatarUrl: string | null } | null>(null);
25
-
26
- const handleSearch = async () => {
27
- if (searchInput.trim()) {
28
- setIsLoading(true);
29
- try {
30
- const authorData = await fetchAllAuthorsData([searchInput.trim()]);
31
- const authorInfo = await fetchUserData([searchInput.trim()]);
32
- setSearchedData(authorData);
33
- setUserInfo(authorInfo);
34
- setCurrentSearchTerm(searchInput.trim());
35
- } catch (error) {
36
- console.error("Error fetching data for searched user:", error);
37
- setSearchedData(null);
38
- setUserInfo(null);
39
- setCurrentSearchTerm("");
40
- }
41
- setIsLoading(false);
42
- } else {
43
- setSearchedData(null);
44
- setUserInfo(null);
45
- setCurrentSearchTerm("");
46
- }
47
- };
48
-
49
- const handleKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {
50
- if (e.key === 'Enter') {
51
- handleSearch();
52
- }
53
- };
54
-
55
- const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
56
- setSearchInput(e.target.value);
57
- };
58
-
59
- const getIframeCode = (username: string) => {
60
- return `<iframe
61
- src="https://cfahlgren1-model-release-heatmap.hf.space/${username}"
62
- class="w-full h-[300px]"
63
- frameborder="0"
64
- ></iframe>`;
65
- };
66
-
67
- const handleCopyCode = () => {
68
- const iframeCode = getIframeCode(searchInput);
69
- navigator.clipboard.writeText(iframeCode).then(() => {
70
- setIsCopied(true);
71
- setTimeout(() => setIsCopied(false), 2000);
72
- });
73
- };
74
-
75
- const searchedHeatmapData = useMemo(() => {
76
- if (searchedData && searchedData.length > 0 && userInfo) {
77
- return generateCalendarData(searchedData, [{
78
- authors: [currentSearchTerm],
79
- color: "#0088cc",
80
- fullName: userInfo.fullName,
81
- avatarUrl: userInfo.avatarUrl
82
- }])[currentSearchTerm];
83
- }
84
- return null;
85
- }, [searchedData, currentSearchTerm, userInfo]);
86
-
87
- const handleDialogOpenChange = (open: boolean) => {
88
- setIsOpen(open);
89
- if (!open) {
90
- setSearchInput("");
91
- setSearchedData(null);
92
- setCurrentSearchTerm("");
93
- setIsLoading(false);
94
- setIsCopied(false);
95
- setUserInfo(null);
96
- }
97
- };
98
-
99
- return (
100
- <Dialog open={isOpen} onOpenChange={handleDialogOpenChange}>
101
- <DialogTrigger asChild>
102
- <Button variant="outline">Search</Button>
103
- </DialogTrigger>
104
- <DialogContent className="w-full max-w-[95vw] sm:max-w-4xl p-4 sm:p-6 max-h-[90vh] flex flex-col">
105
- <DialogHeader>
106
- <DialogTitle className="text-lg sm:text-xl mb-4">Get your Hugging Face Heatmap</DialogTitle>
107
- </DialogHeader>
108
- <div className="flex-grow overflow-y-auto">
109
- <div className="grid gap-4 py-4">
110
- <div className="flex items-center space-x-2 p-2 bg-background rounded-md">
111
- <Input
112
- type="text"
113
- placeholder="Enter username"
114
- value={searchInput}
115
- onChange={handleInputChange}
116
- onKeyDown={handleKeyPress}
117
- className="flex-grow"
118
- />
119
- </div>
120
- {isLoading ? (
121
- <p className="text-center">Loading...</p>
122
- ) : searchedHeatmapData && userInfo ? (
123
- <div className="mt-4 space-y-4">
124
- <div className="overflow-x-auto pb-2">
125
- <Heatmap
126
- data={searchedHeatmapData}
127
- color="#FF9D00"
128
- providerName={currentSearchTerm}
129
- fullName={userInfo.fullName}
130
- avatarUrl={userInfo.avatarUrl || ''}
131
- />
132
- </div>
133
- <div>
134
- <div className="flex justify-between items-center mb-2">
135
- <h3 className="font-semibold text-sm sm:text-base">Embed in iFrame</h3>
136
- <Button onClick={handleCopyCode} variant="link" size="sm">
137
- {isCopied ? "Copied!" : "Copy"}
138
- </Button>
139
- </div>
140
- <div className="overflow-x-auto">
141
- <pre className="bg-secondary p-2 rounded text-xs whitespace-pre-wrap break-all">
142
- <code>{getIframeCode(searchInput)}</code>
143
- </pre>
144
- </div>
145
- </div>
146
- </div>
147
- ) : searchedData !== null && searchedData.length === 0 ? (
148
- <p className="text-center text-slate-500 text-sm italic">User or Organization not found</p>
149
- ) : null}
150
- </div>
151
- </div>
152
- </DialogContent>
153
- </Dialog>
154
- );
155
- };
156
-
157
- export default UserSearchDialog;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/pages/[author]/index.tsx DELETED
@@ -1,96 +0,0 @@
1
- import React, { useState, useEffect } from "react";
2
- import { GetServerSidePropsContext } from "next";
3
- import { OpenSourceHeatmapProps } from "../../types/heatmap";
4
- import { generateCalendarData } from "../../utils/calendar";
5
- import Heatmap from "../../components/Heatmap";
6
- import { fetchUserData, fetchAuthorData } from "../../utils/authors";
7
-
8
- const DEFAULT_COLOR = "#FF9D00";
9
-
10
- const OpenSourceHeatmap: React.FC<OpenSourceHeatmapProps> = ({
11
- calendarData,
12
- providers,
13
- }) => {
14
- const [isLoading, setIsLoading] = useState(true);
15
-
16
- useEffect(() => {
17
- if (calendarData && Object.keys(calendarData).length > 0) {
18
- setIsLoading(false);
19
- }
20
- }, [calendarData]);
21
-
22
- return (
23
- <div className="w-full max-w-screen-lg mx-auto p-4">
24
- {isLoading ? (
25
- <p className="text-center">Loading...</p>
26
- ) : (
27
- <div>
28
- {Object.entries(providers)
29
- .sort(
30
- ([keyA], [keyB]) =>
31
- calendarData[keyB].reduce((sum, day) => sum + day.count, 0) -
32
- calendarData[keyA].reduce((sum, day) => sum + day.count, 0)
33
- )
34
- .map(([providerName, { color, fullName, avatarUrl }]) => (
35
- <Heatmap
36
- key={providerName}
37
- data={calendarData[providerName]}
38
- color={color}
39
- providerName={providerName}
40
- fullName={fullName ?? providerName}
41
- avatarUrl={avatarUrl ?? ''}
42
- />
43
- ))}
44
- </div>
45
- )}
46
- </div>
47
- );
48
- };
49
-
50
- export async function getServerSideProps(context: GetServerSidePropsContext) {
51
- const { author, color } = context.query;
52
-
53
- const authorColor = color || DEFAULT_COLOR;
54
-
55
- try {
56
- const { fullName, avatarUrl } = await fetchUserData([author as string]);
57
-
58
- const providers = {
59
- [author as string]: {
60
- color: authorColor as string,
61
- authors: [author as string],
62
- fullName,
63
- avatarUrl,
64
- },
65
- };
66
-
67
- const flatData = await fetchAuthorData(author as string);
68
- const calendarData = generateCalendarData(flatData, [providers[author as string]]);
69
-
70
- return {
71
- props: {
72
- calendarData,
73
- color: authorColor,
74
- providers,
75
- },
76
- };
77
- } catch (error) {
78
- console.error("Error fetching data:", error);
79
- return {
80
- props: {
81
- calendarData: {},
82
- color: authorColor,
83
- providers: {
84
- [author as string]: {
85
- color: authorColor as string,
86
- authors: [author as string],
87
- fullName: author,
88
- avatarUrl: null,
89
- },
90
- },
91
- },
92
- };
93
- }
94
- }
95
-
96
- export default OpenSourceHeatmap;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/pages/index.tsx CHANGED
@@ -42,45 +42,10 @@ interface PolicyData {
42
 
43
  export async function getStaticProps() {
44
  try {
45
- // const allAuthors = PROVIDERS.flatMap(({ authors }) => authors);
46
- // const uniqueAuthors = Array.from(new Set(allAuthors));
47
-
48
- // const flatData: ModelData[] = await fetchAllAuthorsData(uniqueAuthors);
49
- // const updatedProviders = await fetchAllProvidersData(PROVIDERS);
50
-
51
- // const calendarData = generateCalendarData(flatData, updatedProviders);
52
-
53
- // Read policy data
54
- const policiesDir = path.join(process.cwd(), 'content', 'policies');
55
- const policyFolders = fs.readdirSync(policiesDir);
56
-
57
- const policyData: PolicyData[] = [];
58
-
59
- for (const folder of policyFolders) {
60
- const zhFilePath = path.join(policiesDir, folder, 'zh.md');
61
- const enFilePath = path.join(policiesDir, folder, 'en.md');
62
-
63
- if (fs.existsSync(zhFilePath) && fs.existsSync(enFilePath)) {
64
- const zhContent = fs.readFileSync(zhFilePath, 'utf-8');
65
- const enContent = fs.readFileSync(enFilePath, 'utf-8');
66
-
67
- const { data: zhData } = matter(zhContent);
68
- const { data: enData } = matter(enContent);
69
-
70
- policyData.push({
71
- ...zhData,
72
- slug: folder,
73
- fileName: 'zh.md',
74
- releaseDate: zhData.releaseDate ? zhData.releaseDate.toString() : '',
75
- } as PolicyData);
76
- policyData.push({
77
- ...enData,
78
- slug: folder,
79
- fileName: 'en.md',
80
- releaseDate: enData.releaseDate ? enData.releaseDate.toString() : '',
81
- } as PolicyData);
82
- }
83
- }
84
 
85
  // Sort policyData based on releaseDate in descending order
86
  policyData.sort((a, b) => {
 
42
 
43
  export async function getStaticProps() {
44
  try {
45
+ // Read policy data from policies.json
46
+ const policiesFilePath = path.join(process.cwd(), 'content', 'policies.json');
47
+ const policiesContent = fs.readFileSync(policiesFilePath, 'utf-8');
48
+ const policyData: PolicyData[] = JSON.parse(policiesContent);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  // Sort policyData based on releaseDate in descending order
51
  policyData.sort((a, b) => {
src/pages/policies/[slug].tsx DELETED
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- import { GetStaticProps, GetStaticPaths } from 'next';
3
- import fs from 'fs';
4
- import path from 'path';
5
- import matter from 'gray-matter';
6
- import ReactMarkdown from 'react-markdown';
7
-
8
- interface PolicyProps {
9
- content: string;
10
- }
11
-
12
- const PolicyPage: React.FC<PolicyProps> = ({ content }) => {
13
- return (
14
- <div className="container mx-auto py-8">
15
- <ReactMarkdown>{content}</ReactMarkdown>
16
- </div>
17
- );
18
- };
19
-
20
- export const getStaticPaths: GetStaticPaths = async () => {
21
- return {
22
- paths: [],
23
- fallback: false,
24
- };
25
- };
26
-
27
- export const getStaticProps: GetStaticProps<PolicyProps> = async ({ params }) => {
28
- const { slug, fileName } = params as { slug: string; fileName: string };
29
- const filePath = path.join(process.cwd(), 'content', 'policies', slug, fileName);
30
- const fileContent = fs.readFileSync(filePath, 'utf-8');
31
- const { content } = matter(fileContent);
32
-
33
- return {
34
- props: {
35
- content,
36
- },
37
- };
38
- };
39
-
40
- export default PolicyPage;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/pages/policies/[slug]/[fileName].tsx DELETED
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
- import { GetStaticProps, GetStaticPaths } from 'next';
3
- import fs from 'fs';
4
- import path from 'path';
5
- import matter from 'gray-matter';
6
- import ReactMarkdown from 'react-markdown';
7
-
8
- interface PolicyProps {
9
- content: string;
10
- }
11
-
12
- const PolicyPage: React.FC<PolicyProps> = ({ content }) => {
13
- return (
14
- <div className="container mx-auto py-8">
15
- <ReactMarkdown>{content}</ReactMarkdown>
16
- </div>
17
- );
18
- };
19
-
20
- export const getStaticPaths: GetStaticPaths = async () => {
21
- const policiesDir = path.join(process.cwd(), 'content', 'policies');
22
- const policyFolders = fs.readdirSync(policiesDir);
23
-
24
- const paths = policyFolders.flatMap((folder) => {
25
- const languageFiles = fs.readdirSync(path.join(policiesDir, folder));
26
- return languageFiles.map((file) => {
27
- return { params: { slug: folder, fileName: file } };
28
- });
29
- });
30
-
31
- return {
32
- paths,
33
- fallback: false,
34
- };
35
- };
36
-
37
- export const getStaticProps: GetStaticProps<PolicyProps> = async ({ params }) => {
38
- const { slug, fileName } = params as { slug: string; fileName: string };
39
- const filePath = path.join(process.cwd(), 'content', 'policies', slug, fileName);
40
- const fileContent = fs.readFileSync(filePath, 'utf-8');
41
- const { content } = matter(fileContent);
42
-
43
- return {
44
- props: {
45
- content,
46
- },
47
- };
48
- };
49
-
50
- export default PolicyPage;