diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 658f35d..41772eb 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -32,16 +32,11 @@ user = await whoami(); } else { user = null; - - if ($page.url.pathname !== '/') - goto('/login'); // Redirect to login if not authenticated } } catch (error) { console.error('Authentication check failed:', error); isAuthenticated = false; user = null; - if ($page.url.pathname !== '/') - goto('/login'); // Redirect to login if not authenticated } }); diff --git a/src/lib/components/PointEditor.svelte b/src/lib/components/PointEditor.svelte index a5d17a4..02cfb5b 100644 --- a/src/lib/components/PointEditor.svelte +++ b/src/lib/components/PointEditor.svelte @@ -1,197 +1,8 @@ - - - - Редактирование точки - - - - - {"Редактирование точки"} - (isAlertVisible = false)} - fade={false} - class="mb-2" - > - - {alertText} - - { - e.preventDefault(); - handleSavePoint(); - }} - > - - Название точки: - - - - - Широта: - - Градусы - - - Долгота: - - Градусы - - - Высота: - - Метры над ур. моря - - - - - Обновить точку - - Отмена - - isConfirmationVisible = true} - > - Удалить точку - - - - - - - - { - isConfirmationVisible = false; - handleDeletePoint(selectedPoint); - }} - oncancel={() => { - isConfirmationVisible = false; - }} -> - Вы уверены, что хотите удалить эту точку? - \ No newline at end of file + \ No newline at end of file diff --git a/src/lib/components/PointListModal.svelte b/src/lib/components/PointListModal.svelte index b47abc9..51e0e34 100644 --- a/src/lib/components/PointListModal.svelte +++ b/src/lib/components/PointListModal.svelte @@ -16,24 +16,16 @@ import { addToast } from "$lib/components/Toast.svelte"; import type { SavedPoint } from "$lib/types"; import { SavedPointsStore } from "$lib/stores"; - import ConfirmationPrompt from "./ConfirmationPrompt.svelte"; import { getSavedPoints, savePoint, updatePoint, deletePoint } from "$lib/api/points"; // Props - let { - isOpen = $bindable(false), - onClose = () => {}, - onChange = () => {}, - point = null, - coordinates = { id: 0, name: "", lat: 0, lon: 0, alt: 0 }, - } = $props(); + let { isOpen = $bindable(false), onClose = () => {}, onChange = () => {} } = $props(); // Runes - let selectedPoint = $state(point); - let newPoint = $state(coordinates as SavedPoint); + let selectedPoint = $state(null); + let newPoint = $state({ id: 0, name: "", lat: 0, lon: 0, alt: 0 }); let isEditing = $state(false); let isAlertVisible = $state(false); - let isConfirmationVisible = $state(false); let alertText = $state(""); // Table handler @@ -67,13 +59,7 @@ isEditing = true; } - function confirmDeletePoint(point: SavedPoint) { - selectedPoint = point; - isConfirmationVisible = true; - } - - function handleDeletePoint(point: SavedPoint | null) { - if (!point) return; + function handleDeletePoint(point: SavedPoint) { deletePoint(point.id) .then(() => { $SavedPointsStore = $SavedPointsStore.filter((p) => p.id !== point.id); @@ -143,7 +129,7 @@ } - + Сохраненные точки @@ -193,7 +179,7 @@ handleEditPoint(row)}> - confirmDeletePoint(row)}> + handleDeletePoint(row)}> @@ -289,20 +275,3 @@ - - { - isConfirmationVisible = false; - handleDeletePoint(selectedPoint); - }} - oncancel={() => { - isConfirmationVisible = false; - }} -> - Вы уверены, что хотите удалить эту точку? - \ No newline at end of file diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index d027858..a48518c 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -86,7 +86,7 @@ Войти {/if} - Назад + Назад diff --git a/src/routes/user/account/+page.svelte b/src/routes/user/account/+page.svelte index 7b1f76f..7f58e31 100644 --- a/src/routes/user/account/+page.svelte +++ b/src/routes/user/account/+page.svelte @@ -116,7 +116,7 @@ - + Учетная запись Сохраненные сценарии diff --git a/src/routes/user/templates/+page.svelte b/src/routes/user/templates/+page.svelte index 7c1294c..b1948f8 100644 --- a/src/routes/user/templates/+page.svelte +++ b/src/routes/user/templates/+page.svelte @@ -16,8 +16,6 @@ import Navbar from "$lib/components/Navbar.svelte"; import Footer from "$lib/components/Footer.svelte"; import ConfirmationPrompt from "$lib/components/ConfirmationPrompt.svelte"; - import PointEditor from "$lib/components/PointEditor.svelte"; - import ToastContainer from "$lib/components/Toast.svelte"; import { addToast } from "$lib/components/Toast.svelte"; // TODO: Implement these imports @@ -37,14 +35,12 @@ let templatesTable = $derived(new TableHandler($SavedScenarioTemplatesStore, { rowsPerPage: 5 })); let templatesSearch = $derived(templatesTable.createSearch(["name"])); - let editPoint: SavedPoint | null = $state(null); - onMount(async () => { // Mock data for demonstration. Replace with API calls. - const pts = await getSavedPoints(); - $SavedPointsStore = pts; - SavedPointsStore.set($SavedPointsStore); - + $SavedPointsStore = [ + { id: 1, name: "Baikonur Cosmodrome", lat: 45.96, lon: 63.3, alt: 90 }, + { id: 2, name: "Kennedy Space Center", lat: 28.57, lon: -80.64, alt: 3 }, + ]; $SavedFlightProfilesStore = [ { id: 1, name: "Standard Weather Balloon", rate_profile_data: {ascent_rate: 5, descent_rate: 8, burst_altitude: 30000} }, { id: 2, name: "High Altitude Probe", rate_profile_data: {ascent_rate: 6, descent_rate: 10, burst_altitude: 40000} }, @@ -119,10 +115,6 @@ }, }); } - - function handleEditPoint(point: SavedPoint) { - editPoint = point; - } @@ -132,7 +124,7 @@ - + Учетная запись Сохраненные сценарии @@ -149,28 +141,13 @@ Точки запуска - - pointsSearch.set()} - /> - { - pointsSearch.value = ""; - pointsSearch.set(); - }} - disabled={!pointsSearch.value} - > - - - + pointsSearch.set()} + /> @@ -190,9 +167,6 @@ {row.lon.toFixed(4)} ° {row.alt} м - handleEditPoint(row)}> - - (showConfirm = false)} > {confirmConfig.body} - - - { editPoint = null; pointsTable.setRows($SavedPointsStore) }} -/> - - \ No newline at end of file + \ No newline at end of file diff --git a/static/css/custom.css b/static/css/custom.css index bbba238..41fa26e 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -128,10 +128,6 @@ flex-direction: column; } -.modal-tinted { - filter: brightness(0.6); -} - @media (max-width: 767.98px) { .coordinates-display {
Вы уверены, что хотите удалить эту точку?
{confirmConfig.body}