Skip to content

Commit

Permalink
add data static page
Browse files Browse the repository at this point in the history
update
  • Loading branch information
Clairjoestar committed Feb 25, 2025
1 parent 5dbaae1 commit 105cad5
Show file tree
Hide file tree
Showing 14 changed files with 334 additions and 9 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BASE_URL=
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BASE_URL=api.ruyisdk.cn
10 changes: 9 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const config = {
title: "RuyiSDK",
tagline: "RuyiSDK是面向RISC-V架构的一体化集成开发环境",
favicon: "img/favicon.ico",

customFields: {
// Put your custom environment here
apiURL: process.env.BASE_URL,
},
// Set the production url of your site here
url: "https://ruyisdk.org",
// Set the /<baseUrl>/ pathname under which your site is served
Expand Down Expand Up @@ -179,6 +182,10 @@ const config = {
className: 'hover-wechat-link',
to: '/contact'
},
{
label: "数据统计",
to: "/StatisticalDataPages",
},
],
},
{
Expand Down Expand Up @@ -224,6 +231,7 @@ const config = {
blogSidebarCount: "ALL",
},
],

/* [
"@docusaurus/plugin-google-gtag",
{
Expand Down
18 changes: 18 additions & 0 deletions i18n/de/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,23 @@
},
"QQ1": {
"message": "QQ-Gruppe 1"
},
"RuyiSDK 数据总览": {
"message": "RuyiSDK Datenübersicht"
},
"下载数量 Downloads": {
"message": "Anzahl der Downloads"
},
"安装次数 Installs": {
"message": "Anzahl der Installationen"
},
"最常用指令 Top Commands": {
"message": "Meistgenutzte Befehle"
},
"最常用包 Top Packages": {
"message": "Meistgenutzte Pakete"
},
"暂无数据": {
"message": "Keine Daten verfügbar"
}
}
5 changes: 4 additions & 1 deletion i18n/de/docusaurus-theme-classic/navbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@
"item.label.社区守则": {
"message": "Community-Richtlinien",
"description": "Navbar item with label 社区守则"
},
"item.label.数据统计": {
"message": "Datenstatistik"
}
}
}
21 changes: 21 additions & 0 deletions i18n/en/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,26 @@
},
"QQ1": {
"message": "QQ Group 1"
},
"RuyiSDK 数据总览": {
"message": "RuyiSDK Data Overview"
},
"下载数量 Downloads": {
"message": "Number of Downloads"
},
"安装次数 Installs": {
"message": "Number of Installations"
},
"最常用指令 Top Commands": {
"message": "Most Used Commands"
},
"最常用包 Top Packages": {
"message": "Most Used Packages"
},
"数据统计": {
"message": "Data Statistics"
},
"暂无数据": {
"message": "No data available"
}
}
5 changes: 4 additions & 1 deletion i18n/en/docusaurus-theme-classic/navbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@
"item.label.社区守则": {
"message": "Community Code",
"description": "Navbar item with label 社区守则"
},
"item.label.数据统计": {
"message": "Data Statistics"
}
}
}
112 changes: 108 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"dev": "dotenv -e .env.development -- cross-env NODE_ENV=development docusaurus start",
"start": "dotenv -e .env.production -- cross-env NODE_ENV=production docusaurus start",
"build": "dotenv -e .env.production -- cross-env NODE_ENV=production docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
Expand All @@ -21,8 +22,11 @@
"@mdx-js/react": "^3.0.0",
"@xterm/xterm": "^5.5.0",
"antd": "^5.23.1",
"axios": "^1.7.9",
"clsx": "^2.0.0",
"cross-env": "^7.0.3",
"docusaurus-plugin-sass": "^0.2.5",
"dotenv-cli": "^8.0.0",
"jsonp": "^0.2.1",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
Expand Down
25 changes: 25 additions & 0 deletions src/components/StatisticalData/DashboardClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useMemo, useContext } from "react";
import axios from "axios";
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';

const useDashboardClient = () => {
const { siteConfig: { customFields }, } = useDocusaurusContext()

const axiosInstance = useMemo(() => {
if (!customFields.apiURL) return null;

const instance = axios.create({
baseURL: `https://${customFields.apiURL}`,
timeout: 10000,
headers: {
"Content-Type": "application/json",
},
});

return instance;
}, [customFields.apiURL]);

return axiosInstance;
};

export default useDashboardClient;
Loading

0 comments on commit 105cad5

Please sign in to comment.