Skip to content

Commit

Permalink
Reformat imports
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed Mar 14, 2024
1 parent 576b496 commit 98ef540
Show file tree
Hide file tree
Showing 39 changed files with 107 additions and 67 deletions.
1 change: 1 addition & 0 deletions frontend/src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {goto} from '$app/navigation';

import type {LoginState} from './stores';

export function getLoginUrl(redirectUrl?: string): string {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/components/Flashes.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import {flashes, type Flash} from '$lib/stores';
import {onMount} from 'svelte';
import {flashes, type Flash} from '$lib/stores';
let loadedFlashes: Flash[] = [];
export function update(replace = false): void {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/components/Map.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script lang="ts">
import {reactive} from '$lib/svelte';
import {Map, NavigationControl, Marker, type LngLatLike} from 'maplibre-gl';
import {onMount} from 'svelte';
import {reactive} from '$lib/svelte';
export let latitude: number | null = null;
export let longitude: number | null = null;
export let editable: boolean = false;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/XContestSummary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Render a XContest flight summary, with icon, distance and link.
<script lang="ts">
import {formatDistance} from '$lib/formatters';
import {tracktypeName, type XContestTracktype} from '$lib/xcontest';
import XContestTracktypeIcon from './XContestTracktypeIcon.svelte';
/**
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/stores.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {writable} from 'svelte/store';

import {getCookiesMap} from './cookies';

// Flashes
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/routes/+error.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import {page} from '$app/stores';
import Flashes from '$lib/components/Flashes.svelte';
import {page} from '$app/stores';
</script>

<Flashes />
Expand Down
1 change: 1 addition & 0 deletions frontend/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import {onMount} from 'svelte';
import {loginState, refreshLoginState} from '$lib/stores';
onMount(() => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import {onMount} from 'svelte';
import {ResolvablePromise} from '$lib/resolvable-promise';
import Flashes from '$lib/components/Flashes.svelte';
import {ResolvablePromise} from '$lib/resolvable-promise';
import {_loadApiStats, type GlobalStats} from './+page';
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/routes/auth/login/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<script lang="ts">
import {goto} from '$app/navigation';
import {page} from '$app/stores';
import Flashes from '$lib/components/Flashes.svelte';
import {addFlash, refreshLoginState} from '$lib/stores';
import {ensureError} from '$lib/assert';
import Flashes from '$lib/components/Flashes.svelte';
import MessageModal from '$lib/components/MessageModal.svelte';
import {addFlash, refreshLoginState} from '$lib/stores';
import {sanitizeRedirectPath} from '$lib/urls';
import {goto} from '$app/navigation';
import {page} from '$app/stores';
import {apiLogin} from './api';
// Form values
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/routes/auth/login/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {error} from '@sveltejs/kit';

import {apiPost, extractResponseError} from '$lib/api';
import {ensureClientOrServerErrorCode} from '$lib/errors';
import {error} from '@sveltejs/kit';

export interface LoginResult {
readonly success: boolean;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/routes/auth/logout/+page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {goto} from '$app/navigation';
import {addFlash, refreshLoginState} from '$lib/stores';

import {goto} from '$app/navigation';

import {apiLogout} from './api';

// Disable server-side rendering for this page
Expand Down
1 change: 1 addition & 0 deletions frontend/src/routes/auth/logout/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {error} from '@sveltejs/kit';

import type {SvelteKitFetch} from '$lib';
import {apiPost, extractResponseError} from '$lib/api';
import {ensureClientOrServerErrorCode} from '$lib/errors';
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/routes/auth/password/change/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<script lang="ts">
import {onMount} from 'svelte';
import {goto} from '$app/navigation';
import {ensureError} from '$lib/assert';
import {requireLogin} from '$lib/auth';
import Flashes from '$lib/components/Flashes.svelte';
import MessageModal from '$lib/components/MessageModal.svelte';
import {reactive} from '$lib/svelte';
import {MIN_PASSWORD_LENGTH} from '$lib/constants';
import {ensureError} from '$lib/assert';
import {addFlash, loginState} from '$lib/stores';
import {reactive} from '$lib/svelte';
import {goto} from '$app/navigation';
import {apiChangePassword} from './api';
import PasswordFormInputField from './PasswordFormInputField.svelte';
import {requireLogin} from '$lib/auth';
import {apiChangePassword} from './api';
// Form values
let current: string = '';
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/routes/auth/password/change/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {error} from '@sveltejs/kit';

import {apiPost, extractApiError, extractResponseError} from '$lib/api';
import {ensureClientOrServerErrorCode} from '$lib/errors';
import {error} from '@sveltejs/kit';

export type PasswordChangeResult =
| {
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/routes/auth/registration/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts">
import {onMount} from 'svelte';
import Flashes from '$lib/components/Flashes.svelte';
import {addFlash, refreshLoginState} from '$lib/stores';
import {ensureError} from '$lib/assert';
import Flashes from '$lib/components/Flashes.svelte';
import MessageModal from '$lib/components/MessageModal.svelte';
import {reactive} from '$lib/svelte';
import {MIN_PASSWORD_LENGTH} from '$lib/constants';
import {addFlash, refreshLoginState} from '$lib/stores';
import {reactive} from '$lib/svelte';
import {goto} from '$app/navigation';
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/routes/auth/registration/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {error} from '@sveltejs/kit';

import {apiPost, extractApiError, extractResponseError} from '$lib/api';
import {ensureClientOrServerErrorCode} from '$lib/errors';
import {error} from '@sveltejs/kit';

export type RegistrationResult =
| {
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/routes/flights/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<script lang="ts">
import {goto, invalidateAll} from '$app/navigation';
import {apiDelete, extractResponseError} from '$lib/api';
import CountryFlag from '$lib/components/CountryFlag.svelte';
import DialogModal from '$lib/components/DialogModal.svelte';
import Flashes from '$lib/components/Flashes.svelte';
import MessageModal from '$lib/components/MessageModal.svelte';
import {addFlash} from '$lib/stores';
import XContestSummary from '$lib/components/XContestSummary.svelte';
import {formatDate, formatDistance, formatDuration} from '$lib/formatters';
import {addFlash} from '$lib/stores';
import {goto, invalidateAll} from '$app/navigation';
import type {Data} from './+page';
import type {FlightListItem} from './api';
import XContestSummary from '$lib/components/XContestSummary.svelte';
export let data: Data;
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/routes/flights/FlightForm.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<script lang="ts">
import {onMount} from 'svelte';
import {u8aToBase64} from '$lib/base64';
import MessageModal from '$lib/components/MessageModal.svelte';
import {addFlash} from '$lib/stores';
import {reactive} from '$lib/svelte';
import type {XContestTracktype} from '$lib/xcontest';
import {u8aToBase64} from '$lib/base64';
import {goto} from '$app/navigation';
import type {Glider} from '../gliders/api';
import {
processIgc,
type Flight,
Expand All @@ -18,8 +21,6 @@
type NewApiFlight,
editApiFlight,
} from './api';
import {addFlash} from '$lib/stores';
import {goto} from '$app/navigation';
// Props
export let flight: Flight | undefined = undefined;
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/routes/flights/[id]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script lang="ts">
import CountryFlag from '$lib/components/CountryFlag.svelte';
import Flashes from '$lib/components/Flashes.svelte';
import type {Data} from './+page';
import {formatDate, formatDistance, formatDuration, formatTime} from '$lib/formatters';
import XContestSummary from '$lib/components/XContestSummary.svelte';
import {formatDate, formatDistance, formatDuration, formatTime} from '$lib/formatters';
import type {Data} from './+page';
export let data: Data;
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/routes/flights/[id]/edit/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts">
import FlightForm from '../../FlightForm.svelte';
import Flashes from '$lib/components/Flashes.svelte';
import FlightForm from '../../FlightForm.svelte';
import type {Data} from './+page';
export let data: Data;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/routes/flights/[id]/edit/+page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {z} from 'zod';

import {loadApiGliders, type Glider} from '../../../gliders/api';
import {loadApiLocations} from '../../../locations/api';
import {loadApiFlights, type FlightLocation, loadApiFlight, type Flight} from '../../api';
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/routes/flights/add/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<script lang="ts">
import FlightForm from '../FlightForm.svelte';
import Flashes from '$lib/components/Flashes.svelte';
import type {Data} from './+page';
import {onMount} from 'svelte';
import {requireLogin} from '$lib/auth';
import Flashes from '$lib/components/Flashes.svelte';
import {loginState} from '$lib/stores';
import {onMount} from 'svelte';
import FlightForm from '../FlightForm.svelte';
import type {Data} from './+page';
export let data: Data;
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/routes/flights/api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type {SvelteKitFetch} from '$lib';
import {z} from 'zod';
import {error} from '@sveltejs/kit';
import {AuthenticationError, ensureClientOrServerErrorCode} from '$lib/errors';
import {z} from 'zod';

import type {SvelteKitFetch} from '$lib';
import {apiPost, apiPostBlob, extractResponseError} from '$lib/api';
import {SCHEMA_DATETIME_STRING} from '$lib/zod-helpers';
import {AuthenticationError, ensureClientOrServerErrorCode} from '$lib/errors';
import {ensureXContestTracktype, type XContestTracktype} from '$lib/xcontest';
import {SCHEMA_DATETIME_STRING} from '$lib/zod-helpers';

const SCHEMA_API_FLIGHT_LOCATION = z.object({
id: z.number(),
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/routes/gliders/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script lang="ts">
import {goto, invalidateAll} from '$app/navigation';
import {apiDelete, extractResponseError} from '$lib/api';
import DialogModal from '$lib/components/DialogModal.svelte';
import Flashes from '$lib/components/Flashes.svelte';
import MessageModal from '$lib/components/MessageModal.svelte';
import {addFlash} from '$lib/stores';
import {formatDuration} from '$lib/formatters';
import {addFlash} from '$lib/stores';
import {goto, invalidateAll} from '$app/navigation';
import type {Data} from './+page';
import type {Glider} from './api';
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/routes/gliders/GliderForm.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import {onMount} from 'svelte';
import {goto} from '$app/navigation';
import {apiPost, extractResponseError} from '$lib/api';
import MessageModal from '$lib/components/MessageModal.svelte';
import {addFlash} from '$lib/stores';
import {reactive} from '$lib/svelte';
import {type Glider} from './api';
import {apiPost, extractResponseError} from '$lib/api';
import {goto} from '$app/navigation';
import type {Glider} from './api';
// Props
export let glider: Glider | undefined = undefined;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/routes/gliders/[id]/edit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import Flashes from '$lib/components/Flashes.svelte';
import GliderForm from '../../GliderForm.svelte';
import type {Data} from './+page';
export let data: Data;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/gliders/[id]/edit/+page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {error} from '@sveltejs/kit';
import {z} from 'zod';

import {loadApiGliders, type Glider} from '../../api';
import {error} from '@sveltejs/kit';

// Disable server-side rendering for this page
export const ssr = false;
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/routes/gliders/add/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script lang="ts">
import GliderForm from '../GliderForm.svelte';
import Flashes from '$lib/components/Flashes.svelte';
import {onMount} from 'svelte';
import {requireLogin} from '$lib/auth';
import Flashes from '$lib/components/Flashes.svelte';
import {loginState} from '$lib/stores';
import {onMount} from 'svelte';
import GliderForm from '../GliderForm.svelte';
onMount(() => {
requireLogin($loginState, '/flights/add/');
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/routes/gliders/api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type {SvelteKitFetch} from '$lib';
import {z} from 'zod';
import {error} from '@sveltejs/kit';
import {AuthenticationError, ensureClientOrServerErrorCode} from '$lib/errors';
import {z} from 'zod';

import type {SvelteKitFetch} from '$lib';
import {extractResponseError} from '$lib/api';
import {AuthenticationError, ensureClientOrServerErrorCode} from '$lib/errors';

const SCHEMA_API_GLIDER = z.object({
id: z.number(),
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/routes/locations/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script lang="ts">
import {goto, invalidateAll} from '$app/navigation';
import {apiDelete, extractResponseError} from '$lib/api';
import CountryFlag from '$lib/components/CountryFlag.svelte';
import DialogModal from '$lib/components/DialogModal.svelte';
import Flashes from '$lib/components/Flashes.svelte';
import MessageModal from '$lib/components/MessageModal.svelte';
import {addFlash} from '$lib/stores';
import {goto, invalidateAll} from '$app/navigation';
import type {Data} from './+page';
import type {Location} from './api';
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/routes/locations/LocationForm.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script lang="ts">
import {onMount} from 'svelte';
import {goto} from '$app/navigation';
import {apiPost, extractResponseError} from '$lib/api';
import MapComponent from '$lib/components/Map.svelte';
import MessageModal from '$lib/components/MessageModal.svelte';
import {addFlash} from '$lib/stores';
import {reactive} from '$lib/svelte';
import {type Location} from './api';
import {apiPost, extractResponseError} from '$lib/api';
import {goto} from '$app/navigation';
import type {Location} from './api';
// Props
export let location: Location | undefined = undefined;
Expand Down
Loading

0 comments on commit 98ef540

Please sign in to comment.