feat: add scrape import functionality with status messages and logs
All checks were successful
Build Docker Image / build (push) Successful in 1m22s
All checks were successful
Build Docker Image / build (push) Successful in 1m22s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
|
||||
let { data } = $props();
|
||||
let { data, form } = $props();
|
||||
|
||||
const newCharacters = $derived(data.changes.filter((c: any) => c.type === 'new'));
|
||||
const modifiedCharacters = $derived(data.changes.filter((c: any) => c.type === 'modified'));
|
||||
@@ -40,6 +40,22 @@
|
||||
<div>
|
||||
<h1 class="text-3xl font-black uppercase tracking-[0.25em] text-amber-50 mb-2">Character Changes</h1>
|
||||
<p class="text-gray-400">Total changes: {newCharacters.length} new, {modifiedCharacters.length} modified</p>
|
||||
<form method="POST" action="?/runScrapeImport" class="mt-4">
|
||||
<button
|
||||
type="submit"
|
||||
class="rounded-full border border-sky-300/40 bg-sky-500/20 px-4 py-2 text-sm font-semibold text-sky-100 transition hover:bg-sky-500/30"
|
||||
>
|
||||
🔄 Lancer scrape + import
|
||||
</button>
|
||||
</form>
|
||||
{#if form?.message}
|
||||
<p class={`mt-3 text-sm ${form.success ? 'text-emerald-300' : 'text-rose-300'}`}>
|
||||
{form.message}
|
||||
</p>
|
||||
{/if}
|
||||
{#if form?.logs}
|
||||
<pre class="mt-3 max-h-72 overflow-auto rounded-lg border border-white/10 bg-slate-900/70 p-3 text-xs text-slate-200 whitespace-pre-wrap">{form.logs}</pre>
|
||||
{/if}
|
||||
{#if newCharacters.length + modifiedCharacters.length > 0}
|
||||
<form method="POST" action="?/acceptAll" class="mt-4">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user