feat: move preview pages to root

This commit is contained in:
2026-09-10 19:59:40 +05:00
parent 85effce7d9
commit 45dc54b6aa
8 changed files with 8 additions and 77 deletions
+1 -1
View File
@@ -54,7 +54,7 @@
## Переезд ## Переезд
- [ ] составить план переноса preview -> корень, старый корень -> old - [x] составить план переноса preview -> корень, старый корень -> old
- [ ] добавить i18n в preview - [ ] добавить i18n в preview
## SEO/GEO ## SEO/GEO
+7 -7
View File
@@ -58,24 +58,24 @@
`list-tools``/`, `tools/[id]``/`, витрину `kit``/kit`. Удалить `list-tools``/`, `tools/[id]``/`, витрину `kit``/kit`. Удалить
`preview/+layout.svelte` (корневой shell заменяет его). `preview/+layout.svelte` (корневой shell заменяет его).
### 4. Flatten `kit/` → `components/` ### 4. Update hardcoded `/preview/` URLs
В компонентах с захардкоженными путями `/preview/` заменить на корневые.
### 5. Flatten `kit/` → `components/`
Перенести компоненты из `lib/components/kit/` в `lib/components/`, обновить все Перенести компоненты из `lib/components/kit/` в `lib/components/`, обновить все
импорты, удалить пустую `kit/`. импорты, удалить пустую `kit/`.
### 5. Flatten `preview/` → `lib/` ### 6. Flatten `preview/` → `lib/`
Перенести код из `lib/previw/` в `lib/`, обновить все импорты, удалить пустую Перенести код из `lib/previw/` в `lib/`, обновить все импорты, удалить пустую
`preview/`. `preview/`.
### 6. Перенести `old/` → `v1/` ### 7. Перенести `old/` → `v1/`
- `$lib/old/` — переименовать в `lib/v1/`, обновить все импорты - `$lib/old/` — переименовать в `lib/v1/`, обновить все импорты
### 7. Update hardcoded `/preview/` URLs
В компонентах с захардкоженными путями `/preview/` заменить на корневые.
### 8. E2E тесты + playwright config ### 8. E2E тесты + playwright config
Заменить `/preview/...` на `/...` во всех e2e файлах и конфиге playwright. Заменить `/preview/...` на `/...` во всех e2e файлах и конфиге playwright.
-69
View File
@@ -1,69 +0,0 @@
<script lang="ts">
import { page } from "$app/state";
import Footer from "$lib/components/kit/layout/Footer.svelte";
import TopBar from "$lib/components/kit/layout/TopBar.svelte";
import type { Snippet } from "svelte";
import "../../app.css";
interface Props {
children: Snippet;
}
let { children }: Props = $props();
type Theme = "light" | "dark";
const stored =
typeof localStorage !== "undefined"
? (localStorage.getItem("easy-png-tools:theme") as Theme | null)
: null;
let theme = $state<Theme>(stored ?? "light");
function toggle() {
theme = theme === "light" ? "dark" : "light";
}
$effect(() => {
document.documentElement.dataset.theme = theme;
try {
localStorage.setItem("easy-png-tools:theme", theme);
} catch {
/* ignore */
}
});
let crumb = $derived(toCrumb(page.url.pathname));
const CRUMB: Record<string, string> = {
"/preview/list-tools": "CATALOG",
"/preview/tools/linear-gradient-png": "GRADIENT",
"/preview/tools/remove-background-png": "BACKGROUND REMOVER",
};
function toCrumb(path: string): string {
return (
"/ " +
(CRUMB[path] ??
path.split("/").filter(Boolean).pop()?.toUpperCase() ??
"PREVIEW")
);
}
</script>
<main class="preview-root" data-theme={theme}>
<TopBar {theme} {crumb} ontoggle={toggle} />
{@render children()}
<Footer />
</main>
<style>
.preview-root {
background-color: var(--color-background);
background-image:
linear-gradient(var(--color-background-muted) 1px, transparent 1px),
linear-gradient(90deg, var(--color-background-muted) 1px, transparent 1px);
background-size: var(--space-xxxl) var(--space-xxxl);
min-height: 100vh;
display: flex;
flex-direction: column;
}
</style>