-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35e3b7c
commit 9a2cfeb
Showing
22 changed files
with
1,228 additions
and
621 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const clientContext = 'appAgentClient'; | ||
|
||
export const profilesStoreContext = 'profilesStore' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<script lang="ts"> | ||
import { encodeHashToBase64, type AgentPubKey } from "@holochain/client"; | ||
import "@holochain-open-dev/profiles/dist/elements/agent-avatar.js"; | ||
import { getContext } from "svelte"; | ||
import type { ProfilesStore } from "@holochain-open-dev/profiles"; | ||
import SvgIcon from "./SvgIcon.svelte"; | ||
import { profilesStoreContext } from '../../contexts'; | ||
let profilesStore: ProfilesStore = (getContext(profilesStoreContext) as any).getProfileStore(); | ||
export let agentPubKey: AgentPubKey | ||
export let size = 32 | ||
export let namePosition = "row" | ||
export let nameColor = "rgba(86, 94, 109, 1.0)" | ||
export let showAvatar = true | ||
export let showNickname = true | ||
export let placeholder = false | ||
$: agentPubKey | ||
$: agentPubKeyB64 = encodeHashToBase64(agentPubKey) | ||
$: profile = profilesStore.profiles.get(agentPubKey) | ||
$: nickname = $profile.status=="complete" && $profile.value ? $profile.value.entry.nickname : agentPubKeyB64.slice(5,9)+"..." | ||
</script> | ||
|
||
<div class="avatar-{namePosition}" | ||
> | ||
{#if $profile.status == "pending"} | ||
( ? ) | ||
{:else if $profile.status == "complete"} | ||
<!-- {JSON.stringify($profile.value.entry.fields.avatar)} --> | ||
|
||
{#if showAvatar} | ||
{#if placeholder && !$profile.value.entry.fields.avatar} | ||
<SvgIcon color="#fff" icon=faUser size="" style="margin-left:5px;margin-right:5px"></SvgIcon> | ||
{:else} | ||
<!-- <div title={nickname}> --> | ||
<!-- <SvgIcon color="black" icon=faUser size="" style="margin-left:5px;margin-right:5px"></SvgIcon> --> | ||
<agent-avatar title={nickname} disable-tooltip={true} disable-copy={true} size={size} agent-pub-key="{agentPubKeyB64}"></agent-avatar> | ||
<!-- </div> --> | ||
{/if} | ||
{/if} | ||
{#if showNickname} | ||
<div class="nickname" style="color: {nameColor}">{ nickname }</div> | ||
{/if} | ||
{/if} | ||
</div> | ||
|
||
<style> | ||
.avatar-column { | ||
align-items: center; | ||
display:flex; | ||
flex-direction: column; | ||
} | ||
.avatar-row { | ||
display:inline-flex; | ||
flex-direction: row; | ||
justify-content:center; | ||
position: relative; | ||
height: 100%; | ||
align-items: center; | ||
} | ||
.avatar-row .nickname{ | ||
margin-left: 0.5em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.