feat: add link to preview design

This commit is contained in:
2026-08-28 11:50:50 +05:00
parent d373cc0daf
commit 40eee984da
2 changed files with 46 additions and 26 deletions
+1 -2
View File
@@ -336,8 +336,7 @@ src/routes/preview/tools/[id]/+page.svelte
### Шаг 4. Переключатель и проверка ### Шаг 4. Переключатель и проверка
- [ ] **[C15]** Кнопка «Preview v2» + `localStorage`-флаг в старой шапке (ведёт на - [x] **[C15]** В старой шапке ссылка «Preview v2» → `/preview`, ставит `localStorage['easy-png-tools:preview-v2']='1'`.
`/preview`).
- [ ] **[C16]** Смоук §8, скриншоты против `refs-html/`, прогон старых тестов - [ ] **[C16]** Смоук §8, скриншоты против `refs-html/`, прогон старых тестов
(доказательство отсутствия регресса). Фиксы по результатам — отдельными (доказательство отсутствия регресса). Фиксы по результатам — отдельными
мелкими коммитами. мелкими коммитами.
+45 -24
View File
@@ -1,12 +1,12 @@
<script lang="ts"> <script lang="ts">
import '../../app.css'; import "../../app.css";
import favicon from '$lib/assets/favicon.svg'; import favicon from "$lib/assets/favicon.svg";
import { onMount } from 'svelte'; import { onMount } from "svelte";
import { resolve } from '$app/paths'; import { resolve } from "$app/paths";
import { getLocale, initLocale, setLocale } from '$lib/i18n/locale.svelte'; import { getLocale, initLocale, setLocale } from "$lib/i18n/locale.svelte";
import { getTheme, initTheme, setTheme } from '$lib/theme.svelte'; import { getTheme, initTheme, setTheme } from "$lib/theme.svelte";
import { t } from '$lib/i18n/t'; import { t } from "$lib/i18n/t";
import { LOCALES, type Locale } from '$lib/i18n/dict'; import { LOCALES, type Locale } from "$lib/i18n/dict";
let { children } = $props(); let { children } = $props();
@@ -15,7 +15,7 @@
initTheme(); initTheme();
}); });
const LANG_LABELS: Record<Locale, string> = { ru: 'RU', en: 'EN' }; const LANG_LABELS: Record<Locale, string> = { ru: "RU", en: "EN" };
</script> </script>
<svelte:head> <svelte:head>
@@ -24,10 +24,20 @@
<div class="app"> <div class="app">
<header> <header>
<a href={resolve('/')} class="brand">easy-png-tools</a> <a href={resolve("/")} class="brand">easy-png-tools</a>
<nav aria-label={t('header.sectionsAria')}> <nav aria-label={t("header.sectionsAria")}>
<a class="nav-link workspace-link" href={resolve('/')}>{t('header.workspace')}</a> <a class="nav-link workspace-link" href={resolve("/")}
<a class="nav-link" href={resolve('/list-tools')}>{t('header.catalog')}</a> >{t("header.workspace")}</a
>
<a class="nav-link" href={resolve("/list-tools")}>{t("header.catalog")}</a
>
<a
class="nav-link preview-v2"
href={resolve("/preview")}
onclick={() => localStorage.setItem("easy-png-tools:preview-v2", "1")}
>
Preview v2
</a>
<div class="lang-switch" role="group" aria-label="Language / Язык"> <div class="lang-switch" role="group" aria-label="Language / Язык">
{#each LOCALES as l (l)} {#each LOCALES as l (l)}
<button <button
@@ -45,22 +55,22 @@
<button <button
type="button" type="button"
class="lang-btn" class="lang-btn"
class:active={getTheme() === 'light'} class:active={getTheme() === "light"}
aria-pressed={getTheme() === 'light'} aria-pressed={getTheme() === "light"}
title={t('ui.themeLight')} title={t("ui.themeLight")}
aria-label={t('ui.themeLight')} aria-label={t("ui.themeLight")}
onclick={() => setTheme('light')} onclick={() => setTheme("light")}
> >
</button> </button>
<button <button
type="button" type="button"
class="lang-btn" class="lang-btn"
class:active={getTheme() === 'dark'} class:active={getTheme() === "dark"}
aria-pressed={getTheme() === 'dark'} aria-pressed={getTheme() === "dark"}
title={t('ui.themeDark')} title={t("ui.themeDark")}
aria-label={t('ui.themeDark')} aria-label={t("ui.themeDark")}
onclick={() => setTheme('dark')} onclick={() => setTheme("dark")}
> >
</button> </button>
@@ -73,7 +83,7 @@
</main> </main>
<footer> <footer>
<p class="text-caption text-muted">{t('header.footerNote')}</p> <p class="text-caption text-muted">{t("header.footerNote")}</p>
</footer> </footer>
</div> </div>
@@ -161,6 +171,17 @@
color: var(--link); color: var(--link);
} }
.preview-v2 {
color: var(--accent);
border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
}
.preview-v2:hover {
background: var(--accent);
color: var(--bg);
text-decoration: none;
}
main { main {
flex: 1; flex: 1;
width: 100%; width: 100%;