MapComplete/src/UI/BigComponents/WelcomeBack.svelte

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1 KiB
Svelte
Raw Normal View History

<script lang="ts">
import { Popover } from "flowbite-svelte"
import { fade } from "svelte/transition"
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
let open = false
export let state: { osmConnection: OsmConnection }
let userdetails = state.osmConnection.userDetails
2025-06-18 21:40:01 +02:00
userdetails.addCallbackAndRunD((ud) => {
if (ud) {
open = true
window.setTimeout(() => {
2025-06-18 21:40:01 +02:00
open = false
}, 5000)
}
})
</script>
2025-06-18 21:40:01 +02:00
<Popover
class="z-50 mt-4"
defaultClass="py-2 px-3 w-fit "
trigger="null"
placement="bottom"
transition={(e) => fade(e, { duration: 150 })}
bind:open
>
{#if $userdetails !== undefined}
<div style="width: max-content" class="flex items-center">
{#if $userdetails.img}
2025-06-18 21:40:01 +02:00
<img src={$userdetails.img} alt="profile picture" class="mr-4 h-8 w-8 rounded-full" />
{/if}
<div>
<div>Welcome back</div>
<div class="normal-background" style="width: max-content">
<b>{$userdetails?.name}</b>
</div>
</div>
</div>
{/if}
</Popover>