- Move test files to lib/__tests__/ directory - Extract formatting utilities (formatVersion, formatFileSize, formatDateTime) from fs-utils.ts to new utils.ts module - Add Jest test configuration and test scripts - Update component imports to use new utils module - Add CLAUDE.md documentation for project structure Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
// app/download/ApkCard.tsx
|
|
import { formatFileSize, formatDateTime } from '@/lib/utils';
|
|
|
|
interface ApkCardProps {
|
|
name: string;
|
|
commit: string | null;
|
|
size: number;
|
|
modifiedAt: string;
|
|
downloadUrl: string;
|
|
}
|
|
|
|
export default function ApkCard({ name, commit, size, modifiedAt, downloadUrl }: ApkCardProps) {
|
|
return (
|
|
<div className="bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
|
<h3 className="text-lg font-semibold text-gray-800 mb-2 break-all">
|
|
{name}
|
|
</h3>
|
|
|
|
<div className="space-y-1 text-sm text-gray-600 mb-4">
|
|
<div className="flex justify-between">
|
|
<span>文件大小:</span>
|
|
<span className="font-medium">{formatFileSize(size)}</span>
|
|
</div>
|
|
<div className="flex justify-between">
|
|
<span>修改时间:</span>
|
|
<span className="font-medium">{formatDateTime(new Date(modifiedAt))}</span>
|
|
</div>
|
|
{commit && (
|
|
<div className="flex justify-between">
|
|
<span>Commit:</span>
|
|
<span className="font-medium font-mono">{commit}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
<a
|
|
href={downloadUrl}
|
|
download
|
|
rel="noopener noreferrer"
|
|
className="block w-full text-center bg-green-600 text-white py-2 px-4 rounded-md hover:bg-green-700 transition-colors"
|
|
>
|
|
下载 APK
|
|
</a>
|
|
</div>
|
|
);
|
|
}
|