mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 21:46:35 +00:00
feat: move preview pages to root
This commit is contained in:
+1
-1
@@ -54,7 +54,7 @@
|
||||
|
||||
## Переезд
|
||||
|
||||
- [ ] составить план переноса preview -> корень, старый корень -> old
|
||||
- [x] составить план переноса preview -> корень, старый корень -> old
|
||||
- [ ] добавить i18n в preview
|
||||
|
||||
## SEO/GEO
|
||||
|
||||
+7
-7
@@ -58,24 +58,24 @@
|
||||
`list-tools` → `/`, `tools/[id]` → `/`, витрину `kit` → `/kit`. Удалить
|
||||
`preview/+layout.svelte` (корневой shell заменяет его).
|
||||
|
||||
### 4. Flatten `kit/` → `components/`
|
||||
### 4. Update hardcoded `/preview/` URLs
|
||||
|
||||
В компонентах с захардкоженными путями `/preview/` заменить на корневые.
|
||||
|
||||
### 5. Flatten `kit/` → `components/`
|
||||
|
||||
Перенести компоненты из `lib/components/kit/` в `lib/components/`, обновить все
|
||||
импорты, удалить пустую `kit/`.
|
||||
|
||||
### 5. Flatten `preview/` → `lib/`
|
||||
### 6. Flatten `preview/` → `lib/`
|
||||
|
||||
Перенести код из `lib/previw/` в `lib/`, обновить все импорты, удалить пустую
|
||||
`preview/`.
|
||||
|
||||
### 6. Перенести `old/` → `v1/`
|
||||
### 7. Перенести `old/` → `v1/`
|
||||
|
||||
- `$lib/old/` — переименовать в `lib/v1/`, обновить все импорты
|
||||
|
||||
### 7. Update hardcoded `/preview/` URLs
|
||||
|
||||
В компонентах с захардкоженными путями `/preview/` заменить на корневые.
|
||||
|
||||
### 8. E2E тесты + playwright config
|
||||
|
||||
Заменить `/preview/...` на `/...` во всех e2e файлах и конфиге playwright.
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user