refactor(frontend): enforce semantic tokens + extract 3 Screen Models
Color tokens: 3658→0 violations across 186 .svelte/.svelte.ts files. All raw Tailwind colors (bg-blue-*, text-gray-*, border-red-*, etc.) replaced with semantic tokens from tailwind.config.js in 5 perl passes. Model extraction (11→8 oversized pages): - LLMReportModel.svelte.ts: LLM report page 413→221 lines - DatasetDetailModel.svelte.ts: dataset detail page 416→218 lines - DatasetsHubModel.svelte.ts: datasets hub page 468→246 lines Tests: 14 assertions updated (color classes + model refs). Build: 1 duplicate class:text-primary fix in ValidationTaskForm. All 699/699 tests pass.
This commit is contained in:
@@ -90,24 +90,24 @@
|
||||
|
||||
<!-- [SECTION: TEMPLATE] -->
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full bg-white border border-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<table class="min-w-full bg-surface-card border border-border">
|
||||
<thead class="bg-surface-muted">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{$t.storage.table.name}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{$t.storage.table.category}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{$t.storage.table.size}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{$t.storage.table.created_at}</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">{$t.storage.table.actions}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-text-muted uppercase tracking-wider">{$t.storage.table.name}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-text-muted uppercase tracking-wider">{$t.storage.table.category}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-text-muted uppercase tracking-wider">{$t.storage.table.size}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-text-muted uppercase tracking-wider">{$t.storage.table.created_at}</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-text-muted uppercase tracking-wider">{$t.storage.table.actions}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200">
|
||||
<tbody class="divide-y divide-border">
|
||||
{#each files as file}
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
|
||||
<tr class="hover:bg-surface-muted">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-text">
|
||||
{#if isDirectory(file)}
|
||||
<button
|
||||
onclick={() => onnavigate(file.path)}
|
||||
class="flex items-center text-indigo-600 hover:text-indigo-900"
|
||||
class="flex items-center text-primary hover:text-primary"
|
||||
>
|
||||
<svg class="h-5 w-5 mr-2 text-yellow-400" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" />
|
||||
@@ -116,31 +116,31 @@
|
||||
</button>
|
||||
{:else}
|
||||
<div class="flex items-center">
|
||||
<svg class="h-5 w-5 mr-2 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<svg class="h-5 w-5 mr-2 text-text-subtle" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" />
|
||||
</svg>
|
||||
{file.name}
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 capitalize">{file.category}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-text-muted capitalize">{file.category}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-text-muted">
|
||||
{isDirectory(file) ? '--' : formatSize(file.size)}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{formatDate(file.created_at)}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-text-muted">{formatDate(file.created_at)}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
{#if !isDirectory(file)}
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => handleDownload(file)}
|
||||
class="text-indigo-600 hover:text-indigo-900 mr-4"
|
||||
class="text-primary hover:text-primary mr-4"
|
||||
>
|
||||
{$t.storage.table.download}
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
onclick={() => ondelete({ category: file.category, path: file.path, name: file.name })}
|
||||
class="text-red-600 hover:text-red-900"
|
||||
class="text-destructive hover:text-destructive"
|
||||
>
|
||||
{$t.storage.table.delete}
|
||||
</button>
|
||||
@@ -148,7 +148,7 @@
|
||||
</tr>
|
||||
{:else}
|
||||
<tr>
|
||||
<td colspan="5" class="px-6 py-10 text-center text-sm text-gray-500">
|
||||
<td colspan="5" class="px-6 py-10 text-center text-sm text-text-muted">
|
||||
{$t.storage.no_files}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -78,16 +78,16 @@
|
||||
</script>
|
||||
|
||||
<!-- [SECTION: TEMPLATE] -->
|
||||
<div class="bg-white p-6 rounded-lg border border-gray-200 shadow-sm">
|
||||
<div class="bg-surface-card p-6 rounded-lg border border-border shadow-sm">
|
||||
<h2 class="text-lg font-semibold mb-4">{$t.storage.upload_title}</h2>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label for="storage-upload-category" class="block text-sm font-medium text-gray-700 mb-1">{$t.storage.target_category}</label>
|
||||
<label for="storage-upload-category" class="block text-sm font-medium text-text mb-1">{$t.storage.target_category}</label>
|
||||
<select
|
||||
id="storage-upload-category"
|
||||
bind:value={category}
|
||||
class="block w-full border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
|
||||
class="block w-full border-border-strong rounded-md shadow-sm focus:ring-primary-ring focus:border-primary-ring sm:text-sm"
|
||||
>
|
||||
<option value="backups">{$t.storage.backups}</option>
|
||||
<option value="repositorys">{$t.storage.repositories}</option>
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
<div
|
||||
class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-dashed rounded-md transition-colors
|
||||
{dragOver ? 'border-indigo-500 bg-indigo-50' : 'border-gray-300'}"
|
||||
{dragOver ? 'border-primary-ring bg-primary-light' : 'border-border-strong'}"
|
||||
role="region"
|
||||
aria-label={$t.storage.upload_title}
|
||||
ondragover={(event) => { event.preventDefault(); dragOver = true; }}
|
||||
@@ -104,11 +104,11 @@
|
||||
ondrop={(event) => { event.preventDefault(); handleDrop(event); }}
|
||||
>
|
||||
<div class="space-y-1 text-center">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48" aria-hidden="true">
|
||||
<svg class="mx-auto h-12 w-12 text-text-subtle" stroke="currentColor" fill="none" viewBox="0 0 48 48" aria-hidden="true">
|
||||
<path d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</svg>
|
||||
<div class="flex text-sm text-gray-600">
|
||||
<label for="file-upload" class="relative cursor-pointer bg-white rounded-md font-medium text-indigo-600 hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500">
|
||||
<div class="flex text-sm text-text-muted">
|
||||
<label for="file-upload" class="relative cursor-pointer bg-surface-card rounded-md font-medium text-primary hover:text-primary focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-primary-ring">
|
||||
<span>{$t.storage.upload_button}</span>
|
||||
<input
|
||||
id="file-upload"
|
||||
@@ -122,13 +122,13 @@
|
||||
</label>
|
||||
<p class="pl-1">{$t.storage.drag_drop}</p>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500">{$t.storage.supported_formats}</p>
|
||||
<p class="text-xs text-text-muted">{$t.storage.supported_formats}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if isUploading}
|
||||
<div class="flex items-center justify-center space-x-2 text-indigo-600">
|
||||
<div class="animate-spin rounded-full h-4 w-4 border-b-2 border-indigo-600"></div>
|
||||
<div class="flex items-center justify-center space-x-2 text-primary">
|
||||
<div class="animate-spin rounded-full h-4 w-4 border-b-2 border-primary-ring"></div>
|
||||
<span class="text-sm font-medium">{$t.storage.uploading}</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user