feat: add profile recoloring
This commit is contained in:
1 parent
343e3cf78a
commit
8182fa09e7
4 files changed
+83
-16
No files matched your search
@@ -9,6 +9,8 @@
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import TextInput from '$lib/components/input/TextInput.svelte'
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import {
|
||||
DEFAULT_INSTANCE_URL,
|
||||
@@ -16,7 +18,16 @@
|
||||
instance,
|
||||
} from '$lib/instance.js'
|
||||
import { validateInstance } from '$lib/lemmy.js'
|
||||
import { ArrowLeftOnRectangle, Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||
import {
|
||||
ArrowLeftOnRectangle,
|
||||
ArrowUturnLeft,
|
||||
EllipsisHorizontal,
|
||||
Icon,
|
||||
PaintBrush,
|
||||
Plus,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { flip } from 'svelte/animate'
|
||||
|
||||
let newInstance: string = $profileData.defaultInstance ?? DEFAULT_INSTANCE_URL
|
||||
@@ -110,18 +121,53 @@
|
||||
}}
|
||||
let:action
|
||||
>
|
||||
{#each $profileData.profiles as profile (profile.id)}
|
||||
{#each $profileData.profiles as profile, index (profile.id)}
|
||||
<div
|
||||
class="flex flex-row gap-4 items-center py-4"
|
||||
class="flex flex-row gap-2 items-center py-4"
|
||||
animate:flip={{ duration: 250 }}
|
||||
>
|
||||
<div class="flex flex-col">
|
||||
<span class="font-bold">{profile.username}</span>
|
||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
{profile.instance}
|
||||
</span>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="relative group flex-col items-center">
|
||||
<ProfileAvatar
|
||||
{profile}
|
||||
{index}
|
||||
selected={$currentProfile?.id == profile.id}
|
||||
size={24}
|
||||
/>
|
||||
<div
|
||||
class="absolute top-0 left-0 w-full h-full opacity-0
|
||||
grid group-hover:opacity-100 z-20 place-items-center
|
||||
bg-slate-200 dark:bg-zinc-900 border border-slate-300 dark:border-zinc-800 rounded-full
|
||||
transition-all"
|
||||
>
|
||||
<Icon src={PaintBrush} mini size="14" />
|
||||
</div>
|
||||
<input
|
||||
type="color"
|
||||
class="opacity-0 absolute top-0 left-0 h-full w-full rounded-full cursor-pointer z-30"
|
||||
bind:value={profile.color}
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="font-bold">{profile.username}</span>
|
||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
{profile.instance}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-auto" />
|
||||
<Menu let:toggleOpen alignment="bottom-right">
|
||||
<Button on:click={toggleOpen} size="square-md" slot="button">
|
||||
<Icon src={EllipsisHorizontal} mini size="16" slot="icon" />
|
||||
</Button>
|
||||
<MenuButton
|
||||
disabled={!profile.color}
|
||||
on:click={() => (profile.color = undefined)}
|
||||
>
|
||||
<Icon src={ArrowUturnLeft} size="16" mini slot="icon" />
|
||||
Reset color
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
<Button
|
||||
on:click={() => {
|
||||
if (profile.id == $currentProfile?.id) {
|
||||
|
||||
Reference in new issue
Block a user