First commit to the code repository
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# 数据库配置
|
||||
MYSQL_HOST=xpack-mysql
|
||||
MYSQL_PORT=3306
|
||||
MYSQL_USER=root
|
||||
MYSQL_PASSWORD=mysql_ZTdhRB
|
||||
MYSQL_DB=xpack
|
||||
|
||||
# 服务端口配置
|
||||
API_PORT=8000
|
||||
ADMIN_PORT=8001
|
||||
|
||||
# 调试配置
|
||||
DEBUG=false
|
||||
LOG_LEVEL=INFO
|
||||
|
||||
# Redis 配置
|
||||
REDIS_HOST=xpack-redis
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=redis_6sJZDm
|
||||
REDIS_DB=0
|
||||
|
||||
# RabbitMQ 配置
|
||||
RABBITMQ_HOST=xpack-rabbitmq
|
||||
RABBITMQ_PORT=5672
|
||||
RABBITMQ_USER=rabbitmq
|
||||
RABBITMQ_PASSWORD=rabbitmq_Gs123dA
|
||||
RABBITMQ_VHOST=/
|
||||
@@ -0,0 +1,62 @@
|
||||
name: "Bug Report"
|
||||
description: Report a bug to help improve the project.
|
||||
title: "bug: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for taking the time to report this bug!
|
||||
|
||||
_The more information you share, the faster we can identify and fix the bug._
|
||||
|
||||
Prior to opening the issue, please make sure that you:
|
||||
|
||||
- Use English to communicate.
|
||||
- Search the [open issues](https://github.com/xpack-ai/XPack-MCP-Market/issues) and [discussion forum](https://github.com/xpack-ai/XPack-MCP-Market/discussions) to avoid duplicating the issue.
|
||||
|
||||
- type: textarea
|
||||
id: current-behavior
|
||||
attributes:
|
||||
label: Current Behavior
|
||||
description: Describe the issue you are facing.
|
||||
placeholder: |
|
||||
What is the issue with the current behavior?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: Describe what you expected to happen.
|
||||
placeholder: |
|
||||
What did you expect to happen instead?
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: error
|
||||
attributes:
|
||||
label: Error Logs
|
||||
description: Paste the error logs if any.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: Share the steps you took so that we can reproduce the issue. Reports without proper steps details will likely be closed.
|
||||
placeholder: |
|
||||
1. Run XPack via the Docker image.
|
||||
2. Try configuring ...
|
||||
3. ...
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment
|
||||
description: Share your environment details. Reports without proper environment details will likely be closed.
|
||||
value: |
|
||||
- XPack version:
|
||||
- Operating system (run `uname -a`):
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: XPack Discussion Forum
|
||||
url: https://github.com/xpack-ai/XPack-MCP-Marketdiscussions
|
||||
about: Please ask and answer questions here.
|
||||
@@ -0,0 +1,33 @@
|
||||
name: "Documentation Issue"
|
||||
description: Issues related to documentation.
|
||||
title: "docs: "
|
||||
labels: [doc]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
_The more information you share, the faster we can help you._
|
||||
|
||||
Prior to opening the issue, please make sure that you:
|
||||
|
||||
- Use English to communicate.
|
||||
- Search the [open issues](https://github.com/xpack-ai/XPack-MCP-Marketissues) and [discussion forum](https://github.com/xpack-ai/XPack-MCP-Marketdiscussions) to avoid duplicating the issue.
|
||||
|
||||
- type: textarea
|
||||
id: current-state
|
||||
attributes:
|
||||
label: Current State
|
||||
description: Describe the current state of the documentation.
|
||||
placeholder: |
|
||||
The documentation for the API in this page (url) is missing ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: desired-state
|
||||
attributes:
|
||||
label: Desired State
|
||||
description: Describe the desired state the documentation should be in.
|
||||
placeholder: |
|
||||
There should be line mentioning how the API behaves when ...
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,23 @@
|
||||
name: "Feature Request"
|
||||
description: Suggest an enhancement to XPack.
|
||||
title: "feat: As a user, I want to ..., so that ..."
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
_The more information you share, the faster we can help you._
|
||||
|
||||
Prior to opening the issue, please make sure that you:
|
||||
|
||||
- Use English to communicate.
|
||||
- Search the [open issues](https://github.com/xpack-ai/XPack-MCP-Marketissues) and [discussion forum](https://github.com/xpack-ai/XPack-MCP-Marketdiscussions) to avoid duplicating the issue.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Describe the feature you would like to see.
|
||||
placeholder: |
|
||||
As a user, I want to ..., so that...
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,31 @@
|
||||
name: "Request Help"
|
||||
description: Stuck? Ask for help!
|
||||
title: "help request: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
_The more information you share, the faster we can help you._
|
||||
|
||||
Prior to opening the issue, please make sure that you:
|
||||
|
||||
- Use English to communicate.
|
||||
- Search the [open issues](https://github.com/xpack-ai/XPack-MCP-Marketissues) and [discussion forum](https://github.com/xpack-ai/XPack-MCP-Marketdiscussions) to avoid duplicating the issue.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Describe the issue you are facing and what you need help with.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment
|
||||
description: Share your environment details. Reports without proper environment details will likely be closed.
|
||||
value: |
|
||||
- XPack version:
|
||||
- Operating system (run `uname -a`):
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,36 @@
|
||||
# XPack 开源版本 - Copilot 编程指导
|
||||
|
||||
## 项目架构
|
||||
|
||||
### 服务依赖
|
||||
- `admin_service` 和 `api_service` 相互独立,都依赖 `common`
|
||||
- 遵循分层架构:Controller → Service → Repository
|
||||
|
||||
### 目录结构
|
||||
```
|
||||
services/
|
||||
├── admin_service/ # 管理端服务
|
||||
├── api_service/ # API服务
|
||||
└── common/ # 公共模块
|
||||
```
|
||||
|
||||
## 编码规范
|
||||
|
||||
### 代码风格
|
||||
- 遵循 PEP 8,使用类型注解和 docstring
|
||||
- 命名:函数/变量用 `snake_case`,类用 `PascalCase`
|
||||
- 导入:优先使用 `services/common`,避免跨服务导入
|
||||
|
||||
### 日志要求
|
||||
- **必须使用英文**,使用 `services/common/logging_config.py`
|
||||
- 格式:`logger.info("Action completed: {context}")`
|
||||
- 避免敏感信息,包含必要上下文
|
||||
|
||||
### 错误处理
|
||||
- 使用 `services/common/error_msg.py` 定义的错误消息
|
||||
- 统一异常处理和日志记录
|
||||
|
||||
## 开发建议
|
||||
- 有适当的日志记录(英文格式,统一格式)
|
||||
- 添加方法级别英文注释,需要简洁
|
||||
- 添加的注释一律使用英文
|
||||
@@ -0,0 +1,46 @@
|
||||
name: release
|
||||
#触发机制,当创建tag时
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
name: release
|
||||
steps:
|
||||
- name: SetOutput
|
||||
id: vars
|
||||
run: echo "tag=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT
|
||||
- name: Checkout #Checkout代码
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3.0.0
|
||||
with:
|
||||
node-version: '22.16'
|
||||
- name: Pnpm install and build
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
./scripts/frontend_build.sh
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login Docker #登录docker
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Setup qshell
|
||||
uses: foxundermoon/setup-qshell@v5
|
||||
with:
|
||||
version: '2.9.0'
|
||||
- name: build
|
||||
run: |
|
||||
cd scripts && ./docker_build.sh ${{ secrets.DOCKER_USERNAME }}
|
||||
- name: publish
|
||||
env:
|
||||
AccessKey: ${{ secrets.AK }}
|
||||
SecretKey: ${{ secrets.SK }}
|
||||
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
|
||||
QINIU_NAME: ${{ secrets.QINIU_NAME }}
|
||||
run: cd scripts && ./docker_publish.sh ${{ secrets.DOCKER_USERNAME }}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.pyo
|
||||
*.pyd
|
||||
*.pyc
|
||||
|
||||
# Virtualenv
|
||||
.venv/
|
||||
venv/
|
||||
.env/
|
||||
.env
|
||||
|
||||
# VSCode
|
||||
.vscode/
|
||||
|
||||
# PyCharm
|
||||
.idea/
|
||||
|
||||
# MacOS
|
||||
.DS_Store
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
logs/
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
*.so
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Test output
|
||||
htmlcov/
|
||||
.coverage
|
||||
.tox/
|
||||
|
||||
# Docker
|
||||
*.pid
|
||||
|
||||
# Ignore local config
|
||||
local_settings.py
|
||||
/.secrets
|
||||
@@ -1,2 +1,191 @@
|
||||
# XPack-MCP-Market
|
||||

|
||||
|
||||
## Hardware Requirements
|
||||
**Recommended Configuration**
|
||||
- CPU: 8 cores
|
||||
- Memory: 16GB
|
||||
- Storage: 200GB
|
||||
- Operating System: Linux
|
||||
- System Architecture: AMD64
|
||||
|
||||
**Minimum Requirements**
|
||||
- CPU: 2 cores
|
||||
- Memory: 4GB
|
||||
- Storage: 200GB
|
||||
- Operating System: Linux / Mac
|
||||
- System Architecture: AMD64 / ARM64
|
||||
|
||||
**Dependencies**
|
||||
**XPack-MCP-Market** requires `MySQL, Redis, RabbitMQ` with the following versions:
|
||||
- **MySQL:** >= 5.7.x
|
||||
- **Redis:** >= 6.2.x
|
||||
- **RabbitMQ:** >=4.0
|
||||
|
||||
## Deployment
|
||||
### Quick Start Script
|
||||
> Supported Systems:
|
||||
> - CentOS 7.9 (representing 7.x)
|
||||
> - CentOS 8.5 (representing 8.x)
|
||||
> - Ubuntu 20.04
|
||||
> - Ubuntu 22.04
|
||||
> - Debian 12.4
|
||||
> - Alibaba Cloud Linux 3.2104
|
||||
> - Alibaba Cloud Linux 2.1903
|
||||
Currently, installation has only been tested on the above systems. If you need one-click deployment for other systems, please submit an [Issue](https://github.com/xpack-ai/XPack-MCP-Market/issues).
|
||||
```
|
||||
curl -sSO https://download.xpack.com/install/quick-start.sh; bash quick-start.sh
|
||||
```
|
||||
|
||||
### Docker-Compose Deployment
|
||||
To install XPack-MCP-Market using this method, you need to have [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/standalone/) installed.
|
||||
1. Edit the `docker-compose.yml` file
|
||||
```
|
||||
vi docker-compose.yml
|
||||
```
|
||||
2. Modify the configuration, you can reference the original file at [docker-compose.yml](https://github.com/xpack-ai/XPack-MCP-Market/blob/main/scripts/docker-compose.yml)
|
||||
```
|
||||
version: '3'
|
||||
services:
|
||||
xpack-mysql:
|
||||
image: mysql:8.0.37
|
||||
privileged: true
|
||||
restart: always
|
||||
container_name: xpack-mysql
|
||||
hostname: xpack-mysql
|
||||
command:
|
||||
- "--character-set-server=utf8mb4"
|
||||
- "--collation-server=utf8mb4_unicode_ci"
|
||||
ports:
|
||||
- "33306:3306"
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
|
||||
- MYSQL_DATABASE=xpack
|
||||
volumes:
|
||||
- /var/lib/xpack/mysql:/var/lib/mysql
|
||||
networks:
|
||||
- xpack
|
||||
xpack-mcp-market:
|
||||
image: xpackai/xpack-mcp-market
|
||||
container_name: xpack-mcp-market
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- xpack
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
- xpack-mysql
|
||||
- xpack-redis
|
||||
- xpack-rabbitmq
|
||||
xpack-redis:
|
||||
container_name: xpack-redis
|
||||
image: redis:7.2.4
|
||||
hostname: xpack-redis
|
||||
privileged: true
|
||||
restart: always
|
||||
ports:
|
||||
- 6379:6379
|
||||
command:
|
||||
- bash
|
||||
- -c
|
||||
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
|
||||
networks:
|
||||
- xpack
|
||||
xpack-rabbitmq:
|
||||
image: rabbitmq:4.1.2-alpine
|
||||
container_name: xpack-rabbitmq
|
||||
privileged: true
|
||||
restart: always
|
||||
environment:
|
||||
- RABBITMQ_DEFAULT_USER=rabbitmq
|
||||
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
|
||||
networks:
|
||||
- xpack
|
||||
networks:
|
||||
xpack:
|
||||
driver: bridge
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: 172.101.0.0/24
|
||||
```
|
||||
3. Start XPack-MCP-Market
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
4. Access `XPack-MCP-Market` in your browser at port 3000
|
||||
|
||||
## Build Guide
|
||||
### Prerequisites
|
||||
1. Clone the XPack repository.
|
||||
```
|
||||
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
|
||||
```
|
||||
2. Enter the project directory.
|
||||
```
|
||||
cd XPack-MCP-Market
|
||||
```
|
||||
### Frontend Build
|
||||
> Requirements:
|
||||
> - Node >= 22.x
|
||||
> - Pnpm >= 10.x
|
||||
|
||||
1. Execute the frontend build script
|
||||
```
|
||||
cd scripts && ./frontend_build.sh && cd ../
|
||||
```
|
||||
After compilation, the frontend code will be built into the `frontend/out` directory.
|
||||
|
||||
2. Start the UI interface
|
||||
```
|
||||
cd frontend/out && node server.js
|
||||
```
|
||||
### Backend Build
|
||||
> Requirements:
|
||||
> - Python >= 3.11
|
||||
|
||||
#### Using`uv` (Recommended)
|
||||
1. Create virtual environment
|
||||
```
|
||||
uv venv
|
||||
```
|
||||
2. Activate virtual environment
|
||||
```
|
||||
source .venv/bin/activate
|
||||
```
|
||||
3. Install dependencies
|
||||
```
|
||||
uv pip install -r requirements.txt
|
||||
```
|
||||
4. Copy environment variable file
|
||||
```
|
||||
cp .env.example .env
|
||||
```
|
||||
5. Edit environment variables
|
||||
```
|
||||
vi .env
|
||||
```
|
||||
6. Start admin backend service
|
||||
**Foreground**
|
||||
```
|
||||
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload
|
||||
```
|
||||
**Background**
|
||||
```
|
||||
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload &
|
||||
```
|
||||
|
||||
7. Start API to MCP service
|
||||
**Foreground**
|
||||
```
|
||||
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload
|
||||
```
|
||||
**Background**
|
||||
```
|
||||
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload &
|
||||
```
|
||||
### Docker Build
|
||||
```
|
||||
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
|
||||
```
|
||||
@@ -0,0 +1,206 @@
|
||||
# XPack-MCP-Market
|
||||

|
||||
|
||||
## 硬件要求
|
||||
**推荐配置**
|
||||
- CPU:8核
|
||||
- 内存:16G
|
||||
- 硬盘存储:200G
|
||||
- 操作系统:Linux
|
||||
- 系统架构:AMD64
|
||||
|
||||
**最低配置**
|
||||
- CPU:2核
|
||||
- 内存:4G
|
||||
- 硬盘存储:200G
|
||||
- 操作系统:Linux / Mac
|
||||
- 系统架构:AMD64 / ARM64
|
||||
|
||||
**程序依赖**
|
||||
**XPack** 依赖 `MySQL、Redis、RabbitMQ`,所需版本如下:
|
||||
- **MySQL:** >= 5.7.x
|
||||
- **Redis:** >= 6.2.x
|
||||
- **RabbitMQ:** >= 4.0
|
||||
|
||||
## 部署
|
||||
### 脚本一键部署
|
||||
> 支持的系统列表:
|
||||
> - CentOS 7.9(7.x为代表)
|
||||
> - CentOS 8.5(8.x为代表)
|
||||
> - Ubuntu 20.04
|
||||
> - Ubuntu 22.04
|
||||
> - Debian 12.4
|
||||
> - Alibaba Cloud Linux 3.2104
|
||||
> - Alibaba Cloud Linux 2.1903
|
||||
|
||||
当前仅测试了上述部署的安装,若需要其他系统的一键部署,可给我们提交[Issue](https://github.com/xpack-ai/XPack-MCP-Market/issues)。
|
||||
```bash
|
||||
curl -sSO https://download.xpack.com/install/quick-start.sh; bash quick-start.sh
|
||||
```
|
||||
|
||||
### Docker-Compose部署
|
||||
使用此方法安装 **XPack-MCP-Market**,你需要安装 [Docker](https://docs.docker.com/engine/install/) 和 [Docker Compose](https://docs.docker.com/compose/install/standalone/)。
|
||||
|
||||
1. 编辑 `docker-compose.yml` 文件
|
||||
```bash
|
||||
vi docker-compose.yml
|
||||
```
|
||||
|
||||
2. 修改文件配置,原文件可参考 [docker-compose.yml](https://github.com/xpack-ai/XPack-MCP-Market/blob/main/scripts/docker-compose.yml)
|
||||
```yaml
|
||||
version: '3'
|
||||
services:
|
||||
xpack-mysql:
|
||||
image: mysql:8.0.37
|
||||
privileged: true
|
||||
restart: always
|
||||
container_name: xpack-mysql
|
||||
hostname: xpack-mysql
|
||||
command:
|
||||
- "--character-set-server=utf8mb4"
|
||||
- "--collation-server=utf8mb4_unicode_ci"
|
||||
ports:
|
||||
- "33306:3306"
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
|
||||
- MYSQL_DATABASE=xpack
|
||||
volumes:
|
||||
- /var/lib/xpack/mysql:/var/lib/mysql
|
||||
networks:
|
||||
- xpack
|
||||
xpack-mcp-market:
|
||||
image: xpackai/xpack-mcp-market
|
||||
container_name: xpack-mcp-market
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
- xpack
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
- xpack-mysql
|
||||
- xpack-redis
|
||||
- xpack-rabbitmq
|
||||
xpack-redis:
|
||||
container_name: xpack-redis
|
||||
image: redis:7.2.4
|
||||
hostname: xpack-redis
|
||||
privileged: true
|
||||
restart: always
|
||||
ports:
|
||||
- 6379:6379
|
||||
command:
|
||||
- bash
|
||||
- -c
|
||||
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
|
||||
networks:
|
||||
- xpack
|
||||
xpack-rabbitmq:
|
||||
image: rabbitmq:4.1.2-alpine
|
||||
container_name: xpack-rabbitmq
|
||||
privileged: true
|
||||
restart: always
|
||||
environment:
|
||||
- RABBITMQ_DEFAULT_USER=rabbitmq
|
||||
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
|
||||
networks:
|
||||
- xpack
|
||||
networks:
|
||||
xpack:
|
||||
driver: bridge
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: 172.101.0.0/24
|
||||
```
|
||||
|
||||
3. 启动XPack-MCP-Market
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
4. 浏览器访问XPack-MCP-Market,端口号默认为:3000
|
||||
[图片]
|
||||
|
||||
## 编译指南
|
||||
### 前期准备
|
||||
1. 拉取XPack-MCP-Market仓库
|
||||
```bash
|
||||
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
|
||||
```
|
||||
|
||||
2. 进入项目目录
|
||||
```bash
|
||||
cd XPack-MCP-Market
|
||||
```
|
||||
|
||||
### 编译前端
|
||||
> 环境要求:
|
||||
> - Node >= 22.x
|
||||
> - Pnpm >= 10.x
|
||||
|
||||
1. 执行前端编译脚本
|
||||
```bash
|
||||
cd scripts && ./frontend_build.sh && cd ../
|
||||
```
|
||||
编译完成后,前端代码将编译进 `frontend/out` 目录。
|
||||
|
||||
2. 启动UI界面
|
||||
```bash
|
||||
cd frontend/out && node server.js
|
||||
```
|
||||
|
||||
### 编译后端
|
||||
> 环境要求:
|
||||
> - Python >= 3.11
|
||||
|
||||
#### 使用 `uv`(推荐)
|
||||
1. 创建虚拟环境
|
||||
```bash
|
||||
uv venv
|
||||
```
|
||||
|
||||
2. 激活虚拟环境
|
||||
```bash
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
3. 安装依赖
|
||||
```bash
|
||||
uv pip install -r requirements.txt
|
||||
```
|
||||
|
||||
4. 复制环境变量文件
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
5. 编辑环境变量
|
||||
```bash
|
||||
vi .env
|
||||
```
|
||||
|
||||
6. 启动管理后台服务
|
||||
**前台运行**
|
||||
```bash
|
||||
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload
|
||||
```
|
||||
**后台运行**
|
||||
```bash
|
||||
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload &
|
||||
```
|
||||
|
||||
7. 启动API转MCP服务
|
||||
**前台运行**
|
||||
```bash
|
||||
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload
|
||||
```
|
||||
**后台运行**
|
||||
```bash
|
||||
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload &
|
||||
```
|
||||
|
||||
### Docker编译
|
||||
```bash
|
||||
docker build -t xpack --build-arg APP=xpack --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
# 贡献指南
|
||||
|
||||
欢迎贡献代码!请遵循本项目的贡献流程。
|
||||
@@ -0,0 +1,44 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/versions
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# env files (can opt-in for committing if needed)
|
||||
# .env*
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
.env*
|
||||
/package-lock.json
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [XPack.ai team] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,305 @@
|
||||
# XPack WebUI
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
A modern, enterprise-grade web application for the MCP (Model Context Protocol) Store, enabling seamless discovery, management, and integration of AI agent tools and services.
|
||||
|
||||
## 🌟 Overview
|
||||
|
||||
XPack WebUI is the flagship frontend interface for the MCP Store ecosystem, designed to connect AI agents with thousands of ready-to-use APIs and tools. Built with cutting-edge technologies, it provides developers and businesses with a unified platform to accelerate AI agent development and deployment.
|
||||
|
||||
### ✨ Key Features
|
||||
|
||||
- **🛍️ Comprehensive Marketplace**: Browse, search, and discover MCP services across multiple categories
|
||||
- **👤 Multi-tier Authentication**: Secure user and admin authentication systems
|
||||
- **⚙️ Advanced Admin Console**: Complete service management, user administration, and revenue tracking
|
||||
- **🌐 Full Internationalization**: Native support for English and Chinese with extensible i18n framework
|
||||
- **📱 Responsive Design**: Optimized for desktop, tablet, and mobile experiences
|
||||
- **🎨 Modern UI/UX**: Built with NextUI and Tailwind CSS for exceptional user experience
|
||||
- **🔧 Developer-First**: Comprehensive API integration and management tools
|
||||
- **📊 Analytics & Insights**: Built-in revenue management and user analytics
|
||||
- **🚀 Performance Optimized**: SSR (Server-Side Rendering) for dynamic content and SEO optimization with advanced caching strategies
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- **Node.js** 18.0 or higher
|
||||
- **pnpm** package manager (recommended)
|
||||
- **Backend API** service running (for full functionality)
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone <repository-url>
|
||||
cd apps/op
|
||||
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
# Configure environment
|
||||
cp .env.example .env.local
|
||||
|
||||
# Start development server
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) to view the application.
|
||||
|
||||
### Environment Configuration
|
||||
|
||||
Create `.env.local` file in the project root and configure your backend service URLs:
|
||||
|
||||
```bash
|
||||
# Backend Service API URL Prefix
|
||||
NEXT_PUBLIC_API_URL=http://127.0.0.1:8100
|
||||
|
||||
```
|
||||
|
||||
### Production Build
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
pnpm start
|
||||
```
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
### Technology Stack
|
||||
|
||||
- **Framework**: Next.js 15 with App Router
|
||||
- **Language**: TypeScript 5
|
||||
- **UI Library**: NextUI v2
|
||||
- **Styling**: Tailwind CSS
|
||||
- **State Management**: Zustand
|
||||
- **Data Fetching**: SWR + Custom API Services
|
||||
- **Animations**: Framer Motion
|
||||
- **Internationalization**: react-i18next
|
||||
- **Form Handling**: React Hook Form + Zod
|
||||
- **Icons**: Lucide React + React Icons
|
||||
- **Additional Libraries**:
|
||||
- Recharts (for analytics charts)
|
||||
- React Markdown (for content rendering)
|
||||
- Crypto-js (for encryption)
|
||||
- Three.js (for 3D effects)
|
||||
- Lottie React (for animations)
|
||||
- Anime.js (for advanced animations)
|
||||
- React Hook Form + Zod (for form validation)
|
||||
- React Hot Toast (for notifications)
|
||||
- React Hover Video Player (for media)
|
||||
- @uiw/react-md-editor (for markdown editing)
|
||||
- Simplex Noise (for procedural generation)
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
src/
|
||||
├── app/ # Next.js App Router pages
|
||||
│ ├── marketplace/ # Service marketplace
|
||||
│ ├── console/ # Admin console
|
||||
│ ├── dashboard/ # User dashboard
|
||||
│ ├── signin/ # User authentication
|
||||
│ ├── admin-signin/ # Admin authentication
|
||||
│ └── loginSuccess/ # Login success page
|
||||
├── components/ # Feature-specific components
|
||||
│ ├── console/ # Admin console components
|
||||
│ ├── dashboard/ # User dashboard components
|
||||
│ ├── marketplace/ # Marketplace components
|
||||
│ ├── mcp-services/ # MCP service management
|
||||
│ ├── user-management/ # User administration
|
||||
│ ├── revenue-management/# Revenue tracking
|
||||
│ ├── system-setting/ # System configuration
|
||||
│ └── wallet/ # Wallet management
|
||||
├── shared/ # Shared utilities and components
|
||||
│ ├── components/ # Reusable UI components
|
||||
│ ├── hooks/ # Custom React hooks
|
||||
│ ├── store/ # Global state management
|
||||
│ ├── types/ # TypeScript definitions
|
||||
│ ├── lib/ # Utility functions
|
||||
│ ├── rpc/ # RPC services
|
||||
│ ├── providers/ # React providers
|
||||
│ ├── contexts/ # React contexts
|
||||
│ ├── config/ # Configuration files
|
||||
│ ├── data/ # Static data and mocks
|
||||
│ └── utils/ # Utility functions
|
||||
├── services/ # Backend API integration
|
||||
│ ├── marketplaceService.ts # Marketplace API
|
||||
│ ├── mcpService.ts # MCP service API
|
||||
│ ├── userService.ts # User management API
|
||||
│ ├── revenueService.ts # Revenue tracking API
|
||||
│ ├── paymentChannelService.ts # Payment API
|
||||
│ ├── systemConfigService.ts # System config API
|
||||
│ ├── platformConfigService.ts # Platform config API
|
||||
│ └── overviewService.ts # Overview/stats API
|
||||
├── hooks/ # App-specific hooks
|
||||
│ ├── useAdminLogin.tsx # Admin authentication
|
||||
│ ├── useLogin.tsx # User authentication
|
||||
│ ├── useMCPServicesList.ts # MCP services data
|
||||
│ ├── useMCPServiceDetail.ts # Service details
|
||||
│ ├── useUserManagement.ts # User management
|
||||
│ ├── useRevenueManagement.ts # Revenue data
|
||||
│ ├── usePaymentChannelManagement.ts # Payment channels
|
||||
│ └── useSystemConfigManagement.ts # System config
|
||||
├── store/ # Zustand stores
|
||||
│ └── admin.ts # Admin state management
|
||||
├── types/ # TypeScript type definitions
|
||||
│ ├── admin.ts # Admin types
|
||||
│ ├── dashboard.ts # Dashboard types
|
||||
│ ├── mcp-service.ts # MCP service types
|
||||
│ ├── payment.ts # Payment types
|
||||
│ ├── revenue.ts # Revenue types
|
||||
│ ├── system.ts # System types
|
||||
│ ├── user.ts # User types
|
||||
│ └── global.d.ts # Global type declarations
|
||||
├── rpc/ # RPC layer
|
||||
│ └── admin-api.ts # Admin API client
|
||||
└── utils/ # Utility functions
|
||||
└── getEmail.ts # Email utilities
|
||||
```
|
||||
|
||||
## 🎯 Core Features
|
||||
|
||||
### Marketplace Experience
|
||||
|
||||
- **Service Discovery**: Advanced search and filtering capabilities for MCP services
|
||||
- **Service Catalog**: Browse services by categories with detailed information
|
||||
- **Service Details**: Comprehensive service documentation and API specifications
|
||||
- **Installation Guides**: Step-by-step integration instructions for developers
|
||||
|
||||
### User Dashboard
|
||||
|
||||
- **Personal Overview**: Account summary
|
||||
- **API Key Management**: Create, edit, and manage API keys with usage analytics
|
||||
|
||||
### Admin Console
|
||||
|
||||
- **MCP Services Management**: Complete CRUD operations for MCP services
|
||||
- Service creation and editing with OpenAPI generator
|
||||
- OpenAPI document parsing from files or URLs
|
||||
- Service status management (enabled/disabled)
|
||||
- API configuration and documentation
|
||||
- **User Management**: User account administration and monitoring
|
||||
- **Revenue Management**: Financial reporting and revenue analytics
|
||||
- **System Configuration**: Comprehensive platform settings and customization
|
||||
- Platform configuration (branding, URLs, features)
|
||||
- Admin account settings
|
||||
- Email service configuration
|
||||
- Google OAuth authentication setup
|
||||
- **Payment Channels**: Payment method configuration and management
|
||||
- **Platform Overview**: Real-time statistics and system monitoring
|
||||
|
||||
### Developer Experience
|
||||
|
||||
- **API Integration**: Seamless backend API connectivity with custom RPC layer
|
||||
- **Type Safety**: Full TypeScript support with comprehensive type definitions
|
||||
- **Component Library**: Reusable UI components with NextUI design system
|
||||
- **Custom Hooks**: Optimized data fetching and state management
|
||||
- **Error Handling**: Comprehensive error boundaries and user feedback
|
||||
- **Real-time Updates**: Live data synchronization with backend services
|
||||
|
||||
## 🌐 Internationalization
|
||||
|
||||
The application supports multiple languages with a robust i18n system:
|
||||
|
||||
- **English** (default)
|
||||
- **Chinese Simplified**
|
||||
|
||||
Translation files are located in `public/locales/` and managed through react-i18next with automatic language detection and fallback support.
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
Comprehensive documentation is available in the `docs/` directory:
|
||||
|
||||
- **[Development Guide](./docs/development.md)** - Setup, workflow, and coding standards
|
||||
- **[Architecture Guide](./docs/architecture.md)** - Technical architecture and design patterns
|
||||
- **[API Integration](./docs/api.md)** - Backend API services and data management
|
||||
- **[Deployment Guide](./docs/deployment.md)** - Production build and deployment
|
||||
- **[Internationalization](./docs/i18n.md)** - Multi-language support and translation
|
||||
- **[Contributing Guide](./docs/contributing.md)** - Contribution guidelines and best practices
|
||||
|
||||
## 🛠️ Development
|
||||
|
||||
### Available Scripts
|
||||
|
||||
```bash
|
||||
pnpm dev # Start development server
|
||||
pnpm build # Build for production
|
||||
pnpm start # Start production server
|
||||
pnpm lint # Run ESLint
|
||||
pnpm type-check # TypeScript type checking
|
||||
```
|
||||
|
||||
### Development Workflow
|
||||
|
||||
1. **Setup**: Follow the installation guide above
|
||||
2. **Development**: Use `pnpm dev` for hot-reload development
|
||||
3. **Type Checking**: Run `pnpm type-check` before commits
|
||||
4. **Linting**: Ensure code quality with `pnpm lint`
|
||||
5. **Building**: Test production builds with `pnpm build`
|
||||
|
||||
### Code Quality
|
||||
|
||||
- **ESLint**: Configured with Next.js and TypeScript rules
|
||||
- **TypeScript**: Strict type checking enabled
|
||||
- **Prettier**: Code formatting (configured in IDE)
|
||||
- **Husky**: Pre-commit hooks for quality assurance
|
||||
|
||||
## 🚀 Deployment
|
||||
|
||||
The application is optimized for various deployment platforms:
|
||||
|
||||
- **Vercel**: Native Next.js deployment with zero configuration
|
||||
- **Docker**: Containerized deployment with standalone output
|
||||
- **Self-hosted**: Node.js server deployment
|
||||
|
||||
### Build Configuration
|
||||
|
||||
- **Standalone Output**: Optimized for containerized deployments
|
||||
- **Image Optimization**: Configured for static assets
|
||||
- **SSR Support**: Server-side rendering for dynamic content and SEO
|
||||
- **Bundle Analysis**: Webpack bundle optimization
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
We welcome contributions from the community! Please read our [Contributing Guide](./docs/contributing.md) for detailed information on:
|
||||
|
||||
- **Development Setup**: Local environment configuration
|
||||
- **Code Standards**: Coding conventions and best practices
|
||||
- **Pull Request Process**: Contribution workflow and review process
|
||||
- **Issue Reporting**: Bug reports and feature requests
|
||||
- **Testing Guidelines**: Quality assurance requirements
|
||||
|
||||
### Getting Started with Contributing
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
||||
3. Make your changes and test thoroughly
|
||||
4. Commit your changes: `git commit -m 'Add amazing feature'`
|
||||
5. Push to the branch: `git push origin feature/amazing-feature`
|
||||
6. Open a Pull Request
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## 🙏 Acknowledgments
|
||||
|
||||
- **NextUI Team** for the exceptional UI component library
|
||||
- **Vercel Team** for Next.js and deployment platform
|
||||
- **Open Source Community** for the amazing tools and libraries
|
||||
|
||||
## 📞 Support
|
||||
|
||||
- **Documentation**: Check the `docs/` directory for detailed guides
|
||||
- **Issues**: Report bugs and request features via GitHub Issues
|
||||
- **Community**: Join our community discussions
|
||||
- **Enterprise**: Contact us for enterprise support and customization
|
||||
|
||||
---
|
||||
|
||||
**Built with ❤️ by the XPack.AI Team**
|
||||
@@ -0,0 +1,307 @@
|
||||
# XPack WebUI
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
一个现代化的企业级 Web 应用程序,专为 MCP(模型上下文协议)商店打造,实现 AI 智能体工具和服务的无缝发现、管理和集成。
|
||||
|
||||
## 🌟 概述
|
||||
|
||||
XPack WebUI 是 MCP 商店生态系统的旗舰前端界面,旨在连接 AI 智能体与数千个即用型 API 和工具。采用前沿技术构建,为开发者和企业提供统一平台,加速 AI 智能体的开发和部署。
|
||||
|
||||
这是一个现代化的企业级 Web 应用程序,专为 MCP(模型上下文协议)商店打造,实现 AI 智能体工具和服务的无缝发现、管理和集成。
|
||||
|
||||
### ✨ 核心特性
|
||||
|
||||
- **🛍️ 综合性市场**: 跨多个类别浏览、搜索和发现 MCP 服务
|
||||
- **👤 多层级认证**: 安全的用户和管理员认证系统
|
||||
- **⚙️ 高级管理控制台**: 完整的服务管理、用户管理和收入跟踪
|
||||
- **🌐 完整国际化**: 原生支持中英文,具备可扩展的 i18n 框架
|
||||
- **📱 响应式设计**: 针对桌面、平板和移动设备优化
|
||||
- **🎨 现代化 UI/UX**: 基于 NextUI 和 Tailwind CSS 构建,提供卓越用户体验
|
||||
- **🔧 开发者优先**: 全面的 API 集成和管理工具
|
||||
- **📊 分析与洞察**: 内置收入管理和用户分析
|
||||
- **🚀 性能优化**: SSR(服务器端渲染)支持动态内容和SEO优化,配备高级缓存策略
|
||||
|
||||
## 🚀 快速开始
|
||||
|
||||
### 前置要求
|
||||
|
||||
- **Node.js** 18.0 或更高版本
|
||||
- **pnpm** 包管理器(推荐)
|
||||
- **后端 API** 服务运行中(完整功能需要)
|
||||
|
||||
### 安装
|
||||
|
||||
```bash
|
||||
# 克隆仓库
|
||||
git clone <repository-url>
|
||||
cd apps/op
|
||||
|
||||
# 安装依赖
|
||||
pnpm install
|
||||
|
||||
# 配置环境
|
||||
cp .env.example .env.local
|
||||
|
||||
# 启动开发服务器
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
打开 [http://localhost:3000](http://localhost:3000) 查看应用程序。
|
||||
|
||||
### 环境配置
|
||||
|
||||
在项目根目录创建 `.env.local` 文件,配置后端服务 URL:
|
||||
|
||||
```bash
|
||||
# 后端服务 API URL 前缀
|
||||
NEXT_PUBLIC_API_URL=http://127.0.0.1:8100
|
||||
|
||||
```
|
||||
|
||||
### 生产构建
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
pnpm start
|
||||
```
|
||||
|
||||
## 🏗️ 架构
|
||||
|
||||
### 技术栈
|
||||
|
||||
- **框架**: Next.js 15 with App Router
|
||||
- **语言**: TypeScript 5
|
||||
- **UI 库**: NextUI v2
|
||||
- **样式**: Tailwind CSS
|
||||
- **状态管理**: Zustand
|
||||
- **数据获取**: SWR + 自定义 API 服务
|
||||
- **动画**: Framer Motion
|
||||
- **国际化**: react-i18next
|
||||
- **表单处理**: React Hook Form + Zod
|
||||
- **图标**: Lucide React + React Icons
|
||||
- **其他库**:
|
||||
- Recharts (图表分析)
|
||||
- React Markdown (内容渲染)
|
||||
- Crypto-js (加密)
|
||||
- Three.js (3D 效果)
|
||||
- Lottie React (动画)
|
||||
- Anime.js (高级动画)
|
||||
- React Hook Form + Zod (表单验证)
|
||||
- React Hot Toast (通知)
|
||||
- React Hover Video Player (媒体)
|
||||
- @uiw/react-md-editor (Markdown 编辑)
|
||||
- Simplex Noise (程序化生成)
|
||||
|
||||
### 项目结构
|
||||
|
||||
```
|
||||
src/
|
||||
├── app/ # Next.js App Router 页面
|
||||
│ ├── marketplace/ # 服务市场
|
||||
│ ├── console/ # 管理控制台
|
||||
│ ├── dashboard/ # 用户仪表板
|
||||
│ ├── signin/ # 用户认证
|
||||
│ ├── admin-signin/ # 管理员认证
|
||||
│ └── loginSuccess/ # 登录成功页面
|
||||
├── components/ # 功能特定组件
|
||||
│ ├── console/ # 管理控制台组件
|
||||
│ ├── dashboard/ # 用户仪表板组件
|
||||
│ ├── marketplace/ # 市场组件
|
||||
│ ├── mcp-services/ # MCP 服务管理
|
||||
│ ├── user-management/ # 用户管理
|
||||
│ ├── revenue-management/# 收入跟踪
|
||||
│ ├── system-setting/ # 系统配置
|
||||
│ └── wallet/ # 钱包管理
|
||||
├── shared/ # 共享工具和组件
|
||||
│ ├── components/ # 可复用 UI 组件
|
||||
│ ├── hooks/ # 自定义 React hooks
|
||||
│ ├── store/ # 全局状态管理
|
||||
│ ├── types/ # TypeScript 类型定义
|
||||
│ ├── lib/ # 工具函数
|
||||
│ ├── rpc/ # RPC 服务
|
||||
│ ├── providers/ # React 提供者
|
||||
│ ├── contexts/ # React 上下文
|
||||
│ ├── config/ # 配置文件
|
||||
│ ├── data/ # 静态数据和模拟数据
|
||||
│ └── utils/ # 工具函数
|
||||
├── services/ # 后端 API 集成
|
||||
│ ├── marketplaceService.ts # 市场 API
|
||||
│ ├── mcpService.ts # MCP 服务 API
|
||||
│ ├── userService.ts # 用户管理 API
|
||||
│ ├── revenueService.ts # 收入跟踪 API
|
||||
│ ├── paymentChannelService.ts # 支付 API
|
||||
│ ├── systemConfigService.ts # 系统配置 API
|
||||
│ ├── platformConfigService.ts # 平台配置 API
|
||||
│ └── overviewService.ts # 概览/统计 API
|
||||
├── hooks/ # 应用特定 hooks
|
||||
│ ├── useAdminLogin.tsx # 管理员认证
|
||||
│ ├── useLogin.tsx # 用户认证
|
||||
│ ├── useMCPServicesList.ts # MCP 服务数据
|
||||
│ ├── useMCPServiceDetail.ts # 服务详情
|
||||
│ ├── useUserManagement.ts # 用户管理
|
||||
│ ├── useRevenueManagement.ts # 收入数据
|
||||
│ ├── usePaymentChannelManagement.ts # 支付渠道
|
||||
│ └── useSystemConfigManagement.ts # 系统配置
|
||||
├── store/ # Zustand 状态存储
|
||||
│ └── admin.ts # 管理员状态管理
|
||||
├── types/ # TypeScript 类型定义
|
||||
│ ├── admin.ts # 管理员类型
|
||||
│ ├── dashboard.ts # 仪表板类型
|
||||
│ ├── mcp-service.ts # MCP 服务类型
|
||||
│ ├── payment.ts # 支付类型
|
||||
│ ├── revenue.ts # 收入类型
|
||||
│ ├── system.ts # 系统类型
|
||||
│ ├── user.ts # 用户类型
|
||||
│ └── global.d.ts # 全局类型声明
|
||||
├── rpc/ # RPC 层
|
||||
│ └── admin-api.ts # 管理员 API 客户端
|
||||
└── utils/ # 工具函数
|
||||
└── getEmail.ts # 邮箱工具
|
||||
```
|
||||
|
||||
## 🎯 核心功能
|
||||
|
||||
### 市场体验
|
||||
|
||||
- **服务发现**: MCP 服务的高级搜索和过滤功能
|
||||
- **服务目录**: 按类别浏览服务,提供详细信息
|
||||
- **服务详情**: 全面的服务文档和 API 规范
|
||||
- **安装指南**: 为开发者提供分步集成说明
|
||||
|
||||
### 用户仪表板
|
||||
|
||||
- **个人概览**: 账户摘要
|
||||
- **API 密钥管理**: 创建、编辑和管理 API 密钥,包含使用统计
|
||||
|
||||
### 管理控制台
|
||||
|
||||
- **MCP 服务管理**: MCP 服务的完整 CRUD 操作
|
||||
- 使用 OpenAPI 生成器创建和编辑服务
|
||||
- 从文件或 URL 解析 OpenAPI 文档
|
||||
- 服务状态管理(启用/禁用)
|
||||
- API 配置和文档
|
||||
- **用户管理**: 用户账户管理和监控
|
||||
- **收入管理**: 财务报告和收入分析
|
||||
- **系统配置**: 全面的平台设置和自定义
|
||||
- 平台配置(品牌、URL、功能)
|
||||
- 管理员账户设置
|
||||
- 邮件服务配置
|
||||
- Google OAuth 认证设置
|
||||
- **支付渠道**: 支付方式配置和管理
|
||||
- **平台概览**: 实时统计和系统监控
|
||||
|
||||
### 开发者体验
|
||||
|
||||
- **API 集成**: 使用自定义 RPC 层的无缝后端 API 连接
|
||||
- **类型安全**: 完整的 TypeScript 支持和全面的类型定义
|
||||
- **组件库**: 使用 NextUI 设计系统的可复用 UI 组件
|
||||
- **自定义 Hooks**: 优化的数据获取和状态管理
|
||||
- **错误处理**: 全面的错误边界和用户反馈
|
||||
- **实时更新**: 与后端服务的实时数据同步
|
||||
|
||||
## 🌐 国际化
|
||||
|
||||
应用程序支持多语言,具备强大的 i18n 系统:
|
||||
|
||||
- **英语**(默认)
|
||||
- **简体中文**
|
||||
|
||||
翻译文件位于 `public/locales/`,通过 react-i18next 管理,支持自动语言检测和回退。
|
||||
|
||||
## 📚 文档
|
||||
|
||||
`docs/` 目录中提供了全面的文档:
|
||||
|
||||
- **[开发指南](./docs/development.md)** - 设置、工作流程和编码标准
|
||||
- **[架构指南](./docs/architecture.md)** - 技术架构和设计模式
|
||||
- **[API 集成](./docs/api.md)** - 后端 API 服务和数据管理
|
||||
- **[部署指南](./docs/deployment.md)** - 生产构建和部署
|
||||
- **[国际化](./docs/i18n.md)** - 多语言支持和翻译
|
||||
- **[贡献指南](./docs/contributing.md)** - 贡献指南和最佳实践
|
||||
|
||||
## 🛠️ 开发
|
||||
|
||||
### 可用脚本
|
||||
|
||||
```bash
|
||||
pnpm dev # 启动开发服务器
|
||||
pnpm build # 生产构建
|
||||
pnpm start # 启动生产服务器
|
||||
pnpm lint # 运行 ESLint
|
||||
pnpm type-check # TypeScript 类型检查
|
||||
```
|
||||
|
||||
### 开发工作流
|
||||
|
||||
1. **设置**: 按照上述安装指南操作
|
||||
2. **开发**: 使用 `pnpm dev` 进行热重载开发
|
||||
3. **类型检查**: 提交前运行 `pnpm type-check`
|
||||
4. **代码检查**: 使用 `pnpm lint` 确保代码质量
|
||||
5. **构建**: 使用 `pnpm build` 测试生产构建
|
||||
|
||||
### 代码质量
|
||||
|
||||
- **ESLint**: 配置了 Next.js 和 TypeScript 规则
|
||||
- **TypeScript**: 启用严格类型检查
|
||||
- **Prettier**: 代码格式化(在 IDE 中配置)
|
||||
- **Husky**: 质量保证的预提交钩子
|
||||
|
||||
## 🚀 部署
|
||||
|
||||
应用程序针对各种部署平台进行了优化:
|
||||
|
||||
- **Vercel**: 零配置的原生 Next.js 部署
|
||||
- **Docker**: 使用独立输出的容器化部署
|
||||
- **自托管**: Node.js 服务器部署
|
||||
|
||||
### 构建配置
|
||||
|
||||
- **独立输出**: 针对容器化部署优化
|
||||
- **图像优化**: 为静态资源配置
|
||||
- **SSR 支持**: 服务器端渲染支持动态内容和SEO优化
|
||||
- **包分析**: Webpack 包优化
|
||||
|
||||
## 🤝 贡献
|
||||
|
||||
我们欢迎社区贡献!请阅读我们的[贡献指南](./docs/contributing.md)了解详细信息:
|
||||
|
||||
- **开发设置**: 本地环境配置
|
||||
- **代码标准**: 编码约定和最佳实践
|
||||
- **拉取请求流程**: 贡献工作流程和审查过程
|
||||
- **问题报告**: 错误报告和功能请求
|
||||
- **测试指南**: 质量保证要求
|
||||
|
||||
### 开始贡献
|
||||
|
||||
1. Fork 仓库
|
||||
2. 创建功能分支:`git checkout -b feature/amazing-feature`
|
||||
3. 进行更改并彻底测试
|
||||
4. 提交更改:`git commit -m 'Add amazing feature'`
|
||||
5. 推送到分支:`git push origin feature/amazing-feature`
|
||||
6. 打开拉取请求
|
||||
|
||||
## 📄 许可证
|
||||
|
||||
本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
|
||||
|
||||
## 🙏 致谢
|
||||
|
||||
- **NextUI 团队** 提供卓越的 UI 组件库
|
||||
- **Vercel 团队** 提供 Next.js 和部署平台
|
||||
- **开源社区** 提供出色的工具和库
|
||||
|
||||
## 📞 支持
|
||||
|
||||
- **文档**: 查看 `docs/` 目录获取详细指南
|
||||
- **问题**: 通过 GitHub Issues 报告错误和请求功能
|
||||
- **社区**: 加入我们的社区讨论
|
||||
- **企业**: 联系我们获取企业支持和定制
|
||||
|
||||
---
|
||||
|
||||
**由 XPack.AI 团队用 ❤️ 构建**
|
||||
@@ -0,0 +1,475 @@
|
||||
# API Integration Guide
|
||||
|
||||
## Overview
|
||||
|
||||
XPack WebUI integrates with the XPack platform APIs to provide marketplace, user management, and admin functionality. The application uses a custom RPC layer alongside traditional REST APIs for optimal performance and real-time capabilities.
|
||||
|
||||
## API Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
```env
|
||||
# API Endpoints
|
||||
NEXT_PUBLIC_API_URL=http://localhost:8080
|
||||
```
|
||||
|
||||
### Base API Client
|
||||
|
||||
The application uses a custom fetch wrapper and RPC client:
|
||||
|
||||
```typescript
|
||||
// REST API Client - src/utils/api.ts
|
||||
import { apiRequest } from "@/utils/api";
|
||||
|
||||
// GET request
|
||||
const data = await apiRequest("/api/web/mcp_services");
|
||||
|
||||
// POST request
|
||||
const result = await apiRequest("/api/web/mcp_service_info", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
// RPC Client - src/rpc/client.ts
|
||||
import { rpcClient } from "@/rpc/client";
|
||||
|
||||
// RPC method call
|
||||
const result = await rpcClient.call("marketplace.getServices", {
|
||||
category: "ai-tools",
|
||||
limit: 20,
|
||||
});
|
||||
```
|
||||
|
||||
## API Services
|
||||
|
||||
### Marketplace Service
|
||||
|
||||
Located in `src/services/marketplaceService.ts`:
|
||||
|
||||
```typescript
|
||||
// Fetch all MCP services
|
||||
export async function fetchServices(): Promise<ServiceData[]>;
|
||||
|
||||
// Fetch service by ID
|
||||
export async function fetchServiceById(id: string): Promise<ServiceData | null>;
|
||||
|
||||
// Search services with filters
|
||||
export async function searchServices(
|
||||
filters: ServiceFilters
|
||||
): Promise<ServiceData[]>;
|
||||
```
|
||||
|
||||
### Authentication Service
|
||||
|
||||
Located in `src/services/authService.ts`:
|
||||
|
||||
```typescript
|
||||
// User login
|
||||
export async function loginUser(
|
||||
credentials: LoginCredentials
|
||||
): Promise<AuthResponse>;
|
||||
|
||||
// Admin login
|
||||
export async function adminLogin(
|
||||
credentials: AdminCredentials
|
||||
): Promise<AdminAuthResponse>;
|
||||
|
||||
// Token validation
|
||||
export async function validateToken(token: string): Promise<boolean>;
|
||||
|
||||
// Logout
|
||||
export async function logout(): Promise<void>;
|
||||
```
|
||||
|
||||
### User Service
|
||||
|
||||
Located in `src/services/userService.ts`:
|
||||
|
||||
```typescript
|
||||
// Get user profile
|
||||
export async function getUserProfile(): Promise<UserProfile>;
|
||||
|
||||
// Update user profile
|
||||
export async function updateUserProfile(
|
||||
data: UserProfileUpdate
|
||||
): Promise<UserProfile>;
|
||||
|
||||
// Get user dashboard data
|
||||
export async function getUserDashboard(): Promise<DashboardData>;
|
||||
```
|
||||
|
||||
### Wallet Service
|
||||
|
||||
Located in `src/services/walletService.ts`:
|
||||
|
||||
```typescript
|
||||
// Get wallet balance
|
||||
export async function getWalletBalance(): Promise<WalletBalance>;
|
||||
|
||||
// Get transaction history
|
||||
export async function getTransactions(
|
||||
filters?: TransactionFilters
|
||||
): Promise<Transaction[]>;
|
||||
|
||||
// Create payment
|
||||
export async function createPayment(
|
||||
data: PaymentData
|
||||
): Promise<PaymentResponse>;
|
||||
```
|
||||
|
||||
## Data Types
|
||||
|
||||
### Service Data
|
||||
|
||||
```typescript
|
||||
interface ServiceData {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
category: string;
|
||||
author: string;
|
||||
version: string;
|
||||
rating: number;
|
||||
downloads: number;
|
||||
verified: boolean;
|
||||
updatedAt: string;
|
||||
tags: string[];
|
||||
documentation?: string;
|
||||
pricing?: PricingInfo;
|
||||
}
|
||||
```
|
||||
|
||||
### User Types
|
||||
|
||||
```typescript
|
||||
interface User {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
avatar?: string;
|
||||
role: "user" | "admin";
|
||||
createdAt: string;
|
||||
lastLoginAt?: string;
|
||||
}
|
||||
|
||||
interface UserProfile extends User {
|
||||
preferences: UserPreferences;
|
||||
subscription?: SubscriptionInfo;
|
||||
}
|
||||
```
|
||||
|
||||
### Authentication
|
||||
|
||||
```typescript
|
||||
interface AuthResponse {
|
||||
token: string;
|
||||
user: User;
|
||||
expiresAt: string;
|
||||
}
|
||||
|
||||
interface LoginCredentials {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
```
|
||||
|
||||
## State Management
|
||||
|
||||
### API State with SWR
|
||||
|
||||
The application uses SWR for data fetching and caching:
|
||||
|
||||
```typescript
|
||||
import useSWR from "swr";
|
||||
import { fetchServices } from "@/services/marketplaceService";
|
||||
|
||||
function useServices() {
|
||||
const { data, error, isLoading, mutate } = useSWR(
|
||||
"/api/web/mcp_services",
|
||||
fetchServices,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: true,
|
||||
errorRetryCount: 3,
|
||||
dedupingInterval: 5000,
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
services: data,
|
||||
isLoading,
|
||||
error,
|
||||
refresh: mutate,
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Zustand Store Structure
|
||||
|
||||
The application uses multiple Zustand stores for different domains:
|
||||
|
||||
```typescript
|
||||
// src/store/authStore.ts
|
||||
interface AuthStore {
|
||||
user: User | null;
|
||||
token: string | null;
|
||||
isAuthenticated: boolean;
|
||||
login: (credentials: LoginCredentials) => Promise<void>;
|
||||
logout: () => void;
|
||||
refreshToken: () => Promise<void>;
|
||||
}
|
||||
|
||||
export const useAuthStore = create<AuthStore>((set, get) => ({
|
||||
user: null,
|
||||
token: null,
|
||||
isAuthenticated: false,
|
||||
|
||||
login: async (credentials) => {
|
||||
const response = await loginUser(credentials);
|
||||
set({
|
||||
user: response.user,
|
||||
token: response.token,
|
||||
isAuthenticated: true,
|
||||
});
|
||||
},
|
||||
|
||||
logout: () => {
|
||||
set({
|
||||
user: null,
|
||||
token: null,
|
||||
isAuthenticated: false,
|
||||
});
|
||||
},
|
||||
}));
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### API Error Types
|
||||
|
||||
```typescript
|
||||
interface APIError {
|
||||
message: string;
|
||||
code: string;
|
||||
status: number;
|
||||
details?: any;
|
||||
}
|
||||
```
|
||||
|
||||
### Error Handling Pattern
|
||||
|
||||
```typescript
|
||||
import { toast } from "react-hot-toast";
|
||||
|
||||
async function handleAPICall<T>(apiCall: () => Promise<T>): Promise<T | null> {
|
||||
try {
|
||||
return await apiCall();
|
||||
} catch (error) {
|
||||
if (error instanceof APIError) {
|
||||
toast.error(error.message);
|
||||
} else {
|
||||
toast.error("An unexpected error occurred");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Authentication Flow
|
||||
|
||||
### User Authentication
|
||||
|
||||
1. User submits login form
|
||||
2. Call `loginUser` API
|
||||
3. Store token and user data in auth store
|
||||
4. Redirect to dashboard or intended page
|
||||
|
||||
```typescript
|
||||
// src/hooks/useLogin.ts
|
||||
export function useLogin() {
|
||||
const { login } = useAuthStore();
|
||||
const router = useRouter();
|
||||
|
||||
const handleLogin = async (credentials: LoginCredentials) => {
|
||||
try {
|
||||
await login(credentials);
|
||||
router.push("/dashboard");
|
||||
} catch (error) {
|
||||
toast.error("Login failed");
|
||||
}
|
||||
};
|
||||
|
||||
return { handleLogin };
|
||||
}
|
||||
```
|
||||
|
||||
### Admin Authentication
|
||||
|
||||
Similar flow but with admin-specific endpoints and redirects to console.
|
||||
|
||||
## Data Fetching Patterns
|
||||
|
||||
### Server-Side Rendering (SSR)
|
||||
|
||||
For marketplace product pages with dynamic content:
|
||||
|
||||
```typescript
|
||||
// src/app/marketplace/[id]/page.tsx
|
||||
export default async function ProductPage({ params }: { params: { id: string } }) {
|
||||
// Server-side data fetching
|
||||
const service = await fetchServiceById(params.id)
|
||||
|
||||
if (!service) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
return <ProductDetail service={service} />
|
||||
}
|
||||
```
|
||||
|
||||
### Client-side Data
|
||||
|
||||
For dynamic content and real-time updates:
|
||||
|
||||
```typescript
|
||||
function ServicesPage() {
|
||||
const { services, isLoading, error } = useServices()
|
||||
|
||||
if (isLoading) return <LoadingSpinner />
|
||||
if (error) return <ErrorMessage error={error} />
|
||||
|
||||
return (
|
||||
<div>
|
||||
{services?.map((service) => (
|
||||
<ServiceCard key={service.id} service={service} />
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Public Endpoints
|
||||
|
||||
- `GET /api/web/mcp_services` - List all MCP services
|
||||
- `POST /api/web/mcp_service_info` - Get service details by ID
|
||||
- `GET /api/web/categories` - List service categories
|
||||
- `POST /api/auth/login` - User login
|
||||
- `POST /api/auth/register` - User registration
|
||||
- `GET /api/web/featured` - Get featured services
|
||||
|
||||
### Protected Endpoints
|
||||
|
||||
- `GET /api/user/profile` - Get user profile
|
||||
- `PUT /api/user/profile` - Update user profile
|
||||
- `GET /api/user/dashboard` - Get user dashboard data
|
||||
- `GET /api/user/services` - Get user's services
|
||||
- `POST /api/user/services` - Create new service
|
||||
- `GET /api/wallet/balance` - Get wallet balance
|
||||
- `GET /api/wallet/transactions` - Get transaction history
|
||||
- `POST /api/wallet/payment` - Create payment
|
||||
|
||||
### Admin Endpoints
|
||||
|
||||
- `POST /api/admin/login` - Admin login
|
||||
- `GET /api/admin/users` - List all users
|
||||
- `PUT /api/admin/users/:id` - Update user
|
||||
- `DELETE /api/admin/users/:id` - Delete user
|
||||
- `GET /api/admin/analytics` - Get analytics data
|
||||
- `GET /api/admin/services` - Get all services for management
|
||||
- `PUT /api/admin/services/:id` - Update service status
|
||||
- `DELETE /api/admin/services/:id` - Delete service
|
||||
|
||||
### RPC Methods
|
||||
|
||||
The application also supports RPC calls for real-time operations:
|
||||
|
||||
- `marketplace.getServices(filters)` - Get services with real-time updates
|
||||
- `marketplace.subscribeToUpdates()` - Subscribe to service updates
|
||||
- `user.getDashboard()` - Get real-time dashboard data
|
||||
- `wallet.getBalance()` - Get real-time wallet balance
|
||||
- `admin.getAnalytics()` - Get real-time analytics data
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
The API implements rate limiting. Handle rate limit errors:
|
||||
|
||||
```typescript
|
||||
if (error.status === 429) {
|
||||
toast.error("Too many requests. Please try again later.");
|
||||
// Implement exponential backoff
|
||||
}
|
||||
```
|
||||
|
||||
## Caching Strategy
|
||||
|
||||
### SWR Configuration
|
||||
|
||||
```typescript
|
||||
// Global SWR config
|
||||
const swrConfig = {
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: true,
|
||||
errorRetryCount: 3,
|
||||
errorRetryInterval: 5000,
|
||||
};
|
||||
```
|
||||
|
||||
### Cache Keys
|
||||
|
||||
Use consistent cache keys:
|
||||
|
||||
```typescript
|
||||
// Good
|
||||
const CACHE_KEYS = {
|
||||
SERVICES: "/api/services",
|
||||
SERVICE_DETAIL: (id: string) => `/api/services/${id}`,
|
||||
USER_PROFILE: "/api/user/profile",
|
||||
} as const;
|
||||
```
|
||||
|
||||
## Testing API Integration
|
||||
|
||||
### Mock API Responses
|
||||
|
||||
```typescript
|
||||
// __tests__/mocks/api.ts
|
||||
export const mockServices: ServiceData[] = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Test Service",
|
||||
description: "A test service",
|
||||
category: "utility",
|
||||
author: "Test Author",
|
||||
version: "1.0.0",
|
||||
rating: 4.5,
|
||||
downloads: 1000,
|
||||
verified: true,
|
||||
updatedAt: "2024-01-01",
|
||||
tags: ["test"],
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
### API Testing
|
||||
|
||||
```typescript
|
||||
// __tests__/api/services.test.ts
|
||||
import { fetchServices } from "@/shared/api/services";
|
||||
|
||||
// Mock fetch
|
||||
global.fetch = jest.fn();
|
||||
|
||||
describe("Services API", () => {
|
||||
it("fetches services successfully", async () => {
|
||||
(fetch as jest.Mock).mockResolvedValueOnce({
|
||||
ok: true,
|
||||
json: async () => mockServices,
|
||||
});
|
||||
|
||||
const services = await fetchServices();
|
||||
expect(services).toEqual(mockServices);
|
||||
});
|
||||
});
|
||||
```
|
||||
@@ -0,0 +1,965 @@
|
||||
# Architecture Guide
|
||||
|
||||
## Overview
|
||||
|
||||
XPack WebUI is built with modern web technologies and follows best practices for scalability, maintainability, and performance. This guide provides an in-depth look at the application's architecture.
|
||||
|
||||
## Technology Stack
|
||||
|
||||
### Core Framework
|
||||
- **Next.js 15**: React framework with App Router
|
||||
- **React 18**: UI library with concurrent features
|
||||
- **TypeScript 5**: Type-safe JavaScript
|
||||
|
||||
### UI & Styling
|
||||
- **NextUI v2**: Modern React UI library
|
||||
- **Tailwind CSS**: Utility-first CSS framework
|
||||
- **Framer Motion**: Animation library
|
||||
- **Lucide React**: Icon library
|
||||
- **React Icons**: Additional icon sets
|
||||
|
||||
### State Management
|
||||
- **Zustand**: Lightweight state management
|
||||
- **SWR**: Data fetching and caching
|
||||
- **React Hook Form**: Form state management
|
||||
- **Zod**: Schema validation
|
||||
|
||||
### Internationalization
|
||||
- **react-i18next**: Internationalization framework
|
||||
- **i18next**: Core i18n functionality
|
||||
- **i18next-browser-languagedetector**: Language detection
|
||||
- **i18next-http-backend**: Translation loading
|
||||
|
||||
### Additional Libraries
|
||||
- **Recharts**: Charts and analytics visualization
|
||||
- **React Markdown**: Markdown content rendering
|
||||
- **Crypto-js**: Encryption and security utilities
|
||||
- **Three.js**: 3D graphics and effects
|
||||
- **Lottie React**: Animation rendering
|
||||
- **Anime.js**: Advanced animation library
|
||||
- **React Hot Toast**: Toast notifications
|
||||
- **React Hover Video Player**: Video interactions
|
||||
|
||||
### Development Tools
|
||||
- **ESLint**: Code linting with Next.js configuration
|
||||
- **TypeScript**: Static type checking
|
||||
- **PostCSS**: CSS processing
|
||||
- **Autoprefixer**: CSS vendor prefixing
|
||||
|
||||
## Application Architecture
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
apps/op/
|
||||
├── docs/ # Documentation
|
||||
│ ├── architecture.md # System architecture
|
||||
│ ├── development.md # Development guide
|
||||
│ ├── deployment.md # Deployment instructions
|
||||
│ ├── api.md # API documentation
|
||||
│ └── troubleshooting.md # Common issues and solutions
|
||||
├── public/ # Static assets
|
||||
│ ├── icons/ # Application icons
|
||||
│ ├── images/ # Images and graphics
|
||||
│ └── locales/ # Translation files
|
||||
├── src/ # Source code
|
||||
│ ├── app/ # Next.js App Router pages
|
||||
│ │ ├── admin-signin/ # Admin login page
|
||||
│ │ ├── console/ # Admin console
|
||||
│ │ ├── dashboard/ # User dashboard
|
||||
│ │ ├── loginSuccess/ # Login success page
|
||||
│ │ ├── marketplace/ # Service marketplace
|
||||
│ │ ├── signin/ # User login page
|
||||
│ │ ├── system-setting/ # System settings
|
||||
│ │ ├── wallet/ # Wallet management
|
||||
│ │ ├── globals.css # Global styles
|
||||
│ │ ├── layout.tsx # Root layout
|
||||
│ │ └── page.tsx # Home page
|
||||
│ ├── components/ # Reusable UI components
|
||||
│ │ ├── common/ # Common components
|
||||
│ │ ├── console/ # Console-specific components
|
||||
│ │ ├── dashboard/ # Dashboard components
|
||||
│ │ ├── marketplace/ # Marketplace components
|
||||
│ │ ├── navigation/ # Navigation components
|
||||
│ │ ├── signin/ # Authentication components
|
||||
│ │ ├── system-setting/ # Settings components
|
||||
│ │ ├── ui/ # Base UI components
|
||||
│ │ └── wallet/ # Wallet components
|
||||
│ ├── hooks/ # Custom React hooks
|
||||
│ │ ├── useAuth.ts # Authentication hook
|
||||
│ │ ├── useLocalStorage.ts # Local storage hook
|
||||
│ │ └── useTranslation.ts # Translation hook
|
||||
│ ├── rpc/ # RPC layer
|
||||
│ │ ├── client.ts # RPC client
|
||||
│ │ ├── types.ts # RPC types
|
||||
│ │ └── utils.ts # RPC utilities
|
||||
│ ├── services/ # API services
|
||||
│ │ ├── authService.ts # Authentication service
|
||||
│ │ ├── marketplaceService.ts # Marketplace API
|
||||
│ │ ├── userService.ts # User management
|
||||
│ │ └── walletService.ts # Wallet operations
|
||||
│ ├── shared/ # Shared utilities
|
||||
│ │ ├── constants/ # Application constants
|
||||
│ │ ├── lib/ # Utility libraries
|
||||
│ │ ├── types/ # Shared TypeScript types
|
||||
│ │ └── utils/ # Helper functions
|
||||
│ ├── store/ # State management
|
||||
│ │ ├── authStore.ts # Authentication state
|
||||
│ │ ├── marketplaceStore.ts # Marketplace state
|
||||
│ │ ├── userStore.ts # User state
|
||||
│ │ └── walletStore.ts # Wallet state
|
||||
│ ├── types/ # TypeScript definitions
|
||||
│ │ ├── api.ts # API types
|
||||
│ │ ├── auth.ts # Authentication types
|
||||
│ │ ├── marketplace.ts # Marketplace types
|
||||
│ │ └── user.ts # User types
|
||||
│ └── utils/ # Utility functions
|
||||
│ ├── api.ts # API utilities
|
||||
│ ├── auth.ts # Authentication utilities
|
||||
│ ├── crypto.ts # Cryptographic utilities
|
||||
│ ├── format.ts # Formatting utilities
|
||||
│ └── validation.ts # Validation utilities
|
||||
├── .env.example # Environment variables template
|
||||
├── .eslintrc.json # ESLint configuration
|
||||
├── .gitignore # Git ignore rules
|
||||
├── next.config.ts # Next.js configuration
|
||||
├── package.json # Dependencies and scripts
|
||||
├── postcss.config.js # PostCSS configuration
|
||||
├── tailwind.config.ts # Tailwind CSS configuration
|
||||
└── tsconfig.json # TypeScript configuration
|
||||
```
|
||||
|
||||
### Architectural Patterns
|
||||
|
||||
#### 1. Feature-Based Organization
|
||||
|
||||
The application follows a feature-based directory structure where related components, services, and utilities are grouped together:
|
||||
|
||||
- **Page-Level Features**: Each major feature (marketplace, console, dashboard, wallet) has its own directory under `app/`
|
||||
- **Component Organization**: Components are organized by feature domain (marketplace, console, dashboard, etc.)
|
||||
- **Service Layer**: API services are separated by business domain (auth, marketplace, user, wallet)
|
||||
- **State Management**: Zustand stores are organized by feature area
|
||||
|
||||
```
|
||||
src/
|
||||
├── app/marketplace/ # Marketplace feature
|
||||
│ ├── [id]/page.tsx # Product detail page
|
||||
│ └── page.tsx # Marketplace listing
|
||||
├── components/marketplace/ # Marketplace components
|
||||
│ ├── ServiceCard.tsx
|
||||
│ ├── ServiceList.tsx
|
||||
│ └── SearchFilters.tsx
|
||||
├── services/ # API services by domain
|
||||
│ ├── marketplaceService.ts
|
||||
│ ├── authService.ts
|
||||
│ └── walletService.ts
|
||||
├── store/ # State management by feature
|
||||
│ ├── marketplaceStore.ts
|
||||
│ ├── authStore.ts
|
||||
│ └── walletStore.ts
|
||||
└── rpc/ # RPC layer
|
||||
├── client.ts
|
||||
├── types.ts
|
||||
└── utils.ts
|
||||
```
|
||||
|
||||
#### 2. Layered Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────┐
|
||||
│ Presentation Layer │
|
||||
│ (Pages & Components) │
|
||||
├─────────────────────────────────────┤
|
||||
│ Business Layer │
|
||||
│ (Hooks & Stores) │
|
||||
├─────────────────────────────────────┤
|
||||
│ Service Layer │
|
||||
│ (API Services & RPC) │
|
||||
├─────────────────────────────────────┤
|
||||
│ Data Layer │
|
||||
│ (External APIs & Cache) │
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Layer Responsibilities:**
|
||||
- **Presentation Layer**: UI components, pages, layouts, and user interactions
|
||||
- **Business Layer**: Application logic, state management, and custom hooks
|
||||
- **Service Layer**: API integration, RPC communication, and data transformation
|
||||
- **Data Layer**: External API calls, caching strategies, and data persistence
|
||||
|
||||
#### 3. Security Architecture
|
||||
|
||||
- **Authentication**: JWT-based authentication with secure token storage
|
||||
- **Authorization**: Role-based access control (RBAC) for admin and user roles
|
||||
- **Encryption**: Client-side encryption using crypto-js for sensitive data
|
||||
- **API Security**: Secure API communication with proper error handling
|
||||
- **Input Validation**: Zod schema validation for all user inputs
|
||||
|
||||
#### 4. Performance Optimization
|
||||
|
||||
- **Code Splitting**: Automatic code splitting with Next.js and lazy loading
|
||||
- **Image Optimization**: Next.js Image component for optimized loading
|
||||
- **Caching Strategy**: SWR for intelligent data caching and revalidation
|
||||
- **Bundle Optimization**: Tree shaking and module optimization
|
||||
- **Virtual Scrolling**: For large lists and data sets
|
||||
|
||||
#### 5. Component Composition
|
||||
|
||||
Components follow a composition pattern for flexibility:
|
||||
|
||||
```typescript
|
||||
// Base component
|
||||
function Card({ children, className, ...props }) {
|
||||
return (
|
||||
<div className={cn("rounded-lg border", className)} {...props}>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Composed components
|
||||
function ServiceCard({ service }) {
|
||||
return (
|
||||
<Card className="p-4">
|
||||
<Card.Header>
|
||||
<h3>{service.name}</h3>
|
||||
</Card.Header>
|
||||
<Card.Content>
|
||||
<p>{service.description}</p>
|
||||
</Card.Content>
|
||||
<Card.Footer>
|
||||
<Button>Install</Button>
|
||||
</Card.Footer>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Data Flow
|
||||
|
||||
### 1. Client-Side Data Flow
|
||||
|
||||
```
|
||||
User Interaction → Component → Hook → Store → Service → API
|
||||
↓
|
||||
UI Update ← State Change ← Response
|
||||
```
|
||||
|
||||
**Flow Description:**
|
||||
1. **User Interaction**: User performs an action (click, form submission, etc.)
|
||||
2. **Component**: React component handles the interaction
|
||||
3. **Hook**: Custom hook processes the business logic
|
||||
4. **Store**: Zustand store manages state updates
|
||||
5. **Service**: API service handles external communication
|
||||
6. **API**: Backend API processes the request
|
||||
7. **Response**: Data flows back through the same chain
|
||||
|
||||
### 2. Server-Side Data Flow
|
||||
|
||||
```
|
||||
Next.js App Router → Server Components → API Routes → External Services
|
||||
↓
|
||||
Client Hydration ← SSR ← Data Fetching
|
||||
```
|
||||
|
||||
**Server-Side Features:**
|
||||
- **Server Components**: React Server Components for initial data loading
|
||||
- **API Routes**: Next.js API routes for backend integration
|
||||
- **SSR**: Server-side rendering for dynamic content and SEO optimization
|
||||
- **Middleware**: Authentication and request processing
|
||||
|
||||
### 3. State Management with Zustand
|
||||
|
||||
```typescript
|
||||
// Example: Marketplace Store
|
||||
interface MarketplaceState {
|
||||
services: Service[]
|
||||
loading: boolean
|
||||
error: string | null
|
||||
fetchServices: () => Promise<void>
|
||||
selectService: (id: string) => void
|
||||
}
|
||||
|
||||
const useMarketplaceStore = create<MarketplaceState>((set, get) => ({
|
||||
services: [],
|
||||
loading: false,
|
||||
error: null,
|
||||
|
||||
fetchServices: async () => {
|
||||
set({ loading: true, error: null })
|
||||
try {
|
||||
const services = await marketplaceService.fetchServices()
|
||||
set({ services, loading: false })
|
||||
} catch (error) {
|
||||
set({ error: error.message, loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
selectService: (id: string) => {
|
||||
const service = get().services.find(s => s.id === id)
|
||||
// Handle service selection logic
|
||||
}
|
||||
}))
|
||||
```
|
||||
|
||||
### 4. RPC Communication
|
||||
|
||||
The application uses a custom RPC layer for backend communication:
|
||||
|
||||
```typescript
|
||||
// RPC Client Structure
|
||||
interface RPCClient {
|
||||
call<T>(method: string, params?: any): Promise<T>
|
||||
subscribe(event: string, callback: Function): void
|
||||
unsubscribe(event: string): void
|
||||
}
|
||||
|
||||
// Usage Example
|
||||
const rpcClient = new RPCClient(config.rpcEndpoint)
|
||||
|
||||
// Service method call
|
||||
const result = await rpcClient.call('marketplace.getServices', {
|
||||
category: 'ai-tools',
|
||||
limit: 20
|
||||
})
|
||||
|
||||
// Real-time updates
|
||||
rpcClient.subscribe('service.updated', (data) => {
|
||||
// Handle real-time service updates
|
||||
})
|
||||
```
|
||||
|
||||
### 5. Caching Strategy
|
||||
|
||||
**SWR Configuration:**
|
||||
- **Revalidation**: Automatic revalidation on focus
|
||||
- **Error Retry**: Exponential backoff for failed requests
|
||||
- **Deduplication**: Automatic request deduplication
|
||||
- **Optimistic Updates**: Immediate UI updates with rollback on error
|
||||
|
||||
```typescript
|
||||
// SWR Usage Example
|
||||
const { data, error, mutate } = useSWR(
|
||||
['services', filters],
|
||||
() => marketplaceService.fetchServices(filters),
|
||||
{
|
||||
revalidateOnFocus: true,
|
||||
revalidateOnReconnect: true,
|
||||
errorRetryCount: 3,
|
||||
dedupingInterval: 5000
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
### 6. Authentication Flow
|
||||
|
||||
```
|
||||
Login Request → Auth Service → JWT Token → Local Storage
|
||||
↓
|
||||
Protected Route → Auth Guard → Token Validation → Access Granted/Denied
|
||||
```
|
||||
|
||||
**Authentication Features:**
|
||||
- **JWT Tokens**: Secure token-based authentication
|
||||
- **Refresh Tokens**: Automatic token refresh
|
||||
- **Role-Based Access**: Different access levels for users and admins
|
||||
- **Session Management**: Secure session handling with automatic logout
|
||||
```
|
||||
|
||||
## API Architecture
|
||||
|
||||
### 1. Service Layer Pattern
|
||||
|
||||
```typescript
|
||||
// Base API client
|
||||
class ApiClient {
|
||||
private baseURL: string
|
||||
|
||||
constructor(baseURL: string) {
|
||||
this.baseURL = baseURL
|
||||
}
|
||||
|
||||
async request<T>(endpoint: string, options?: RequestInit): Promise<T> {
|
||||
const url = `${this.baseURL}${endpoint}`
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...options?.headers,
|
||||
},
|
||||
...options,
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`API Error: ${response.status}`)
|
||||
}
|
||||
|
||||
return response.json()
|
||||
}
|
||||
}
|
||||
|
||||
// Service-specific clients
|
||||
class ServiceAPI extends ApiClient {
|
||||
async getServices(): Promise<Service[]> {
|
||||
return this.request('/services')
|
||||
}
|
||||
|
||||
async getService(id: string): Promise<Service> {
|
||||
return this.request(`/services/${id}`)
|
||||
}
|
||||
|
||||
async createService(data: CreateServiceRequest): Promise<Service> {
|
||||
return this.request('/services', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Error Handling Strategy
|
||||
|
||||
```typescript
|
||||
// Centralized error handling
|
||||
export class ApiError extends Error {
|
||||
constructor(
|
||||
message: string,
|
||||
public status: number,
|
||||
public code?: string
|
||||
) {
|
||||
super(message)
|
||||
this.name = 'ApiError'
|
||||
}
|
||||
}
|
||||
|
||||
// Error boundary for API errors
|
||||
export function ApiErrorBoundary({ children }) {
|
||||
return (
|
||||
<ErrorBoundary
|
||||
fallback={({ error }) => (
|
||||
<div className="error-container">
|
||||
<h2>Something went wrong</h2>
|
||||
<p>{error.message}</p>
|
||||
<Button onClick={() => window.location.reload()}>
|
||||
Retry
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</ErrorBoundary>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Component Architecture
|
||||
|
||||
### 1. Component Hierarchy
|
||||
|
||||
```
|
||||
App
|
||||
├── Layout
|
||||
│ ├── Header
|
||||
│ │ ├── Navigation
|
||||
│ │ ├── UserMenu
|
||||
│ │ └── LanguageSelector
|
||||
│ ├── Sidebar (conditional)
|
||||
│ └── Footer
|
||||
├── Page Components
|
||||
│ ├── Marketplace
|
||||
│ │ ├── HeroSection
|
||||
│ │ ├── SearchFilters
|
||||
│ │ └── ServiceList
|
||||
│ │ └── ServiceCard[]
|
||||
│ ├── Console
|
||||
│ │ ├── AdminSidebar
|
||||
│ │ ├── ServiceManagement
|
||||
│ │ ├── UserManagement
|
||||
│ │ └── Analytics
|
||||
│ └── Dashboard
|
||||
│ ├── UserProfile
|
||||
│ ├── InstalledServices
|
||||
│ └── ActivityFeed
|
||||
└── Shared Components
|
||||
├── UI Components
|
||||
├── Form Components
|
||||
└── Modal Components
|
||||
```
|
||||
|
||||
### 2. Component Design Principles
|
||||
|
||||
#### Single Responsibility
|
||||
Each component has one clear purpose:
|
||||
|
||||
```typescript
|
||||
// Good: Single responsibility
|
||||
function ServiceCard({ service }) {
|
||||
return (
|
||||
<Card>
|
||||
<ServiceImage src={service.image} />
|
||||
<ServiceInfo service={service} />
|
||||
<ServiceActions service={service} />
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
// Bad: Multiple responsibilities
|
||||
function ServiceCardWithModal({ service }) {
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
// ... modal logic, card logic, form logic all mixed
|
||||
}
|
||||
```
|
||||
|
||||
#### Composition over Inheritance
|
||||
Use composition to build complex components:
|
||||
|
||||
```typescript
|
||||
// Composable modal system
|
||||
function Modal({ children, isOpen, onClose }) {
|
||||
return (
|
||||
<Portal>
|
||||
<Overlay onClick={onClose} />
|
||||
<ModalContent>
|
||||
{children}
|
||||
</ModalContent>
|
||||
</Portal>
|
||||
)
|
||||
}
|
||||
|
||||
function ServiceModal({ service, isOpen, onClose }) {
|
||||
return (
|
||||
<Modal isOpen={isOpen} onClose={onClose}>
|
||||
<Modal.Header>
|
||||
<h2>{service.name}</h2>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<ServiceDetails service={service} />
|
||||
</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<Button onClick={onClose}>Close</Button>
|
||||
<Button variant="primary">Install</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
#### Props Interface Design
|
||||
Clear and type-safe props interfaces:
|
||||
|
||||
```typescript
|
||||
interface ServiceCardProps {
|
||||
service: Service
|
||||
variant?: 'default' | 'compact' | 'detailed'
|
||||
showActions?: boolean
|
||||
onInstall?: (service: Service) => void
|
||||
onFavorite?: (service: Service) => void
|
||||
className?: string
|
||||
}
|
||||
|
||||
function ServiceCard({
|
||||
service,
|
||||
variant = 'default',
|
||||
showActions = true,
|
||||
onInstall,
|
||||
onFavorite,
|
||||
className,
|
||||
}: ServiceCardProps) {
|
||||
// Component implementation
|
||||
}
|
||||
```
|
||||
|
||||
## State Management Architecture
|
||||
|
||||
### 1. State Organization
|
||||
|
||||
```typescript
|
||||
// Global application state
|
||||
interface AppState {
|
||||
user: UserState
|
||||
services: ServiceState
|
||||
ui: UIState
|
||||
auth: AuthState
|
||||
}
|
||||
|
||||
// Feature-specific state
|
||||
interface ServiceState {
|
||||
items: Service[]
|
||||
loading: boolean
|
||||
error: string | null
|
||||
filters: ServiceFilters
|
||||
pagination: PaginationState
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Store Patterns
|
||||
|
||||
#### Domain Stores
|
||||
Each domain has its own store:
|
||||
|
||||
```typescript
|
||||
// User store
|
||||
export const useUserStore = create<UserState>((set) => ({
|
||||
user: null,
|
||||
loading: false,
|
||||
updateProfile: async (data) => {
|
||||
set({ loading: true })
|
||||
try {
|
||||
const user = await updateUserProfile(data)
|
||||
set({ user, loading: false })
|
||||
} catch (error) {
|
||||
set({ loading: false })
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
// Service store
|
||||
export const useServiceStore = create<ServiceState>((set) => ({
|
||||
services: [],
|
||||
loading: false,
|
||||
fetchServices: async () => {
|
||||
// Implementation
|
||||
}
|
||||
}))
|
||||
```
|
||||
|
||||
#### UI State Store
|
||||
Separate store for UI-specific state:
|
||||
|
||||
```typescript
|
||||
export const useUIStore = create<UIState>((set) => ({
|
||||
sidebarOpen: false,
|
||||
theme: 'light',
|
||||
language: 'en',
|
||||
|
||||
toggleSidebar: () => set((state) => ({
|
||||
sidebarOpen: !state.sidebarOpen
|
||||
})),
|
||||
|
||||
setTheme: (theme) => set({ theme }),
|
||||
setLanguage: (language) => set({ language })
|
||||
}))
|
||||
```
|
||||
|
||||
### 3. Data Synchronization
|
||||
|
||||
#### SWR Integration
|
||||
Combine Zustand with SWR for data fetching:
|
||||
|
||||
```typescript
|
||||
function useServices() {
|
||||
const { data, error, mutate } = useSWR('/api/services', fetchServices)
|
||||
const setServices = useServiceStore((state) => state.setServices)
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
setServices(data)
|
||||
}
|
||||
}, [data, setServices])
|
||||
|
||||
return {
|
||||
services: data || [],
|
||||
loading: !error && !data,
|
||||
error,
|
||||
refresh: mutate
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Performance Architecture
|
||||
|
||||
### 1. Code Splitting Strategy
|
||||
|
||||
```typescript
|
||||
// Route-based splitting
|
||||
const MarketplacePage = lazy(() => import('./marketplace/page'))
|
||||
const ConsolePage = lazy(() => import('./console/page'))
|
||||
const DashboardPage = lazy(() => import('./dashboard/page'))
|
||||
|
||||
// Component-based splitting
|
||||
const ServiceModal = lazy(() => import('./components/ServiceModal'))
|
||||
const AdminPanel = lazy(() => import('./components/AdminPanel'))
|
||||
```
|
||||
|
||||
### 2. Optimization Techniques
|
||||
|
||||
#### Memoization
|
||||
Strategic use of React.memo and useMemo:
|
||||
|
||||
```typescript
|
||||
// Memoized component
|
||||
const ServiceCard = memo(function ServiceCard({ service }) {
|
||||
const formattedPrice = useMemo(() =>
|
||||
formatPrice(service.price), [service.price]
|
||||
)
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<h3>{service.name}</h3>
|
||||
<p>{formattedPrice}</p>
|
||||
</Card>
|
||||
)
|
||||
})
|
||||
|
||||
// Memoized selector
|
||||
const useFilteredServices = () => {
|
||||
const services = useServiceStore((state) => state.services)
|
||||
const filters = useServiceStore((state) => state.filters)
|
||||
|
||||
return useMemo(() =>
|
||||
filterServices(services, filters),
|
||||
[services, filters]
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
#### Virtual Scrolling
|
||||
For large lists:
|
||||
|
||||
```typescript
|
||||
import { FixedSizeList as List } from 'react-window'
|
||||
|
||||
function ServiceList({ services }) {
|
||||
const Row = ({ index, style }) => (
|
||||
<div style={style}>
|
||||
<ServiceCard service={services[index]} />
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<List
|
||||
height={600}
|
||||
itemCount={services.length}
|
||||
itemSize={200}
|
||||
>
|
||||
{Row}
|
||||
</List>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Bundle Optimization
|
||||
|
||||
#### Tree Shaking
|
||||
Ensure proper tree shaking:
|
||||
|
||||
```typescript
|
||||
// Good: Named imports
|
||||
import { Button, Card } from '@nextui-org/react'
|
||||
|
||||
// Bad: Default import
|
||||
import NextUI from '@nextui-org/react'
|
||||
```
|
||||
|
||||
#### Dynamic Imports
|
||||
Load features on demand:
|
||||
|
||||
```typescript
|
||||
// Dynamic feature loading
|
||||
async function loadAdminFeatures() {
|
||||
const { AdminPanel } = await import('./admin/AdminPanel')
|
||||
const { UserManagement } = await import('./admin/UserManagement')
|
||||
|
||||
return { AdminPanel, UserManagement }
|
||||
}
|
||||
```
|
||||
|
||||
## Security Architecture
|
||||
|
||||
### 1. Authentication Flow
|
||||
|
||||
```typescript
|
||||
// Auth context
|
||||
interface AuthContext {
|
||||
user: User | null
|
||||
login: (credentials: LoginCredentials) => Promise<void>
|
||||
logout: () => void
|
||||
isAuthenticated: boolean
|
||||
isAdmin: boolean
|
||||
}
|
||||
|
||||
// Protected route wrapper
|
||||
function ProtectedRoute({ children, requireAdmin = false }) {
|
||||
const { isAuthenticated, isAdmin } = useAuth()
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return <Navigate to="/signin" />
|
||||
}
|
||||
|
||||
if (requireAdmin && !isAdmin) {
|
||||
return <Navigate to="/unauthorized" />
|
||||
}
|
||||
|
||||
return children
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Data Validation
|
||||
|
||||
```typescript
|
||||
// Input validation with Zod
|
||||
import { z } from 'zod'
|
||||
|
||||
const ServiceSchema = z.object({
|
||||
name: z.string().min(1).max(100),
|
||||
description: z.string().min(10).max(500),
|
||||
price: z.number().min(0),
|
||||
category: z.enum(['ai', 'productivity', 'development'])
|
||||
})
|
||||
|
||||
// Form validation
|
||||
function ServiceForm() {
|
||||
const { register, handleSubmit, formState: { errors } } = useForm({
|
||||
resolver: zodResolver(ServiceSchema)
|
||||
})
|
||||
|
||||
const onSubmit = (data) => {
|
||||
// Data is automatically validated
|
||||
createService(data)
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
{/* Form fields */}
|
||||
</form>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 3. XSS Prevention
|
||||
|
||||
```typescript
|
||||
// Safe HTML rendering
|
||||
import DOMPurify from 'dompurify'
|
||||
|
||||
function SafeHTML({ content }) {
|
||||
const sanitizedContent = useMemo(() =>
|
||||
DOMPurify.sanitize(content), [content]
|
||||
)
|
||||
|
||||
return (
|
||||
<div dangerouslySetInnerHTML={{ __html: sanitizedContent }} />
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Testing Architecture
|
||||
|
||||
### 1. Testing Strategy
|
||||
|
||||
```
|
||||
Unit Tests (70%)
|
||||
├── Components
|
||||
├── Hooks
|
||||
├── Utilities
|
||||
└── Stores
|
||||
|
||||
Integration Tests (20%)
|
||||
├── API Integration
|
||||
├── Component Integration
|
||||
└── User Flows
|
||||
|
||||
E2E Tests (10%)
|
||||
├── Critical User Journeys
|
||||
├── Authentication Flows
|
||||
└── Admin Functions
|
||||
```
|
||||
|
||||
### 2. Test Organization
|
||||
|
||||
```typescript
|
||||
// Component test
|
||||
describe('ServiceCard', () => {
|
||||
const mockService = {
|
||||
id: '1',
|
||||
name: 'Test Service',
|
||||
description: 'Test description',
|
||||
price: 9.99
|
||||
}
|
||||
|
||||
it('renders service information', () => {
|
||||
render(<ServiceCard service={mockService} />)
|
||||
expect(screen.getByText('Test Service')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('calls onInstall when install button is clicked', () => {
|
||||
const onInstall = jest.fn()
|
||||
render(<ServiceCard service={mockService} onInstall={onInstall} />)
|
||||
|
||||
fireEvent.click(screen.getByText('Install'))
|
||||
expect(onInstall).toHaveBeenCalledWith(mockService)
|
||||
})
|
||||
})
|
||||
|
||||
// Hook test
|
||||
describe('useServices', () => {
|
||||
it('fetches services on mount', async () => {
|
||||
const { result } = renderHook(() => useServices())
|
||||
|
||||
await waitFor(() => {
|
||||
expect(result.current.services).toHaveLength(3)
|
||||
})
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## Deployment Architecture
|
||||
|
||||
### 1. Build Process
|
||||
|
||||
```typescript
|
||||
// next.config.js
|
||||
module.exports = {
|
||||
output: 'standalone',
|
||||
experimental: {
|
||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||
},
|
||||
env: {
|
||||
CUSTOM_KEY: process.env.CUSTOM_KEY,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Environment Configuration
|
||||
|
||||
```typescript
|
||||
// Environment-specific configs
|
||||
const config = {
|
||||
development: {
|
||||
apiUrl: 'http://localhost:3001',
|
||||
debug: true,
|
||||
},
|
||||
production: {
|
||||
apiUrl: 'https://api.xpack.dev',
|
||||
debug: false,
|
||||
},
|
||||
test: {
|
||||
apiUrl: 'http://localhost:3001',
|
||||
debug: false,
|
||||
},
|
||||
}
|
||||
|
||||
export default config[process.env.NODE_ENV || 'development']
|
||||
```
|
||||
|
||||
### 3. Monitoring and Analytics
|
||||
|
||||
```typescript
|
||||
// Error tracking
|
||||
import * as Sentry from '@sentry/nextjs'
|
||||
|
||||
Sentry.init({
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
environment: process.env.NODE_ENV,
|
||||
})
|
||||
|
||||
// Performance monitoring
|
||||
export function reportWebVitals(metric) {
|
||||
if (metric.label === 'web-vital') {
|
||||
console.log(metric)
|
||||
// Send to analytics service
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This architecture provides a solid foundation for building scalable, maintainable, and performant web applications with modern React and Next.js patterns.
|
||||
@@ -0,0 +1,484 @@
|
||||
# Contributing Guide
|
||||
|
||||
## Welcome Contributors!
|
||||
|
||||
Thank you for your interest in contributing to XPack WebUI. This guide will help you get started with contributing to the project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js 18+
|
||||
- pnpm (recommended package manager)
|
||||
- Git
|
||||
- Basic knowledge of React, Next.js 15, and TypeScript 5
|
||||
|
||||
### Development Setup
|
||||
|
||||
1. **Fork the Repository**
|
||||
|
||||
- Click the "Fork" button on GitHub
|
||||
- Clone your fork locally:
|
||||
```bash
|
||||
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
|
||||
cd XPack-MCP-Market/frontend
|
||||
```
|
||||
|
||||
2. **Set Up Development Environment**
|
||||
|
||||
```bash
|
||||
# Install dependencies (from project root)
|
||||
pnpm install
|
||||
|
||||
# Copy environment file
|
||||
cp .env.example .env.local
|
||||
|
||||
# Start development server
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
3. **Create a Branch**
|
||||
```bash
|
||||
git checkout -b feature/your-feature-name
|
||||
# or
|
||||
git checkout -b fix/your-bug-fix
|
||||
```
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
### Code Style
|
||||
|
||||
We follow strict coding standards to maintain code quality:
|
||||
|
||||
- **TypeScript**: Use strict mode, provide proper types
|
||||
- **ESLint**: Follow the configured rules
|
||||
- **Prettier**: Code is automatically formatted
|
||||
- **File Naming**: Use kebab-case for files, PascalCase for components
|
||||
|
||||
### Component Structure
|
||||
|
||||
```typescript
|
||||
// Good component structure
|
||||
import React from 'react'
|
||||
import { useTranslation } from '@/shared/lib/useTranslation'
|
||||
import type { ComponentProps } from './types'
|
||||
|
||||
interface MyComponentProps extends ComponentProps {
|
||||
title: string
|
||||
onAction: () => void
|
||||
}
|
||||
|
||||
export function MyComponent({ title, onAction, ...props }: MyComponentProps) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className="p-4" {...props}>
|
||||
<h2 className="text-xl font-semibold">{title}</h2>
|
||||
<button onClick={onAction} className="btn-primary">
|
||||
{t('Action')}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### State Management
|
||||
|
||||
- Use Zustand for global state
|
||||
- Use React hooks for local component state
|
||||
- Keep state as close to where it's used as possible
|
||||
|
||||
```typescript
|
||||
// Global state example
|
||||
import { create } from "zustand";
|
||||
|
||||
interface FeatureStore {
|
||||
data: FeatureData[];
|
||||
loading: boolean;
|
||||
fetchData: () => Promise<void>;
|
||||
}
|
||||
|
||||
export const useFeatureStore = create<FeatureStore>((set, get) => ({
|
||||
data: [],
|
||||
loading: false,
|
||||
fetchData: async () => {
|
||||
set({ loading: true });
|
||||
try {
|
||||
const data = await fetchFeatureData();
|
||||
set({ data, loading: false });
|
||||
} catch (error) {
|
||||
set({ loading: false });
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
}));
|
||||
```
|
||||
|
||||
### API Integration
|
||||
|
||||
- Use the existing API service pattern
|
||||
- Handle errors appropriately
|
||||
- Provide loading states
|
||||
|
||||
```typescript
|
||||
// API service example using fetchAPI
|
||||
import { fetchAPI } from "@/shared/rpc/common-function";
|
||||
import { fetchAdminAPI } from "@/rpc/admin-api";
|
||||
|
||||
// Public API call
|
||||
export async function fetchServices(): Promise<ServiceData[]> {
|
||||
const response = await fetchAPI("/api/web/mcp_services");
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// Admin API call
|
||||
export async function getMCPServiceList(
|
||||
params: GetMCPServiceListParams
|
||||
): Promise<MCPServiceListApiResponse> {
|
||||
const queryParams = new URLSearchParams({
|
||||
page: params.page.toString(),
|
||||
page_size: params.page_size.toString(),
|
||||
...(params.search && { search: params.search }),
|
||||
...(params.status && { status: params.status }),
|
||||
});
|
||||
|
||||
return await fetchAdminAPI<MCPService[]>(
|
||||
`/api/mcp/service/list?${queryParams.toString()}`,
|
||||
{ method: "GET" }
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Internationalization
|
||||
|
||||
- Add translations for all user-facing text
|
||||
- Use the translation hook consistently
|
||||
- Update both English and Chinese translations
|
||||
|
||||
```typescript
|
||||
// Component with i18n
|
||||
import { useTranslation } from '@/shared/lib/useTranslation'
|
||||
|
||||
function MyComponent() {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>{t('Welcome')}</h1>
|
||||
<p>{t('This is a description')}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
// public/locales/en/translation.json
|
||||
{
|
||||
"Welcome": "Welcome",
|
||||
"This is a description": "This is a description"
|
||||
}
|
||||
|
||||
// public/locales/zh-CN/translation.json
|
||||
{
|
||||
"Welcome": "欢迎",
|
||||
"This is a description": "这是一个描述"
|
||||
}
|
||||
```
|
||||
|
||||
## Types of Contributions
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
1. **Identify the Bug**
|
||||
|
||||
- Check if the issue already exists
|
||||
- Reproduce the bug locally
|
||||
- Understand the root cause
|
||||
|
||||
2. **Fix the Bug**
|
||||
|
||||
- Write a minimal fix
|
||||
- Add tests if applicable
|
||||
- Ensure no regression
|
||||
|
||||
3. **Test the Fix**
|
||||
- Test manually in browser
|
||||
- Run automated tests
|
||||
- Check different scenarios
|
||||
|
||||
### ✨ New Features
|
||||
|
||||
1. **Feature Planning**
|
||||
|
||||
- Discuss the feature in issues first
|
||||
- Consider the user experience
|
||||
- Plan the implementation approach
|
||||
|
||||
2. **Implementation**
|
||||
|
||||
- Break down into smaller tasks
|
||||
- Follow existing patterns
|
||||
- Add proper TypeScript types
|
||||
|
||||
3. **Documentation**
|
||||
- Update relevant documentation
|
||||
- Add code comments where needed
|
||||
- Update translation files
|
||||
|
||||
### 📚 Documentation
|
||||
|
||||
- Fix typos and grammar
|
||||
- Add missing documentation
|
||||
- Improve existing explanations
|
||||
- Add code examples
|
||||
|
||||
### 🎨 UI/UX Improvements
|
||||
|
||||
- Follow the existing design system
|
||||
- Use NextUI components when possible
|
||||
- Ensure responsive design
|
||||
- Test on different screen sizes
|
||||
|
||||
### 🌐 Translations
|
||||
|
||||
- Add support for new languages
|
||||
- Fix translation errors
|
||||
- Improve translation quality
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
### Before Submitting
|
||||
|
||||
1. **Code Quality**
|
||||
|
||||
```bash
|
||||
# Run linting
|
||||
pnpm lint
|
||||
|
||||
# Check TypeScript
|
||||
pnpm type-check
|
||||
|
||||
# Run tests
|
||||
pnpm test
|
||||
|
||||
# Build check
|
||||
pnpm build
|
||||
```
|
||||
|
||||
2. **Test Your Changes**
|
||||
|
||||
- Test in development environment
|
||||
- Check different browsers
|
||||
- Verify responsive design
|
||||
- Test with different data scenarios
|
||||
|
||||
3. **Update Documentation**
|
||||
- Update README if needed
|
||||
- Add/update code comments
|
||||
- Update translation files
|
||||
|
||||
### Submitting the PR
|
||||
|
||||
1. **Commit Messages**
|
||||
Use conventional commit format:
|
||||
|
||||
```
|
||||
feat: add user profile management
|
||||
fix: resolve navigation menu bug
|
||||
docs: update API documentation
|
||||
style: improve button styling
|
||||
refactor: simplify authentication logic
|
||||
test: add unit tests for services
|
||||
```
|
||||
|
||||
2. **PR Title and Description**
|
||||
|
||||
- Clear, descriptive title
|
||||
- Explain what changes were made
|
||||
- Reference related issues
|
||||
- Include screenshots for UI changes
|
||||
|
||||
3. **PR Template**
|
||||
|
||||
```markdown
|
||||
## Description
|
||||
|
||||
Brief description of changes
|
||||
|
||||
## Type of Change
|
||||
|
||||
- [ ] Bug fix
|
||||
- [ ] New feature
|
||||
- [ ] Documentation update
|
||||
- [ ] Style/UI improvement
|
||||
|
||||
## Testing
|
||||
|
||||
- [ ] Tested locally
|
||||
- [ ] Added/updated tests
|
||||
- [ ] Checked responsive design
|
||||
|
||||
## Screenshots (if applicable)
|
||||
|
||||
Add screenshots here
|
||||
|
||||
## Related Issues
|
||||
|
||||
Fixes #123
|
||||
```
|
||||
|
||||
### Review Process
|
||||
|
||||
1. **Automated Checks**
|
||||
|
||||
- All CI checks must pass
|
||||
- Code coverage requirements
|
||||
- Build must succeed
|
||||
|
||||
2. **Code Review**
|
||||
|
||||
- Maintainers will review within 48 hours
|
||||
- Address feedback promptly
|
||||
- Be open to suggestions
|
||||
|
||||
3. **Approval and Merge**
|
||||
- At least one approval required
|
||||
- All conversations resolved
|
||||
- Maintainer will merge
|
||||
|
||||
## Testing
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
pnpm test
|
||||
|
||||
# Run tests in watch mode
|
||||
pnpm test:watch
|
||||
|
||||
# Run tests with coverage
|
||||
pnpm test:coverage
|
||||
|
||||
# Type checking
|
||||
pnpm type-check
|
||||
|
||||
# Linting
|
||||
pnpm lint
|
||||
|
||||
# Build check
|
||||
pnpm build
|
||||
```
|
||||
|
||||
### Writing Tests
|
||||
|
||||
```typescript
|
||||
// Component test example
|
||||
import { render, screen, fireEvent } from '@testing-library/react'
|
||||
import { MyComponent } from './MyComponent'
|
||||
|
||||
describe('MyComponent', () => {
|
||||
it('renders correctly', () => {
|
||||
render(<MyComponent title="Test Title" onAction={jest.fn()} />)
|
||||
expect(screen.getByText('Test Title')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('calls onAction when button is clicked', () => {
|
||||
const mockAction = jest.fn()
|
||||
render(<MyComponent title="Test" onAction={mockAction} />)
|
||||
|
||||
fireEvent.click(screen.getByRole('button'))
|
||||
expect(mockAction).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
|
||||
- Aim for >80% test coverage
|
||||
- Focus on critical functionality
|
||||
- Test edge cases and error scenarios
|
||||
|
||||
## Code Review Guidelines
|
||||
|
||||
### For Contributors
|
||||
|
||||
- Be responsive to feedback
|
||||
- Ask questions if unclear
|
||||
- Make requested changes promptly
|
||||
- Keep discussions professional
|
||||
|
||||
### For Reviewers
|
||||
|
||||
- Be constructive and helpful
|
||||
- Explain the reasoning behind suggestions
|
||||
- Approve when ready, request changes when needed
|
||||
- Focus on code quality and user experience
|
||||
|
||||
## Community Guidelines
|
||||
|
||||
### Communication
|
||||
|
||||
- Be respectful and inclusive
|
||||
- Help newcomers get started
|
||||
- Share knowledge and best practices
|
||||
- Use GitHub Discussions for questions
|
||||
|
||||
### Issue Reporting
|
||||
|
||||
1. **Search Existing Issues**
|
||||
|
||||
- Check if the issue already exists
|
||||
- Add to existing discussion if relevant
|
||||
|
||||
2. **Provide Details**
|
||||
|
||||
- Clear description of the problem
|
||||
- Steps to reproduce
|
||||
- Expected vs actual behavior
|
||||
- Environment information
|
||||
|
||||
3. **Use Issue Templates**
|
||||
- Bug report template
|
||||
- Feature request template
|
||||
- Question template
|
||||
|
||||
### Feature Requests
|
||||
|
||||
1. **Describe the Problem**
|
||||
|
||||
- What problem does this solve?
|
||||
- Who would benefit from this feature?
|
||||
|
||||
2. **Propose a Solution**
|
||||
|
||||
- How should it work?
|
||||
- What should the user experience be?
|
||||
|
||||
3. **Consider Alternatives**
|
||||
- Are there other ways to solve this?
|
||||
- How do other tools handle this?
|
||||
|
||||
## Recognition
|
||||
|
||||
Contributors will be recognized in:
|
||||
|
||||
- GitHub contributors list
|
||||
- Release notes for significant contributions
|
||||
- Project documentation
|
||||
- Community discussions
|
||||
|
||||
## Getting Help
|
||||
|
||||
- **GitHub Discussions**: For questions and general discussion
|
||||
- **GitHub Issues**: For bug reports and feature requests
|
||||
- **Code Comments**: For implementation questions
|
||||
- **Documentation**: Check existing docs first
|
||||
|
||||
## License
|
||||
|
||||
By contributing to XPack WebUI, you agree that your contributions will be licensed under the MIT License.
|
||||
|
||||
---
|
||||
|
||||
Thank you for contributing to XPack WebUI! Your contributions help make this project better for everyone.
|
||||
@@ -0,0 +1,64 @@
|
||||
# Deployment Guide
|
||||
|
||||
## Overview
|
||||
|
||||
This guide covers deploying XPack WebUI to various environments including development, staging, and production. The application is built with Next.js 15 and supports multiple deployment strategies.
|
||||
|
||||
## Build Process
|
||||
|
||||
### Production Build
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
# Build the application
|
||||
pnpm build
|
||||
|
||||
# Start production server
|
||||
pnpm start
|
||||
```
|
||||
|
||||
The build creates optimized static files in `.next/` directory.
|
||||
|
||||
### Build Configuration
|
||||
|
||||
The application is configured in `next.config.ts`:
|
||||
|
||||
```typescript
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
experimental: {
|
||||
optimizePackageImports: ["@nextui-org/react"],
|
||||
},
|
||||
transpilePackages: ["@nextui-org/react", "@nextui-org/theme"],
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: "https",
|
||||
hostname: "**",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### Required Variables
|
||||
|
||||
```env
|
||||
# API Configuration
|
||||
NEXT_PUBLIC_API_URL=http://localhost:8080
|
||||
```
|
||||
|
||||
### Environment-Specific Files
|
||||
|
||||
- `.env.example` - Template for environment variables
|
||||
- `.env.local` - Local development overrides (not committed)
|
||||
- `.env.development` - Development environment
|
||||
- `.env.test` - Testing environment
|
||||
- `.env.production` - Production environment
|
||||
@@ -0,0 +1,347 @@
|
||||
# Development Guide
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js 18+
|
||||
- pnpm (recommended package manager)
|
||||
- Git
|
||||
|
||||
### Development Setup
|
||||
|
||||
1. **Clone and Install**
|
||||
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd apps/op
|
||||
pnpm install
|
||||
```
|
||||
|
||||
2. **Environment Configuration**
|
||||
|
||||
Create the environment file:
|
||||
|
||||
```bash
|
||||
cp .env.example .env.local
|
||||
```
|
||||
|
||||
Update variables as needed:
|
||||
|
||||
```env
|
||||
# Backend Service API URL Prefix
|
||||
NEXT_PUBLIC_API_URL=http://127.0.0.1:8100
|
||||
```
|
||||
|
||||
3. **Start Development Server**
|
||||
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
The app will be available at `http://localhost:3000`
|
||||
|
||||
## Project Structure
|
||||
|
||||
### Core Directories
|
||||
|
||||
```
|
||||
src/
|
||||
├── app/ # Next.js App Router pages
|
||||
│ ├── marketplace/ # Service marketplace pages
|
||||
│ ├── console/ # Admin console
|
||||
│ ├── dashboard/ # User dashboard
|
||||
│ ├── signin/ # User authentication
|
||||
│ ├── admin-signin/ # Admin authentication
|
||||
│ └── loginSuccess/ # Login success page
|
||||
├── components/ # Feature-specific components
|
||||
│ ├── console/ # Console management
|
||||
│ ├── dashboard/ # Dashboard components
|
||||
│ ├── marketplace/ # Marketplace components
|
||||
│ ├── mcp-services/ # MCP service management
|
||||
│ ├── revenue-management/# Revenue tracking
|
||||
│ ├── system-setting/ # System configuration
|
||||
│ ├── user-management/ # User administration
|
||||
│ └── wallet/ # Wallet management
|
||||
├── shared/ # Shared utilities
|
||||
│ ├── components/ # Reusable UI components
|
||||
│ ├── hooks/ # Custom React hooks
|
||||
│ ├── store/ # Zustand state stores
|
||||
│ ├── types/ # TypeScript definitions
|
||||
│ ├── lib/ # Utility libraries
|
||||
│ ├── rpc/ # RPC services
|
||||
│ ├── providers/ # React providers
|
||||
│ ├── contexts/ # React contexts
|
||||
│ ├── config/ # Configuration files
|
||||
│ ├── data/ # Static data and mocks
|
||||
│ └── utils/ # Utility functions
|
||||
├── services/ # Backend API integration
|
||||
│ ├── marketplaceService.ts # Marketplace API
|
||||
│ ├── mcpService.ts # MCP service API
|
||||
│ ├── userService.ts # User management API
|
||||
│ ├── revenueService.ts # Revenue tracking API
|
||||
│ ├── paymentChannelService.ts # Payment API
|
||||
│ ├── systemConfigService.ts # System config API
|
||||
│ ├── platformConfigService.ts # Platform config API
|
||||
│ └── overviewService.ts # Overview/stats API
|
||||
├── hooks/ # App-specific hooks
|
||||
│ ├── useAdminLogin.tsx # Admin authentication
|
||||
│ ├── useLogin.tsx # User authentication
|
||||
│ ├── useMCPServicesList.ts # MCP services data
|
||||
│ ├── useMCPServiceDetail.ts # Service details
|
||||
│ ├── useUserManagement.ts # User management
|
||||
│ ├── useRevenueManagement.ts # Revenue data
|
||||
│ ├── usePaymentChannelManagement.ts # Payment channels
|
||||
│ └── useSystemConfigManagement.ts # System config
|
||||
├── store/ # Zustand stores
|
||||
│ └── admin.ts # Admin state management
|
||||
├── types/ # TypeScript type definitions
|
||||
│ ├── admin.ts # Admin types
|
||||
│ ├── dashboard.ts # Dashboard types
|
||||
│ ├── mcp-service.ts # MCP service types
|
||||
│ ├── payment.ts # Payment types
|
||||
│ ├── revenue.ts # Revenue types
|
||||
│ ├── system.ts # System types
|
||||
│ ├── user.ts # User types
|
||||
│ └── global.d.ts # Global type declarations
|
||||
├── rpc/ # RPC layer
|
||||
│ └── admin-api.ts # Admin API client
|
||||
└── utils/ # Utility functions
|
||||
└── getEmail.ts # Email utilities
|
||||
```
|
||||
|
||||
### Key Files
|
||||
|
||||
- `src/app/layout.tsx` - Root layout with providers and platform config
|
||||
- `src/app/page.tsx` - Homepage with marketplace
|
||||
- `src/shared/components/Navigation.tsx` - Main navigation
|
||||
- `src/shared/store/` - Global state management with Zustand
|
||||
- `next.config.ts` - Next.js configuration with NextUI optimization
|
||||
- `tailwind.config.ts` - Tailwind CSS configuration
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Code Style
|
||||
|
||||
- **TypeScript**: Strict mode enabled
|
||||
- **ESLint**: Next.js recommended + custom rules
|
||||
- **Prettier**: Automatic formatting
|
||||
- **File naming**: kebab-case for files, PascalCase for components
|
||||
|
||||
### State Management
|
||||
|
||||
Using Zustand for global state:
|
||||
|
||||
```typescript
|
||||
// Example store
|
||||
import { create } from "zustand";
|
||||
|
||||
interface UserStore {
|
||||
user: User | null;
|
||||
setUser: (user: User) => void;
|
||||
}
|
||||
|
||||
export const useUserStore = create<UserStore>((set) => ({
|
||||
user: null,
|
||||
setUser: (user) => set({ user }),
|
||||
}));
|
||||
```
|
||||
|
||||
### API Integration
|
||||
|
||||
Custom fetch wrapper with SWR:
|
||||
|
||||
```typescript
|
||||
// Using SWR for data fetching
|
||||
import useSWR from "swr";
|
||||
import { fetchServices } from "@/shared/api/services";
|
||||
|
||||
function useServices() {
|
||||
const { data, error, isLoading } = useSWR("/api/services", fetchServices);
|
||||
return { services: data, error, isLoading };
|
||||
}
|
||||
```
|
||||
|
||||
### Internationalization
|
||||
|
||||
Using react-i18next:
|
||||
|
||||
```typescript
|
||||
// In components
|
||||
import { useTranslation } from '@/shared/lib/useTranslation'
|
||||
|
||||
function MyComponent() {
|
||||
const { t } = useTranslation()
|
||||
return <h1>{t('Welcome')}</h1>
|
||||
}
|
||||
```
|
||||
|
||||
Translation files are in `public/locales/{lang}/translation.json`
|
||||
|
||||
## Available Scripts
|
||||
|
||||
```bash
|
||||
# Development
|
||||
pnpm dev # Start dev server (port 3000)
|
||||
pnpm build # Production build
|
||||
pnpm start # Start production server
|
||||
|
||||
# Code Quality
|
||||
pnpm lint # Run ESLint
|
||||
pnpm type-check # TypeScript type checking
|
||||
|
||||
# Utilities
|
||||
pnpm format # Format code with Prettier
|
||||
```
|
||||
|
||||
## Adding New Features
|
||||
|
||||
### 1. Create a New Page
|
||||
|
||||
```bash
|
||||
# Create page directory
|
||||
mkdir src/app/my-feature
|
||||
|
||||
# Create page component
|
||||
touch src/app/my-feature/page.tsx
|
||||
```
|
||||
|
||||
```typescript
|
||||
// src/app/my-feature/page.tsx
|
||||
import type { Metadata } from 'next'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'My Feature | XPack',
|
||||
}
|
||||
|
||||
export default function MyFeaturePage() {
|
||||
return (
|
||||
<div>
|
||||
<h1>My Feature</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Add Components
|
||||
|
||||
```typescript
|
||||
// src/components/my-feature/MyComponent.tsx
|
||||
import React from 'react'
|
||||
import { useTranslation } from '@/shared/lib/useTranslation'
|
||||
|
||||
export function MyComponent() {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div className="p-4">
|
||||
<h2>{t('My Component')}</h2>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Add Translations
|
||||
|
||||
```json
|
||||
// public/locales/en/translation.json
|
||||
{
|
||||
"My Component": "My Component",
|
||||
"My Feature": "My Feature"
|
||||
}
|
||||
|
||||
// public/locales/zh-CN/translation.json
|
||||
{
|
||||
"My Component": "我的组件",
|
||||
"My Feature": "我的功能"
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Add Types
|
||||
|
||||
```typescript
|
||||
// src/shared/types/my-feature.ts
|
||||
export interface MyFeatureData {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
```
|
||||
|
||||
### 5. Add API Services
|
||||
|
||||
```typescript
|
||||
// src/shared/api/my-feature.ts
|
||||
import { apiRequest } from "./base";
|
||||
import type { MyFeatureData } from "@/shared/types/my-feature";
|
||||
|
||||
export async function fetchMyFeatureData(): Promise<MyFeatureData[]> {
|
||||
return apiRequest("/api/my-feature");
|
||||
}
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
pnpm test
|
||||
|
||||
# Run tests in watch mode
|
||||
pnpm test:watch
|
||||
|
||||
# Run tests with coverage
|
||||
pnpm test:coverage
|
||||
```
|
||||
|
||||
### Writing Tests
|
||||
|
||||
```typescript
|
||||
// __tests__/components/MyComponent.test.tsx
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { MyComponent } from '@/components/my-feature/MyComponent'
|
||||
|
||||
describe('MyComponent', () => {
|
||||
it('renders correctly', () => {
|
||||
render(<MyComponent />)
|
||||
expect(screen.getByText('My Component')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
### Development Tools
|
||||
|
||||
- **React DevTools**: Browser extension for React debugging
|
||||
- **Next.js DevTools**: Built-in development features
|
||||
- **TypeScript**: Compile-time error checking
|
||||
- **ESLint**: Code quality and error detection
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **Port conflicts**: Change port in package.json if 3000 is occupied
|
||||
2. **Environment variables**: Ensure all required env vars are set
|
||||
3. **TypeScript errors**: Run `pnpm type-check` to identify issues
|
||||
4. **Build failures**: Check for missing dependencies or syntax errors
|
||||
|
||||
## Performance
|
||||
|
||||
### Optimization Tips
|
||||
|
||||
- Use Next.js Image component for images
|
||||
- Implement proper loading states
|
||||
- Use React.memo for expensive components
|
||||
- Optimize bundle size with dynamic imports
|
||||
- Enable SSR for dynamic content and SEO optimization
|
||||
|
||||
### Monitoring
|
||||
|
||||
- Use Next.js built-in analytics
|
||||
- Monitor Core Web Vitals
|
||||
- Check bundle analyzer for size optimization
|
||||
|
||||
## Deployment
|
||||
|
||||
See [Deployment Guide](./deployment.md) for production deployment instructions.
|
||||
@@ -0,0 +1,155 @@
|
||||
# Documentation Updates Summary
|
||||
|
||||
This document summarizes all the documentation updates made to reflect the current state of the XPack WebUI project.
|
||||
|
||||
## Updated Files
|
||||
|
||||
### 1. README_zh.md
|
||||
- ✅ Updated project structure to reflect actual directories and files
|
||||
- ✅ Updated environment configuration instructions
|
||||
- ✅ Enhanced core features descriptions
|
||||
- ✅ Added new components and services
|
||||
|
||||
### 2. docs/development.md
|
||||
- ✅ Updated package manager from npm to pnpm
|
||||
- ✅ Updated environment file setup instructions
|
||||
- ✅ Reflected actual project structure
|
||||
- ✅ Updated technology stack information
|
||||
|
||||
### 3. docs/architecture.md
|
||||
- ✅ Updated technology stack to current versions
|
||||
- ✅ Expanded directory structure documentation
|
||||
- ✅ Enhanced architectural patterns section
|
||||
- ✅ Added security and performance optimization sections
|
||||
- ✅ Detailed data flow and state management
|
||||
|
||||
### 4. docs/api.md
|
||||
- ✅ Updated API configuration for local development
|
||||
- ✅ Reflected current API services structure
|
||||
- ✅ Updated state management documentation
|
||||
- ✅ Added RPC methods section
|
||||
- ✅ Enhanced API endpoints documentation
|
||||
|
||||
### 5. docs/deployment.md
|
||||
- ✅ Updated build process to use pnpm
|
||||
- ✅ Updated environment variables for local development
|
||||
- ✅ Enhanced Docker configuration
|
||||
- ✅ Improved CI/CD pipeline configuration
|
||||
- ✅ Added comprehensive monitoring and logging
|
||||
- ✅ Enhanced security considerations
|
||||
- ✅ Expanded troubleshooting section
|
||||
- ✅ Added detailed rollback strategies
|
||||
|
||||
### 6. docs/troubleshooting.md
|
||||
- ✅ Created comprehensive troubleshooting guide
|
||||
- ✅ Updated package manager commands to pnpm
|
||||
- ✅ Updated API debugging examples to use actual project structure
|
||||
- ✅ Enhanced RPC connection debugging
|
||||
- ✅ Updated performance optimization examples
|
||||
- ✅ Added debugging tools and techniques
|
||||
- ✅ Provided prevention strategies
|
||||
|
||||
### 7. docs/contributing.md
|
||||
- ✅ Updated prerequisites to specify Next.js 15 and TypeScript 5
|
||||
- ✅ Changed package manager from npm/yarn to pnpm
|
||||
- ✅ Updated development setup instructions
|
||||
- ✅ Enhanced API integration examples with actual project patterns
|
||||
- ✅ Updated testing commands and code quality checks
|
||||
- ✅ Improved GitHub Actions configuration examples
|
||||
|
||||
### 8. docs/i18n.md
|
||||
- ✅ Comprehensive internationalization guide
|
||||
- ✅ Current language support (English, Chinese Simplified)
|
||||
- ✅ Translation file structure and management
|
||||
- ✅ Component integration examples
|
||||
- ✅ Testing and maintenance guidelines
|
||||
|
||||
## Key Changes Made
|
||||
|
||||
### Technology Stack Updates
|
||||
- Next.js upgraded to version 15
|
||||
- TypeScript 5 specification
|
||||
- NextUI v2 integration
|
||||
- Added new UI libraries (Lucide React, React Icons)
|
||||
- Zod for schema validation
|
||||
- Package manager standardized to pnpm
|
||||
- Comprehensive development tools list
|
||||
|
||||
### Project Structure Alignment
|
||||
- Reflected actual app/ directory structure
|
||||
- Updated component organization (console, dashboard, marketplace, etc.)
|
||||
- Added new services (mcpService, marketplaceService, userService, etc.)
|
||||
- Documented RPC layer implementation with fetchAPI and fetchAdminAPI
|
||||
- Updated state management structure with Zustand stores
|
||||
|
||||
### Environment Configuration
|
||||
- Changed from .env.development to .env.example
|
||||
- Added local development URLs
|
||||
- Included RPC endpoint configuration
|
||||
- Added domain and extension ID variables
|
||||
|
||||
### Development Workflow
|
||||
- Package manager standardized to pnpm across all documentation
|
||||
- Updated build and development commands
|
||||
- Enhanced type checking and linting with pnpm scripts
|
||||
- Improved testing configuration
|
||||
|
||||
### Deployment Enhancements
|
||||
- Comprehensive CI/CD pipeline with GitHub Actions
|
||||
- Docker configuration with multi-stage builds
|
||||
- PM2 configuration with clustering
|
||||
- Blue-green and canary deployment strategies
|
||||
- Automated rollback procedures
|
||||
|
||||
### Security Improvements
|
||||
- Enhanced security headers configuration
|
||||
- Content Security Policy with nonce support
|
||||
- API authentication and rate limiting
|
||||
- Environment variable security best practices
|
||||
|
||||
### Monitoring and Observability
|
||||
- Vercel Analytics and Speed Insights integration
|
||||
- Sentry error tracking configuration
|
||||
- Custom analytics implementation
|
||||
- Health check endpoints
|
||||
- Structured logging
|
||||
|
||||
## Documentation Quality Improvements
|
||||
|
||||
### Code Examples
|
||||
- All code examples updated to TypeScript
|
||||
- Consistent code formatting and style
|
||||
- Real-world configuration examples
|
||||
- Complete implementation snippets
|
||||
|
||||
### Best Practices
|
||||
- Security best practices documented
|
||||
- Performance optimization techniques
|
||||
- Error handling patterns
|
||||
- Testing strategies
|
||||
|
||||
### Troubleshooting
|
||||
- Common issues and solutions
|
||||
- Debug mode configuration
|
||||
- Performance troubleshooting
|
||||
- Deployment issue resolution
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Review and Validate**: Team review of all updated documentation
|
||||
2. **Testing**: Validate all code examples and configurations
|
||||
3. **Maintenance**: Regular updates as the project evolves
|
||||
4. **User Feedback**: Gather feedback from developers using the documentation
|
||||
|
||||
## File Status
|
||||
|
||||
| File | Status | Last Updated |
|
||||
|------|--------|--------------|
|
||||
| README_zh.md | ✅ Complete | Current |
|
||||
| docs/development.md | ✅ Complete | Current |
|
||||
| docs/architecture.md | ✅ Complete | Current |
|
||||
| docs/api.md | ✅ Complete | Current |
|
||||
| docs/deployment.md | ✅ Complete | Current |
|
||||
| docs/troubleshooting.md | ✅ Complete | Current |
|
||||
|
||||
All documentation has been successfully updated to reflect the current state of the XPack WebUI project, providing comprehensive guidance for development, deployment, and maintenance.
|
||||
@@ -0,0 +1,727 @@
|
||||
# Internationalization (i18n) Guide
|
||||
|
||||
## Overview
|
||||
|
||||
XPack WebUI supports multiple languages using react-i18next. This guide covers how to implement, maintain, and extend internationalization in the application.
|
||||
|
||||
## Current Language Support
|
||||
|
||||
- **English (en)**: Default language
|
||||
- **Chinese Simplified (zh-CN)**: Full translation support
|
||||
|
||||
## Setup and Configuration
|
||||
|
||||
### i18next Configuration
|
||||
|
||||
The i18n system is configured in `src/shared/lib/i18n.ts`:
|
||||
|
||||
```typescript
|
||||
import i18n from 'i18next'
|
||||
import { initReactI18next } from 'react-i18next'
|
||||
import Backend from 'i18next-http-backend'
|
||||
import LanguageDetector from 'i18next-browser-languagedetector'
|
||||
|
||||
i18n
|
||||
.use(Backend)
|
||||
.use(LanguageDetector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
fallbackLng: 'en',
|
||||
debug: process.env.NODE_ENV === 'development',
|
||||
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
|
||||
backend: {
|
||||
loadPath: '/locales/{{lng}}/{{ns}}.json',
|
||||
},
|
||||
|
||||
detection: {
|
||||
order: ['localStorage', 'navigator', 'htmlTag'],
|
||||
caches: ['localStorage'],
|
||||
},
|
||||
})
|
||||
|
||||
export default i18n
|
||||
```
|
||||
|
||||
### Translation Files Structure
|
||||
|
||||
```
|
||||
public/locales/
|
||||
├── en/
|
||||
│ ├── translation.json # Main translations
|
||||
│ ├── common.json # Common UI elements
|
||||
│ ├── marketplace.json # Marketplace specific
|
||||
│ ├── admin.json # Admin console
|
||||
│ └── errors.json # Error messages
|
||||
└── zh-CN/
|
||||
├── translation.json
|
||||
├── common.json
|
||||
├── marketplace.json
|
||||
├── admin.json
|
||||
└── errors.json
|
||||
```
|
||||
|
||||
## Usage in Components
|
||||
|
||||
### Basic Translation Hook
|
||||
|
||||
```typescript
|
||||
import { useTranslation } from '@/shared/lib/useTranslation'
|
||||
|
||||
function MyComponent() {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>{t('Welcome')}</h1>
|
||||
<p>{t('This is a description')}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### Namespace-Specific Translations
|
||||
|
||||
```typescript
|
||||
import { useTranslation } from '@/shared/lib/useTranslation'
|
||||
|
||||
function MarketplaceComponent() {
|
||||
const { t } = useTranslation('marketplace')
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>{t('title')}</h1>
|
||||
<p>{t('description')}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### Multiple Namespaces
|
||||
|
||||
```typescript
|
||||
function AdminComponent() {
|
||||
const { t: tCommon } = useTranslation('common')
|
||||
const { t: tAdmin } = useTranslation('admin')
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button>{tCommon('save')}</button>
|
||||
<h1>{tAdmin('dashboard.title')}</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Translation Patterns
|
||||
|
||||
### 1. Simple Translations
|
||||
|
||||
```json
|
||||
// en/translation.json
|
||||
{
|
||||
"welcome": "Welcome",
|
||||
"goodbye": "Goodbye",
|
||||
"loading": "Loading..."
|
||||
}
|
||||
|
||||
// zh-CN/translation.json
|
||||
{
|
||||
"welcome": "欢迎",
|
||||
"goodbye": "再见",
|
||||
"loading": "加载中..."
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
function Component() {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>{t('welcome')}</h1>
|
||||
<p>{t('loading')}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Nested Translations
|
||||
|
||||
```json
|
||||
// en/translation.json
|
||||
{
|
||||
"user": {
|
||||
"profile": {
|
||||
"title": "User Profile",
|
||||
"edit": "Edit Profile",
|
||||
"save": "Save Changes"
|
||||
},
|
||||
"settings": {
|
||||
"title": "Settings",
|
||||
"language": "Language",
|
||||
"theme": "Theme"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
function UserProfile() {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>{t('user.profile.title')}</h1>
|
||||
<button>{t('user.profile.edit')}</button>
|
||||
<button>{t('user.profile.save')}</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Interpolation
|
||||
|
||||
```json
|
||||
// en/translation.json
|
||||
{
|
||||
"greeting": "Hello, {{name}}!",
|
||||
"itemCount": "You have {{count}} items",
|
||||
"lastLogin": "Last login: {{date, datetime}}"
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
function Component() {
|
||||
const { t } = useTranslation()
|
||||
const user = { name: 'John', lastLogin: new Date() }
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>{t('greeting', { name: user.name })}</h1>
|
||||
<p>{t('itemCount', { count: 5 })}</p>
|
||||
<p>{t('lastLogin', { date: user.lastLogin })}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Pluralization
|
||||
|
||||
```json
|
||||
// en/translation.json
|
||||
{
|
||||
"item": "{{count}} item",
|
||||
"item_plural": "{{count}} items",
|
||||
"notification": {
|
||||
"one": "You have {{count}} notification",
|
||||
"other": "You have {{count}} notifications"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
function Component() {
|
||||
const { t } = useTranslation()
|
||||
const count = 5
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p>{t('item', { count })}</p>
|
||||
<p>{t('notification', { count })}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 5. Context-Based Translations
|
||||
|
||||
```json
|
||||
// en/translation.json
|
||||
{
|
||||
"button": {
|
||||
"save_male": "Save",
|
||||
"save_female": "Save",
|
||||
"delete_male": "Delete",
|
||||
"delete_female": "Delete"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
function Component() {
|
||||
const { t } = useTranslation()
|
||||
const userGender = 'male'
|
||||
|
||||
return (
|
||||
<button>
|
||||
{t('button.save', { context: userGender })}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Language Switching
|
||||
|
||||
### Language Selector Component
|
||||
|
||||
```typescript
|
||||
import { useTranslation } from '@/shared/lib/useTranslation'
|
||||
|
||||
const languages = [
|
||||
{ code: 'en', name: 'English', flag: '🇺🇸' },
|
||||
{ code: 'zh-CN', name: '中文', flag: '🇨🇳' },
|
||||
]
|
||||
|
||||
function LanguageSelector() {
|
||||
const { i18n, t } = useTranslation()
|
||||
|
||||
const changeLanguage = (languageCode: string) => {
|
||||
i18n.changeLanguage(languageCode)
|
||||
}
|
||||
|
||||
return (
|
||||
<Select
|
||||
label={t('common.language')}
|
||||
selectedKeys={[i18n.language]}
|
||||
onSelectionChange={(keys) => {
|
||||
const language = Array.from(keys)[0] as string
|
||||
changeLanguage(language)
|
||||
}}
|
||||
>
|
||||
{languages.map((lang) => (
|
||||
<SelectItem key={lang.code} value={lang.code}>
|
||||
{lang.flag} {lang.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</Select>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### Programmatic Language Change
|
||||
|
||||
```typescript
|
||||
import { useTranslation } from '@/shared/lib/useTranslation'
|
||||
|
||||
function useLanguage() {
|
||||
const { i18n } = useTranslation()
|
||||
|
||||
const changeLanguage = useCallback((language: string) => {
|
||||
i18n.changeLanguage(language)
|
||||
// Optionally save to user preferences
|
||||
localStorage.setItem('preferred-language', language)
|
||||
}, [i18n])
|
||||
|
||||
const getCurrentLanguage = () => i18n.language
|
||||
|
||||
return {
|
||||
currentLanguage: i18n.language,
|
||||
changeLanguage,
|
||||
getCurrentLanguage,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### 1. Lazy Loading Translations
|
||||
|
||||
```typescript
|
||||
// Lazy load namespace
|
||||
const { t, ready } = useTranslation('admin', { useSuspense: false })
|
||||
|
||||
if (!ready) {
|
||||
return <LoadingSpinner />
|
||||
}
|
||||
|
||||
return <AdminPanel />
|
||||
```
|
||||
|
||||
### 2. Translation with HTML
|
||||
|
||||
```json
|
||||
{
|
||||
"terms": "I agree to the <1>Terms of Service</1> and <3>Privacy Policy</3>"
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
import { Trans } from 'react-i18next'
|
||||
|
||||
function TermsComponent() {
|
||||
return (
|
||||
<Trans
|
||||
i18nKey="terms"
|
||||
components={{
|
||||
1: <Link href="/terms" />,
|
||||
3: <Link href="/privacy" />
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Date and Number Formatting
|
||||
|
||||
```typescript
|
||||
// Configure formatters
|
||||
i18n.init({
|
||||
// ... other config
|
||||
interpolation: {
|
||||
format: (value, format, lng) => {
|
||||
if (format === 'uppercase') return value.toUpperCase()
|
||||
if (format === 'currency') {
|
||||
return new Intl.NumberFormat(lng, {
|
||||
style: 'currency',
|
||||
currency: 'USD'
|
||||
}).format(value)
|
||||
}
|
||||
if (format === 'date') {
|
||||
return new Intl.DateTimeFormat(lng).format(value)
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"price": "Price: {{amount, currency}}",
|
||||
"date": "Created: {{date, date}}"
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Custom Translation Hook
|
||||
|
||||
```typescript
|
||||
// Custom hook with additional features
|
||||
export function useAppTranslation(namespace?: string) {
|
||||
const { t, i18n } = useTranslation(namespace)
|
||||
|
||||
const tWithFallback = useCallback((key: string, options?: any) => {
|
||||
const translation = t(key, options)
|
||||
|
||||
// Log missing translations in development
|
||||
if (process.env.NODE_ENV === 'development' && translation === key) {
|
||||
console.warn(`Missing translation for key: ${key}`)
|
||||
}
|
||||
|
||||
return translation
|
||||
}, [t])
|
||||
|
||||
const isRTL = i18n.language === 'ar' || i18n.language === 'he'
|
||||
|
||||
return {
|
||||
t: tWithFallback,
|
||||
i18n,
|
||||
isRTL,
|
||||
currentLanguage: i18n.language,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Translation Management
|
||||
|
||||
### 1. Translation File Organization
|
||||
|
||||
```json
|
||||
// en/common.json - Common UI elements
|
||||
{
|
||||
"buttons": {
|
||||
"save": "Save",
|
||||
"cancel": "Cancel",
|
||||
"delete": "Delete",
|
||||
"edit": "Edit",
|
||||
"close": "Close"
|
||||
},
|
||||
"labels": {
|
||||
"name": "Name",
|
||||
"email": "Email",
|
||||
"password": "Password",
|
||||
"confirmPassword": "Confirm Password"
|
||||
},
|
||||
"messages": {
|
||||
"success": "Operation completed successfully",
|
||||
"error": "An error occurred",
|
||||
"loading": "Loading...",
|
||||
"noData": "No data available"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```json
|
||||
// en/marketplace.json - Feature-specific translations
|
||||
{
|
||||
"title": "MCP Store",
|
||||
"subtitle": "Discover and install MCP services",
|
||||
"search": {
|
||||
"placeholder": "Search services...",
|
||||
"noResults": "No services found",
|
||||
"filters": {
|
||||
"category": "Category",
|
||||
"price": "Price",
|
||||
"rating": "Rating"
|
||||
}
|
||||
},
|
||||
"service": {
|
||||
"install": "Install",
|
||||
"uninstall": "Uninstall",
|
||||
"details": "View Details",
|
||||
"rating": "Rating: {{rating}}/5",
|
||||
"price": "Price: {{price}}"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Translation Validation
|
||||
|
||||
```typescript
|
||||
// Validation script to check for missing translations
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
function validateTranslations() {
|
||||
const localesDir = path.join(process.cwd(), 'public/locales')
|
||||
const languages = fs.readdirSync(localesDir)
|
||||
const baseLanguage = 'en'
|
||||
|
||||
const baseTranslations = loadTranslations(baseLanguage)
|
||||
|
||||
languages.forEach(lang => {
|
||||
if (lang === baseLanguage) return
|
||||
|
||||
const translations = loadTranslations(lang)
|
||||
const missingKeys = findMissingKeys(baseTranslations, translations)
|
||||
|
||||
if (missingKeys.length > 0) {
|
||||
console.warn(`Missing translations in ${lang}:`, missingKeys)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function findMissingKeys(base: any, target: any, prefix = ''): string[] {
|
||||
const missing: string[] = []
|
||||
|
||||
Object.keys(base).forEach(key => {
|
||||
const fullKey = prefix ? `${prefix}.${key}` : key
|
||||
|
||||
if (!(key in target)) {
|
||||
missing.push(fullKey)
|
||||
} else if (typeof base[key] === 'object' && typeof target[key] === 'object') {
|
||||
missing.push(...findMissingKeys(base[key], target[key], fullKey))
|
||||
}
|
||||
})
|
||||
|
||||
return missing
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Translation Extraction
|
||||
|
||||
```typescript
|
||||
// Extract translation keys from components
|
||||
import { parse } from '@babel/parser'
|
||||
import traverse from '@babel/traverse'
|
||||
import fs from 'fs'
|
||||
|
||||
function extractTranslationKeys(filePath: string): string[] {
|
||||
const code = fs.readFileSync(filePath, 'utf-8')
|
||||
const ast = parse(code, {
|
||||
sourceType: 'module',
|
||||
plugins: ['typescript', 'jsx']
|
||||
})
|
||||
|
||||
const keys: string[] = []
|
||||
|
||||
traverse(ast, {
|
||||
CallExpression(path) {
|
||||
if (
|
||||
path.node.callee.type === 'Identifier' &&
|
||||
path.node.callee.name === 't' &&
|
||||
path.node.arguments[0]?.type === 'StringLiteral'
|
||||
) {
|
||||
keys.push(path.node.arguments[0].value)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return keys
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### 1. Key Naming Conventions
|
||||
|
||||
```typescript
|
||||
// Good: Descriptive, hierarchical keys
|
||||
t('marketplace.service.install.button')
|
||||
t('user.profile.form.validation.email.required')
|
||||
t('admin.dashboard.stats.users.total')
|
||||
|
||||
// Bad: Generic, flat keys
|
||||
t('button1')
|
||||
t('error')
|
||||
t('text')
|
||||
```
|
||||
|
||||
### 2. Consistent Namespace Usage
|
||||
|
||||
```typescript
|
||||
// Good: Feature-based namespaces
|
||||
const { t } = useTranslation('marketplace')
|
||||
const { t: tCommon } = useTranslation('common')
|
||||
|
||||
// Bad: Mixed namespace usage
|
||||
const { t } = useTranslation() // Default namespace for everything
|
||||
```
|
||||
|
||||
### 3. Translation Context
|
||||
|
||||
```typescript
|
||||
// Good: Provide context for translators
|
||||
{
|
||||
"user.status.active": "Active", // User account status
|
||||
"order.status.active": "Active", // Order processing status
|
||||
"service.status.active": "Active" // Service running status
|
||||
}
|
||||
|
||||
// Bad: Ambiguous keys
|
||||
{
|
||||
"active": "Active" // What kind of active?
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Handling Dynamic Content
|
||||
|
||||
```typescript
|
||||
// Good: Use interpolation
|
||||
t('welcome.message', { userName: user.name })
|
||||
|
||||
// Bad: String concatenation
|
||||
`Welcome, ${user.name}!`
|
||||
```
|
||||
|
||||
### 5. Error Message Translations
|
||||
|
||||
```json
|
||||
// en/errors.json
|
||||
{
|
||||
"validation": {
|
||||
"required": "This field is required",
|
||||
"email": "Please enter a valid email address",
|
||||
"minLength": "Must be at least {{min}} characters",
|
||||
"maxLength": "Must be no more than {{max}} characters"
|
||||
},
|
||||
"api": {
|
||||
"networkError": "Network error. Please check your connection.",
|
||||
"serverError": "Server error. Please try again later.",
|
||||
"unauthorized": "You are not authorized to perform this action."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Testing Internationalization
|
||||
|
||||
### 1. Component Testing with i18n
|
||||
|
||||
```typescript
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { I18nextProvider } from 'react-i18next'
|
||||
import i18n from '../test-utils/i18n-for-tests'
|
||||
import MyComponent from './MyComponent'
|
||||
|
||||
function renderWithI18n(component: React.ReactElement) {
|
||||
return render(
|
||||
<I18nextProvider i18n={i18n}>
|
||||
{component}
|
||||
</I18nextProvider>
|
||||
)
|
||||
}
|
||||
|
||||
describe('MyComponent', () => {
|
||||
it('renders translated text', () => {
|
||||
renderWithI18n(<MyComponent />)
|
||||
expect(screen.getByText('Welcome')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders in Chinese', async () => {
|
||||
await i18n.changeLanguage('zh-CN')
|
||||
renderWithI18n(<MyComponent />)
|
||||
expect(screen.getByText('欢迎')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
### 2. Test i18n Configuration
|
||||
|
||||
```typescript
|
||||
// test-utils/i18n-for-tests.ts
|
||||
import i18n from 'i18next'
|
||||
import { initReactI18next } from 'react-i18next'
|
||||
|
||||
i18n.use(initReactI18next).init({
|
||||
lng: 'en',
|
||||
fallbackLng: 'en',
|
||||
debug: false,
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
resources: {
|
||||
en: {
|
||||
translation: {
|
||||
'Welcome': 'Welcome',
|
||||
'Goodbye': 'Goodbye',
|
||||
}
|
||||
},
|
||||
'zh-CN': {
|
||||
translation: {
|
||||
'Welcome': '欢迎',
|
||||
'Goodbye': '再见',
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default i18n
|
||||
```
|
||||
|
||||
## Adding New Languages
|
||||
|
||||
### 1. Create Translation Files
|
||||
|
||||
1. Create new language directory: `public/locales/[language-code]/`
|
||||
2. Copy all JSON files from `en/` directory
|
||||
3. Translate all values while keeping keys unchanged
|
||||
|
||||
### 2. Update Language Configuration
|
||||
|
||||
```typescript
|
||||
// Add to language selector
|
||||
const languages = [
|
||||
{ code: 'en', name: 'English', flag: '🇺🇸' },
|
||||
{ code: 'zh-CN', name: '中文', flag: '🇨🇳' },
|
||||
{ code: 'es', name: 'Español', flag: '🇪🇸' }, // New language
|
||||
]
|
||||
```
|
||||
|
||||
### 3. Update i18n Configuration
|
||||
|
||||
```typescript
|
||||
// Add fallback languages if needed
|
||||
i18n.init({
|
||||
fallbackLng: {
|
||||
'zh-CN': ['zh', 'en'],
|
||||
'es': ['en'],
|
||||
'default': ['en']
|
||||
},
|
||||
// ... other config
|
||||
})
|
||||
```
|
||||
|
||||
This comprehensive i18n guide ensures consistent and maintainable internationalization throughout the XPack WebUI application.
|
||||
@@ -0,0 +1,486 @@
|
||||
# Troubleshooting Guide
|
||||
|
||||
## Common Issues
|
||||
|
||||
### Development Environment
|
||||
|
||||
#### 1. Installation Issues
|
||||
|
||||
**Problem**: `pnpm install` fails with dependency conflicts
|
||||
|
||||
**Solution**:
|
||||
```bash
|
||||
# Clear pnpm cache
|
||||
pnpm store prune
|
||||
|
||||
# Delete node_modules and pnpm-lock.yaml
|
||||
rm -rf node_modules pnpm-lock.yaml
|
||||
|
||||
# Reinstall dependencies
|
||||
pnpm install
|
||||
```
|
||||
|
||||
**Problem**: TypeScript compilation errors
|
||||
|
||||
**Solution**:
|
||||
```bash
|
||||
# Check TypeScript configuration
|
||||
pnpm type-check
|
||||
|
||||
# Clear Next.js cache
|
||||
rm -rf .next
|
||||
|
||||
# Restart development server
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
#### 2. Environment Variables
|
||||
|
||||
**Problem**: Environment variables not loading
|
||||
|
||||
**Solution**:
|
||||
1. Ensure `.env.local` file exists in project root
|
||||
2. Check variable names start with `NEXT_PUBLIC_` for client-side access
|
||||
3. Restart development server after changes
|
||||
|
||||
```bash
|
||||
# Copy example environment file
|
||||
cp .env.example .env.local
|
||||
|
||||
# Edit with your values
|
||||
nano .env.local
|
||||
```
|
||||
|
||||
**Problem**: API endpoints returning 404
|
||||
|
||||
**Solution**:
|
||||
1. Verify backend server is running on correct port
|
||||
2. Check API URL configuration in environment variables
|
||||
3. Ensure CORS is properly configured on backend
|
||||
|
||||
#### 3. Build Issues
|
||||
|
||||
**Problem**: Build fails with memory errors
|
||||
|
||||
**Solution**:
|
||||
```bash
|
||||
# Increase Node.js memory limit
|
||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||
|
||||
# Run build
|
||||
pnpm build
|
||||
```
|
||||
|
||||
**Problem**: Static export fails
|
||||
|
||||
**Solution**:
|
||||
```typescript
|
||||
// next.config.ts - Ensure proper configuration for static export
|
||||
const nextConfig: NextConfig = {
|
||||
output: 'export',
|
||||
trailingSlash: true,
|
||||
images: {
|
||||
unoptimized: true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Runtime Issues
|
||||
|
||||
#### 1. Authentication Problems
|
||||
|
||||
**Problem**: Login fails with valid credentials
|
||||
|
||||
**Solution**:
|
||||
1. Check network tab for API response errors
|
||||
2. Verify JWT token storage in localStorage
|
||||
3. Check token expiration and refresh logic
|
||||
|
||||
```typescript
|
||||
// Debug authentication state
|
||||
console.log('Auth state:', useAuthStore.getState())
|
||||
console.log('Token:', localStorage.getItem('auth-token'))
|
||||
```
|
||||
|
||||
**Problem**: Protected routes not working
|
||||
|
||||
**Solution**:
|
||||
1. Verify auth middleware is properly configured
|
||||
2. Check route protection logic in components
|
||||
3. Ensure token validation on server side
|
||||
|
||||
#### 2. API Integration Issues
|
||||
|
||||
**Problem**: API calls failing with CORS errors
|
||||
|
||||
**Solution**:
|
||||
1. Configure CORS headers on backend
|
||||
2. Check API URL configuration
|
||||
3. Verify request headers and methods
|
||||
|
||||
```typescript
|
||||
// Debug API calls using project's actual API functions
|
||||
import { fetchAPI } from '@/shared/rpc/common-function'
|
||||
import { fetchAdminAPI } from '@/rpc/admin-api'
|
||||
|
||||
// Debug public API call
|
||||
const response = await fetchAPI('/api/web/mcp_services', {
|
||||
method: 'GET'
|
||||
})
|
||||
console.log('Public API Response:', response)
|
||||
|
||||
// Debug admin API call
|
||||
const adminResponse = await fetchAdminAPI('/api/mcp/service/list', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
})
|
||||
console.log('Admin API Response:', adminResponse)
|
||||
```
|
||||
|
||||
**Problem**: RPC connection fails
|
||||
|
||||
**Solution**:
|
||||
1. Check WebSocket endpoint configuration
|
||||
2. Verify network connectivity
|
||||
3. Check browser WebSocket support
|
||||
|
||||
```typescript
|
||||
// Debug RPC connection using project's actual RPC structure
|
||||
import { getApiUrl } from '@/shared/rpc/adapter'
|
||||
|
||||
// Check RPC endpoint configuration
|
||||
console.log('API Base URL:', getApiUrl('/'))
|
||||
console.log('RPC Endpoint:', process.env.NEXT_PUBLIC_API_URL)
|
||||
|
||||
// Test API connectivity
|
||||
try {
|
||||
const response = await fetch(getApiUrl('/api/health'))
|
||||
console.log('Health check:', response.status)
|
||||
} catch (error) {
|
||||
console.error('RPC connection error:', error)
|
||||
}
|
||||
```
|
||||
|
||||
#### 3. UI/UX Issues
|
||||
|
||||
**Problem**: Components not rendering correctly
|
||||
|
||||
**Solution**:
|
||||
1. Check browser console for JavaScript errors
|
||||
2. Verify component props and state
|
||||
3. Check CSS conflicts with browser dev tools
|
||||
|
||||
**Problem**: Responsive design issues
|
||||
|
||||
**Solution**:
|
||||
1. Test with browser responsive mode
|
||||
2. Check Tailwind CSS breakpoints
|
||||
3. Verify NextUI component responsive props
|
||||
|
||||
```css
|
||||
/* Debug responsive issues */
|
||||
.debug-responsive {
|
||||
@apply border-2 border-red-500;
|
||||
}
|
||||
|
||||
/* Mobile first approach */
|
||||
@media (min-width: 768px) {
|
||||
/* Tablet styles */
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
/* Desktop styles */
|
||||
}
|
||||
```
|
||||
|
||||
### Performance Issues
|
||||
|
||||
#### 1. Slow Page Loading
|
||||
|
||||
**Problem**: Initial page load is slow
|
||||
|
||||
**Solution**:
|
||||
1. Analyze bundle size with webpack analyzer
|
||||
2. Implement code splitting for large components
|
||||
3. Optimize images and static assets
|
||||
|
||||
```bash
|
||||
# Analyze bundle size
|
||||
ANALYZE=true pnpm build
|
||||
```
|
||||
|
||||
```typescript
|
||||
// Implement code splitting
|
||||
const HeavyComponent = dynamic(() => import('./HeavyComponent'), {
|
||||
loading: () => <div>Loading...</div>,
|
||||
ssr: false
|
||||
})
|
||||
```
|
||||
|
||||
**Problem**: API responses are slow
|
||||
|
||||
**Solution**:
|
||||
1. Implement SWR caching strategy
|
||||
2. Add loading states for better UX
|
||||
3. Consider pagination for large datasets
|
||||
|
||||
```typescript
|
||||
// Optimize data fetching using project's actual hooks and services
|
||||
import { useMCPServicesList } from '@/hooks/useMCPServicesList'
|
||||
import { fetchServices } from '@/services/marketplaceService'
|
||||
|
||||
// Use custom hook with built-in caching
|
||||
const { data, isLoading, error, refetch } = useMCPServicesList({
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
search: '',
|
||||
status: ''
|
||||
})
|
||||
|
||||
// Implement manual caching for service data
|
||||
const cachedFetchServices = useMemo(() => {
|
||||
return async (params: FetchServicesParams) => {
|
||||
const cacheKey = JSON.stringify(params)
|
||||
const cached = sessionStorage.getItem(cacheKey)
|
||||
|
||||
if (cached) {
|
||||
return JSON.parse(cached)
|
||||
}
|
||||
|
||||
const result = await fetchServices(params)
|
||||
sessionStorage.setItem(cacheKey, JSON.stringify(result))
|
||||
return result
|
||||
}
|
||||
}, [])
|
||||
```
|
||||
|
||||
#### 2. Memory Leaks
|
||||
|
||||
**Problem**: Memory usage increases over time
|
||||
|
||||
**Solution**:
|
||||
1. Clean up event listeners in useEffect
|
||||
2. Cancel pending API requests on component unmount
|
||||
3. Properly dispose of subscriptions
|
||||
|
||||
```typescript
|
||||
// Proper cleanup
|
||||
useEffect(() => {
|
||||
const controller = new AbortController()
|
||||
|
||||
fetchData({ signal: controller.signal })
|
||||
.then(setData)
|
||||
.catch(error => {
|
||||
if (error.name !== 'AbortError') {
|
||||
console.error(error)
|
||||
}
|
||||
})
|
||||
|
||||
return () => {
|
||||
controller.abort()
|
||||
}
|
||||
}, [])
|
||||
```
|
||||
|
||||
### Deployment Issues
|
||||
|
||||
#### 1. Production Build Failures
|
||||
|
||||
**Problem**: Build works locally but fails in CI/CD
|
||||
|
||||
**Solution**:
|
||||
1. Check Node.js version consistency
|
||||
2. Verify environment variables in deployment
|
||||
3. Check for platform-specific dependencies
|
||||
|
||||
```yaml
|
||||
# GitHub Actions - Ensure consistent environment
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: latest
|
||||
```
|
||||
|
||||
**Problem**: Static assets not loading
|
||||
|
||||
**Solution**:
|
||||
1. Check asset paths in production
|
||||
2. Verify CDN configuration
|
||||
3. Check Next.js asset prefix configuration
|
||||
|
||||
```typescript
|
||||
// next.config.ts
|
||||
const nextConfig: NextConfig = {
|
||||
assetPrefix: process.env.NODE_ENV === 'production' ? '/static' : '',
|
||||
basePath: process.env.BASE_PATH || ''
|
||||
}
|
||||
```
|
||||
|
||||
#### 2. Runtime Errors in Production
|
||||
|
||||
**Problem**: Application crashes in production
|
||||
|
||||
**Solution**:
|
||||
1. Enable error tracking (Sentry)
|
||||
2. Check server logs for detailed errors
|
||||
3. Implement proper error boundaries
|
||||
|
||||
```typescript
|
||||
// Error boundary component
|
||||
class ErrorBoundary extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = { hasError: false }
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error) {
|
||||
return { hasError: true }
|
||||
}
|
||||
|
||||
componentDidCatch(error, errorInfo) {
|
||||
console.error('Error caught by boundary:', error, errorInfo)
|
||||
// Send to error tracking service
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
return <h1>Something went wrong.</h1>
|
||||
}
|
||||
|
||||
return this.props.children
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Debugging Tools
|
||||
|
||||
### 1. Browser Developer Tools
|
||||
|
||||
**Network Tab**:
|
||||
- Monitor API requests and responses
|
||||
- Check request headers and status codes
|
||||
- Analyze response times
|
||||
|
||||
**Console Tab**:
|
||||
- View JavaScript errors and warnings
|
||||
- Debug application state
|
||||
- Test API calls manually
|
||||
|
||||
**Application Tab**:
|
||||
- Inspect localStorage and sessionStorage
|
||||
- Check service worker status
|
||||
- Monitor cookies and tokens
|
||||
|
||||
### 2. React Developer Tools
|
||||
|
||||
Install React DevTools browser extension:
|
||||
- Inspect component hierarchy
|
||||
- Monitor state changes
|
||||
- Profile component performance
|
||||
|
||||
### 3. Next.js Debugging
|
||||
|
||||
```typescript
|
||||
// Enable debug mode
|
||||
export default function MyApp({ Component, pageProps }) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log('Page props:', pageProps)
|
||||
}
|
||||
|
||||
return <Component {...pageProps} />
|
||||
}
|
||||
```
|
||||
|
||||
### 4. API Debugging
|
||||
|
||||
```typescript
|
||||
// Create debug API wrapper
|
||||
const debugAPI = (url: string, options?: RequestInit) => {
|
||||
console.log('API Request:', url, options)
|
||||
|
||||
return fetch(url, options)
|
||||
.then(response => {
|
||||
console.log('API Response:', response.status, response.statusText)
|
||||
return response
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('API Error:', error)
|
||||
throw error
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## Getting Help
|
||||
|
||||
### 1. Check Documentation
|
||||
|
||||
- Review relevant documentation files in `/docs`
|
||||
- Check component documentation in code comments
|
||||
- Refer to Next.js and React documentation
|
||||
|
||||
### 2. Search Issues
|
||||
|
||||
- Check GitHub issues for similar problems
|
||||
- Search Stack Overflow for common solutions
|
||||
- Review Next.js discussions and forums
|
||||
|
||||
### 3. Create Detailed Bug Reports
|
||||
|
||||
When reporting issues, include:
|
||||
|
||||
1. **Environment Information**:
|
||||
- Node.js version
|
||||
- Browser version
|
||||
- Operating system
|
||||
|
||||
2. **Steps to Reproduce**:
|
||||
- Detailed steps to recreate the issue
|
||||
- Expected vs actual behavior
|
||||
|
||||
3. **Error Messages**:
|
||||
- Complete error messages and stack traces
|
||||
- Browser console errors
|
||||
- Server logs if applicable
|
||||
|
||||
4. **Code Samples**:
|
||||
- Minimal reproducible example
|
||||
- Relevant configuration files
|
||||
|
||||
### 4. Emergency Contacts
|
||||
|
||||
For critical production issues:
|
||||
- Check monitoring dashboards
|
||||
- Review error tracking alerts
|
||||
- Contact system administrators
|
||||
- Implement rollback procedures if necessary
|
||||
|
||||
## Prevention
|
||||
|
||||
### 1. Code Quality
|
||||
|
||||
- Use TypeScript for type safety
|
||||
- Implement comprehensive testing
|
||||
- Follow ESLint and Prettier rules
|
||||
- Conduct code reviews
|
||||
|
||||
### 2. Monitoring
|
||||
|
||||
- Set up error tracking (Sentry)
|
||||
- Monitor performance metrics
|
||||
- Implement health checks
|
||||
- Set up alerting for critical issues
|
||||
|
||||
### 3. Documentation
|
||||
|
||||
- Keep documentation up to date
|
||||
- Document known issues and solutions
|
||||
- Maintain troubleshooting runbooks
|
||||
- Share knowledge across team members
|
||||
@@ -0,0 +1,16 @@
|
||||
import { dirname } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
});
|
||||
|
||||
const eslintConfig = [
|
||||
...compat.extends("next/core-web-vitals", "next/typescript"),
|
||||
];
|
||||
|
||||
export default eslintConfig;
|
||||
@@ -0,0 +1,55 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: false,
|
||||
// Enable SSR
|
||||
output: "standalone",
|
||||
|
||||
// Optimize images
|
||||
images: {
|
||||
domains: [],
|
||||
unoptimized: false, // Enable image optimization for SSR
|
||||
},
|
||||
|
||||
// Webpack configuration
|
||||
webpack: (config) => {
|
||||
return config;
|
||||
},
|
||||
|
||||
// Redirect configuration
|
||||
async redirects() {
|
||||
return [];
|
||||
},
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
destination: `${process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:8100"}/api/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
// Headers for better performance
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
source: "/(.*)",
|
||||
headers: [
|
||||
{
|
||||
key: "X-Content-Type-Options",
|
||||
value: "nosniff",
|
||||
},
|
||||
{
|
||||
key: "X-Frame-Options",
|
||||
value: "DENY",
|
||||
},
|
||||
{
|
||||
key: "X-XSS-Protection",
|
||||
value: "1; mode=block",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
experimental: {
|
||||
optimizePackageImports: ["@nextui-org/react"],
|
||||
},
|
||||
transpilePackages: ["@nextui-org/react", "@nextui-org/theme"],
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: "https",
|
||||
hostname: "**",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "@xpack/webui",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"exports": {
|
||||
"./shared/*": "./src/shared/*"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"stop": "lsof -ti:3000 | xargs kill -9 2>/dev/null || echo 'No process running on port 3000'",
|
||||
"lint": "next lint",
|
||||
"check-types": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.4",
|
||||
"@iconify/react": "^5.0.2",
|
||||
"@nextui-org/react": "^2.6.11",
|
||||
"@nextui-org/theme": "^2.4.5",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@uiw/react-md-editor": "^4.0.7",
|
||||
"animejs": "^4.0.2",
|
||||
"crypto-js": "^4.2.0",
|
||||
"framer-motion": "^11.5.6",
|
||||
"i18next": "^23.8.0",
|
||||
"i18next-browser-languagedetector": "^7.2.0",
|
||||
"i18next-http-backend": "^2.4.2",
|
||||
"immer": "^10.0.3",
|
||||
"lottie-react": "^2.4.1",
|
||||
"lucide-react": "^0.475.0",
|
||||
"next": "^15.3.4",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.49.3",
|
||||
"react-hot-toast": "^2.4.1",
|
||||
"react-hover-video-player": "^10.0.2",
|
||||
"react-i18next": "^14.0.1",
|
||||
"react-icons": "^5.3.0",
|
||||
"react-markdown": "^10.1.0",
|
||||
"recharts": "^2.15.1",
|
||||
"simplex-noise": "^4.0.3",
|
||||
"swr": "^2.2.4",
|
||||
"three": "^0.177.0",
|
||||
"zod": "^3.22.4",
|
||||
"zustand": "^4.5.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.0",
|
||||
"@types/react": "^18.2.48",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/three": "^0.177.0",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-next": "15.0.3",
|
||||
"postcss": "^8.4.33",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
const config = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,684 @@
|
||||
{
|
||||
"MCP Store": "MCP Store",
|
||||
"Discover tools for your AI Agent": "Discover tools for your AI Agent",
|
||||
"Product Not Found": "Product Not Found",
|
||||
"The product you're looking for doesn't exist or has been removed.": "The product you're looking for doesn't exist or has been removed.",
|
||||
"Back to Store": "Back to Store",
|
||||
"Verified": "Verified",
|
||||
"Updated": "Updated",
|
||||
"days ago": "days ago",
|
||||
"Rating": "Rating",
|
||||
"Users": "Users",
|
||||
"Downloads": "Downloads",
|
||||
"Category": "Category",
|
||||
"Author": "Author",
|
||||
"Version": "Version",
|
||||
"Features": "Features",
|
||||
"Documentation": "Documentation",
|
||||
"Pricing": "Pricing",
|
||||
"Pay per use (token-based)": "Pay per use (token-based)",
|
||||
"Add to Agent": "Add to Agent",
|
||||
"Try Now": "Try Now",
|
||||
"Functions Overview": "Functions Overview",
|
||||
"Sign In": "Sign In",
|
||||
"Function List": "Function List",
|
||||
"AI Suggestions": "AI Suggestions",
|
||||
"Office Assistant": "Office Assistant",
|
||||
"Data Analysis": "Data Analysis",
|
||||
"Development Tools": "Development Tools",
|
||||
"Marketing Automation": "Marketing Automation",
|
||||
"Social Media Management": "Social Media Management",
|
||||
"Content Creation": "Content Creation",
|
||||
"includes": "includes",
|
||||
"tools": "tools",
|
||||
"Excel Processing": "Excel Processing",
|
||||
"Email Sending": "Email Sending",
|
||||
"PDF Generation": "PDF Generation",
|
||||
"Calendar Management": "Calendar Management",
|
||||
"Twitter Publisher": "Twitter Publisher",
|
||||
"Content Generator": "Content Generator",
|
||||
"Featured Packages": "Featured Packages",
|
||||
"Individual Tools": "Individual Tools",
|
||||
"Details": "Details",
|
||||
"excel": "Excel",
|
||||
"data": "Data",
|
||||
"analysis": "Analysis",
|
||||
"email": "Email",
|
||||
"automation": "Automation",
|
||||
"communication": "Communication",
|
||||
"pdf": "PDF",
|
||||
"documents": "Documents",
|
||||
"generation": "Generation",
|
||||
"calendar": "Calendar",
|
||||
"scheduling": "Scheduling",
|
||||
"events": "Events",
|
||||
"twitter": "Twitter",
|
||||
"social media": "Social Media",
|
||||
"publishing": "Publishing",
|
||||
"content": "Content",
|
||||
"marketing": "Marketing",
|
||||
"ai": "AI",
|
||||
"office": "Office",
|
||||
"social": "Social",
|
||||
"Office_assistant": "Office Assistant",
|
||||
"Data_analysis": "Data Analysis",
|
||||
"Development_tools": "Development Tools",
|
||||
"Marketing_automation": "Marketing Automation",
|
||||
"Social_media": "Social Media",
|
||||
"Content_creation": "Content Creation",
|
||||
"Free Tools": "Free Tools",
|
||||
"Inspiration Hub": "Inspiration Hub",
|
||||
"Blog": "Blog",
|
||||
"About": "About",
|
||||
"Sign up for free": "Sign up for free",
|
||||
"Best MCP Tools Collection of 2025": "Best MCP Tools Collection of 2025",
|
||||
"How It Works": "How It Works",
|
||||
"Connect APIs": "Connect APIs",
|
||||
"Process & Route": "Process & Route",
|
||||
"Global Distribution": "Global Distribution",
|
||||
"Responses are distributed globally to your AI agents and applications": "Responses are distributed globally to your AI agents and applications",
|
||||
"Free": "Free",
|
||||
"Sign up now to get 100 free calls every month.": "Sign up now to get 100 free calls every month.",
|
||||
"Generate and manage dynamic PowerPoints and Google Slides with your own custom branding and layouts.": "Generate and manage dynamic PowerPoints and Google Slides with your own custom branding and layouts.",
|
||||
"Try for free": "Try for free",
|
||||
"Lightning Fast Setup": "Lightning Fast Setup",
|
||||
"Enterprise Security": "Enterprise Security",
|
||||
"Global Scale": "Global Scale",
|
||||
"Core Features": "Core Features",
|
||||
"Built for the": "Built for the",
|
||||
"Modern Web": "Modern Web",
|
||||
"Learn more": "Learn more",
|
||||
"Ready to get started?": "Ready to get started?",
|
||||
"Join thousands of developers": "Join thousands of developers",
|
||||
"From localhost to https, in seconds.": "From localhost to https, in seconds.",
|
||||
"Deploy from Git or your CLI.": "Deploy from Git or your CLI.",
|
||||
"Chat with your team on real, production-grade UI, not just designs.": "Chat with your team on real, production-grade UI, not just designs.",
|
||||
"Route-aware observability.": "Route-aware observability.",
|
||||
"Monitor and analyze the performance and traffic of your projects.": "Monitor and analyze the performance and traffic of your projects.",
|
||||
"Trusted by builders at": "Trusted by builders at",
|
||||
"MCP Market": "MCP Market",
|
||||
"Partners": "Partners",
|
||||
"Docs": "Docs",
|
||||
"Build AI Agents": "Build AI Agents",
|
||||
"With Incredible MCP": "With Incredible MCP",
|
||||
"Instant Integration": "Instant Integration",
|
||||
"Connect to global APIs and MCP services with just one config or SDK.": "Connect to global APIs and MCP services with just one config or SDK.",
|
||||
"Zero Overhead": "Zero Overhead",
|
||||
"Flexible pay-as-you-go pricing to fuel agent growth at every stage.": "Flexible pay-as-you-go pricing to fuel agent growth at every stage.",
|
||||
"Secure & Compliant": "Secure & Compliant",
|
||||
"Trusted by.": "Trusted by.",
|
||||
"...and loved by agents": "...and loved by agents",
|
||||
"FAQs": "FAQs",
|
||||
"Weather, finance, geolocation": "Weather, finance, geolocation",
|
||||
"Visual and generative AI tools": "Visual and generative AI tools",
|
||||
"…and more are being added every week.": "…and more are being added every week.",
|
||||
"How does pricing work?": "How does pricing work?",
|
||||
"Ready to Empower Your Agent?": "Ready to Empower Your Agent?",
|
||||
"Get Started Now": "Get Started Now",
|
||||
"Get Started": "Get Started",
|
||||
"Demo": "Demo",
|
||||
"Start Deploying": "Start Deploying",
|
||||
"We help these products connect to global services.": "We help these products connect to global services.",
|
||||
"Become a partner": "Become a partner",
|
||||
"AI Design": "AI Design",
|
||||
"AI Agent": "AI Agent",
|
||||
"AI Browser": "AI Browser",
|
||||
"Home": "Home",
|
||||
"Services": "Services",
|
||||
"Interesting in \n becoming a partner?": "Interesting in \n becoming a partner?",
|
||||
"Other Partners": "Other Partners",
|
||||
"Services List": "Services List",
|
||||
"Submit services": "Submit services",
|
||||
"Interesting in \n becoming a services supplier?": "Interesting in \n becoming a services supplier?",
|
||||
"Apply to become a supplier and provide services to global users.": "Apply to become a supplier and provide services to global users.",
|
||||
"Become a supplier": "Become a supplier",
|
||||
"We only list some services": "We only list some services",
|
||||
"Other Services": "Other Services",
|
||||
"Submit a demo": "Submit a demo",
|
||||
"Number of service categories": "Number of service categories",
|
||||
"Number of MCP Tools": "Number of MCP Tools",
|
||||
"Time for integration": "Time for integration",
|
||||
"Daily MCP request count": "Daily MCP request count",
|
||||
"10 Second": "10 Second",
|
||||
"15 Categories": "15 Categories",
|
||||
"1000+ Tools": "1000+ Tools",
|
||||
"1 Million+": "1 Million+",
|
||||
"API Name": "API Name",
|
||||
"Description": "Description",
|
||||
"Integrate once,\nnot a thousand times.": "Integrate once,\nnot a thousand times.",
|
||||
"Payment Successful!": "Payment Successful!",
|
||||
"Congratulations, your payment has been processed successfully. Thank you for your love!": "Congratulations, your payment has been processed successfully. Thank you for your love!",
|
||||
"It's hard to say goodbyes": "It's hard to say goodbyes",
|
||||
"We're sorry to see you go. Your subscription has been cancelled.": "We're sorry to see you go. Your subscription has been cancelled.",
|
||||
"Playground": "Playground",
|
||||
"MCP Services Management": "MCP Services Management",
|
||||
"Service List": "Service List",
|
||||
"Add Service": "Add Service",
|
||||
"OpenAPI Generator": "OpenAPI Generator",
|
||||
"Service Name": "Service Name",
|
||||
"Service Description": "Service Description",
|
||||
"Service Category": "Service Category",
|
||||
"Service Status": "Service Status",
|
||||
"Online": "Online",
|
||||
"Offline": "Offline",
|
||||
"Actions": "Actions",
|
||||
"Edit": "Edit",
|
||||
"Delete": "Delete",
|
||||
"Toggle Status": "Toggle Status",
|
||||
"Create New Service": "Create New Service",
|
||||
"Edit Service": "Edit Service",
|
||||
"Generate from OpenAPI": "Generate from OpenAPI",
|
||||
"Update from OpenAPI": "Update from OpenAPI",
|
||||
"Sync from OpenAPI": "Sync from OpenAPI",
|
||||
"Sync service configuration from OpenAPI/Swagger documentation": "Sync service configuration from OpenAPI/Swagger documentation",
|
||||
"Sync Service": "Sync Service",
|
||||
"OpenAPI URL": "OpenAPI URL",
|
||||
"Upload OpenAPI File": "Upload OpenAPI File",
|
||||
"Generate Service": "Generate Service",
|
||||
"Service Configuration": "Service Configuration",
|
||||
"API Endpoint": "API Endpoint",
|
||||
"Authentication": "Authentication",
|
||||
"API Key": "API Key",
|
||||
"Bearer Token": "Bearer Token",
|
||||
"Basic Auth": "Basic Auth",
|
||||
"No Auth": "No Auth",
|
||||
"Markdown Documentation": "Markdown Documentation",
|
||||
"Save": "Save",
|
||||
"Cancel": "Cancel",
|
||||
"Manage Tools": "Manage Tools",
|
||||
"Tools Count": "Tools Count",
|
||||
"Tool Name": "Tool Name",
|
||||
"Tool Description": "Tool Description",
|
||||
"Add Tool": "Add Tool",
|
||||
"Edit Tool": "Edit Tool",
|
||||
"Delete Tool": "Delete Tool",
|
||||
"Save Changes": "Save Changes",
|
||||
"No tools configured for this service": "No tools configured for this service",
|
||||
"Add tools to extend service functionality": "Add tools to extend service functionality",
|
||||
"Configure and manage tools for this service": "Configure and manage tools for this service",
|
||||
"Add New Tool": "Add New Tool",
|
||||
"Enter tool name": "Enter tool name",
|
||||
"Enter tool description": "Enter tool description",
|
||||
"Tool name": "Tool name",
|
||||
"Tool description": "Tool description",
|
||||
"Take Offline": "Take Offline",
|
||||
"Bring Online": "Bring Online",
|
||||
"Short Description": "Short Description",
|
||||
"Long Description": "Long Description",
|
||||
"Brief description of the service": "Brief description of the service",
|
||||
"Detailed description of the service": "Detailed description of the service",
|
||||
"Basic Information": "Basic Information",
|
||||
"API Configuration": "API Configuration",
|
||||
"Authentication Type": "Authentication Type",
|
||||
"Update Service": "Update Service",
|
||||
"Create Service": "Create Service",
|
||||
"Confirm Delete": "Confirm Delete",
|
||||
"Are you sure you want to delete this service?": "Are you sure you want to delete this service?",
|
||||
"This action cannot be undone.": "This action cannot be undone.",
|
||||
"Manage your MCP services, configure APIs, and monitor service status": "Manage your MCP services, configure APIs, and monitor service status",
|
||||
"Search services...": "Search services...",
|
||||
"Filter by category": "Filter by category",
|
||||
"Filter by status": "Filter by status",
|
||||
"All Categories": "All Categories",
|
||||
"All Status": "All Status",
|
||||
"Created": "Created",
|
||||
"Last Updated": "Last Updated",
|
||||
"Total Services": "Total Services",
|
||||
"Online Services": "Online Services",
|
||||
"Offline Services": "Offline Services",
|
||||
"Service created successfully": "Service created successfully",
|
||||
"Service updated successfully": "Service updated successfully",
|
||||
"Service deleted successfully": "Service deleted successfully",
|
||||
"Service status updated successfully": "Service status updated successfully",
|
||||
"Failed to create service": "Failed to create service",
|
||||
"Failed to update service": "Failed to update service",
|
||||
"Failed to delete service": "Failed to delete service",
|
||||
"Failed to update service status": "Failed to update service status",
|
||||
"Invalid OpenAPI URL": "Invalid OpenAPI URL",
|
||||
"Failed to parse OpenAPI document": "Failed to parse OpenAPI document",
|
||||
"OpenAPI document parsed successfully": "OpenAPI document parsed successfully",
|
||||
"Please enter a valid URL": "Please enter a valid URL",
|
||||
"Please select a file": "Please select a file",
|
||||
"File uploaded successfully": "File uploaded successfully",
|
||||
"Failed to upload file": "Failed to upload file",
|
||||
"Service name is required": "Service name is required",
|
||||
"Service description is required": "Service description is required",
|
||||
"API endpoint is required": "API endpoint is required",
|
||||
"Documentation is required": "Documentation is required",
|
||||
"Connect Your AI Agent to the Real World": "Connect Your AI Agent to the Real World",
|
||||
"Open‑source MCP marketplace — publish or consume APIs in minutes.": "Open‑source MCP marketplace — publish or consume APIs in minutes.",
|
||||
"get latest documentation for libraries": "get latest documentation for libraries",
|
||||
"execute terminal commands safely": "execute terminal commands safely",
|
||||
"find latest scientific research papers": "find latest scientific research papers",
|
||||
"tools to enhance thinking and reasoning": "tools to enhance thinking and reasoning",
|
||||
"find flight tickets and airbnb listings": "find flight tickets and airbnb listings",
|
||||
"automate web browser interactions": "automate web browser interactions",
|
||||
"send messages and receive notifications": "send messages and receive notifications",
|
||||
"Marketplace": "Marketplace",
|
||||
"{{count}} Tools": "{{count}} Tools",
|
||||
"Overview": "Overview",
|
||||
"Tools": "Tools",
|
||||
"Welcome": "Welcome",
|
||||
"Log in to your account to continue": "Log in to your account to continue",
|
||||
"Log in with Google": "Log in with Google",
|
||||
"OR": "OR",
|
||||
"Email": "Email",
|
||||
"Enter your email": "Enter your email",
|
||||
"Continue": "Continue",
|
||||
"Check your email": "Check your email",
|
||||
"We sent a verification code to": "We sent a verification code to",
|
||||
"Verification Code": "Verification Code",
|
||||
"Enter 6-digit code": "Enter 6-digit code",
|
||||
"Verify": "Verify",
|
||||
"Resend code": "Resend code",
|
||||
"Verification code sent": "Verification code sent",
|
||||
"Failed to send verification code": "Failed to send verification code",
|
||||
"Verification failed": "Verification failed",
|
||||
"Login Success": "Login Success",
|
||||
"Login Error": "Login Error",
|
||||
"Back Home": "Back Home",
|
||||
"MCP Services": "MCP Services",
|
||||
"User Management": "User Management",
|
||||
"Revenue Management": "Revenue Management",
|
||||
"Payment Channels": "Payment Channels",
|
||||
"System Settings": "System Settings",
|
||||
"Overview and analytics": "Overview and analytics",
|
||||
"Manage MCP services and API tools": "Manage MCP services and API tools",
|
||||
"Manage registered users": "Manage registered users",
|
||||
"View user recharge history": "View user recharge history",
|
||||
"Configure payment channels": "Configure payment channels",
|
||||
"Platform basic configuration": "Platform basic configuration",
|
||||
"Admin Dashboard": "Admin Dashboard",
|
||||
"Platform management and analytics": "Platform management and analytics",
|
||||
"Total Users": "Total Users",
|
||||
"Active Users": "Active Users",
|
||||
"New Users Today": "New Users Today",
|
||||
"User ID": "User ID",
|
||||
"Username": "Username",
|
||||
"Email Address": "Email Address",
|
||||
"Registration Date": "Registration Date",
|
||||
"Last Login": "Last Login",
|
||||
"User Role": "User Role",
|
||||
"User Status": "User Status",
|
||||
"Active": "Active",
|
||||
"Inactive": "Inactive",
|
||||
"Banned": "Banned",
|
||||
"Admin": "Admin",
|
||||
"User": "User",
|
||||
"Search users...": "Search users...",
|
||||
"Filter by role": "Filter by role",
|
||||
"All Roles": "All Roles",
|
||||
"Ban User": "Ban User",
|
||||
"Unban User": "Unban User",
|
||||
"Delete User": "Delete User",
|
||||
"View Profile": "View Profile",
|
||||
"Edit User": "Edit User",
|
||||
"User Profile": "User Profile",
|
||||
"Personal Information": "Personal Information",
|
||||
"Account Settings": "Account Settings",
|
||||
"Full Name": "Full Name",
|
||||
"Phone Number": "Phone Number",
|
||||
"Registration IP": "Registration IP",
|
||||
"Last Login IP": "Last Login IP",
|
||||
"Account Created": "Account Created",
|
||||
"Email Verified": "Email Verified",
|
||||
"Two Factor Auth": "Two Factor Auth",
|
||||
"Enabled": "Enabled",
|
||||
"Disabled": "Disabled",
|
||||
"Yes": "Yes",
|
||||
"No": "No",
|
||||
"User Statistics": "User Statistics",
|
||||
"API Calls": "API Calls",
|
||||
"Services Used": "Services Used",
|
||||
"Total Spent": "Total Spent",
|
||||
"Wallet Balance": "Wallet Balance",
|
||||
"Confirm Ban User": "Confirm Ban User",
|
||||
"Are you sure you want to ban this user?": "Are you sure you want to ban this user?",
|
||||
"Confirm Unban User": "Confirm Unban User",
|
||||
"Are you sure you want to unban this user?": "Are you sure you want to unban this user?",
|
||||
"Confirm Delete User": "Confirm Delete User",
|
||||
"Are you sure you want to delete this user?": "Are you sure you want to delete this user?",
|
||||
"This will permanently delete all user data.": "This will permanently delete all user data.",
|
||||
"User banned successfully": "User banned successfully",
|
||||
"User unbanned successfully": "User unbanned successfully",
|
||||
"User deleted successfully": "User deleted successfully",
|
||||
"Failed to ban user": "Failed to ban user",
|
||||
"Failed to unban user": "Failed to unban user",
|
||||
"Failed to delete user": "Failed to delete user",
|
||||
"User updated successfully": "User updated successfully",
|
||||
"Failed to update user": "Failed to update user",
|
||||
"Manage platform users and permissions": "Manage platform users and permissions",
|
||||
"Register": "Register",
|
||||
"Sign Up": "Sign Up",
|
||||
"Create Account": "Create Account",
|
||||
"Already have an account?": "Already have an account?",
|
||||
"Don't have an account?": "Don't have an account?",
|
||||
"Password": "Password",
|
||||
"Confirm Password": "Confirm Password",
|
||||
"Enter your password": "Enter your password",
|
||||
"Confirm your password": "Confirm your password",
|
||||
"Passwords do not match": "Passwords do not match",
|
||||
"Password must be at least 8 characters": "Password must be at least 8 characters",
|
||||
"Registration successful": "Registration successful",
|
||||
"Registration failed": "Registration failed",
|
||||
"Email already exists": "Email already exists",
|
||||
"Invalid email format": "Invalid email format",
|
||||
"Sign up with Google": "Sign up with Google",
|
||||
"Terms of Service": "Terms of Service",
|
||||
"Privacy Policy": "Privacy Policy",
|
||||
"By signing up, you agree to our": "By signing up, you agree to our",
|
||||
"and": "and",
|
||||
"Forgot Password?": "Forgot Password?",
|
||||
"Reset Password": "Reset Password",
|
||||
"Send Reset Link": "Send Reset Link",
|
||||
"Back to Login": "Back to Login",
|
||||
"Password reset email sent": "Password reset email sent",
|
||||
"Failed to send reset email": "Failed to send reset email",
|
||||
"Invalid credentials": "Invalid credentials",
|
||||
"Account not found": "Account not found",
|
||||
"Account is banned": "Account is banned",
|
||||
"Please verify your email": "Please verify your email",
|
||||
"Login failed": "Login failed",
|
||||
"Failed to fetch system config": "Failed to fetch system config",
|
||||
"Failed to save platform config": "Failed to save platform config",
|
||||
"Failed to test platform config": "Failed to test platform config",
|
||||
"Failed to fetch admin config": "Failed to fetch admin config",
|
||||
"Failed to save admin config": "Failed to save admin config",
|
||||
"Failed to test admin login": "Failed to test admin login",
|
||||
"Failed to fetch Google auth config": "Failed to fetch Google auth config",
|
||||
"Failed to save Google auth config": "Failed to save Google auth config",
|
||||
"Failed to test Google auth": "Failed to test Google auth",
|
||||
"Failed to fetch Stripe config": "Failed to fetch Stripe config",
|
||||
"Failed to save Stripe config": "Failed to save Stripe config",
|
||||
"Stripe connection test failed": "Stripe connection test failed",
|
||||
"Stripe connection test successful": "Stripe connection test successful",
|
||||
"Connection test failed": "Connection test failed",
|
||||
"Unknown error": "Unknown error",
|
||||
"Secret Key cannot be empty": "Secret Key cannot be empty",
|
||||
"Stripe Configuration": "Stripe Configuration",
|
||||
"Google Login Settings": "Google Login Settings",
|
||||
"Enable Google Login": "Enable Google Login",
|
||||
"Administrator Account": "Administrator Account",
|
||||
"Platform Information": "Platform Information",
|
||||
"Delete Service": "Delete Service",
|
||||
"Parsing OpenAPI document...": "Parsing OpenAPI document...",
|
||||
"Generated Service Configuration": "Generated Service Configuration",
|
||||
"None": "None",
|
||||
"Tags": "Tags",
|
||||
"Paid": "Paid",
|
||||
"Premium": "Premium",
|
||||
"Tools Management": "Tools Management",
|
||||
"Detailed Description": "Detailed Description",
|
||||
"Revenue Analytics": "Revenue Analytics",
|
||||
"View revenue trends and statistics": "View revenue trends and statistics",
|
||||
"Recharge History": "Recharge History",
|
||||
"Track user payment and recharge records": "Track user payment and recharge records",
|
||||
"Financial Reports": "Financial Reports",
|
||||
"Generate detailed financial reports": "Generate detailed financial reports",
|
||||
"User Profiles": "User Profiles",
|
||||
"View and edit user information": "View and edit user information",
|
||||
"Permissions": "Permissions",
|
||||
"Manage user roles and access rights": "Manage user roles and access rights",
|
||||
"Activity Monitor": "Activity Monitor",
|
||||
"Track user activities and usage": "Track user activities and usage",
|
||||
"Close menu": "Close menu",
|
||||
"Open menu": "Open menu",
|
||||
"MCP Store Logo": "MCP Store Logo",
|
||||
"Computer Vision": "Computer Vision",
|
||||
"Sports": "Sports",
|
||||
"Entertainment": "Entertainment",
|
||||
"Art": "Art",
|
||||
"Business": "Business",
|
||||
"Others": "Others",
|
||||
"Multimedia": "Multimedia",
|
||||
"SSG": "SSG",
|
||||
"WebTool": "WebTool",
|
||||
"ContentPanel": "ContentPanel",
|
||||
"Verification code must be 6 digits": "Verification code must be 6 digits",
|
||||
"Please enter the 6-digit verification code we sent to the above email. This code expires within 30 minutes.": "Please enter the 6-digit verification code we sent to the above email. This code expires within 30 minutes.",
|
||||
"Go to email": "Go to email",
|
||||
"Enter your verification code": "Enter your verification code",
|
||||
"Resend": "Resend",
|
||||
"Verify Email Error": "Verify Email Error",
|
||||
"Generate MCP service configuration from OpenAPI/Swagger documentation": "Generate MCP service configuration from OpenAPI/Swagger documentation",
|
||||
"From URL": "From URL",
|
||||
"Upload File": "Upload File",
|
||||
"Choose File": "Choose File",
|
||||
"Supports JSON and YAML formats": "Supports JSON and YAML formats",
|
||||
"Use Generated Configuration": "Use Generated Configuration",
|
||||
"Invalid email address": "Invalid email address",
|
||||
"Back to Home": "Back to Home",
|
||||
"Enter the URL to your OpenAPI/Swagger specification": "Enter the URL to your OpenAPI/Swagger specification",
|
||||
"Enter service name": "Enter service name",
|
||||
"The header name for the API key (e.g., X-API-Key, Authorization)": "The header name for the API key (e.g., X-API-Key, Authorization)",
|
||||
"Enter API key": "Enter API key",
|
||||
"Enter bearer token": "Enter bearer token",
|
||||
"The bearer token for authentication": "The bearer token for authentication",
|
||||
"Add tag": "Add tag",
|
||||
"per call": "per call",
|
||||
"per": "per",
|
||||
"Per Token": "Per Token",
|
||||
"Per Call": "Per Call",
|
||||
"Charge Type": "Charge Type",
|
||||
"Price": "Price",
|
||||
"Price per unit (call or token)": "Price per unit (call or token)",
|
||||
"No charge for API calls": "No charge for API calls",
|
||||
"Fixed price per API call": "Fixed price per API call",
|
||||
"Price based on token consumption": "Price based on token consumption",
|
||||
"Price (cents)": "Price (cents)",
|
||||
"Token Unit": "Token Unit",
|
||||
"Number of tokens per billing unit": "Number of tokens per billing unit",
|
||||
"Daily Free Calls": "Daily Free Calls",
|
||||
"Number of free calls per day per user": "Number of free calls per day per user",
|
||||
"Import": "Import",
|
||||
"API Key Header Name": "API Key Header Name",
|
||||
"Secret Key format is incorrect, should start with sk_": "Secret Key format is incorrect, should start with sk_",
|
||||
"Webhook Secret format is incorrect, should start with whsec_": "Webhook Secret format is incorrect, should start with whsec_",
|
||||
"Password must be at least 8 characters long": "Password must be at least 8 characters long",
|
||||
"OAuth 2.0 Client Secret (optional, for server-side verification)": "OAuth 2.0 Client Secret (optional, for server-side verification)",
|
||||
"Authorized redirect URI configured in Google Cloud Console": "Authorized redirect URI configured in Google Cloud Console",
|
||||
"Webhook signing secret for verifying Stripe events": "Webhook signing secret for verifying Stripe events",
|
||||
"URL of the platform logo image (optional)": "URL of the platform logo image (optional)",
|
||||
"Failed to load system configurations": "Failed to load system configurations",
|
||||
"Platform configuration saved successfully": "Platform configuration saved successfully",
|
||||
"Failed to save platform configuration": "Failed to save platform configuration",
|
||||
"Administrator configuration saved successfully": "Administrator configuration saved successfully",
|
||||
"Failed to save administrator configuration": "Failed to save administrator configuration",
|
||||
"Google authentication configuration saved successfully": "Google authentication configuration saved successfully",
|
||||
"Failed to save Google authentication configuration": "Failed to save Google authentication configuration",
|
||||
"Configure Google OAuth integration": "Configure Google OAuth integration",
|
||||
"Allow users to sign in with Google": "Allow users to sign in with Google",
|
||||
"Google Client ID": "Google Client ID",
|
||||
"OAuth 2.0 Client ID from Google Cloud Console": "OAuth 2.0 Client ID from Google Cloud Console",
|
||||
"Google Client Secret": "Google Client Secret",
|
||||
"Redirect URI": "Redirect URI",
|
||||
"Configuration Guide": "Configuration Guide",
|
||||
"Create a project in Google Cloud Console": "Create a project in Google Cloud Console",
|
||||
"Enable Google+ API or Google Sign-In API": "Enable Google+ API or Google Sign-In API",
|
||||
"Create OAuth 2.0 credentials": "Create OAuth 2.0 credentials",
|
||||
"Add authorized redirect URIs": "Add authorized redirect URIs",
|
||||
"Copy the Client ID and Client Secret": "Copy the Client ID and Client Secret",
|
||||
"Configure administrator login credentials": "Configure administrator login credentials",
|
||||
"Administrator Username": "Administrator Username",
|
||||
"Enter administrator username": "Enter administrator username",
|
||||
"Username for administrator login": "Username for administrator login",
|
||||
"Administrator Password": "Administrator Password",
|
||||
"Enter administrator password": "Enter administrator password",
|
||||
"Re-enter the password to confirm": "Re-enter the password to confirm",
|
||||
"Confirm administrator password": "Confirm administrator password",
|
||||
"Configure platform logo, name and currency": "Configure platform logo, name and currency",
|
||||
"Platform Name": "Platform Name",
|
||||
"Enter platform name": "Enter platform name",
|
||||
"The name displayed across the platform": "The name displayed across the platform",
|
||||
"Platform Logo URL": "Platform Logo URL",
|
||||
"Currency Unit": "Currency Unit",
|
||||
"Select currency": "Select currency",
|
||||
"Default currency for the platform": "Default currency for the platform",
|
||||
"call": "call",
|
||||
"No services found": "No services found",
|
||||
"free/day": "free/day",
|
||||
"Account (Email)": "Account (Email)",
|
||||
"Recharge Amount": "Recharge Amount",
|
||||
"Recharge Time": "Recharge Time",
|
||||
"Payment Method": "Payment Method",
|
||||
"Transaction ID": "Transaction ID",
|
||||
"Status": "Status",
|
||||
"Completed": "Completed",
|
||||
"Pending": "Pending",
|
||||
"Failed": "Failed",
|
||||
"No revenue records found": "No revenue records found",
|
||||
"Search by email or transaction ID...": "Search by email or transaction ID...",
|
||||
"Balance": "Balance",
|
||||
"No users found": "No users found",
|
||||
"No tools added yet. Add your first tool using the input above.": "No tools added yet. Add your first tool using the input above.",
|
||||
"Insert tool below": "Insert tool below",
|
||||
"Remove tool": "Remove tool",
|
||||
"Service Detail": "Service Detail",
|
||||
"Billing Mode": "Billing Mode",
|
||||
"Enable free quota": "Enable free quota",
|
||||
"Configure Stripe payment interface": "Configure Stripe payment interface",
|
||||
"Secret Key": "Secret Key",
|
||||
"Stripe secret key for server-side API calls": "Stripe secret key for server-side API calls",
|
||||
"Webhook Secret": "Webhook Secret",
|
||||
"Test Connection": "Test Connection",
|
||||
"Monitor platform revenue and view user recharge history": "Monitor platform revenue and view user recharge history",
|
||||
"Manage registered users, view user information, and handle user operations": "Manage registered users, view user information, and handle user operations",
|
||||
"Monitor platform revenue, view user recharge history, analyze financial data, and generate revenue reports.": "Monitor platform revenue, view user recharge history, analyze financial data, and generate revenue reports.",
|
||||
"Manage all registered users, view user profiles, handle permissions, and monitor user activities.": "Manage all registered users, view user profiles, handle permissions, and monitor user activities.",
|
||||
"API Key Value": "API Key Value",
|
||||
"Total Balance": "Total Balance",
|
||||
"Monthly growth 12%": "Monthly growth 12%",
|
||||
"Platform total fund pool": "Platform total fund pool",
|
||||
"Today's API Calls": "Today's API Calls",
|
||||
"API call count": "API call count",
|
||||
"Total MCP Services": "Total MCP Services",
|
||||
"Deployed services": "Deployed services",
|
||||
"This is your AI service management center. You can quickly view platform core data on the left and manage and configure your MCP services, users, payment channels, etc.": "This is your AI service management center. You can quickly view platform core data on the left and manage and configure your MCP services, users, payment channels, etc.",
|
||||
"Log In": "Log In",
|
||||
"Register Date": "Register Date",
|
||||
"Dashboard": "Dashboard",
|
||||
"Account": "Account",
|
||||
"Date": "Date",
|
||||
"Amount": "Amount",
|
||||
"My Wallet": "My Wallet",
|
||||
"Manage your wallet balance and view recharge history": "Manage your wallet balance and view recharge history",
|
||||
"Available Balance": "Available Balance",
|
||||
"Recharge": "Recharge",
|
||||
"No recharge history found": "No recharge history found",
|
||||
"Loading...": "Loading...",
|
||||
"Copied to clipboard": "Copied to clipboard",
|
||||
"Failed to create auth key": "Failed to create auth key",
|
||||
"Failed to update auth key": "Failed to update auth key",
|
||||
"Auth key updated successfully": "Auth key updated successfully",
|
||||
"Create": "Create",
|
||||
"Update": "Update",
|
||||
"Copy": "Copy",
|
||||
"Close": "Close",
|
||||
"MCP Config": "MCP Config",
|
||||
"Copy full config": "Copy full config",
|
||||
"Analytics": "Analytics",
|
||||
"Times": "Times",
|
||||
"No analytics data available": "No analytics data available",
|
||||
"Delete Auth Key": "Delete Auth Key",
|
||||
"Are you sure you want to delete the \"{{keyName}}\" Auth key?": "Are you sure you want to delete the \"{{keyName}}\" Auth key?",
|
||||
"This action cannot be undone. All applications using this API key will stop working.": "This action cannot be undone. All applications using this API key will stop working.",
|
||||
"Failed to delete": "Failed to delete",
|
||||
"Deleted successfully": "Deleted successfully",
|
||||
"My Dashboard": "My Dashboard",
|
||||
"Manage your integration and auth key": "Manage your integration and auth key",
|
||||
"Auth Key": "Auth Key",
|
||||
"New": "New",
|
||||
"tokens": "tokens",
|
||||
"Credit Card": "Credit Card",
|
||||
"PayPal": "PayPal",
|
||||
"Bank Transfer": "Bank Transfer",
|
||||
"Alipay": "Alipay",
|
||||
"WeChat Pay": "WeChat Pay",
|
||||
"Confirm": "Confirm",
|
||||
"Recharge Account": "Recharge Account",
|
||||
"Funds will be added to your account balance": "Funds will be added to your account balance",
|
||||
"Manage your balance and recharge history": "Manage your balance and recharge history",
|
||||
"Build incredible AI agents together": "Build incredible AI agents together",
|
||||
"Balance: {{amount}}": "Balance: {{amount}}",
|
||||
"Log Out": "Log Out",
|
||||
"Enter your username": "Enter your username",
|
||||
"Login": "Login",
|
||||
"Admin Portal": "Admin Portal",
|
||||
"Log in to admin console": "Log in to admin console",
|
||||
"Welcome to XPack.AI Open Source": "Welcome to XPack.AI Open Source",
|
||||
"Are you sure you want to delete this \"{{name}}\" service?": "Are you sure you want to delete this \"{{name}}\" service?",
|
||||
"Service status toggled successfully": "Service status toggled successfully",
|
||||
"Failed to toggle service status": "Failed to toggle service status",
|
||||
"Stripe configuration saved successfully": "Stripe configuration saved successfully",
|
||||
"Failed to save Stripe configuration": "Failed to save Stripe configuration",
|
||||
"System config updated successfully": "System config updated successfully",
|
||||
"Failed to update system config": "Failed to update system config",
|
||||
"Confirm Purchase": "Confirm Purchase",
|
||||
"Payment completed": "Payment completed",
|
||||
"Waiting for payment, remaining time: ": "Waiting for payment, remaining time: ",
|
||||
"Payment failed": "Payment failed",
|
||||
"Payment expired": "Payment expired",
|
||||
"Payment cancelled": "Payment cancelled",
|
||||
"Payment pending": "Payment pending",
|
||||
"After the transaction is completed, the status will be automatically refreshed. If there is no response for a long time, you can manually click the [Yes, I've Paid] button to refresh the status.": "After the transaction is completed, the status will be automatically refreshed. If there is no response for a long time, you can manually click the [Yes, I've Paid] button to refresh the status.",
|
||||
"Your Auth Key:": "Your Auth Key:",
|
||||
"Authorization Created": "Authorization Created",
|
||||
"Create New Authorization": "Create New Authorization",
|
||||
"Edit Authorization": "Edit Authorization",
|
||||
"Authorization Name": "Authorization Name",
|
||||
"Edit authorization name": "Edit authorization name",
|
||||
"Done": "Done",
|
||||
"Start Now!!": "Start Now!!",
|
||||
"Yes, I've Paid": "Yes, I've Paid",
|
||||
"Payment timeout": "Payment timeout",
|
||||
"Payment timeout, please try again later": "Payment timeout, please try again later",
|
||||
"Payment not completed yet. Please complete the payment before proceeding.": "Payment not completed yet. Please complete the payment before proceeding.",
|
||||
"Platform registered users": "Platform registered users",
|
||||
"Total Revenue": "Total Revenue",
|
||||
"Failed to save stripe config": "Failed to save stripe config",
|
||||
"Stripe config saved successfully": "Stripe config saved successfully",
|
||||
"Login successful": "Login successful",
|
||||
"Logged out successfully": "Logged out successfully",
|
||||
"Configure email settings": "Configure email settings",
|
||||
"Email Configuration": "Email Configuration",
|
||||
"Configure SMTP settings for email notifications": "Configure SMTP settings for email notifications",
|
||||
"SMTP Host": "SMTP Host",
|
||||
"Enter SMTP host": "Enter SMTP host",
|
||||
"SMTP server hostname or IP address": "SMTP server hostname or IP address",
|
||||
"SMTP Port": "SMTP Port",
|
||||
"Enter SMTP port": "Enter SMTP port",
|
||||
"SMTP server port number": "SMTP server port number",
|
||||
"Common Ports": "Common Ports",
|
||||
"Custom Port": "Custom Port",
|
||||
"Custom": "Custom",
|
||||
"SMTP Username": "SMTP Username",
|
||||
"Enter SMTP username": "Enter SMTP username",
|
||||
"Username for SMTP authentication": "Username for SMTP authentication",
|
||||
"SMTP Password": "SMTP Password",
|
||||
"Enter SMTP password": "Enter SMTP password",
|
||||
"Password for SMTP authentication": "Password for SMTP authentication",
|
||||
"Sender Email": "Sender Email",
|
||||
"Enter sender email": "Enter sender email",
|
||||
"Email address used as sender": "Email address used as sender",
|
||||
"Email configuration saved successfully": "Email configuration saved successfully",
|
||||
"Failed to save email configuration": "Failed to save email configuration",
|
||||
"Test Email Connection": "Test Email Connection",
|
||||
"Enter SMTP server address": "Enter SMTP server address",
|
||||
"Select or enter port": "Select or enter port",
|
||||
"Enter custom port": "Enter custom port",
|
||||
"Invalid port number": "Invalid port number",
|
||||
"Enter sender email address": "Enter sender email address",
|
||||
"Common SMTP Settings": "Common SMTP Settings",
|
||||
"Website Title": "Website Title",
|
||||
"Enter website title": "Enter website title",
|
||||
"The title displayed in browser tab and search results": "The title displayed in browser tab and search results",
|
||||
"Headline": "Headline",
|
||||
"Enter homepage headline": "Enter homepage headline",
|
||||
"Main headline displayed on the homepage": "Main headline displayed on the homepage",
|
||||
"Subheadline": "Subheadline",
|
||||
"Enter homepage subheadline": "Enter homepage subheadline",
|
||||
"Secondary headline displayed below the main headline": "Secondary headline displayed below the main headline",
|
||||
"Platform Language": "Platform Language",
|
||||
"Select platform language": "Select platform language",
|
||||
"Configure platform logo, name, titles, language": "Configure platform logo, name, titles, language"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,686 @@
|
||||
{
|
||||
"MCP Store": "MCP 商店",
|
||||
"Discover tools for your AI Agent": "为你的 AI Agent 发现工具",
|
||||
"Product Not Found": "产品未找到",
|
||||
"The product you're looking for doesn't exist or has been removed.": "您要查找的产品不存在或已被删除。",
|
||||
"Back to Store": "返回商店",
|
||||
"Verified": "已验证",
|
||||
"Updated": "更新于",
|
||||
"days ago": "天前",
|
||||
"Rating": "评分",
|
||||
"Users": "用户",
|
||||
"Downloads": "下载量",
|
||||
"Category": "分类",
|
||||
"Author": "作者",
|
||||
"Version": "版本",
|
||||
"Features": "功能特性",
|
||||
"Documentation": "文档",
|
||||
"Pricing": "定价",
|
||||
"Pay per use (token-based)": "按使用付费(基于 Token)",
|
||||
"Add to Agent": "添加到 Agent",
|
||||
"Try Now": "立即试用",
|
||||
"Functions Overview": "功能概览",
|
||||
"Sign In": "登录",
|
||||
"Function List": "功能清单",
|
||||
"AI Suggestions": "AI 建议",
|
||||
"Office Assistant": "办公助手",
|
||||
"Data Analysis": "数据分析",
|
||||
"Development Tools": "开发工具",
|
||||
"Marketing Automation": "营销自动化",
|
||||
"Social Media Management": "社交媒体管理",
|
||||
"Content Creation": "内容创作",
|
||||
"includes": "包含",
|
||||
"tools": "工具",
|
||||
"Excel Processing": "Excel 处理",
|
||||
"Email Sending": "邮件发送",
|
||||
"PDF Generation": "PDF 生成",
|
||||
"Calendar Management": "日历管理",
|
||||
"Twitter Publisher": "Twitter 发布",
|
||||
"Content Generator": "内容生成",
|
||||
"Featured Packages": "精选工具包",
|
||||
"Individual Tools": "单个工具",
|
||||
"Details": "详情",
|
||||
"excel": "Excel",
|
||||
"data": "数据",
|
||||
"analysis": "分析",
|
||||
"email": "邮件",
|
||||
"automation": "自动化",
|
||||
"communication": "通信",
|
||||
"pdf": "PDF",
|
||||
"documents": "文档",
|
||||
"generation": "生成",
|
||||
"calendar": "日历",
|
||||
"scheduling": "调度",
|
||||
"events": "事件",
|
||||
"twitter": "Twitter",
|
||||
"social media": "社交媒体",
|
||||
"publishing": "发布",
|
||||
"content": "内容",
|
||||
"marketing": "营销",
|
||||
"ai": "AI",
|
||||
"office": "办公",
|
||||
"social": "社交",
|
||||
"Office_assistant": "办公助手",
|
||||
"Data_analysis": "数据分析",
|
||||
"Development_tools": "开发工具",
|
||||
"Marketing_automation": "营销自动化",
|
||||
"Social_media": "社交媒体",
|
||||
"Content_creation": "内容创作",
|
||||
"Free Tools": "免费工具",
|
||||
"Inspiration Hub": "灵感中心",
|
||||
"Blog": "博客",
|
||||
"About": "关于",
|
||||
"Sign up for free": "免费注册",
|
||||
"Best MCP Tools Collection of 2025": "2025年最佳MCP工具集合",
|
||||
"How It Works": "工作原理",
|
||||
"Connect APIs": "连接 API",
|
||||
"Process & Route": "处理与路由",
|
||||
"Global Distribution": "全球分发",
|
||||
"Responses are distributed globally to your AI agents and applications": "响应全球分发到您的 AI Agent 和应用程序",
|
||||
"Free": "免费",
|
||||
"Sign up now to get 100 free calls every month.": "注册即可获得每月 100 次免费调用",
|
||||
"Generate and manage dynamic PowerPoints and Google Slides with your own custom branding and layouts.": "使用您自己的自定义品牌和布局生成和管理动态 PowerPoint 和 Google 幻灯片。",
|
||||
"Try for free": "免费试用",
|
||||
"Lightning Fast Setup": "闪电般快速设置",
|
||||
"Enterprise Security": "企业级安全",
|
||||
"Global Scale": "全球规模",
|
||||
"Core Features": "核心功能",
|
||||
"Built for the": "为",
|
||||
"Modern Web": "现代网络而构建",
|
||||
"Learn more": "了解更多",
|
||||
"Ready to get started?": "准备开始了吗?",
|
||||
"Join thousands of developers": "加入数千名开发者",
|
||||
"From localhost to https, in seconds.": "从本地到 HTTPS,仅需几秒。",
|
||||
"Deploy from Git or your CLI.": "从 Git 或 CLI 部署。",
|
||||
"Chat with your team on real, production-grade UI, not just designs.": "与您的团队在真实的生产级 UI 上聊天,而不仅仅是设计稿。",
|
||||
"Route-aware observability.": "路由感知可观测性。",
|
||||
"Monitor and analyze the performance and traffic of your projects.": "监控和分析您项目的性能和流量。",
|
||||
"Trusted by builders at": "受到以下公司建设者的信赖",
|
||||
"MCP Market": "MCP 市场",
|
||||
"Partners": "合作伙伴",
|
||||
"Docs": "文档",
|
||||
"Build AI Agents": "使用令人难以置信的 MCP",
|
||||
"With Incredible MCP": "构建 AI Agent",
|
||||
"Instant Integration": "即时集成",
|
||||
"Connect to global APIs and MCP services with just one config or SDK.": "通过一个配置或 SDK 连接到全球 API 和 MCP 服务。",
|
||||
"Zero Overhead": "零开销",
|
||||
"Flexible pay-as-you-go pricing to fuel agent growth at every stage.": "灵活的按使用付费定价,为每个阶段的 Agent 增长提供动力。",
|
||||
"Secure & Compliant": "安全 & 合规",
|
||||
"Trusted by.": "受以下公司信赖",
|
||||
"...and loved by agents": "并受到 Agent 的喜爱",
|
||||
"FAQs": "常见问题",
|
||||
"Weather, finance, geolocation": "天气、财务和地理定位",
|
||||
"Visual and generative AI tools": "视觉和生成式 AI 工具",
|
||||
"…and more are being added every week.": "…并且每周都会添加更多功能",
|
||||
"How does pricing work?": "定价如何运作?",
|
||||
"Ready to Empower Your Agent?": "准备好为您的 Agent 赋能?",
|
||||
"Get Started Now": "立即开始",
|
||||
"Get Started": "立即开始",
|
||||
"Demo": "演示",
|
||||
"Start Deploying": "开始部署",
|
||||
"We help these products connect to global services.": "我们帮助这些产品连接到全球服务。",
|
||||
"Become a partner": "成为合作伙伴",
|
||||
"AI Design": "AI 设计",
|
||||
"AI Agent": "AI Agent",
|
||||
"AI Browser": "AI 浏览器",
|
||||
"Home": "首页",
|
||||
"Services": "服务",
|
||||
"Interesting in \n becoming a partner?": "有兴趣\n 成为合作伙伴吗?",
|
||||
"Other Partners": "其他合作伙伴",
|
||||
"Services List": "服务列表",
|
||||
"Submit services": "提交服务",
|
||||
"Interesting in \n becoming a services supplier?": "有兴趣\n 成为服务供应商吗?",
|
||||
"Apply to become a supplier and provide services to global users.": "申请成为供应商,为全球用户提供服务。",
|
||||
"Become a supplier": "成为供应商",
|
||||
"We only list some services": "我们只列出部分服务",
|
||||
"Other Services": "其他服务",
|
||||
"Submit a demo": "提交演示",
|
||||
"Number of service categories": "服务分类数量",
|
||||
"Number of MCP Tools": "MCP 工具数量",
|
||||
"Time for integration": "集成时间",
|
||||
"Daily MCP request count": "每日 MCP 请求数量",
|
||||
"10 Second": "10 秒",
|
||||
"15 Categories": "15 个分类",
|
||||
"1000+ Tools": "1000+ 工具",
|
||||
"1 Million+": "100 万+",
|
||||
"API Name": "API 名称",
|
||||
"Description": "描述",
|
||||
"Integrate once,\nnot a thousand times.": "集成一次,\n而不是千次。",
|
||||
"Payment Successful!": "支付成功!",
|
||||
"Congratulations, your payment has been processed successfully. Thank you for your love!": "恭喜,您的付款已成功处理。感谢您的支持!",
|
||||
"It's hard to say goodbyes": "说再见总是很难",
|
||||
"We're sorry to see you go. Your subscription has been cancelled.": "我们很遗憾看到您离开。您的订阅已被取消。",
|
||||
"Playground": "演示环境",
|
||||
"MCP Services Management": "MCP 服务管理",
|
||||
"Service List": "服务列表",
|
||||
"Add Service": "添加服务",
|
||||
"OpenAPI Generator": "OpenAPI 生成器",
|
||||
"Service Name": "服务名称",
|
||||
"Service Description": "服务描述",
|
||||
"Service Category": "服务分类",
|
||||
"Service Status": "服务状态",
|
||||
"Online": "上线",
|
||||
"Offline": "下线",
|
||||
"Actions": "操作",
|
||||
"Edit": "编辑",
|
||||
"Delete": "删除",
|
||||
"Toggle Status": "切换状态",
|
||||
"Create New Service": "创建新服务",
|
||||
"Edit Service": "编辑服务",
|
||||
"Generate from OpenAPI": "从 OpenAPI 生成",
|
||||
"Update from OpenAPI": "从 OpenAPI 更新",
|
||||
"Sync from OpenAPI": "从 OpenAPI 同步",
|
||||
"Sync service configuration from OpenAPI/Swagger documentation": "从 OpenAPI/Swagger 文档同步服务配置",
|
||||
"Sync Service": "同步服务",
|
||||
"OpenAPI URL": "OpenAPI 地址",
|
||||
"Upload OpenAPI File": "上传 OpenAPI 文件",
|
||||
"Generate Service": "生成服务",
|
||||
"Service Configuration": "服务配置",
|
||||
"API Endpoint": "API 端点",
|
||||
"Authentication": "身份验证",
|
||||
"API Key": "API 密钥",
|
||||
"Bearer Token": "Bearer 令牌",
|
||||
"Basic Auth": "基础认证",
|
||||
"No Auth": "无认证",
|
||||
"Markdown Documentation": "Markdown 文档",
|
||||
"Save": "保存",
|
||||
"Cancel": "取消",
|
||||
"Service Documentation": "服务文档",
|
||||
"Manage Tools": "管理工具",
|
||||
"Tools Count": "工具数量",
|
||||
"Tool Name": "工具名称",
|
||||
"Tool Description": "工具描述",
|
||||
"Add Tool": "添加工具",
|
||||
"Edit Tool": "编辑工具",
|
||||
"Delete Tool": "删除工具",
|
||||
"Save Changes": "保存更改",
|
||||
"No tools configured for this service": "此服务未配置任何工具",
|
||||
"Add tools to extend service functionality": "添加工具以扩展服务功能",
|
||||
"Configure and manage tools for this service": "配置和管理此服务的工具",
|
||||
"Add New Tool": "添加新工具",
|
||||
"Enter tool name": "输入工具名称",
|
||||
"Enter tool description": "输入工具描述",
|
||||
"Tool name": "工具名称",
|
||||
"Tool description": "工具描述",
|
||||
"Take Offline": "下线",
|
||||
"Bring Online": "上线",
|
||||
"Short Description": "简短描述",
|
||||
"Long Description": "详细描述",
|
||||
"Brief description of the service": "服务的简短描述",
|
||||
"Detailed description of the service": "服务的详细描述",
|
||||
"Basic Information": "基本信息",
|
||||
"API Configuration": "API配置",
|
||||
"Authentication Type": "认证类型",
|
||||
"Update Service": "更新服务",
|
||||
"Create Service": "创建服务",
|
||||
"Confirm Delete": "确认删除",
|
||||
"Are you sure you want to delete this service?": "您确定要删除此服务吗?",
|
||||
"This action cannot be undone.": "此操作无法撤销。",
|
||||
"Manage your MCP services, configure APIs, and monitor service status": "管理您的MCP服务,配置API,并监控服务状态",
|
||||
"Search services...": "搜索服务...",
|
||||
"Filter by category": "按分类筛选",
|
||||
"Filter by status": "按状态筛选",
|
||||
"All Categories": "所有分类",
|
||||
"All Status": "所有状态",
|
||||
"Created": "创建时间",
|
||||
"Last Updated": "最后更新",
|
||||
"Total Services": "总服务数",
|
||||
"Online Services": "在线服务",
|
||||
"Offline Services": "离线服务",
|
||||
"Service created successfully": "服务创建成功",
|
||||
"Service updated successfully": "服务更新成功",
|
||||
"Service deleted successfully": "服务删除成功",
|
||||
"Service status updated successfully": "服务状态更新成功",
|
||||
"Failed to create service": "创建服务失败",
|
||||
"Failed to update service": "更新服务失败",
|
||||
"Failed to delete service": "删除服务失败",
|
||||
"Failed to update service status": "更新服务状态失败",
|
||||
"Invalid OpenAPI URL": "无效的 OpenAPI 地址",
|
||||
"Failed to parse OpenAPI document": "解析 OpenAPI 文档失败",
|
||||
"OpenAPI document parsed successfully": "OpenAPI 文档解析成功",
|
||||
"Please enter a valid URL": "请输入有效的 URL",
|
||||
"Please select a file": "请选择文件",
|
||||
"File uploaded successfully": "文件上传成功",
|
||||
"Failed to upload file": "文件上传失败",
|
||||
"Service name is required": "服务名称为必填项",
|
||||
"Service description is required": "服务描述为必填项",
|
||||
"API endpoint is required": "API 端点为必填项",
|
||||
"Documentation is required": "文档为必填项",
|
||||
"Connect Your AI Agent to the Real World": "连接您的 AI Agent 到真实世界",
|
||||
"Open‑source MCP marketplace — publish or consume APIs in minutes.": "开源 MCP 市场 — 发布或消费 API 分钟内。",
|
||||
"get latest documentation for libraries": "获取最新文档",
|
||||
"execute terminal commands safely": "安全执行终端命令",
|
||||
"find latest scientific research papers": "查找最新科学研究论文",
|
||||
"tools to enhance thinking and reasoning": "增强思考和推理的工具",
|
||||
"find flight tickets and airbnb listings": "查找航班票和 Airbnb 列表",
|
||||
"automate web browser interactions": "自动化网页交互",
|
||||
"send messages and receive notifications": "发送消息和接收通知",
|
||||
"Marketplace": "MCP 市场",
|
||||
"{{count}} Tools": "{{count}} 个工具",
|
||||
"Overview": "概览",
|
||||
"Tools": "工具",
|
||||
"Welcome": "欢迎",
|
||||
"Log in to your account to continue": "登录您的账户以继续",
|
||||
"Log in with Google": "使用 Google 登录",
|
||||
"OR": "或",
|
||||
"Email": "邮箱",
|
||||
"Enter your email": "输入您的邮箱",
|
||||
"Continue": "继续",
|
||||
"Check your email": "检查您的邮箱",
|
||||
"We sent a verification code to": "我们已向以下邮箱发送验证码",
|
||||
"Verification Code": "验证码",
|
||||
"Enter 6-digit code": "输入6位验证码",
|
||||
"Verify": "验证",
|
||||
"Resend code": "重新发送验证码",
|
||||
"Verification code sent": "验证码已发送",
|
||||
"Failed to send verification code": "发送验证码失败",
|
||||
"Verification failed": "验证失败",
|
||||
"Login Success": "登录成功",
|
||||
"Login Error": "登录错误",
|
||||
"Back Home": "返回首页",
|
||||
"MCP Services": "MCP 服务",
|
||||
"User Management": "用户管理",
|
||||
"Revenue Management": "收入管理",
|
||||
"Payment Channels": "支付渠道",
|
||||
"System Settings": "系统设置",
|
||||
"Overview and analytics": "概览和分析",
|
||||
"Manage MCP services and API tools": "管理MCP服务及API工具",
|
||||
"Manage registered users": "管理注册用户",
|
||||
"View user recharge history": "查看用户充值历史",
|
||||
"Configure payment channels": "配置支付渠道",
|
||||
"Platform basic configuration": "平台基础配置",
|
||||
"Admin Dashboard": "管理后台",
|
||||
"Platform management and analytics": "平台管理和分析",
|
||||
"Total Users": "总用户数",
|
||||
"Active Users": "活跃用户",
|
||||
"New Users Today": "今日新用户",
|
||||
"User ID": "用户ID",
|
||||
"Username": "用户名",
|
||||
"Email Address": "邮箱地址",
|
||||
"Registration Date": "注册日期",
|
||||
"Last Login": "最后登录",
|
||||
"User Role": "用户角色",
|
||||
"User Status": "用户状态",
|
||||
"Active": "活跃",
|
||||
"Inactive": "非活跃",
|
||||
"Banned": "已封禁",
|
||||
"Admin": "管理员",
|
||||
"User": "用户",
|
||||
"Search users...": "搜索用户...",
|
||||
"Filter by role": "按角色筛选",
|
||||
"All Roles": "所有角色",
|
||||
"Ban User": "封禁用户",
|
||||
"Unban User": "解封用户",
|
||||
"Delete User": "删除用户",
|
||||
"View Profile": "查看资料",
|
||||
"Edit User": "编辑用户",
|
||||
"User Profile": "用户资料",
|
||||
"Personal Information": "个人信息",
|
||||
"Account Settings": "账户设置",
|
||||
"Full Name": "姓名",
|
||||
"Phone Number": "手机号码",
|
||||
"Registration IP": "注册IP",
|
||||
"Last Login IP": "最后登录IP",
|
||||
"Account Created": "账户创建时间",
|
||||
"Email Verified": "邮箱已验证",
|
||||
"Two Factor Auth": "双因子认证",
|
||||
"Enabled": "已启用",
|
||||
"Disabled": "已禁用",
|
||||
"Yes": "是",
|
||||
"No": "否",
|
||||
"User Statistics": "用户统计",
|
||||
"API Calls": "API调用次数",
|
||||
"Services Used": "使用的服务",
|
||||
"Total Spent": "总消费",
|
||||
"Wallet Balance": "钱包余额",
|
||||
"Confirm Ban User": "确认封禁用户",
|
||||
"Are you sure you want to ban this user?": "您确定要封禁此用户吗?",
|
||||
"Confirm Unban User": "确认解封用户",
|
||||
"Are you sure you want to unban this user?": "您确定要解封此用户吗?",
|
||||
"Confirm Delete User": "确认删除用户",
|
||||
"Are you sure you want to delete this user?": "您确定要删除此用户吗?",
|
||||
"This will permanently delete all user data.": "这将永久删除所有用户数据。",
|
||||
"User banned successfully": "用户封禁成功",
|
||||
"User unbanned successfully": "用户解封成功",
|
||||
"User deleted successfully": "用户删除成功",
|
||||
"Failed to ban user": "封禁用户失败",
|
||||
"Failed to unban user": "解封用户失败",
|
||||
"Failed to delete user": "删除用户失败",
|
||||
"User updated successfully": "用户更新成功",
|
||||
"Failed to update user": "更新用户失败",
|
||||
"Manage platform users and permissions": "管理平台用户和权限",
|
||||
"Register": "注册",
|
||||
"Sign Up": "注册",
|
||||
"Create Account": "创建账户",
|
||||
"Already have an account?": "已有账户?",
|
||||
"Don't have an account?": "还没有账户?",
|
||||
"Password": "密码",
|
||||
"Confirm Password": "确认密码",
|
||||
"Enter your password": "请输入密码",
|
||||
"Confirm your password": "请确认密码",
|
||||
"Passwords do not match": "密码不匹配",
|
||||
"Password must be at least 8 characters": "密码至少需要8个字符",
|
||||
"Registration successful": "注册成功",
|
||||
"Registration failed": "注册失败",
|
||||
"Email already exists": "邮箱已存在",
|
||||
"Invalid email format": "邮箱格式无效",
|
||||
"Sign up with Google": "使用Google注册",
|
||||
"Terms of Service": "服务条款",
|
||||
"Privacy Policy": "隐私政策",
|
||||
"By signing up, you agree to our": "注册即表示您同意我们的",
|
||||
"and": "和",
|
||||
"Forgot Password?": "忘记密码?",
|
||||
"Reset Password": "重置密码",
|
||||
"Send Reset Link": "发送重置链接",
|
||||
"Back to Login": "返回登录",
|
||||
"Password reset email sent": "密码重置邮件已发送",
|
||||
"Failed to send reset email": "发送重置邮件失败",
|
||||
"Invalid credentials": "凭据无效",
|
||||
"Account not found": "账户不存在",
|
||||
"Account is banned": "账户已被封禁",
|
||||
"Please verify your email": "请验证您的邮箱",
|
||||
"Login failed": "登录失败",
|
||||
"Failed to fetch system config": "获取系统配置失败",
|
||||
"Failed to save platform config": "保存平台配置失败",
|
||||
"Failed to test platform config": "测试平台配置失败",
|
||||
"Failed to fetch admin config": "获取管理员配置失败",
|
||||
"Failed to save admin config": "保存管理员配置失败",
|
||||
"Failed to test admin login": "测试管理员登录失败",
|
||||
"Failed to fetch Google auth config": "获取Google认证配置失败",
|
||||
"Failed to save Google auth config": "保存Google认证配置失败",
|
||||
"Failed to test Google auth": "测试Google认证失败",
|
||||
"Failed to fetch Stripe config": "获取Stripe配置失败",
|
||||
"Failed to save Stripe config": "保存Stripe配置失败",
|
||||
"Stripe connection test failed": "Stripe连接测试失败",
|
||||
"Stripe connection test successful": "Stripe连接测试成功",
|
||||
"Connection test failed": "连接测试失败",
|
||||
"Unknown error": "未知错误",
|
||||
"Secret Key cannot be empty": "密钥不能为空",
|
||||
"Stripe Configuration": "Stripe配置",
|
||||
"Google Login Settings": "Google登录设置",
|
||||
"Enable Google Login": "启用Google登录",
|
||||
"Administrator Account": "管理员账户",
|
||||
"Platform Information": "平台信息",
|
||||
"Delete Service": "删除服务",
|
||||
"Parsing OpenAPI document...": "正在解析OpenAPI文档...",
|
||||
"Generated Service Configuration": "生成的服务配置",
|
||||
"None": "无",
|
||||
"Tags": "标签",
|
||||
"Paid": "付费",
|
||||
"Premium": "高级",
|
||||
"Tools Management": "工具管理",
|
||||
"Detailed Description": "详细描述",
|
||||
"Revenue Analytics": "收入分析",
|
||||
"View revenue trends and statistics": "查看收入趋势和统计",
|
||||
"Recharge History": "充值历史",
|
||||
"Track user payment and recharge records": "跟踪用户支付和充值记录",
|
||||
"Financial Reports": "财务报告",
|
||||
"Generate detailed financial reports": "生成详细的财务报告",
|
||||
"User Profiles": "用户档案",
|
||||
"View and edit user information": "查看和编辑用户信息",
|
||||
"Permissions": "权限",
|
||||
"Manage user roles and access rights": "管理用户角色和访问权限",
|
||||
"Activity Monitor": "活动监控",
|
||||
"Track user activities and usage": "跟踪用户活动和使用情况",
|
||||
"Close menu": "关闭菜单",
|
||||
"Open menu": "打开菜单",
|
||||
"MCP Store Logo": "MCP商店标志",
|
||||
"Computer Vision": "计算机视觉",
|
||||
"Sports": "体育",
|
||||
"Entertainment": "娱乐",
|
||||
"Art": "艺术",
|
||||
"Business": "商业",
|
||||
"Others": "其他",
|
||||
"Multimedia": "多媒体",
|
||||
"SSG": "SSG",
|
||||
"WebTool": "网页工具",
|
||||
"ContentPanel": "内容面板",
|
||||
"Verification code must be 6 digits": "验证码必须是6位数字",
|
||||
"Please enter the 6-digit verification code we sent to the above email. This code expires within 30 minutes.": "请输入我们发送到上述邮箱的6位验证码。此验证码将在30分钟内过期。",
|
||||
"Go to email": "前往邮箱",
|
||||
"Enter your verification code": "输入您的验证码",
|
||||
"Resend": "重新发送",
|
||||
"Verify Email Error": "邮箱验证错误",
|
||||
"Generate MCP service configuration from OpenAPI/Swagger documentation": "从OpenAPI/Swagger文档生成MCP服务配置",
|
||||
"From URL": "从URL",
|
||||
"Upload File": "上传文件",
|
||||
"Choose File": "选择文件",
|
||||
"Supports JSON and YAML formats": "支持JSON和YAML格式",
|
||||
"Use Generated Configuration": "使用生成的配置",
|
||||
"Invalid email address": "无效的邮箱地址",
|
||||
"Back to Home": "返回首页",
|
||||
"Enter the URL to your OpenAPI/Swagger specification": "输入您的OpenAPI/Swagger规范的URL",
|
||||
"Enter service name": "输入服务名称",
|
||||
"The header name for the API key (e.g., X-API-Key, Authorization)": "API密钥的头部名称(例如:X-API-Key, Authorization)",
|
||||
"Enter API key": "输入API密钥",
|
||||
"Enter bearer token": "输入Bearer令牌",
|
||||
"The bearer token for authentication": "用于身份验证的Bearer令牌",
|
||||
"Add tag": "添加标签",
|
||||
"per call": "每次调用",
|
||||
"per": "每",
|
||||
"Per Token": "按令牌",
|
||||
"Per Call": "每次调用",
|
||||
"Charge Type": "计费类型",
|
||||
"Price": "价格",
|
||||
"Price per unit (call or token)": "每单位价格(调用或令牌)",
|
||||
"No charge for API calls": "API调用免费",
|
||||
"Fixed price per API call": "每次API调用固定价格",
|
||||
"Price based on token consumption": "基于令牌消耗的价格",
|
||||
"Price (cents)": "价格(分)",
|
||||
"Token Unit": "令牌单位",
|
||||
"Number of tokens per billing unit": "每个计费单位的令牌数量",
|
||||
"Daily Free Calls": "每日免费调用",
|
||||
"Number of free calls per day per user": "每个用户每天的免费调用次数",
|
||||
"Import": "导入",
|
||||
"API Key Header Name": "API密钥头部名称",
|
||||
"Secret Key format is incorrect, should start with sk_": "密钥格式不正确,应以sk_开头",
|
||||
"Webhook Secret format is incorrect, should start with whsec_": "Webhook密钥格式不正确,应以whsec_开头",
|
||||
"Password must be at least 8 characters long": "密码至少需要8个字符",
|
||||
"OAuth 2.0 Client Secret (optional, for server-side verification)": "OAuth 2.0 客户端密钥(可选,用于服务端验证)",
|
||||
"Authorized redirect URI configured in Google Cloud Console": "在Google Cloud Console中配置的授权重定向URI",
|
||||
"Webhook signing secret for verifying Stripe events": "用于验证Stripe事件的Webhook签名密钥",
|
||||
"URL of the platform logo image (optional)": "平台Logo图片的URL(可选)",
|
||||
"Are you sure you want to delete this user? ": "您确定要删除此用户吗?",
|
||||
"Failed to load system configurations": "加载系统配置失败",
|
||||
"Platform configuration saved successfully": "平台配置保存成功",
|
||||
"Failed to save platform configuration": "保存平台配置失败",
|
||||
"Administrator configuration saved successfully": "管理员配置保存成功",
|
||||
"Failed to save administrator configuration": "保存管理员配置失败",
|
||||
"Google authentication configuration saved successfully": "Google认证配置保存成功",
|
||||
"Failed to save Google authentication configuration": "保存Google认证配置失败",
|
||||
"Configure Google OAuth integration": "配置Google OAuth集成",
|
||||
"Allow users to sign in with Google": "允许用户使用Google登录",
|
||||
"Google Client ID": "Google客户端ID",
|
||||
"OAuth 2.0 Client ID from Google Cloud Console": "来自Google Cloud Console的OAuth 2.0客户端ID",
|
||||
"Google Client Secret": "Google客户端密钥",
|
||||
"Redirect URI": "重定向URI",
|
||||
"Configuration Guide": "配置指南",
|
||||
"Create a project in Google Cloud Console": "在Google Cloud Console中创建项目",
|
||||
"Enable Google+ API or Google Sign-In API": "启用Google+ API或Google登录API",
|
||||
"Create OAuth 2.0 credentials": "创建OAuth 2.0凭据",
|
||||
"Add authorized redirect URIs": "添加授权重定向URI",
|
||||
"Copy the Client ID and Client Secret": "复制客户端ID和客户端密钥",
|
||||
"Configure administrator login credentials": "配置管理员登录凭据",
|
||||
"Administrator Username": "管理员用户名",
|
||||
"Enter administrator username": "输入管理员用户名",
|
||||
"Username for administrator login": "管理员登录用户名",
|
||||
"Administrator Password": "管理员密码",
|
||||
"Enter administrator password": "输入管理员密码",
|
||||
"Re-enter the password to confirm": "重新输入密码以确认",
|
||||
"Confirm administrator password": "确认管理员密码",
|
||||
"Configure platform logo, name and currency": "配置平台Logo、名称和货币",
|
||||
"Platform Name": "平台名称",
|
||||
"Enter platform name": "输入平台名称",
|
||||
"The name displayed across the platform": "在平台上显示的名称",
|
||||
"Platform Logo URL": "平台Logo URL",
|
||||
"Currency Unit": "货币单位",
|
||||
"Select currency": "选择货币",
|
||||
"Default currency for the platform": "平台默认货币",
|
||||
"call": "调用",
|
||||
"No services found": "未找到服务",
|
||||
"free/day": "免费/天",
|
||||
"Account (Email)": "账户(邮箱)",
|
||||
"Recharge Amount": "充值金额",
|
||||
"Recharge Time": "充值时间",
|
||||
"Payment Method": "支付方式",
|
||||
"Transaction ID": "交易ID",
|
||||
"Status": "状态",
|
||||
"Completed": "已完成",
|
||||
"Pending": "待处理",
|
||||
"Failed": "失败",
|
||||
"No revenue records found": "未找到收入记录",
|
||||
"Search by email or transaction ID...": "按邮箱或交易ID搜索...",
|
||||
"Balance": "余额",
|
||||
"No users found": "未找到用户",
|
||||
"No tools added yet. Add your first tool using the input above.": "尚未添加工具。使用上面的输入添加您的第一个工具。",
|
||||
"Insert tool below": "在下方插入工具",
|
||||
"Remove tool": "移除工具",
|
||||
"Service Detail": "服务详情",
|
||||
"Billing Mode": "计费模式",
|
||||
"Enable free quota": "启用免费配额",
|
||||
"Configure Stripe payment interface": "配置Stripe支付接口",
|
||||
"Secret Key": "密钥",
|
||||
"Stripe secret key for server-side API calls": "用于服务端API调用的Stripe密钥",
|
||||
"Webhook Secret": "Webhook密钥",
|
||||
"Test Connection": "测试连接",
|
||||
"Monitor platform revenue and view user recharge history": "监控平台收入并查看用户充值历史",
|
||||
"Manage registered users, view user information, and handle user operations": "管理注册用户,查看用户信息,并处理用户操作",
|
||||
"Monitor platform revenue, view user recharge history, analyze financial data, and generate revenue reports.": "监控平台收入,查看用户充值历史,分析财务数据,并生成收入报告。",
|
||||
"Manage all registered users, view user profiles, handle permissions, and monitor user activities.": "管理所有注册用户,查看用户档案,处理权限,并监控用户活动。",
|
||||
"API Key Value": "API密钥值",
|
||||
"Total Balance": "总余额",
|
||||
"Monthly growth 12%": "较上月增长 12%",
|
||||
"Platform total fund pool": "平台总资金池",
|
||||
"Today's API Calls": "今日调用量",
|
||||
"API call count": "API 调用次数",
|
||||
"Total MCP Services": "MCP服务总数",
|
||||
"Deployed services": "已部署的服务",
|
||||
"This is your AI service management center. You can quickly view platform core data on the left and manage and configure your MCP services, users, payment channels, etc.": "这里是您的AI服务管理中心,您可以在左侧快速查看平台核心数据,在此管理和配置您的 MCP 服务、用户、支付渠道等。",
|
||||
"Log In": "登录",
|
||||
"Register Date": "注册日期",
|
||||
"Dashboard": "仪表盘",
|
||||
"Account": "账户",
|
||||
"Date": "日期",
|
||||
"Amount": "金额",
|
||||
"My Wallet": "我的钱包",
|
||||
"Manage your wallet balance and view recharge history": "管理您的钱包余额并查看充值历史",
|
||||
"Available Balance": "可用余额",
|
||||
"Recharge": "充值",
|
||||
"No recharge history found": "未找到充值记录",
|
||||
"Loading...": "加载中...",
|
||||
"Copied to clipboard": "已复制到剪贴板",
|
||||
"Failed to create auth key": "创建认证密钥失败",
|
||||
"Failed to update auth key": "更新认证密钥失败",
|
||||
"Auth key updated successfully": "认证密钥更新成功",
|
||||
"Create": "创建",
|
||||
"Update": "更新",
|
||||
"Copy": "复制",
|
||||
"Close": "关闭",
|
||||
"MCP Config": "MCP配置",
|
||||
"Copy full config": "复制完整配置",
|
||||
"Analytics": "分析",
|
||||
"Times": "次",
|
||||
"No analytics data available": "无可用分析数据",
|
||||
"Delete Auth Key": "删除认证密钥",
|
||||
"Are you sure you want to delete the \"{{keyName}}\" Auth key?": "您确定要删除\"{{keyName}}\"认证密钥吗?",
|
||||
"This action cannot be undone. All applications using this API key will stop working.": "此操作无法撤销。所有使用此API密钥的应用程序将停止工作。",
|
||||
"Failed to delete": "删除失败",
|
||||
"Deleted successfully": "删除成功",
|
||||
"My Dashboard": "我的仪表板",
|
||||
"Manage your integration and auth key": "管理您的集成和认证密钥",
|
||||
"Auth Key": "认证密钥",
|
||||
"New": "新建",
|
||||
"tokens": "令牌",
|
||||
"Credit Card": "信用卡",
|
||||
"PayPal": "PayPal",
|
||||
"Bank Transfer": "银行转账",
|
||||
"Alipay": "支付宝",
|
||||
"WeChat Pay": "微信支付",
|
||||
"Confirm": "确认",
|
||||
"Recharge Account": "充值账户",
|
||||
"Funds will be added to your account balance": "资金将添加到您的账户余额",
|
||||
"Manage your balance and recharge history": "管理您的余额和充值历史",
|
||||
"Build incredible AI agents together": "一起构建强大的 AI 代理",
|
||||
"Balance: {{amount}}": "余额: {{amount}}",
|
||||
"Log Out": "退出登录",
|
||||
"Enter your username": "输入您的用户名",
|
||||
"Login": "登录",
|
||||
"Admin Portal": "管理员门户",
|
||||
"Log in to admin console": "登录管理员控制台",
|
||||
"Welcome to XPack.AI Open Source": "欢迎来到XPack.AI开源项目",
|
||||
"Are you sure you want to delete this \"{{name}}\" service?": "您确定要删除这个\"{{name}}\"服务吗?",
|
||||
"Service status toggled successfully": "服务状态切换成功",
|
||||
"Failed to toggle service status": "切换服务状态失败",
|
||||
"Stripe configuration saved successfully": "Stripe 配置保存成功",
|
||||
"Failed to save Stripe configuration": "保存 Stripe 配置失败",
|
||||
"System config updated successfully": "系统配置更新成功",
|
||||
"Failed to update system config": "更新系统配置失败",
|
||||
"Confirm Purchase": "确认购买",
|
||||
"Payment completed": "支付完成",
|
||||
"Waiting for payment, remaining time: ": "等待支付,剩余时间:",
|
||||
"Payment failed": "支付失败",
|
||||
"Payment expired": "支付过期",
|
||||
"Payment cancelled": "支付取消",
|
||||
"Payment pending": "支付待处理",
|
||||
"After the transaction is completed, the status will be automatically refreshed. If there is no response for a long time, you can manually click the [Yes, I've Paid] button to refresh the status.": "交易完成后,状态将自动刷新。如果长时间没有响应,您可以手动点击[已支付]按钮刷新状态。",
|
||||
"Your Auth Key:": "您的认证密钥:",
|
||||
"Authorization Created": "授权已创建",
|
||||
"Create New Authorization": "创建新授权",
|
||||
"Edit Authorization": "编辑授权",
|
||||
"Authorization Name": "授权名称",
|
||||
"Edit authorization name": "编辑授权名称",
|
||||
"Done": "完成",
|
||||
"Start Now!!": "立即开始!!",
|
||||
"Yes, I've Paid": "已支付",
|
||||
"Payment timeout": "支付超时",
|
||||
"Payment timeout, please try again later": "支付超时,请稍后再试",
|
||||
"Payment not completed yet. Please complete the payment before proceeding.": "支付未完成,请先完成支付再继续。",
|
||||
"Platform registered users": "平台注册用户",
|
||||
"Total Revenue": "总收入",
|
||||
"Failed to save stripe config": "保存 Stripe 配置失败",
|
||||
"Stripe config saved successfully": "Stripe 配置保存成功",
|
||||
"Login successful": "登录成功",
|
||||
"Logged out successfully": "退出登录成功",
|
||||
"Configure email settings": "配置邮箱设置",
|
||||
"Email Configuration": "邮箱配置",
|
||||
"Configure SMTP settings for email notifications": "配置SMTP设置用于邮件通知",
|
||||
"SMTP Host": "SMTP主机",
|
||||
"Enter SMTP host": "输入SMTP主机",
|
||||
"SMTP server hostname or IP address": "SMTP服务器主机名或IP地址",
|
||||
"SMTP Port": "SMTP端口",
|
||||
"Enter SMTP port": "输入SMTP端口",
|
||||
"SMTP server port number": "SMTP服务器端口号",
|
||||
"Common Ports": "常用端口",
|
||||
"Custom": "自定义",
|
||||
"SMTP Username": "SMTP用户名",
|
||||
"Enter SMTP username": "输入SMTP用户名",
|
||||
"Username for SMTP authentication": "SMTP认证用户名",
|
||||
"SMTP Password": "SMTP密码",
|
||||
"Enter SMTP password": "输入SMTP密码",
|
||||
"Password for SMTP authentication": "SMTP认证密码",
|
||||
"Sender Email": "发送邮箱",
|
||||
"Enter sender email": "输入发送邮箱",
|
||||
"Email address used as sender": "用作发送方的邮箱地址",
|
||||
"Email configuration saved successfully": "邮箱配置保存成功",
|
||||
"Failed to save email configuration": "保存邮箱配置失败",
|
||||
"Test Email Connection": "测试邮箱连接",
|
||||
"Enter SMTP server address": "输入SMTP服务器地址",
|
||||
"Select or enter port": "选择或输入端口",
|
||||
"Custom Port": "自定义端口",
|
||||
"Enter custom port": "输入自定义端口",
|
||||
"Invalid port number": "无效的端口号",
|
||||
"Enter sender email address": "输入发送邮箱地址",
|
||||
"Common SMTP Settings": "常用SMTP设置",
|
||||
"Website Title": "网站标题",
|
||||
"Enter website title": "输入网站标题",
|
||||
"The title displayed in browser tab and search results": "在浏览器标签和搜索结果中显示的标题",
|
||||
"Headline": "主标题",
|
||||
"Enter homepage headline": "输入主标题",
|
||||
"Main headline displayed on the homepage": "主标题显示在首页",
|
||||
"Subheadline": "副标题",
|
||||
"Enter homepage subheadline": "输入副标题",
|
||||
"Secondary headline displayed below the main headline": "副标题显示在主标题下方",
|
||||
"Platform Language": "平台语言",
|
||||
"Select platform language": "选择平台语言",
|
||||
"Configure platform logo, name, titles, language": "配置平台logo、名称、标题、语言"
|
||||
}
|
||||
|
After Width: | Height: | Size: 766 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 226 KiB |
|
After Width: | Height: | Size: 204 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 946 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 700 B |
|
After Width: | Height: | Size: 924 B |
|
After Width: | Height: | Size: 1014 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 746 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 766 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,13 @@
|
||||
'use server';
|
||||
|
||||
import { revalidatePath, revalidateTag } from 'next/cache';
|
||||
|
||||
export async function revalidatePlatformConfig() {
|
||||
// 重新验证根路径和所有子路径
|
||||
revalidatePath('/', 'layout');
|
||||
|
||||
// 如果使用了标签缓存,也可以重新验证特定标签
|
||||
revalidateTag('platform-config');
|
||||
|
||||
console.log('Platform config cache revalidated');
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Input } from "@nextui-org/react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { z } from "zod";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { useAdminLogin } from "@/hooks/useAdminLogin";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
const adminLoginSchema = z.object({
|
||||
username: z.string().min(1, "Username is required"),
|
||||
password: z.string().min(1, "Password is required"),
|
||||
});
|
||||
|
||||
// 使用本地定义的类型,与schema保持一致
|
||||
type AdminLoginFormData = z.infer<typeof adminLoginSchema>;
|
||||
|
||||
export const AdminLoginForm = () => {
|
||||
const { t } = useTranslation();
|
||||
const { loading, adminLogin } = useAdminLogin();
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm<AdminLoginFormData>({
|
||||
resolver: zodResolver(adminLoginSchema),
|
||||
});
|
||||
|
||||
const onSubmit = async (data: AdminLoginFormData) => {
|
||||
await adminLogin(data);
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-4">
|
||||
<Input
|
||||
{...register("username")}
|
||||
type="text"
|
||||
label={t("Username")}
|
||||
placeholder={t("Enter your username")}
|
||||
isInvalid={!!errors.username}
|
||||
errorMessage={errors.username?.message}
|
||||
variant="bordered"
|
||||
/>
|
||||
<Input
|
||||
{...register("password")}
|
||||
type="password"
|
||||
label={t("Password")}
|
||||
placeholder={t("Enter your password")}
|
||||
isInvalid={!!errors.password}
|
||||
errorMessage={errors.password?.message}
|
||||
variant="bordered"
|
||||
/>
|
||||
<Button
|
||||
type="submit"
|
||||
color="primary"
|
||||
isLoading={loading}
|
||||
className="w-full mt-2"
|
||||
>
|
||||
{t("Login")}
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense } from "react";
|
||||
import { AdminLoginForm } from "./AdminLoginForm";
|
||||
|
||||
const AdminSignInComponent = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mt-2 flex w-full max-w-sm flex-col gap-8 rounded-large bg-content1 px-8 py-6 shadow-small backdrop-blur-sm">
|
||||
<AdminLoginForm />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default function AdminSignInWrapper() {
|
||||
return (
|
||||
<Suspense fallback={<></>}>
|
||||
<AdminSignInComponent />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
"use client";
|
||||
|
||||
import React, { Suspense } from "react";
|
||||
import { Spinner } from "@nextui-org/react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import AdminSignInComponent from "./components/AdminSignIn";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
|
||||
const AdminLoginHeader = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center pb-6">
|
||||
<DynamicLogo
|
||||
alt="Platform Logo"
|
||||
className="h-[40px]"
|
||||
/>
|
||||
<p className="text-xl font-medium mt-4">{t("Admin Portal")}</p>
|
||||
<p className="text-sm text-default-500">
|
||||
{t("Log in to admin console")}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const AdminLoginPageContent = () => {
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col items-center justify-center w-full h-full mt-20">
|
||||
<AdminLoginHeader />
|
||||
<AdminSignInComponent />
|
||||
<Toaster />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const AdminLoginPage = () => {
|
||||
return (
|
||||
<Suspense fallback={<div className="flex justify-center mt-40"><Spinner size="lg" color="default" /></div>}>
|
||||
<AdminLoginPageContent />
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
export default AdminLoginPage;
|
||||
@@ -0,0 +1,15 @@
|
||||
import React from "react";
|
||||
import type { Metadata } from "next";
|
||||
import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
|
||||
import ConsoleMain from "@/components/console/Main";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const title = await getDynamicTitle("Console");
|
||||
return createBaseMetadata(title);
|
||||
}
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<ConsoleMain />
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import React from "react";
|
||||
import type { Metadata } from "next";
|
||||
import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
|
||||
import DashboardMain from "@/components/dashboard/Main";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const title = await getDynamicTitle("Dashboard");
|
||||
return createBaseMetadata(title);
|
||||
}
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<DashboardMain />
|
||||
);
|
||||
}
|
||||
|
After Width: | Height: | Size: 129 KiB |
@@ -0,0 +1,83 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
html,
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: "Red Hat Display", sans-serif;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* NextUI integration */
|
||||
[data-theme] {
|
||||
--nextui-background: hsl(0 0% 100%);
|
||||
--nextui-foreground: hsl(240 10% 3.9%);
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--nextui-background: hsl(240 10% 3.9%);
|
||||
--nextui-foreground: hsl(0 0% 98%);
|
||||
}
|
||||
|
||||
/* Ensure proper line clamping */
|
||||
.line-clamp-1 {
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.line-clamp-2 {
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.line-clamp-3 {
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
/* Hide scrollbar for horizontal scrolling */
|
||||
.scrollbar-hide {
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.scrollbar-hide::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.xpack-checkerboard-img {
|
||||
background-color: #fff; /* 给一层白色底 */
|
||||
background-image:
|
||||
linear-gradient(
|
||||
45deg,
|
||||
rgb(227 227 227 / 30%) 25%,
|
||||
transparent 25%,
|
||||
transparent 75%,
|
||||
rgb(227 227 227 / 30%) 75%,
|
||||
rgb(227 227 227 / 30%)
|
||||
),
|
||||
linear-gradient(
|
||||
45deg,
|
||||
rgb(227 227 227 / 30%) 25%,
|
||||
transparent 25%,
|
||||
transparent 75%,
|
||||
rgb(227 227 227 / 30%) 75%,
|
||||
rgb(227 227 227 / 30%)
|
||||
);
|
||||
background-position:
|
||||
0 0,
|
||||
8px 8px; /* 调整两层背景的偏移 */
|
||||
background-size: 16px 16px; /* 每个格子的尺寸 */
|
||||
background-repeat: repeat;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Red_Hat_Display } from "next/font/google";
|
||||
import ClientRootProviders from "@/shared/components/ClientRootProviders";
|
||||
import "./globals.css";
|
||||
import { getCachedPlatformConfig, getDynamicTitle, createBaseMetadata } from "@/shared/utils/metadata";
|
||||
|
||||
const redHatDisplay = Red_Hat_Display({
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "500", "700"],
|
||||
display: "swap",
|
||||
});
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const title = await getDynamicTitle();
|
||||
return createBaseMetadata(title);
|
||||
}
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const platformConfig = await getCachedPlatformConfig();
|
||||
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<head>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
window.localStorage.setItem("i18nextLng", "${platformConfig?.platform?.language || "en"}");
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
</head>
|
||||
<body className={redHatDisplay.className} suppressHydrationWarning>
|
||||
<ClientRootProviders initConfig={platformConfig}>
|
||||
{children}
|
||||
</ClientRootProviders>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, Suspense } from "react";
|
||||
import { Spinner, Button } from "@nextui-org/react";
|
||||
import { useLogin } from "@/hooks/useLogin";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
|
||||
function LoginSuccessContent() {
|
||||
const { t } = useTranslation();
|
||||
const { loading, status, googleLoginRedirect } = useLogin();
|
||||
const searchParams = useSearchParams();
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
if (searchParams?.get("status") === "success") {
|
||||
return;
|
||||
}
|
||||
googleLoginRedirect();
|
||||
}, []);
|
||||
|
||||
const backHome = () => {
|
||||
const dynamicParams = new URLSearchParams(searchParams?.get("state") || "");
|
||||
router.push(`/login?${dynamicParams.toString()}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center w-1/3 gap-4 mx-auto mt-40 xl:w-1/4 light">
|
||||
{loading ? (
|
||||
<Spinner size="lg" color="default" />
|
||||
) : status === "success" ? (
|
||||
<>
|
||||
<Icon
|
||||
fontSize={70}
|
||||
className="text-success"
|
||||
icon="mi:circle-check"
|
||||
/>
|
||||
<div className="text-xl font-bold text-success">
|
||||
{t("Login Success")}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Icon
|
||||
fontSize={70}
|
||||
className="text-danger"
|
||||
icon="mi:circle-error"
|
||||
/>
|
||||
<div className="text-xl font-bold text-danger">
|
||||
{t("Login Error")}
|
||||
</div>
|
||||
<Button onClick={backHome}>{t("Back Home")}</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function LoginSuccessPage() {
|
||||
return (
|
||||
<Suspense fallback={<div className="flex justify-center mt-40"><Spinner size="lg" color="default" /></div>}>
|
||||
<LoginSuccessContent />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import React, { cache } from "react";
|
||||
import { notFound } from "next/navigation";
|
||||
import { ProductDetailClient } from "@/shared/components/marketplace/ProductDetail";
|
||||
import type { Metadata } from "next";
|
||||
import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
|
||||
import { fetchServiceById } from "@/services/marketplaceService";
|
||||
import type { ServiceData } from "@/shared/types/marketplace";
|
||||
import { Footer } from "@/shared/components/Footer";
|
||||
import { Navigation } from "@/shared/components/Navigation";
|
||||
|
||||
|
||||
interface ProductPageProps {
|
||||
params: Promise<{ id: string }>;
|
||||
}
|
||||
|
||||
const getProductById = cache(async (id: string): Promise<ServiceData | null> => {
|
||||
try {
|
||||
const product = await fetchServiceById(id);
|
||||
return product;
|
||||
} catch (error) {
|
||||
console.error(`Error fetching product ${id}:`, error);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Generate metadata for SEO
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: ProductPageProps): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
|
||||
// use cached function to get data to generate metadata
|
||||
const product = await getProductById(id);
|
||||
|
||||
if (product) {
|
||||
const title = await getDynamicTitle(product.name);
|
||||
return {
|
||||
...createBaseMetadata(title),
|
||||
description: product.short_description || `Discover ${product.name} and its powerful tools`,
|
||||
};
|
||||
}
|
||||
|
||||
// default metadata if product not found
|
||||
const defaultTitle = await getDynamicTitle("Marketplace");
|
||||
return createBaseMetadata(defaultTitle);
|
||||
}
|
||||
|
||||
export default async function ProductPage({ params }: ProductPageProps) {
|
||||
const { id } = await params;
|
||||
|
||||
// use cached function to get product data (avoid duplicate API calls)
|
||||
const serviceData = await getProductById(id);
|
||||
|
||||
if (!serviceData) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex flex-col justify-between">
|
||||
<Navigation />
|
||||
<main className="flex-1">
|
||||
<ProductDetailClient product={serviceData} />
|
||||
</main>
|
||||
<div> <Footer /></div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Card, CardBody, Button } from "@nextui-org/react";
|
||||
import { Package, ArrowLeft } from "lucide-react";
|
||||
import { Navigation } from "@/shared/components/Navigation";
|
||||
|
||||
export default function NotFound() {
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-background via-default-50 to-primary-50">
|
||||
<Navigation />
|
||||
<div className="flex items-center justify-center py-20">
|
||||
<Card className="w-96 shadow-2xl">
|
||||
<CardBody className="text-center p-8">
|
||||
<div className="w-16 h-16 mx-auto mb-4 bg-danger-100 rounded-full flex items-center justify-center">
|
||||
<Package className="text-danger" size={32} />
|
||||
</div>
|
||||
<h1 className="text-2xl font-bold mb-4">{t("404 Not Found")}</h1>
|
||||
<Button
|
||||
onPress={() => router.push("/")}
|
||||
color="primary"
|
||||
size="lg"
|
||||
startContent={<ArrowLeft size={18} />}
|
||||
>
|
||||
{t("Back to Home")}
|
||||
</Button>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import React, { Suspense } from "react";
|
||||
import { MarketplaceMain } from "@/components/marketplace/Main";
|
||||
import type { Metadata } from "next";
|
||||
import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
|
||||
import { Navigation } from "@/shared/components/Navigation";
|
||||
import { Footer } from "@/shared/components/Footer";
|
||||
import { fetchServices } from "@/services/marketplaceService";
|
||||
import type { ServiceData } from "@/shared/types/marketplace";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const title = await getDynamicTitle("Marketplace");
|
||||
return createBaseMetadata(title);
|
||||
}
|
||||
|
||||
export default async function HomePage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
}) {
|
||||
// get search params
|
||||
const params = await searchParams;
|
||||
const page = params.page ? parseInt(params.page as string, 10) : 1;
|
||||
const search = (params.search as string) || "";
|
||||
const pageSize = 36;
|
||||
|
||||
// get services data
|
||||
let services: ServiceData[] = [];
|
||||
let total = 0;
|
||||
let error = null;
|
||||
|
||||
try {
|
||||
// use real API interface
|
||||
const response = await fetchServices({
|
||||
page,
|
||||
page_size: pageSize,
|
||||
keyword: search,
|
||||
});
|
||||
services = response?.data?.services || [];
|
||||
total = response?.page?.total || 0;
|
||||
} catch (err) {
|
||||
console.error("Error fetching services:", err);
|
||||
error = "Failed to load services";
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex flex-col justify-between">
|
||||
<Navigation />
|
||||
<main className="flex-1">
|
||||
<Suspense>
|
||||
<MarketplaceMain
|
||||
initialServices={services}
|
||||
initialTotal={total}
|
||||
initialPage={page}
|
||||
initialSearch={search}
|
||||
pageSize={pageSize}
|
||||
error={error}
|
||||
/>
|
||||
</Suspense>
|
||||
</main>
|
||||
<div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import React from "react";
|
||||
import { Navigation } from "@/shared/components/Navigation";
|
||||
import { Footer } from "@/shared/components/Footer";
|
||||
import { PaymentSuccess } from "@/components/payment/Success";
|
||||
|
||||
export default async function PaymentSuccessPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<Navigation />
|
||||
<main>
|
||||
<PaymentSuccess />
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { Icon } from "@iconify/react/dist/iconify.js";
|
||||
|
||||
interface LoginButtonProps {
|
||||
title: string;
|
||||
icon?: string;
|
||||
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger";
|
||||
variant?: "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | "ghost";
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export const LoginButton = ({
|
||||
title,
|
||||
icon,
|
||||
color = "default",
|
||||
variant = "bordered",
|
||||
onClick,
|
||||
}: LoginButtonProps) => {
|
||||
return (
|
||||
<Button
|
||||
color={color}
|
||||
variant={variant}
|
||||
startContent={icon && <Icon icon={icon} width={20} />}
|
||||
onClick={onClick}
|
||||
className="w-full"
|
||||
>
|
||||
{title}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,58 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Input } from "@nextui-org/react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { z } from "zod";
|
||||
import { StepState } from "../page";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
|
||||
const emailSchema = z.object({
|
||||
email: z.string().email("Invalid email address"),
|
||||
});
|
||||
|
||||
type EmailFormData = z.infer<typeof emailSchema>;
|
||||
|
||||
interface LoginEmailFromProps {
|
||||
setEmail: (email: string) => void;
|
||||
setStep: (step: StepState) => void;
|
||||
}
|
||||
|
||||
export const LoginEmailFrom = ({ setEmail, setStep }: LoginEmailFromProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors, isSubmitting },
|
||||
} = useForm<EmailFormData>({
|
||||
resolver: zodResolver(emailSchema),
|
||||
});
|
||||
|
||||
const onSubmit = async (data: EmailFormData) => {
|
||||
setEmail(data.email);
|
||||
setStep("verifyEmail");
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-4">
|
||||
<Input
|
||||
{...register("email")}
|
||||
type="email"
|
||||
label={t("Email")}
|
||||
placeholder={t("Enter your email")}
|
||||
isInvalid={!!errors.email}
|
||||
errorMessage={errors.email?.message}
|
||||
variant="bordered"
|
||||
/>
|
||||
<Button
|
||||
type="submit"
|
||||
color="primary"
|
||||
isLoading={isSubmitting}
|
||||
className="w-full"
|
||||
>
|
||||
{t("Continue")}
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
"use client";
|
||||
|
||||
import { Divider } from "@nextui-org/react";
|
||||
import { Suspense, useState } from "react";
|
||||
import { LoginButton } from "./LoginButton";
|
||||
import { useLogin } from "@/hooks/useLogin";
|
||||
import { EmailVerificationForm } from "./VerifyEmail";
|
||||
import { LoginEmailFrom } from "./LoginEmailFrom";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
|
||||
export type StepState = "init" | "emailForm" | "verifyEmail";
|
||||
|
||||
const SignInComponent = () => {
|
||||
const { t } = useTranslation();
|
||||
const [email, setEmail] = useState("");
|
||||
const [step, setStep] = useState<StepState>("init");
|
||||
const { googleLoginOrSignUp } = useLogin();
|
||||
const { googleAuthConfig } = usePlatformConfig();
|
||||
|
||||
// 检查是否启用了 Google 登录
|
||||
const isGoogleLoginEnabled = googleAuthConfig?.is_enabled && googleAuthConfig?.client_id;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mt-2 flex w-full max-w-sm flex-col gap-8 rounded-large bg-content1 px-8 py-6 shadow-small backdrop-blur-sm">
|
||||
{step === "verifyEmail" && <EmailVerificationForm email={email} />}
|
||||
{step === "init" && isGoogleLoginEnabled && (
|
||||
<LoginButton
|
||||
title={t("Log in with Google")}
|
||||
color="primary"
|
||||
variant="solid"
|
||||
icon="flat-color-icons:google"
|
||||
onClick={googleLoginOrSignUp}
|
||||
/>
|
||||
)}
|
||||
{/* OR - 只有在启用 Google 登录时才显示分隔符 */}
|
||||
{isGoogleLoginEnabled && (
|
||||
<div className="flex items-center gap-4">
|
||||
<Divider className="flex-1" />
|
||||
<p className="shrink-0 text-tiny text-default-500">{t("OR")}</p>
|
||||
<Divider className="flex-1" />
|
||||
</div>
|
||||
)}
|
||||
{/* Login With Email */}
|
||||
{step === "init" && (
|
||||
<LoginEmailFrom setEmail={setEmail} setStep={setStep} />
|
||||
)}
|
||||
{step !== "init" && isGoogleLoginEnabled && (
|
||||
<LoginButton
|
||||
title={t("Log in with Google")}
|
||||
icon="flat-color-icons:google"
|
||||
onClick={googleLoginOrSignUp}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default function SignInWrapper() {
|
||||
return (
|
||||
<Suspense fallback={<></>}>
|
||||
<SignInComponent />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Input, Link } from "@nextui-org/react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { z } from "zod";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useLogin } from "@/hooks/useLogin";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import toast from "react-hot-toast";
|
||||
import { fetchAPI } from "@/shared/rpc/common-function";
|
||||
import { getEmail } from "@/utils/getEmail";
|
||||
|
||||
const schema = z.object({
|
||||
captcha: z
|
||||
.string()
|
||||
.length(6, { message: "Verification code must be 6 digits" }),
|
||||
});
|
||||
|
||||
const sendCaptcha = (email: string) => {
|
||||
// Send captcha to user
|
||||
return fetchAPI("/api/auth/email/send_captcha", {
|
||||
method: "POST",
|
||||
body: {
|
||||
user_email: email,
|
||||
type: 1,
|
||||
} as unknown as BodyInit,
|
||||
});
|
||||
};
|
||||
|
||||
export const EmailVerificationForm = ({ email }: { email: string }) => {
|
||||
const { loading, emailLoginOrSignUp } = useLogin();
|
||||
const { t } = useTranslation();
|
||||
const sendCaptchaRef = useRef(false);
|
||||
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
watch,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
defaultValues: {
|
||||
captcha: "",
|
||||
},
|
||||
mode: "onChange",
|
||||
resolver: zodResolver(schema),
|
||||
});
|
||||
|
||||
const captcha = watch("captcha");
|
||||
const [timeLeft, setTimeLeft] = useState(60);
|
||||
|
||||
useEffect(() => {
|
||||
if (!sendCaptchaRef.current) {
|
||||
sendCaptcha(email);
|
||||
sendCaptchaRef.current = true;
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let interval: NodeJS.Timeout;
|
||||
if (timeLeft > 0) {
|
||||
interval = setInterval(() => {
|
||||
setTimeLeft(timeLeft - 1);
|
||||
}, 1000);
|
||||
}
|
||||
return () => clearInterval(interval);
|
||||
}, [timeLeft]);
|
||||
|
||||
const resend = () => {
|
||||
setTimeLeft(60);
|
||||
if (timeLeft > 0) return;
|
||||
sendCaptcha(email);
|
||||
};
|
||||
|
||||
const onSubmit = async (data: { captcha: string }) => {
|
||||
const result = await emailLoginOrSignUp({
|
||||
captcha: data.captcha,
|
||||
user_email: email,
|
||||
});
|
||||
|
||||
if (result.success) return;
|
||||
|
||||
// Using NextUI's toast instead of Ant Design's message
|
||||
toast.error(t("Verify Email Error"));
|
||||
};
|
||||
|
||||
const isCodeValid = captcha.length === 6;
|
||||
const canResendCode = timeLeft === 0;
|
||||
const emailWebsite = getEmail(email);
|
||||
|
||||
return (
|
||||
<form className="flex flex-col gap-8" onSubmit={handleSubmit(onSubmit)}>
|
||||
<div className="flex flex-col gap-4">
|
||||
<Input isDisabled value={email} />
|
||||
<p className="text-default-500 text-[12px]">
|
||||
{t(
|
||||
"Please enter the 6-digit verification code we sent to the above email. This code expires within 30 minutes."
|
||||
)}
|
||||
{emailWebsite ? (
|
||||
<Link className="text-[12px]" href={emailWebsite} target="_blank">
|
||||
{t("Go to email")}
|
||||
</Link>
|
||||
) : null}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Controller
|
||||
name="captcha"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<div className="flex items-center gap-4">
|
||||
<Input
|
||||
{...field}
|
||||
placeholder={t("Enter your verification code")}
|
||||
maxLength={6}
|
||||
isInvalid={!!errors.captcha}
|
||||
errorMessage={errors.captcha?.message}
|
||||
/>
|
||||
{timeLeft > 0 ? (
|
||||
<Button disabled variant="light">
|
||||
{timeLeft} s
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
color="default"
|
||||
onClick={resend}
|
||||
isDisabled={!canResendCode}
|
||||
variant="ghost"
|
||||
>
|
||||
{t("Resend")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Button
|
||||
fullWidth
|
||||
isLoading={loading}
|
||||
color="primary"
|
||||
type="submit"
|
||||
isDisabled={!isCodeValid}
|
||||
>
|
||||
{t("Log In")}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,78 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, Suspense } from "react";
|
||||
import { Spinner } from "@nextui-org/react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import SignInComponent from "./components/SignIn";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useLogin } from "@/hooks/useLogin";
|
||||
import { useSharedStore } from "@/shared/store/share";
|
||||
import { useGlobalStore } from "@/shared/store/global";
|
||||
import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
|
||||
export interface LoginFormData {
|
||||
user_email: string;
|
||||
password?: string;
|
||||
nick_name?: string;
|
||||
}
|
||||
|
||||
const LoginHeader = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center pb-6">
|
||||
<DynamicLogo
|
||||
alt="Platform Logo"
|
||||
className="h-[40px]"
|
||||
/>
|
||||
<p className="text-xl font-medium mt-4">{t("Welcome")}</p>
|
||||
<p className="text-sm text-default-500">
|
||||
{t("Log in to your account to continue")}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export type StepState = "init" | "emailForm" | "verifyEmail";
|
||||
|
||||
const LoginPageContent = () => {
|
||||
const searchParams = useSearchParams();
|
||||
const [user_token] = useSharedStore((state: any) => [state.user_token]);
|
||||
const [getUser] = useGlobalStore((state) => [state.getUser]);
|
||||
const { afterLoginSuccess } = useLogin();
|
||||
|
||||
const handleCheckLogin = async () => {
|
||||
const res = await getUser();
|
||||
if (res.success) {
|
||||
afterLoginSuccess(searchParams, {
|
||||
is_register: res.data.register,
|
||||
user_token: user_token || "",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
handleCheckLogin();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col items-center justify-center w-full h-full mt-20">
|
||||
<LoginHeader />
|
||||
<SignInComponent />
|
||||
<Toaster />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const LoginPage = () => {
|
||||
return (
|
||||
<Suspense fallback={<div className="flex justify-center mt-40"><Spinner size="lg" color="default" /></div>}>
|
||||
<LoginPageContent />
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
export default LoginPage;
|
||||
@@ -0,0 +1,5 @@
|
||||
.xpack-console-stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { overviewService } from "@/services/overviewService";
|
||||
import { PlatformOverviewData } from "@/types/dashboard";
|
||||
import "./ConsoleStats.css"
|
||||
import { Alert, Card, CardBody, CardFooter } from "@nextui-org/react";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { ChartBarIcon, DollarSignIcon, ServerIcon, UserIcon } from "lucide-react";
|
||||
|
||||
interface StatCardProps {
|
||||
title: string;
|
||||
value: string | number;
|
||||
icon: React.ReactNode;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
const StatCard: React.FC<StatCardProps> = ({ title, value, icon, description }) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Card shadow="none" className="border-1">
|
||||
<CardBody>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex-1">
|
||||
<p className="text-sm font-medium text-gray-600 mb-1">{t(title)}</p>
|
||||
<p className="text-2xl font-bold text-gray-900">{value}</p>
|
||||
</div>
|
||||
<div className="ml-4 text-blue-500">
|
||||
{icon}
|
||||
</div>
|
||||
</div>
|
||||
</CardBody>
|
||||
<CardFooter>
|
||||
{description && (
|
||||
<p className="text-xs text-gray-500 mt-1">{t(description)}</p>
|
||||
)}
|
||||
</CardFooter>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
const ConsoleStats: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const [overviewData, setOverviewData] = useState<PlatformOverviewData | null>(null);
|
||||
const fetchOverviewData = async () => {
|
||||
try {
|
||||
const data = await overviewService.getPlatformOverview();
|
||||
setOverviewData(data);
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch overview data:', err);
|
||||
} finally {
|
||||
}
|
||||
};
|
||||
// get platform overview data
|
||||
useEffect(() => {
|
||||
fetchOverviewData();
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* stat card grid */}
|
||||
<div className="xpack-console-stats-grid gap-4">
|
||||
<StatCard
|
||||
title="Total Users"
|
||||
value={overviewData?.total_user.toLocaleString() || 0}
|
||||
icon={
|
||||
<UserIcon size={32} />
|
||||
}
|
||||
description="Platform registered users"
|
||||
/>
|
||||
<StatCard
|
||||
title="Total Revenue"
|
||||
value={overviewData?.total_balance.toLocaleString() || 0}
|
||||
icon={
|
||||
<DollarSignIcon size={32} />
|
||||
}
|
||||
description="Platform total fund pool"
|
||||
/>
|
||||
<StatCard
|
||||
title="Today's API Calls"
|
||||
value={overviewData?.invoke_count.today.toLocaleString() || 0}
|
||||
icon={
|
||||
<ChartBarIcon size={32} />
|
||||
}
|
||||
description="API call count"
|
||||
/>
|
||||
|
||||
<StatCard
|
||||
title="Total MCP Services"
|
||||
value={overviewData?.total_service.toLocaleString() || 0}
|
||||
icon={
|
||||
<ServerIcon size={32} />
|
||||
}
|
||||
description="Deployed services"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* welcome guide */}
|
||||
<Alert color="primary" title={t("Welcome to XPack.AI Open Source")} description={t("This is your AI service management center. You can quickly view platform core data on the left and manage and configure your MCP services, users, payment channels, etc.")}></Alert>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ConsoleStats;
|
||||
@@ -0,0 +1,192 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState, Suspense } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useAdminStore } from "@/store/admin";
|
||||
import DashboardSidebar from "@/shared/components/DashboardSidebar";
|
||||
import DashboardDemoContent from "@/shared/components/DashboardDemoContent";
|
||||
import ConsoleStats from "@/components/console/ConsoleStats";
|
||||
import PaymentChannelsContent from "@/components/console/PaymentChannelsContent";
|
||||
import SystemSettingsContent from "@/components/console/SystemSettingsContent";
|
||||
import { SidebarItem, TabKey } from "@/shared/types/dashboard";
|
||||
import { useAdminLogin } from "@/hooks/useAdminLogin";
|
||||
import { MCPServicesManagement } from "@/components/mcp-services/MCPServicesManagement";
|
||||
import UserManagement from "@/components/user-management/UserManagement";
|
||||
import RevenueManagement from "@/components/revenue-management/RevenueManagement";
|
||||
import { Cog, CreditCard, DollarSign, Home, Settings, Users } from "lucide-react";
|
||||
|
||||
const ConsoleContent: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const [admin_token] = useAdminStore((state) => [state.admin_token]);
|
||||
|
||||
const getInitialTab = (): TabKey => {
|
||||
const tabFromUrl = searchParams.get("tab") as TabKey;
|
||||
if (
|
||||
tabFromUrl &&
|
||||
[
|
||||
"mcp-services",
|
||||
"user-management",
|
||||
"revenue-management",
|
||||
"payment-channels",
|
||||
"system-settings",
|
||||
].includes(tabFromUrl)
|
||||
) {
|
||||
return tabFromUrl;
|
||||
}
|
||||
return "console";
|
||||
};
|
||||
|
||||
const [activeTab, setActiveTab] = useState<TabKey>(getInitialTab);
|
||||
const sidebarItems: SidebarItem[] = [
|
||||
{
|
||||
key: "console",
|
||||
icon: <Home className="w-5 h-5" />,
|
||||
label: t("Dashboard"),
|
||||
description: t("Overview and analytics"),
|
||||
},
|
||||
{
|
||||
key: "mcp-services",
|
||||
icon: <Settings className="w-5 h-5" />,
|
||||
label: t("MCP Services"),
|
||||
description: t("Manage MCP services and API tools"),
|
||||
},
|
||||
{
|
||||
key: "user-management",
|
||||
icon: <Users className="w-5 h-5" />,
|
||||
label: t("User Management"),
|
||||
description: t("Manage registered users"),
|
||||
},
|
||||
{
|
||||
key: "revenue-management",
|
||||
icon: <DollarSign className="w-5 h-5" />,
|
||||
label: t("Revenue Management"),
|
||||
description: t("View user recharge history"),
|
||||
},
|
||||
{
|
||||
key: "payment-channels",
|
||||
icon: <CreditCard className="w-5 h-5" />,
|
||||
label: t("Payment Channels"),
|
||||
description: t("Configure payment channels"),
|
||||
},
|
||||
{
|
||||
key: "system-settings",
|
||||
icon: <Cog className="w-5 h-5" />,
|
||||
label: t("System Settings"),
|
||||
description: t("Platform basic configuration"),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
// If admin is not logged in, redirect to admin login page
|
||||
useEffect(() => {
|
||||
if (!admin_token) {
|
||||
router.push("/admin-signin");
|
||||
}
|
||||
}, [admin_token, router]);
|
||||
|
||||
const handleTabNavigate = (tab: TabKey) => {
|
||||
setActiveTab(tab);
|
||||
// update url params
|
||||
if (tab === "console") {
|
||||
// when switch to dashboard, clear all query params, only keep base path
|
||||
router.push("/console", { scroll: false });
|
||||
} else {
|
||||
// other tabs set corresponding tab params
|
||||
const params = new URLSearchParams();
|
||||
params.set("tab", tab);
|
||||
router.push(`/console?${params.toString()}`, { scroll: false });
|
||||
}
|
||||
};
|
||||
|
||||
const { adminLogout } = useAdminLogin();
|
||||
|
||||
const handleLogout = () => {
|
||||
// use admin logout method
|
||||
adminLogout();
|
||||
};
|
||||
|
||||
// render different content based on activeTab
|
||||
const renderContent = () => {
|
||||
switch (activeTab) {
|
||||
case "mcp-services":
|
||||
return <MCPServicesManagement />;
|
||||
case "user-management":
|
||||
return (
|
||||
<div className="h-full overflow-auto">
|
||||
<UserManagement />
|
||||
</div>
|
||||
);
|
||||
case "revenue-management":
|
||||
return (
|
||||
<div className="h-full overflow-auto">
|
||||
<RevenueManagement />
|
||||
</div>
|
||||
);
|
||||
case "payment-channels":
|
||||
return (
|
||||
<DashboardDemoContent
|
||||
title={t("Payment Channels")}
|
||||
description={t("Configure payment channels")}
|
||||
>
|
||||
<PaymentChannelsContent />
|
||||
</DashboardDemoContent>
|
||||
);
|
||||
case "system-settings":
|
||||
return (
|
||||
<DashboardDemoContent
|
||||
title={t("System Settings")}
|
||||
description={t("Platform basic configuration")}
|
||||
>
|
||||
<SystemSettingsContent />
|
||||
</DashboardDemoContent>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<DashboardDemoContent
|
||||
title={t("Admin Dashboard")}
|
||||
description={t("Platform management and analytics")}
|
||||
>
|
||||
<ConsoleStats />
|
||||
</DashboardDemoContent>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<div className="flex">
|
||||
{/* Sidebar */}
|
||||
<DashboardSidebar
|
||||
activeTab={activeTab}
|
||||
onTabNavigate={handleTabNavigate}
|
||||
onLogout={handleLogout}
|
||||
sidebarItems={sidebarItems}
|
||||
/>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="flex-1 h-screen overflow-y-auto">{renderContent()}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const ConsoleMain: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="min-h-screen bg-background flex items-center justify-center">
|
||||
{t("Loading...")}
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<ConsoleContent />
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
export default ConsoleMain;
|
||||
@@ -0,0 +1,46 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { StripeConfigForm } from './StripeConfigForm';
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { usePaymentChannelManagement } from "@/hooks/usePaymentChannelManagement";
|
||||
import { StripeConfig } from "@/types/payment";
|
||||
import { toast } from "react-hot-toast";
|
||||
|
||||
export const PaymentChannelsContent: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const {
|
||||
stripeConfig,
|
||||
isSaving,
|
||||
saveStripeConfig,
|
||||
testStripeConnection,
|
||||
} = usePaymentChannelManagement();
|
||||
|
||||
|
||||
// test stripe connection
|
||||
const handleTestStripeConnection = async (config: StripeConfig) => {
|
||||
const result = await testStripeConnection(config);
|
||||
|
||||
if (result.success) {
|
||||
toast.success(t("Stripe connection test successful"));
|
||||
} else {
|
||||
toast.error(result.message || t("Stripe connection test failed"));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-6 w-full">
|
||||
{/* stripe configuration */}
|
||||
<StripeConfigForm
|
||||
config={stripeConfig}
|
||||
onSave={saveStripeConfig}
|
||||
onTest={handleTestStripeConnection}
|
||||
isLoading={isSaving}
|
||||
isTestLoading={false}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PaymentChannelsContent;
|
||||
@@ -0,0 +1,121 @@
|
||||
'use client';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Input, Button, AccordionItem, Accordion } from '@nextui-org/react';
|
||||
import { Eye, EyeOff } from 'lucide-react';
|
||||
import { StripeConfig } from '@/types/payment';
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
|
||||
interface StripeConfigFormProps {
|
||||
config: StripeConfig;
|
||||
onSave: (config: StripeConfig) => void;
|
||||
onTest: (config: StripeConfig) => void;
|
||||
isLoading?: boolean;
|
||||
isTestLoading?: boolean;
|
||||
}
|
||||
|
||||
export const StripeConfigForm: React.FC<StripeConfigFormProps> = ({
|
||||
config,
|
||||
onSave,
|
||||
isLoading = false,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [formData, setFormData] = useState<StripeConfig>(config);
|
||||
const [showSecretKey, setShowSecretKey] = useState(false);
|
||||
const [showWebhookSecret, setShowWebhookSecret] = useState(false);
|
||||
useEffect(() => {
|
||||
console.log("config", config);
|
||||
setFormData(config);
|
||||
}, [config]);
|
||||
|
||||
const handleInputChange = (field: keyof StripeConfig, value: string) => {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
[field]: value
|
||||
}));
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
onSave(formData);
|
||||
};
|
||||
|
||||
|
||||
const isFormValid = formData.secret.trim() !== '' && formData.webhook_secret.trim() !== '';
|
||||
|
||||
return (
|
||||
<Accordion variant='splitted' itemClasses={{
|
||||
base: 'shadow-none border-1',
|
||||
}} defaultExpandedKeys={['stripe-config']} className='px-0'>
|
||||
<AccordionItem key="stripe-config" title={
|
||||
<div className="flex flex-col justify-between">
|
||||
<h3 className="text-lg font-semibold">{t('Stripe Configuration')}</h3>
|
||||
<p className="text-sm text-gray-500">{t('Configure Stripe payment interface')}</p>
|
||||
</div>
|
||||
} >
|
||||
<div className="space-y-4">
|
||||
{/* Secret Key */}
|
||||
<Input
|
||||
label={t('Secret Key')}
|
||||
placeholder="sk_test_... or sk_live_..."
|
||||
description={t('Stripe secret key for server-side API calls')}
|
||||
value={formData.secret}
|
||||
onChange={(e) => handleInputChange('secret', e.target.value)}
|
||||
type={showSecretKey ? "text" : "password"}
|
||||
endContent={
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowSecretKey(!showSecretKey)}
|
||||
className="focus:outline-none"
|
||||
>
|
||||
{showSecretKey ? (
|
||||
<EyeOff className="w-4 h-4 text-gray-400" />
|
||||
) : (
|
||||
<Eye className="w-4 h-4 text-gray-400" />
|
||||
)}
|
||||
</button>
|
||||
}
|
||||
isRequired
|
||||
/>
|
||||
|
||||
{/* Webhook Secret (Optional) */}
|
||||
<Input
|
||||
label={t('Webhook Secret')}
|
||||
placeholder="whsec_..."
|
||||
description={t('Webhook signing secret for verifying Stripe events')}
|
||||
value={formData.webhook_secret || ''}
|
||||
onChange={(e) => handleInputChange('webhook_secret', e.target.value)}
|
||||
type={showWebhookSecret ? "text" : "password"}
|
||||
isRequired
|
||||
endContent={
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowWebhookSecret(!showWebhookSecret)}
|
||||
className="focus:outline-none"
|
||||
>
|
||||
{showWebhookSecret ? (
|
||||
<EyeOff className="w-4 h-4 text-gray-400" />
|
||||
) : (
|
||||
<Eye className="w-4 h-4 text-gray-400" />
|
||||
)}
|
||||
</button>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Action Buttons */}
|
||||
<div className="flex gap-3 py-4">
|
||||
<Button
|
||||
color="primary"
|
||||
variant="solid"
|
||||
onPress={handleSave}
|
||||
isLoading={isLoading}
|
||||
isDisabled={!isFormValid}
|
||||
size='sm'
|
||||
>
|
||||
{t('Save')}
|
||||
</Button>
|
||||
</div>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
);
|
||||
};
|
||||