Improve project failed state

This commit is contained in:
Alexis Sellier
2021-06-11 10:44:10 +02:00
parent b9999209de
commit b856676573
5 changed files with 91 additions and 56 deletions
+1 -5
View File
@@ -118,10 +118,6 @@
height: 2rem;
margin-right: 1rem;
}
.error {
background-color: var(--color-negative-background);
padding: 1rem;
}
</style>
{#await Org.get(address, config)}
@@ -223,7 +219,7 @@
</div>
{/each}
{:catch err}
<div class="error">
<div class="error error-message">
Error loading projects: {err}.
</div>
{/await}
+51 -26
View File
@@ -29,6 +29,20 @@
</script>
<style>
main > header {
padding: 0 8rem;
margin-bottom: 2rem;
}
.anchor {
display: inline-block;
font-size: 0.75rem;
font-family: var(--font-family-monospace);
color: var(--color-secondary);
background-color: var(--color-secondary-background);
padding: 0.75rem;
border-radius: 0.25rem;
}
.center-content {
margin: 0 auto;
max-width: var(--content-max-width);
@@ -61,31 +75,42 @@
}
</style>
<div class="container center-content">
{#if commit}
<div class="column-left">
<div class="source-tree">
{#await proj.getTree(urn, commit, "/", config)}
Loading..
{:then tree}
<Tree {tree} {path} {fetchTree} on:select={onSelect} />
{:catch err}
{err}
{/await}
<main>
{#await proj.getTree(urn, commit, "/", config)}
Loading..
{:then tree}
<header>
<div class="anchor">
commit {commit}
</div>
</header>
<div class="container center-content">
{#if commit}
<div class="column-left">
<div class="source-tree">
<Tree {tree} {path} {fetchTree} on:select={onSelect} />
</div>
</div>
<div class="column-right">
{#await blob}
<Loading small center />
{:then blob}
{#if blob}
<Blob {blob} />
{:else}
<!-- Project has no README -->
{/if}
{:catch}
<!-- TODO: Handle error -->
{/await}
</div>
{/if}
</div>
{:catch err}
<div class="container center-content">
<div class="error error-message text-small">
API request to <code class="text-small">{err.url}</code> failed
</div>
</div>
<div class="column-right">
{#await blob}
<Loading small center />
{:then blob}
{#if blob}
<Blob {blob} />
{:else}
<!-- Project has no README -->
{/if}
{:catch}
<!-- TODO: Handle error -->
{/await}
</div>
{/if}
</div>
{/await}
</main>
-15
View File
@@ -38,24 +38,12 @@
padding: 4rem 0;
}
main > header {
margin-bottom: 4rem;
padding: 0 8rem;
}
.title {
font-size: 2.25rem;
margin-bottom: 0.5rem;
}
.anchor {
display: inline-block;
font-size: 0.75rem;
font-family: var(--font-family-monospace);
color: var(--color-secondary);
background-color: var(--color-secondary-background);
padding: 0.75rem;
border-radius: 0.25rem;
}
.urn {
font-family: var(--font-family-monospace);
font-size: 0.75rem;
@@ -76,9 +64,6 @@
<div class="title bold">{project.meta.name}</div>
<div class="urn">{urn}</div>
<div class="description">{project.meta.description}</div>
<div class="anchor">
commit {commit || project.head}
</div>
</header>
<Browser {urn} commit={commit || project.head} {path} {onSelect} {config} />
{:else}