feat: 实现 Mini Game AI 工具平台
基于 Next.js 15、React 19 和 TypeScript 构建面向小游戏开发者的 AI 赋能工具平台。 主要功能: - 首页:包含 Hero、功能展示、优势介绍、定价和 CTA 区域 - 三大核心工具:视频转序列帧、图片压缩、音频压缩 - 响应式布局:包含顶部导航、页脚和侧边栏 - 文件上传:支持拖拽上传,使用 react-dropzone - 进度追踪:实时显示上传和处理进度 - 可配置工具:每个工具都支持自定义参数配置 - 结果预览:支持下载处理后的文件 - 4K 优化:针对大屏幕优化的响应式设计 - API 路由:文件上传和处理的模拟实现 技术栈: - Next.js 15 (App Router) - React 19 - TypeScript (严格模式) - Tailwind CSS(自定义 4K 断点) - shadcn/ui 组件库 - Framer Motion 动画 - Zustand 状态管理 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
142
src/types/index.ts
Normal file
142
src/types/index.ts
Normal file
@@ -0,0 +1,142 @@
|
||||
/**
|
||||
* File types
|
||||
*/
|
||||
|
||||
export interface UploadedFile {
|
||||
id: string;
|
||||
file: File;
|
||||
name: string;
|
||||
size: number;
|
||||
type: string;
|
||||
url?: string;
|
||||
uploadedAt: Date;
|
||||
}
|
||||
|
||||
export interface ProcessedFile {
|
||||
id: string;
|
||||
originalFile: UploadedFile;
|
||||
processedUrl: string;
|
||||
metadata: ProcessMetadata;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processing types
|
||||
*/
|
||||
|
||||
export type ProcessStatus = "idle" | "uploading" | "processing" | "completed" | "failed";
|
||||
|
||||
export interface ProcessMetadata {
|
||||
format?: string;
|
||||
quality?: number;
|
||||
bitrate?: number;
|
||||
fps?: number;
|
||||
resolution?: string;
|
||||
duration?: number;
|
||||
frames?: number;
|
||||
compressionRatio?: number;
|
||||
}
|
||||
|
||||
export interface ProcessingResult {
|
||||
success: boolean;
|
||||
fileUrl?: string;
|
||||
filename?: string;
|
||||
metadata?: ProcessMetadata;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface ProcessingProgress {
|
||||
status: ProcessStatus;
|
||||
progress: number; // 0-100
|
||||
message: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tool types
|
||||
*/
|
||||
|
||||
export type ToolType = "video-frames" | "image-compress" | "audio-compress" | "ai-image" | "ai-audio";
|
||||
|
||||
export interface ToolConfig {
|
||||
type: ToolType;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
supportedFormats: string[];
|
||||
maxSize: number;
|
||||
features: string[];
|
||||
isPremium?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* User types (Phase 6)
|
||||
*/
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
avatar?: string;
|
||||
plan: "free" | "pro" | "enterprise";
|
||||
quota: UserQuota;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export interface UserQuota {
|
||||
used: number;
|
||||
limit: number;
|
||||
resetDate: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* API types
|
||||
*/
|
||||
|
||||
export interface ApiResponse<T> {
|
||||
success: boolean;
|
||||
data?: T;
|
||||
error?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface UploadResponse {
|
||||
fileId: string;
|
||||
fileUrl: string;
|
||||
metadata: {
|
||||
size: number;
|
||||
type: string;
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Tool configuration types
|
||||
*/
|
||||
|
||||
export interface VideoFramesConfig {
|
||||
fps: number;
|
||||
format: "png" | "jpeg" | "webp";
|
||||
quality: number;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
|
||||
export interface ImageCompressConfig {
|
||||
quality: number;
|
||||
format: "original" | "jpeg" | "png" | "webp";
|
||||
resize?: {
|
||||
width?: number;
|
||||
height?: number;
|
||||
fit: "contain" | "cover" | "fill";
|
||||
};
|
||||
}
|
||||
|
||||
export interface AudioCompressConfig {
|
||||
bitrate: number;
|
||||
format: "mp3" | "aac" | "ogg" | "flac";
|
||||
sampleRate: number;
|
||||
channels: number;
|
||||
}
|
||||
Reference in New Issue
Block a user