Files
playlet-piped/playlet-web/src/lib/ProfileAvatar.svelte
T
Brahim Hadricheandgithub-action linter 394dd23999 Multiple profiles (#312)
* Navbar user profile

* profiles stuff

* fix profile

* Lint fix

* Some ui experiments

* More ui work

* progress

* Lint fix

* migration, web api, wip

* profile view and web app

* web app and apis

* Invidious and profiles

* Lint fix

* bug fix

* Remove ActionContentNode

* Profile icon button, profile color

* Lint fix

* reset server url

* href that doesn't work

* remove activate button on active profile

* TODO

* Fin.

* Final touches

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-03-04 09:04:34 -05:00

33 lines
852 B
Svelte

<script lang="ts">
import { playletStateStore } from "lib/Stores";
import UserIcon from "assets/user.svg.svelte";
let currentProfile;
playletStateStore.subscribe((value) => {
let profiles = value?.profiles?.profiles ?? [];
currentProfile = profiles.find(
(p) => p.id === value?.profiles?.currentProfile
);
});
</script>
<div>
{#if currentProfile && currentProfile.username}
<div class="avatar placeholder m-1.5">
<div
class="rounded-full w-8 ring ring-offset-base-100 ring-offset-2"
style="background-color: {currentProfile.color}"
>
<span class="text-xl font-medium text-gray-200"
>{currentProfile.username.substring(0, 1).toUpperCase()}</span
>
</div>
</div>
{:else}
<div class="w-8 rounded-full">
<UserIcon />
</div>
{/if}
</div>