Small improvements #44
4 changed files with 323 additions and 0 deletions
15
src/lib/translations/en-US/error.json
Normal file
15
src/lib/translations/en-US/error.json
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"seo.title": "Page not found — Embroidery Viewer",
|
||||||
|
"seo.description": "The page you are looking for could not be found.",
|
||||||
|
"seo.keywords": "404, page not found, embroidery viewer",
|
||||||
|
"seo.url": "https://embroideryviewer.xyz",
|
||||||
|
"notFound.code": "404",
|
||||||
|
"notFound.title": "This stitch went off pattern",
|
||||||
|
"notFound.description": "The page you are looking for may have been moved, removed, or never existed. Let's get you back to previewing embroidery designs.",
|
||||||
|
"notFound.home": "Back to home",
|
||||||
|
"notFound.viewer": "Open the viewer",
|
||||||
|
"notFound.imageAlt": "Embroidery design preview on screen",
|
||||||
|
"generic.title": "Something went wrong",
|
||||||
|
"generic.description": "We hit a snag while loading this page. Please try again or return to the home page.",
|
||||||
|
"generic.home": "Back to home"
|
||||||
|
}
|
||||||
|
|
@ -247,6 +247,16 @@ const config = {
|
||||||
key: 'announcement',
|
key: 'announcement',
|
||||||
loader: async () => (await import('./en-US/announcement.json')).default,
|
loader: async () => (await import('./en-US/announcement.json')).default,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
locale: SUPPORTED_LOCALES.PT_BR,
|
||||||
|
key: 'error',
|
||||||
|
loader: async () => (await import('./pt-BR/error.json')).default,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
locale: SUPPORTED_LOCALES.EN_US,
|
||||||
|
key: 'error',
|
||||||
|
loader: async () => (await import('./en-US/error.json')).default,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
15
src/lib/translations/pt-BR/error.json
Normal file
15
src/lib/translations/pt-BR/error.json
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"seo.title": "Página não encontrada — Embroidery Viewer",
|
||||||
|
"seo.description": "A página que você procura não foi encontrada.",
|
||||||
|
"seo.keywords": "404, página não encontrada, visualizador de bordado",
|
||||||
|
"seo.url": "https://embroideryviewer.xyz",
|
||||||
|
"notFound.code": "404",
|
||||||
|
"notFound.title": "Este ponto saiu do desenho",
|
||||||
|
"notFound.description": "A página pode ter sido movida, removida ou nunca existiu. Vamos voltar para visualizar seus bordados.",
|
||||||
|
"notFound.home": "Voltar ao início",
|
||||||
|
"notFound.viewer": "Abrir o visualizador",
|
||||||
|
"notFound.imageAlt": "Prévia de desenho de bordado na tela",
|
||||||
|
"generic.title": "Algo deu errado",
|
||||||
|
"generic.description": "Encontramos um problema ao carregar esta página. Tente novamente ou volte ao início.",
|
||||||
|
"generic.home": "Voltar ao início"
|
||||||
|
}
|
||||||
283
src/routes/+error.svelte
Normal file
283
src/routes/+error.svelte
Normal file
|
|
@ -0,0 +1,283 @@
|
||||||
|
<script>
|
||||||
|
import { resolve } from '$app/paths';
|
||||||
|
import { PUBLIC_IMAGE_BASE_URL } from '$env/static/public';
|
||||||
|
import { t } from '$lib/translations';
|
||||||
|
import { isMobile } from '$lib/utils/isMobile';
|
||||||
|
|
||||||
|
import Head from '$lib/components/Head.svelte';
|
||||||
|
|
||||||
|
/** @type {{ status: number }} */
|
||||||
|
let { status } = $props();
|
||||||
|
|
||||||
|
const isNotFound = $derived(status === 404);
|
||||||
|
|
||||||
|
const embroideryImage = isMobile()
|
||||||
|
? `${PUBLIC_IMAGE_BASE_URL}/t/f_webp,w_480/embroidery-viewer/hero-mobile.webp`
|
||||||
|
: `${PUBLIC_IMAGE_BASE_URL}/t/f_webp,w_640/embroidery-viewer/viewer-screenshot.webp`;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Head
|
||||||
|
title="error.seo.title"
|
||||||
|
description="error.seo.description"
|
||||||
|
keywords="error.seo.keywords"
|
||||||
|
url="error.seo.url"
|
||||||
|
shouldBeIndexed={false}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<section class="error-page" aria-labelledby="error-heading">
|
||||||
|
<div class="thread-bg" aria-hidden="true"></div>
|
||||||
|
|
||||||
|
<div class="error-card" class:single-column={!isNotFound}>
|
||||||
|
<div class="copy">
|
||||||
|
<p class="code">{isNotFound ? $t('error.notFound.code') : status}</p>
|
||||||
|
<h1 id="error-heading">
|
||||||
|
{isNotFound ? $t('error.notFound.title') : $t('error.generic.title')}
|
||||||
|
</h1>
|
||||||
|
<p class="description">
|
||||||
|
{isNotFound
|
||||||
|
? $t('error.notFound.description')
|
||||||
|
: $t('error.generic.description')}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<a class="organic-btn" href={resolve('/')}>
|
||||||
|
{isNotFound ? $t('error.notFound.home') : $t('error.generic.home')}
|
||||||
|
</a>
|
||||||
|
{#if isNotFound}
|
||||||
|
<a class="organic-btn-secondary outline" href={resolve('/viewer')}>
|
||||||
|
{$t('error.notFound.viewer')}
|
||||||
|
</a>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if isNotFound}
|
||||||
|
<div class="visual">
|
||||||
|
<div class="hoop" aria-hidden="true">
|
||||||
|
<div class="hoop-inner">
|
||||||
|
<img
|
||||||
|
src={embroideryImage}
|
||||||
|
width="640"
|
||||||
|
height="480"
|
||||||
|
alt={$t('error.notFound.imageAlt')}
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="needle" aria-hidden="true"></div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.error-page {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 120px 24px 80px;
|
||||||
|
overflow: hidden;
|
||||||
|
background:
|
||||||
|
radial-gradient(
|
||||||
|
circle at 15% 20%,
|
||||||
|
rgba(6, 52, 95, 0.08),
|
||||||
|
transparent 45%
|
||||||
|
),
|
||||||
|
radial-gradient(
|
||||||
|
circle at 85% 80%,
|
||||||
|
rgba(25, 71, 149, 0.1),
|
||||||
|
transparent 50%
|
||||||
|
),
|
||||||
|
linear-gradient(180deg, #f8fafb 0%, #eef3f8 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.thread-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.35;
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg width='600' height='600' viewBox='0 0 600 600' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2306345f' stroke-width='1.2' opacity='0.5'%3E%3Cpath d='M80 120 Q200 40 320 140 T520 100' stroke-dasharray='6 8'/%3E%3Cpath d='M60 380 Q180 300 300 400 T540 360' stroke-dasharray='4 10'/%3E%3Ccircle cx='300' cy='300' r='120' stroke-dasharray='3 6'/%3E%3C/g%3E%3C/svg%3E");
|
||||||
|
background-size: 520px;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card.single-column {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
max-width: 520px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card.single-column .description {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card.single-column .actions {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
width: min(100%, 1000px);
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 48px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 48px;
|
||||||
|
background: rgba(255, 255, 255, 0.88);
|
||||||
|
border-radius: 32px 58% 42% 68% / 48% 38% 62% 52%;
|
||||||
|
box-shadow:
|
||||||
|
0 24px 48px rgba(6, 52, 95, 0.12),
|
||||||
|
0 0 0 1px rgba(6, 52, 95, 0.06);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.code {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 0 8px;
|
||||||
|
font-size: clamp(3rem, 10vw, 4.5rem);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: -0.04em;
|
||||||
|
color: var(--color-primary);
|
||||||
|
background: linear-gradient(135deg, #06345f 0%, #194795 55%, #3d6eb5 100%);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0 0 16px;
|
||||||
|
font-size: clamp(1.5rem, 3vw, 2rem);
|
||||||
|
line-height: 1.25;
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.05rem;
|
||||||
|
line-height: 1.65;
|
||||||
|
color: #3a4a5c;
|
||||||
|
max-width: 38ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 14px;
|
||||||
|
margin-top: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions .organic-btn,
|
||||||
|
.actions .organic-btn-secondary {
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 16px 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.organic-btn-secondary.outline {
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-primary);
|
||||||
|
border: 2px solid var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.organic-btn-secondary.outline:hover {
|
||||||
|
background: var(--color-primary);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.visual {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hoop {
|
||||||
|
position: relative;
|
||||||
|
width: min(100%, 340px);
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 14px;
|
||||||
|
background: linear-gradient(145deg, #c9a227 0%, #8b6914 40%, #d4af37 100%);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 2px 4px rgba(255, 255, 255, 0.45),
|
||||||
|
inset 0 -4px 8px rgba(0, 0, 0, 0.2),
|
||||||
|
0 16px 32px rgba(6, 52, 95, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hoop-inner {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #f2f6f5;
|
||||||
|
border: 3px dashed rgba(6, 52, 95, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hoop-inner img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.needle {
|
||||||
|
position: absolute;
|
||||||
|
top: 8%;
|
||||||
|
right: 6%;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%2306345f' d='M8 40 L24 4 L28 8 L14 38 Z'/%3E%3Ccircle cx='8' cy='40' r='4' fill='%23194795'/%3E%3C/svg%3E");
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
transform: rotate(12deg);
|
||||||
|
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.15));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 860px) {
|
||||||
|
.error-card {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
text-align: center;
|
||||||
|
padding: 36px 28px;
|
||||||
|
border-radius: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.visual {
|
||||||
|
order: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hoop {
|
||||||
|
width: min(280px, 80vw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.error-page {
|
||||||
|
padding-top: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions .organic-btn,
|
||||||
|
.actions .organic-btn-secondary {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Add table
Reference in a new issue