mirror of
https://github.com/KevinMidboe/planetposen-frontend.git
synced 2025-10-29 13:10:12 +00:00
Resolved all eslint issues
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fade, fly, slide } from 'svelte/transition';
|
import { fly, slide } from 'svelte/transition';
|
||||||
import type IOrderValidationError from '$lib/interfaces/IOrderValidationError';
|
|
||||||
|
|
||||||
export let errors: string[] = [];
|
export let errors: string[] = [];
|
||||||
let currentCard = 0;
|
let currentCard = 0;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ProductTile from './ProductTile.svelte';
|
import ProductTile from './ProductTile.svelte';
|
||||||
import Button from './Button.svelte';
|
// import Button from './Button.svelte';
|
||||||
import type { IProduct } from '$lib/interfaces/IProduct';
|
import type { IProduct } from '$lib/interfaces/IProduct';
|
||||||
import LinkArrow from './LinkArrow.svelte';
|
import LinkArrow from './LinkArrow.svelte';
|
||||||
|
|
||||||
export let products: IProduct[];
|
export let products: IProduct[];
|
||||||
export let title: string;
|
export let title: string;
|
||||||
export let textColor: string = 'black';
|
export let textColor = 'black';
|
||||||
export let backgroundColor: string = 'white';
|
export let backgroundColor = 'white';
|
||||||
|
|
||||||
let galleryStyles = `background-color: ${backgroundColor}; color: ${textColor}`;
|
let galleryStyles = `background-color: ${backgroundColor}; color: ${textColor}`;
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ color: ${product?.primary_color === '#231B1D' ? '#f3efeb' : '#37301e'}`;
|
|||||||
if (entries[0]?.isIntersecting) {
|
if (entries[0]?.isIntersecting) {
|
||||||
const target = entries[0]?.target as HTMLElement;
|
const target = entries[0]?.target as HTMLElement;
|
||||||
const targetIndex = Number(target?.dataset?.index);
|
const targetIndex = Number(target?.dataset?.index);
|
||||||
if (targetIndex === NaN) return;
|
if (isNaN(targetIndex)) return;
|
||||||
|
|
||||||
selected = targetIndex;
|
selected = targetIndex;
|
||||||
updateHeight();
|
updateHeight();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
let dragOver: boolean = false;
|
let dragOver = false;
|
||||||
let fileInput: HTMLInputElement;
|
let fileInput: HTMLInputElement;
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
await uploadImage(file);
|
await uploadImage(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => (fileInput.value = ''), 3000);
|
setTimeout(() => resetUploadInput, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetUploadInput() {
|
function resetUploadInput() {
|
||||||
@@ -80,20 +80,21 @@
|
|||||||
// uploadImage(file)
|
// uploadImage(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFileDrop(event: Event) {
|
function onFileDrop(event: DragEvent) {
|
||||||
const { files } = event?.dataTransfer;
|
const files: FileList | undefined = event?.dataTransfer?.files;
|
||||||
if (files) {
|
if (files) {
|
||||||
fileInput.files = files;
|
fileInput.files = files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: hasFiles = fileInput?.files?.length > 0 || false;
|
$: hasFiles = (fileInput?.files && fileInput?.files?.length > 0) || false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id="drop_zone"
|
id="drop_zone"
|
||||||
class="{dragOver ? 'highlighted' : ''}"
|
class="{dragOver ? 'highlighted' : ''}"
|
||||||
on:click="{() => fileInput.click()}"
|
on:click="{() => fileInput.click()}"
|
||||||
|
on:keypress="{(e) => e.code === 'Enter' && fileInput.click()}"
|
||||||
on:drop|preventDefault="{onFileDrop}"
|
on:drop|preventDefault="{onFileDrop}"
|
||||||
on:dragover|preventDefault="{() => (dragOver = true)}"
|
on:dragover|preventDefault="{() => (dragOver = true)}"
|
||||||
on:dragenter|preventDefault="{() => (dragOver = true)}"
|
on:dragenter|preventDefault="{() => (dragOver = true)}"
|
||||||
@@ -118,8 +119,11 @@
|
|||||||
<span>Files found to upload:</span>
|
<span>Files found to upload:</span>
|
||||||
|
|
||||||
<div class="thumbnails">
|
<div class="thumbnails">
|
||||||
{#each fileInput.files || [] as file}
|
{#each fileInput.files || [] as file, index}
|
||||||
<img src="{window.URL.createObjectURL(file)}" />
|
<img
|
||||||
|
src="{window.URL.createObjectURL(file)}"
|
||||||
|
alt="{`Upload asset thumbnail number ${index + 1}`}"
|
||||||
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
export let pointLeft: boolean = false;
|
export let pointLeft = false;
|
||||||
let defaultRoute = '/shop';
|
let defaultRoute = '/shop';
|
||||||
|
|
||||||
function navigateBack() {
|
function navigateBack() {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { loadStripe } from '@stripe/stripe-js/pure';
|
|||||||
import type {
|
import type {
|
||||||
ConfirmCardPaymentData,
|
ConfirmCardPaymentData,
|
||||||
PaymentIntentResult,
|
PaymentIntentResult,
|
||||||
Stripe,
|
Stripe
|
||||||
StripeError
|
// StripeError
|
||||||
} from '@stripe/stripe-js';
|
} from '@stripe/stripe-js';
|
||||||
|
|
||||||
let stripeInstance: Stripe;
|
let stripeInstance: Stripe;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import FrontTextImageBubble from '$lib/components/FrontTextImageBubble.svelte';
|
import FrontTextImageBubble from '$lib/components/FrontTextImageBubble.svelte';
|
||||||
// import FrontProductGallery from '$lib/components/FrontProductGallery.svelte';
|
// import FrontProductGallery from '$lib/components/FrontProductGallery.svelte';
|
||||||
import type IFrontTextImage from '$lib/interfaces/IFrontTextImage';
|
import type IFrontTextImage from '$lib/interfaces/IFrontTextImage';
|
||||||
import type { IProduct } from '$lib/interfaces/IProduct';
|
// import type { IProduct } from '$lib/interfaces/IProduct';
|
||||||
import type IFrontText from '$lib/interfaces/IFrontText';
|
import type IFrontText from '$lib/interfaces/IFrontText';
|
||||||
|
|
||||||
const textImages: Array<IFrontTextImage> = [
|
const textImages: Array<IFrontTextImage> = [
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
import { buildApiUrl } from '$lib/utils/apiUrl';
|
import { buildApiUrl } from '$lib/utils/apiUrl';
|
||||||
import type { StripeCardElement } from '@stripe/stripe-js/types';
|
import type { StripeCardElement } from '@stripe/stripe-js/types';
|
||||||
import type ICustomer from '$lib/interfaces/ICustomer';
|
import type ICustomer from '$lib/interfaces/ICustomer';
|
||||||
import type IOrderValidationError from '$lib/interfaces/IOrderValidationError';
|
|
||||||
import type {
|
import type {
|
||||||
IOrderCreateDTO,
|
IOrderCreateDTO,
|
||||||
IOrderCreateResponse,
|
IOrderCreateResponse,
|
||||||
@@ -44,7 +43,7 @@
|
|||||||
|
|
||||||
function handleSubmitOrderError(error: IOrderCreateUnsuccessfullResponse) {
|
function handleSubmitOrderError(error: IOrderCreateUnsuccessfullResponse) {
|
||||||
console.log('got error from order api!', error, error?.validationErrors);
|
console.log('got error from order api!', error, error?.validationErrors);
|
||||||
const { success, validationErrors } = error;
|
const { validationErrors } = error;
|
||||||
|
|
||||||
if (!validationErrors || validationErrors?.length == 0) {
|
if (!validationErrors || validationErrors?.length == 0) {
|
||||||
errors.push('Ukjent feil ved plassering av ordre.');
|
errors.push('Ukjent feil ved plassering av ordre.');
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import PaymentDetails from './PaymentDetails.svelte';
|
import PaymentDetails from './PaymentDetails.svelte';
|
||||||
import CustomerDetails from './CustomerDetails.svelte';
|
import CustomerDetails from './CustomerDetails.svelte';
|
||||||
import TrackingDetails from './TrackingDetails.svelte';
|
import TrackingDetails from './TrackingDetails.svelte';
|
||||||
import ShipmentProgress from '$lib/components/ShipmentProgress.svelte';
|
|
||||||
import type { IOrder } from '$lib/interfaces/IOrder';
|
import type { IOrder } from '$lib/interfaces/IOrder';
|
||||||
import type { PageServerData } from './$types';
|
import type { PageServerData } from './$types';
|
||||||
|
|
||||||
|
|||||||
@@ -49,10 +49,9 @@
|
|||||||
else updateShipment();
|
else updateShipment();
|
||||||
}
|
}
|
||||||
|
|
||||||
let edit: boolean = false;
|
let edit = false;
|
||||||
let trackingCode: string = shipping?.tracking_code;
|
let trackingCode: string = shipping?.tracking_code;
|
||||||
let trackingLink: string = shipping?.tracking_link;
|
let trackingLink: string = shipping?.tracking_link;
|
||||||
let courier: string = shipping?.courier;
|
|
||||||
let selectedCourier: any = shipping?.courier_id;
|
let selectedCourier: any = shipping?.courier_id;
|
||||||
let couriers: ICourier[];
|
let couriers: ICourier[];
|
||||||
</script>
|
</script>
|
||||||
@@ -63,7 +62,7 @@
|
|||||||
{#if shipping}
|
{#if shipping}
|
||||||
<ul class="property-list">
|
<ul class="property-list">
|
||||||
<li>
|
<li>
|
||||||
<span class="label" for="courier">Tracking company</span>
|
<label class="label" for="courier">Tracking company</label>
|
||||||
{#if !edit}
|
{#if !edit}
|
||||||
<span>{shipping.courier}</span>
|
<span>{shipping.courier}</span>
|
||||||
{:else if couriers?.length > 0}
|
{:else if couriers?.length > 0}
|
||||||
|
|||||||
Reference in New Issue
Block a user