feat: add profile recoloring
This commit is contained in:
1 parent
343e3cf78a
commit
8182fa09e7
4 files changed
+83
-16
No files matched your search
+2
-1
@@ -25,13 +25,14 @@ function setFromStorage(key: string, item: any, stringify: boolean = true) {
|
||||
return localStorage.setItem(key, stringify ? JSON.stringify(item) : item)
|
||||
}
|
||||
|
||||
interface Profile {
|
||||
export interface Profile {
|
||||
id: number
|
||||
instance: string
|
||||
jwt?: string
|
||||
user?: PersonData
|
||||
username?: string
|
||||
favorites?: number[]
|
||||
color?: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import { slide } from 'svelte/transition'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
|
||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||
</script>
|
||||
|
||||
<nav
|
||||
@@ -68,13 +69,10 @@
|
||||
? ''
|
||||
: '!p-1.5'} {$profile?.id == prof.id ? 'font-bold' : ''}"
|
||||
>
|
||||
<Icon
|
||||
src={UserCircle}
|
||||
mini={$profile?.id == prof.id}
|
||||
size="20"
|
||||
title={prof.username}
|
||||
class="text-blue-500"
|
||||
style="filter: hue-rotate({index * 50}deg)"
|
||||
<ProfileAvatar
|
||||
profile={prof}
|
||||
{index}
|
||||
selected={$profile?.id == prof.id}
|
||||
/>
|
||||
<span
|
||||
class:hidden={!$userSettings.expandSidebar}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<script lang="ts">
|
||||
import type { Profile } from '$lib/auth.js'
|
||||
import { Icon, UserCircle } from 'svelte-hero-icons'
|
||||
|
||||
export let profile: Profile | undefined = undefined
|
||||
export let selected: boolean = false
|
||||
export let index: number = 0
|
||||
export let size: number = 20
|
||||
</script>
|
||||
|
||||
{#if profile}
|
||||
<Icon
|
||||
src={UserCircle}
|
||||
mini={selected}
|
||||
size={`${size}`}
|
||||
title={profile.username}
|
||||
class="text-blue-500"
|
||||
style={profile.color
|
||||
? `color: ${profile.color}`
|
||||
: `filter: hue-rotate(${index * 50}deg)`}
|
||||
/>
|
||||
{/if}
|
||||
Reference in new issue
Block a user