Skip to content

Commit

Permalink
Merge pull request #406 from lanedirt/323-customize-error-when-unhand…
Browse files Browse the repository at this point in the history
…led-error-occurs-in-webapp

Style blazor wasm exception message
  • Loading branch information
lanedirt authored Nov 22, 2024
2 parents 8a99dbf + 5de9a0b commit 197248a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/AliasVault.Client/wwwroot/css/app.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#blazor-error-ui {
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
Expand All @@ -18,7 +16,6 @@
}

.blazor-error-boundary {
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5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em;
color: white;
}
Expand Down
38 changes: 38 additions & 0 deletions src/AliasVault.Client/wwwroot/css/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,10 @@ video {
max-width: 36rem;
}

.max-w-screen-xl {
max-width: 1280px;
}

.flex-shrink-0 {
flex-shrink: 0;
}
Expand Down Expand Up @@ -1354,6 +1358,11 @@ video {
border-color: rgb(214 131 56 / var(--tw-border-opacity));
}

.border-red-500 {
--tw-border-opacity: 1;
border-color: rgb(239 68 68 / var(--tw-border-opacity));
}

.bg-amber-50 {
--tw-bg-opacity: 1;
background-color: rgb(255 251 235 / var(--tw-bg-opacity));
Expand Down Expand Up @@ -1899,6 +1908,11 @@ video {
color: rgb(133 77 14 / var(--tw-text-opacity));
}

.text-amber-500 {
--tw-text-opacity: 1;
color: rgb(245 158 11 / var(--tw-text-opacity));
}

.opacity-0 {
opacity: 0;
}
Expand Down Expand Up @@ -2074,6 +2088,11 @@ video {
background-color: rgb(153 27 27 / var(--tw-bg-opacity));
}

.hover\:bg-red-700:hover {
--tw-bg-opacity: 1;
background-color: rgb(185 28 28 / var(--tw-bg-opacity));
}

.hover\:from-primary-600:hover {
--tw-gradient-from: #d68338 var(--tw-gradient-from-position);
--tw-gradient-to: rgb(214 131 56 / 0) var(--tw-gradient-to-position);
Expand Down Expand Up @@ -2129,6 +2148,11 @@ video {
color: rgb(255 255 255 / var(--tw-text-opacity));
}

.hover\:text-red-200:hover {
--tw-text-opacity: 1;
color: rgb(254 202 202 / var(--tw-text-opacity));
}

.hover\:underline:hover {
text-decoration-line: underline;
}
Expand Down Expand Up @@ -2284,6 +2308,11 @@ video {
border-color: rgb(234 179 8 / var(--tw-border-opacity));
}

.dark\:border-red-800:is(.dark *) {
--tw-border-opacity: 1;
border-color: rgb(153 27 27 / var(--tw-border-opacity));
}

.dark\:bg-blue-800:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(30 64 175 / var(--tw-bg-opacity));
Expand Down Expand Up @@ -2364,6 +2393,11 @@ video {
background-color: rgb(113 63 18 / var(--tw-bg-opacity));
}

.dark\:bg-red-900:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(127 29 29 / var(--tw-bg-opacity));
}

.dark\:bg-opacity-80:is(.dark *) {
--tw-bg-opacity: 0.8;
}
Expand Down Expand Up @@ -2642,6 +2676,10 @@ video {
width: auto;
}

.sm\:flex-row {
flex-direction: row;
}

.sm\:rounded-lg {
border-radius: 0.5rem;
}
Expand Down
28 changes: 24 additions & 4 deletions src/AliasVault.Client/wwwroot/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,30 @@ <h2 class="mt-4 text-xl font-semibold text-gray-900 dark:text-white">AliasVault
<div id="app">
</div>

<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
<div id="blazor-error-ui" class="text-white bg-red-700 dark:bg-red-900 p-6 border-t-2 border-red-500 dark:border-red-800">
<div class="container mx-auto max-w-screen-xl px-4">
<div class="flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="flex items-center">
<svg class="w-8 h-8 text-white mr-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
</svg>
<span>An unhandled error has occurred. Please try reloading the page. If the issue persists, please contact support.</span>
</div>
<div class="flex items-center gap-4">
<a href="" class="reload flex items-center px-4 py-2 bg-red-600 hover:bg-red-700 rounded-md transition-colors duration-150">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
</svg>
Reload Page
</a>
<a class="dismiss hover:text-red-200">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</a>
</div>
</div>
</div>
</div>

<script>
Expand Down

0 comments on commit 197248a

Please sign in to comment.