frontend: mandar alert en error

This commit is contained in:
Cat /dev/Nulo 2023-12-09 14:09:50 -03:00
parent 6c65aa2ead
commit e9de6d00d4
3 changed files with 23 additions and 23 deletions

View file

@ -11,9 +11,9 @@
export let params: { dumpUrl: string; portal: string; id: string };
$: url = decodeURIComponent(params.dumpUrl) + "/" + params.portal;
$: data = Promise.all([fetchData(url), fetchErrors(url)]).then(
([data, errors]) => ({ data, errors }),
);
$: data = Promise.all([fetchData(url), fetchErrors(url)])
.then(([data, errors]) => ({ data, errors }))
.catch(alert);
</script>
<main class="mx-auto max-w-3xl">
@ -28,9 +28,9 @@
<NotFound />
{:else}
<header
class="py-5 px-6 border-b border-b-gray-200 dark:border-b-gray-700"
class="border-b border-b-gray-200 px-6 py-5 dark:border-b-gray-700"
>
<h1 class="font-bold text-3xl">{dataset.title}</h1>
<h1 class="text-3xl font-bold">{dataset.title}</h1>
<p class="text-xl">{dataset.description}</p>
<!--
lo saqué porque aún antes de que venga la motosierra estos links no funcionan...
@ -54,13 +54,13 @@
e.datasetIdentifier === dataset.identifier &&
e.distributionIdentifier === dist.identifier,
)}
<li class="flex px-6 py-5 justify-between items-center">
<li class="flex items-center justify-between px-6 py-5">
<div>
<h3>
{dist.title}
{#if dist.format}
<span
class="border border-current text-blue-800 dark:text-blue-400 relative inline-flex items-center text-xs font-semibold px-2 py-1 rounded-full ml-1"
class="relative ml-1 inline-flex items-center rounded-full border border-current px-2 py-1 text-xs font-semibold text-blue-800 dark:text-blue-400"
>
<span>{dist.format}</span>
</span>
@ -85,7 +85,7 @@
{#if !error}
<button
type="button"
class="inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none"
class="focus:shadow-outline inline-flex items-center justify-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-700 focus:ring-offset-2"
on:click={() => downloadFile(url, dataset.identifier, dist)}
>Descargar</button
>

View file

@ -8,7 +8,7 @@
export let params: { dumpUrl: string };
$: url = decodeURIComponent(params.dumpUrl);
$: metadataPromise = fetchDumpMetadata(url);
$: metadataPromise = fetchDumpMetadata(url).catch(alert);
</script>
<main class="mx-auto max-w-3xl">
@ -17,12 +17,12 @@
<p class="p-6">Cargando..</p>
{:then metadata}
<header
class="py-5 px-6 border-b border-b-gray-200 dark:border-b-gray-700 leading-none"
class="border-b border-b-gray-200 px-6 py-5 leading-none dark:border-b-gray-700"
>
<small>
Viendo archivo en
<a
class="underline text-blue-500 dark:text-blue-300"
class="text-blue-500 underline dark:text-blue-300"
target="_blank"
rel="noopener"
href={url}>{url}</a
@ -37,15 +37,15 @@
portal: site.path,
})}
<li>
<div class="flex px-6 py-5 justify-between gap-3">
<div class="flex justify-between gap-3 px-6 py-5">
<div class="flex flex-col">
<h3 class="text-lg">{site.title}</h3>
<p class="text-sm">{site.description}</p>
</div>
<div class="flex flex-col items-center justify-center shrink-0">
<div class="flex shrink-0 flex-col items-center justify-center">
<a
href={portalLink}
class="inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none"
class="focus:shadow-outline inline-flex items-center justify-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-700 focus:ring-offset-2"
>Ver portal</a
>
<SourceLink href={site.url} />

View file

@ -11,9 +11,9 @@
export let params: { dumpUrl: string; portal: string };
$: url = `${decodeURIComponent(params.dumpUrl)}/${params.portal}`;
$: data = Promise.all([fetchData(url), fetchErrors(url)]).then(
([data, errors]) => ({ data, errors }),
);
$: data = Promise.all([fetchData(url), fetchErrors(url)])
.then(([data, errors]) => ({ data, errors }))
.catch(alert);
function arreglarHomepageUrl(url: string): string {
if (!url.startsWith("http://") && !url.startsWith("https://"))
@ -51,29 +51,29 @@
<p class="p-6">Cargando..</p>
{:then { data, errors }}
<header
class="py-5 px-6 border-b border-b-gray-200 dark:border-b-gray-700 leading-none"
class="border-b border-b-gray-200 px-6 py-5 leading-none dark:border-b-gray-700"
>
<small>
Viendo portal archivado de
<a
class="underline text-blue-500 dark:text-blue-300"
class="text-blue-500 underline dark:text-blue-300"
target="_blank"
rel="noopener"
href={url}>{url}</a
>
</small>
<h1 class="font-bold text-3xl">{data.title}</h1>
<h1 class="text-3xl font-bold">{data.title}</h1>
<p class="text-xl">{data.description}</p>
{#if data.homepage}
<SourceLink href={arreglarHomepageUrl(data.homepage)} />
{/if}
</header>
<div class="w-full mx-auto px-6 py-2">
<div class="mx-auto w-full px-6 py-2">
<input
type="text"
placeholder="Buscar..."
class="flex w-full h-10 px-3 py-2 text-sm bg-white dark:bg-gray-800 border rounded-md border-neutral-300 dark:border-gray-700 ring-offset-background placeholder:text-neutral-500 dark:placeholder:text-gray-500 focus:border-neutral-300 dark:focus:border-gray-700 focus:outline-none focus:ring-2 focus:ring-neutral-400 dark:focus:ring-gray-600 disabled:cursor-not-allowed disabled:opacity-50"
class="ring-offset-background flex h-10 w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm placeholder:text-neutral-500 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:placeholder:text-gray-500 dark:focus:border-gray-700 dark:focus:ring-gray-600"
bind:value={query}
/>
</div>
@ -87,7 +87,7 @@
})}
<li>
<a
class="flex px-6 py-5 hover:bg-gray-50 dark:hover:bg-gray-700 justify-between"
class="flex justify-between px-6 py-5 hover:bg-gray-50 dark:hover:bg-gray-700"
href={datasetLink}
>
<div>