Refactoring: remove slot name; fix logout button

This commit is contained in:
Pieter Vander Vennet 2023-12-04 16:09:30 +01:00
parent 2156c42390
commit baf858bc21
5 changed files with 15 additions and 3 deletions

View file

@ -11,7 +11,7 @@
<button class={clss} on:click={() => osmConnection.AttemptLogin()}> <button class={clss} on:click={() => osmConnection.AttemptLogin()}>
<ToSvelte construct={Svg.login_svg().SetClass("w-12 m-1")} /> <ToSvelte construct={Svg.login_svg().SetClass("w-12 m-1")} />
<slot name="message"> <slot>
<Tr t={Translations.t.general.loginWithOpenStreetMap} /> <Tr t={Translations.t.general.loginWithOpenStreetMap} />
</slot> </slot>
</button> </button>

View file

@ -9,7 +9,7 @@
<button <button
on:click={() => { on:click={() => {
state.osmConnection.LogOut() osmConnection.LogOut()
}} }}
> >
<Logout class="h-6 w-6" /> <Logout class="h-6 w-6" />

View file

@ -21,6 +21,8 @@
state.mapProperties.location.setData( state.mapProperties.location.setData(
{ lon, lat } { lon, lat }
); );
const z = state.mapProperties.zoom.data
state.mapProperties.zoom.setData( Math.min(17, Math.max(12, z )) )
state.guistate.menuIsOpened.setData(false); state.guistate.menuIsOpened.setData(false);
} }

View file

@ -7,6 +7,8 @@
import { Utils } from "../../Utils"; import { Utils } from "../../Utils";
import { GeoOperations } from "../../Logic/GeoOperations"; import { GeoOperations } from "../../Logic/GeoOperations";
import type { Feature, LineString, Point } from "geojson"; import type { Feature, LineString, Point } from "geojson";
import LoginToggle from "../Base/LoginToggle.svelte";
import LoginButton from "../Base/LoginButton.svelte";
/** /**
* A panel showing all your favourites * A panel showing all your favourites
@ -37,6 +39,13 @@
</script> </script>
<LoginToggle {state}>
<div slot="not-logged-in">
<LoginButton osmConnection={state.osmConnection}>
<Tr t={Translations.t.favouritePoi.loginToSeeList}/>
</LoginButton>
</div>
<div class="flex flex-col" on:keypress={(e) => console.log("Got keypress", e)}> <div class="flex flex-col" on:keypress={(e) => console.log("Got keypress", e)}>
<Tr t={Translations.t.favouritePoi.intro.Subs({length: $favourites?.length ?? 0})} /> <Tr t={Translations.t.favouritePoi.intro.Subs({length: $favourites?.length ?? 0})} />
<Tr t={Translations.t.favouritePoi.privacy} /> <Tr t={Translations.t.favouritePoi.privacy} />
@ -56,3 +65,4 @@
</button> </button>
</div> </div>
</div> </div>
</LoginToggle>

View file

@ -161,7 +161,7 @@
2. What do we want to add? 2. What do we want to add?
3. Are all elements of this category visible? (i.e. there are no filters possibly hiding this, is the data still loading, ...) --> 3. Are all elements of this category visible? (i.e. there are no filters possibly hiding this, is the data still loading, ...) -->
<LoginButton osmConnection={state.osmConnection} slot="not-logged-in"> <LoginButton osmConnection={state.osmConnection} slot="not-logged-in">
<Tr slot="message" t={Translations.t.general.add.pleaseLogin} /> <Tr t={Translations.t.general.add.pleaseLogin} />
</LoginButton> </LoginButton>
<div class="h-full w-full"> <div class="h-full w-full">
{#if $zoom < Constants.minZoomLevelToAddNewPoint} {#if $zoom < Constants.minZoomLevelToAddNewPoint}