From e629d598d4cf105532643bcc16fd5a459b3d420a Mon Sep 17 00:00:00 2001 From: Ota Prokopec Date: Sun, 19 Mar 2023 13:32:53 +0100 Subject: [PATCH 1/8] map fix --- src/lib/components/Map/Erantmap.svelte | 12 +++++++++--- src/lib/components/Map/Map.svelte | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/components/Map/Erantmap.svelte b/src/lib/components/Map/Erantmap.svelte index 4206ac6..42acca4 100644 --- a/src/lib/components/Map/Erantmap.svelte +++ b/src/lib/components/Map/Erantmap.svelte @@ -1,4 +1,4 @@ - {#if center} - setTimeout(() => setInterval(() => userCenter(), 1000), 100)} {center} bind:mapComponent class={className} on:move> + setTimeout(() => userCenter(), 100)} {center} bind:mapComponent class={className} on:move> {}} on:geolocate={(e) => { + // @ts-ignore const { latitude, longitude } = e.detail.coords user = { lat: latitude, lng: longitude } }} diff --git a/src/lib/components/Map/Map.svelte b/src/lib/components/Map/Map.svelte index a96831d..c00617c 100644 --- a/src/lib/components/Map/Map.svelte +++ b/src/lib/components/Map/Map.svelte @@ -10,7 +10,6 @@ export let radius = false export let center: { lng: number; lat: number } = { lng: 0, lat: 0 } - $: console.log(center) /*export const geo = (e) => { geolocateControl.dispatchEvent('geolocate') @@ -37,6 +36,7 @@ mapComponent.setCenter([center.lng, center.lat], 14) dispatch('ready') }} + on:recentre={(e) => {}} zoom={14} > From e67a66c7ae17449e363bf5bc9f532f74a522bc0f Mon Sep 17 00:00:00 2001 From: Ota Prokopec Date: Sun, 19 Mar 2023 13:52:36 +0100 Subject: [PATCH 2/8] register-login fix / Erant map scaling fix --- index.html | 126 ++++++++++-------- src/lib/components/Buttons/Button.svelte | 5 + src/lib/components/Map/Erantmap.svelte | 2 +- src/routes/authorization/login/log_in.svelte | 7 +- .../authorization/register/register.svelte | 3 + .../utils/authorizationErrors.ts | 2 +- 6 files changed, 84 insertions(+), 61 deletions(-) diff --git a/index.html b/index.html index e875a96..89ae76b 100644 --- a/index.html +++ b/index.html @@ -1,66 +1,80 @@ + + + + + + Erant - - - - - - Erant + + - - + + + + - - - - + + + - - gtag('config', 'G-8RCL0H1Q7V'); - + + + + - - - - - - - - - - - -
- - + + + + +
+ + diff --git a/src/lib/components/Buttons/Button.svelte b/src/lib/components/Buttons/Button.svelte index 413989d..20bc686 100644 --- a/src/lib/components/Buttons/Button.svelte +++ b/src/lib/components/Buttons/Button.svelte @@ -41,6 +41,11 @@ color: white; background-color: rgb(66, 99, 235); + &.disabled { + &:hover { + background-color: rgb(107 114 128); + } + } &:hover { background-color: rgba(66, 99, 235, 0.8); } diff --git a/src/lib/components/Map/Erantmap.svelte b/src/lib/components/Map/Erantmap.svelte index 42acca4..4d2a0e6 100644 --- a/src/lib/components/Map/Erantmap.svelte +++ b/src/lib/components/Map/Erantmap.svelte @@ -22,7 +22,7 @@ }) }) })()*/ - navigator.geolocation.getCurrentPosition((e) => {}) //at mapbox this is required dont know why + //navigator.geolocation.getCurrentPosition((e) => {}) //at mapbox this is required dont know why /* if (navigator.geolocation) { navigator.geolocation.watchPosition(showPosition, () => dispatch('locationFailed')) diff --git a/src/routes/authorization/login/log_in.svelte b/src/routes/authorization/login/log_in.svelte index ac1dc1a..0362ae8 100644 --- a/src/routes/authorization/login/log_in.svelte +++ b/src/routes/authorization/login/log_in.svelte @@ -7,6 +7,7 @@ import TopImage from '$lib/svg/Top-Image.svelte' import { Helper } from 'flowbite-svelte' import { getErrorMessage } from '../utils/authorizationErrors' + import Button from '$lib/components/Buttons/Button.svelte' export let purpose = 'login' //possible values login, register @@ -58,13 +59,13 @@ - + diff --git a/src/routes/authorization/register/register.svelte b/src/routes/authorization/register/register.svelte index b469ecb..ce532ad 100644 --- a/src/routes/authorization/register/register.svelte +++ b/src/routes/authorization/register/register.svelte @@ -30,11 +30,14 @@ err['code'] = 1001 throw err } + await account.create(ID.unique(), email, password, name) await account.createEmailSession(email, password) await account.createVerification(`${location.origin}/register/emailverification/${erantId}`) state = 'email-sent' } catch (err) { + console.log(err) + error = getErrorMessage(err.code) state = 'register' } diff --git a/src/routes/authorization/utils/authorizationErrors.ts b/src/routes/authorization/utils/authorizationErrors.ts index 575a202..c40dbaa 100644 --- a/src/routes/authorization/utils/authorizationErrors.ts +++ b/src/routes/authorization/utils/authorizationErrors.ts @@ -2,7 +2,7 @@ export const errors = { 1001: 'Nickname is already taken', 409: 'A user with the same email already is in Erant', 401: 'Invalid credentials.', - 400: 'Password must be at least 8 characters.', + 400: 'Email musts be valid.', } export const getErrorMessage = (code: number) => { From f499cfff22d10f4c654af3267cf440d321672506 Mon Sep 17 00:00:00 2001 From: Ota Prokopec Date: Sun, 19 Mar 2023 14:05:50 +0100 Subject: [PATCH 3/8] game fix --- src/lib/TStypes/experiences.ts | 2 +- src/lib/components/Map/Erantmap.svelte | 5 ++++- src/lib/components/Map/LocationRequest.svelte | 18 ++++++++++-------- src/lib/utils/database/game.ts | 2 +- src/routes/game/game.svelte | 2 +- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/lib/TStypes/experiences.ts b/src/lib/TStypes/experiences.ts index 6e17856..eb8c246 100644 --- a/src/lib/TStypes/experiences.ts +++ b/src/lib/TStypes/experiences.ts @@ -25,7 +25,7 @@ export type Experience = { $permissions: string $updatedAt: string ExpApproved: boolean - ExpCpsID: string[] + ExpCPsID: string[] ExpCategory?: string ExpEnd0: string ExpEnd60: string diff --git a/src/lib/components/Map/Erantmap.svelte b/src/lib/components/Map/Erantmap.svelte index 4d2a0e6..8719162 100644 --- a/src/lib/components/Map/Erantmap.svelte +++ b/src/lib/components/Map/Erantmap.svelte @@ -4,6 +4,7 @@ import { navigate } from 'svelte-routing' import NavigationBarLayout from '../Layouts/NavigationBarLayout.svelte' import { createEventDispatcher, onMount } from 'svelte' + import LocationRequest from './LocationRequest.svelte' const dispatch = createEventDispatcher() export let center = null @@ -22,7 +23,7 @@ }) }) })()*/ - //navigator.geolocation.getCurrentPosition((e) => {}) //at mapbox this is required dont know why + navigator.geolocation.getCurrentPosition((e) => {}) //at mapbox this is required dont know why /* if (navigator.geolocation) { navigator.geolocation.watchPosition(showPosition, () => dispatch('locationFailed')) @@ -41,6 +42,8 @@ } + + {#if center} setTimeout(() => userCenter(), 100)} {center} bind:mapComponent class={className} on:move> diff --git a/src/lib/components/Map/LocationRequest.svelte b/src/lib/components/Map/LocationRequest.svelte index 2c51103..b5eaeaf 100644 --- a/src/lib/components/Map/LocationRequest.svelte +++ b/src/lib/components/Map/LocationRequest.svelte @@ -13,15 +13,17 @@ {#if granted === false} - - This is a info alert -
-
To advance through your experience you need to enable the location access, without it the app won't work.
-
- +
+ + This is a info alert +
+
To advance through your experience you need to enable the location access, without it the app won't work.
+
+ +
-
- + +
{/if}