feat: add environment badge to commit id column in ApkTable
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { formatFileSize, formatDateTime } from '@/lib/utils';
|
import { formatFileSize, formatDateTime } from '@/lib/utils';
|
||||||
|
import { type ApkEnvironment } from '@/lib/apk-parser';
|
||||||
|
|
||||||
interface Apk {
|
interface Apk {
|
||||||
name: string;
|
name: string;
|
||||||
|
environment: ApkEnvironment;
|
||||||
commit: string | null;
|
commit: string | null;
|
||||||
size: number;
|
size: number;
|
||||||
modifiedAt: string;
|
modifiedAt: string;
|
||||||
@@ -14,6 +16,22 @@ interface ApkTableProps {
|
|||||||
apks: Apk[];
|
apks: Apk[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEnvironmentBadgeClass(env: ApkEnvironment): string {
|
||||||
|
switch (env) {
|
||||||
|
case 'product':
|
||||||
|
return 'bg-blue-100 text-blue-800';
|
||||||
|
case 'dev':
|
||||||
|
case 'sandbox':
|
||||||
|
return 'bg-green-100 text-green-800';
|
||||||
|
default:
|
||||||
|
return 'bg-gray-100 text-gray-800';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatEnvironment(env: ApkEnvironment): string {
|
||||||
|
return env;
|
||||||
|
}
|
||||||
|
|
||||||
export default function ApkTable({ apks }: ApkTableProps) {
|
export default function ApkTable({ apks }: ApkTableProps) {
|
||||||
if (!apks || apks.length === 0) {
|
if (!apks || apks.length === 0) {
|
||||||
return (
|
return (
|
||||||
@@ -46,9 +64,14 @@ export default function ApkTable({ apks }: ApkTableProps) {
|
|||||||
{apks.map((apk) => (
|
{apks.map((apk) => (
|
||||||
<tr key={apk.name} className="hover:bg-gray-50">
|
<tr key={apk.name} className="hover:bg-gray-50">
|
||||||
<td className="px-6 py-4 whitespace-nowrap">
|
<td className="px-6 py-4 whitespace-nowrap">
|
||||||
<span className="font-mono text-sm text-gray-900">
|
<div className="flex items-center gap-2">
|
||||||
{apk.commit || '-'}
|
<span className="font-mono text-sm text-gray-900">
|
||||||
</span>
|
{apk.commit || '-'}
|
||||||
|
</span>
|
||||||
|
<span className={`px-2 py-0.5 text-xs font-medium rounded ${getEnvironmentBadgeClass(apk.environment)}`}>
|
||||||
|
{formatEnvironment(apk.environment)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
||||||
{formatFileSize(apk.size)}
|
{formatFileSize(apk.size)}
|
||||||
|
|||||||
Reference in New Issue
Block a user