Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnails not loading properly for contacts page #382

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions shell/src/shared/atoms/AssetImage.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script lang="ts">
export let image;
export let size: number = 10;
export let transparent: boolean = false;

let displayName: string = "";
dacianavram marked this conversation as resolved.
Show resolved Hide resolved
</script>

<div class="has-tooltip" role="presentation">
<div class="self-center text-center rounded-md justify-self-center w-{size} " style="padding: {size >= 20 ? `4px` : `1px`}">
<div class="relative rounded-md w-{size} h-{size} m-auto" class:bg-white="{!transparent}">
<img class=" w-{size} h-{size} rounded-corners-purple-borders rounded-md" src="{image}" alt="{displayName}" />
</div>
</div>
</div>
11 changes: 7 additions & 4 deletions shell/src/shared/atoms/ItemCard.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import UserImage from "src/shared/atoms/UserImage.svelte";
import { isMobile } from "../functions/isMobile";
import { connectableObservableDescriptor } from "rxjs/internal/observable/ConnectableObservable";
import AssetImage from "./AssetImage.svelte";
import UserImage from "./UserImage.svelte";

export let params = {
imageUrl: null,
Expand Down Expand Up @@ -44,9 +45,11 @@ function cardAction() {
<section role="presentation" on:click="{() => cardAction()}" class:mb-3="{!params.inline}" class="{params.class ? params.class : ''}">
<div class="flex items-center w-full space-x-2 bg-white border cardborder" class:p-3="{!params.edgeless}">
<slot name="itemCardStart">
<div class="">
<UserImage profile="{params}" image="{params.imageUrl}" size="{12}" profileLink="{params.profileLink}" />
</div>
{#if params.imageUrl}
<AssetImage image="{params.imageUrl}" size="{12}" />
{:else}
<UserImage profile="{params.imageProfile}" size="{12}" profileLink="{params.profileLink}" />
{/if}
</slot>
<slot name="itemCardBody">
<div class="flex-col flex-grow">
Expand Down
12 changes: 6 additions & 6 deletions shell/src/shared/atoms/UserImage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import jazzicon from "@metamask/jazzicon";
import { outerHTML } from "../functions/outerHtml";
import Web3 from "web3";

export let profile: Profile;
dacianavram marked this conversation as resolved.
Show resolved Hide resolved
export let profile;
export let size: number = 10;
export let transparent: boolean = false;
export let tooltip: boolean = false;
export let profileLink: boolean = true;
export let editable: boolean = false;
export let image: string = "";

let displayName: string = "";
let isOrganisation: boolean = false;
let sizeInPixels = 0;
let noAvatar;

if (!image && !profile.avatarUrl) {
if (!profile.avatarUrl) {
const seed = Web3.utils.hexToNumber(profile.circlesAddress?.slice(0, 15));
noAvatar = jazzicon(size === 15 ? 54 : size * 4, seed);
}
Expand All @@ -39,7 +39,7 @@ $: {
}
displayName = displayName.length >= 22 ? displayName.slice(0, 22) + "..." : displayName;
}
if (profile.type && profile.type == "ORGANISATION") {
if (profile?.type && profile?.type == "ORGANISATION") {
isOrganisation = true;
} else if (profile.__typename && profile.__typename == "ORGANISATION") {
isOrganisation = true;
Expand Down Expand Up @@ -82,12 +82,12 @@ $: {
class:w-4="{size < 20}"
class:h-4="{size < 20}" />
{/if}
{#if profile.avatarUrl || image}
{#if profile.avatarUrl}
<img
class=" w-{size} h-{size} rounded-corners-purple-borders"
class:rounded-full="{!isOrganisation}"
class:rounded-md="{isOrganisation}"
src="{profile.avatarUrl || image}"
src="{profile.avatarUrl}"
alt="{displayName}" />
{:else}
<div class=" w-{size} h-{size} no-avatar-container" class:rounded-full="{!isOrganisation}" class:rounded-md="{isOrganisation}" class:dashboard-avatar="{size === 15}">
Expand Down