initial commit

This commit is contained in:
2025-06-25 00:23:37 +03:00
parent d63e39b3a8
commit c9a67204e3
21 changed files with 5240 additions and 0 deletions

1
src/app.css Normal file
View File

@@ -0,0 +1 @@
@import 'tailwindcss';

13
src/app.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

12
src/app.html Normal file
View File

@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

7
src/demo.spec.ts Normal file
View File

@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';
describe('sum test', () => {
it('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});

1
src/lib/index.ts Normal file
View File

@@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

View File

@@ -0,0 +1,7 @@
<script lang="ts">
import '../app.css';
let { children } = $props();
</script>
{@render children()}

31
src/routes/+page.svelte Normal file
View File

@@ -0,0 +1,31 @@
<script lang="ts">
import { goto } from '$app/navigation';
import Geolocation from 'svelte-geolocation';
import type { GeolocationError } from 'svelte-geolocation/Geolocation.svelte';
let getPosition: boolean = $state(false);
let loading: boolean = $state(false);
let position: GeolocationPosition | undefined = $state(undefined);
let error: GeolocationError | undefined = $state(undefined);
function flipGetPosition(): void {
getPosition = true;
}
function goToPlayer(): void {
goto(`/on-out?lat=${position?.coords.latitude}&long=${position?.coords.longitude}`);
}
</script>
{#if !getPosition}
<button onclick={flipGetPosition}> Find yourself </button>
{:else if loading}
<p>Loading...</p>
{:else if error}
<p>We can't seem to find you.</p>
{:else}
<p>Your Position is set as: {position?.coords?.latitude}, {position?.coords?.longitude}</p>
<button onclick={goToPlayer}>Ok, on-out with it</button>
{/if}
<Geolocation {getPosition} bind:position bind:loading bind:error />

View File

@@ -0,0 +1,9 @@
<script lang="ts">
import { page } from '$app/state';
const lat = $derived(page.url.searchParams.get('lat'));
const long = $derived(page.url.searchParams.get('long'));
$inspect(lat);
$inspect(long);
</script>

View File

@@ -0,0 +1,13 @@
import { page } from '@vitest/browser/context';
import { describe, expect, it } from 'vitest';
import { render } from 'vitest-browser-svelte';
import Page from './+page.svelte';
describe('/+page.svelte', () => {
it('should render h1', async () => {
render(Page);
const heading = page.getByRole('heading', { level: 1 });
await expect.element(heading).toBeInTheDocument();
});
});