Skip to content

Commit 6fd5262

Browse files
authored
Proper defaulting of thumbnail URL AND role position display (#1951)
* add catalog entry so can create crm app card * default thumbnailURL only for deal to account. Account requires one otherwise uses an icon * fix lint * bad merge
1 parent b015262 commit 6fd5262

File tree

5 files changed

+34
-12
lines changed

5 files changed

+34
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"title": "CrmApp",
6+
"description": "Catalog entry for CRM App",
7+
"isField": false,
8+
"ref": {
9+
"module": "../crm-app",
10+
"name": "CrmApp"
11+
}
12+
},
13+
"meta": {
14+
"adoptsFrom": {
15+
"module": "https://cardstack.com/base/catalog-entry",
16+
"name": "CatalogEntry"
17+
}
18+
}
19+
}
20+
}

packages/experiments-realm/components/account-header.gts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import GlimmerComponent from '@glimmer/component';
2+
import ImageIcon from '@cardstack/boxel-icons/image';
23

34
interface AccountHeaderArgs {
45
Args: {
@@ -15,7 +16,11 @@ interface AccountHeaderArgs {
1516
class AccountHeader extends GlimmerComponent<AccountHeaderArgs> {
1617
<template>
1718
<header class='account-header' ...attributes>
18-
<img src={{@logoURL}} alt={{@name}} class='account-header-logo' />
19+
{{#if @logoURL}}
20+
<img src={{@logoURL}} alt={{@name}} class='account-header-logo' />
21+
{{else}}
22+
<ImageIcon class='account-header-logo default-icon-container' />
23+
{{/if}}
1924
<div class='account-header-info'>
2025
{{#if (has-block 'name')}}
2126
{{yield to='name'}}
@@ -40,6 +45,10 @@ class AccountHeader extends GlimmerComponent<AccountHeaderArgs> {
4045
object-fit: cover;
4146
border-radius: var(--boxel-border-radius-xl);
4247
}
48+
.default-icon-container {
49+
background-color: var(--boxel-200);
50+
color: var(--boxel-400);
51+
}
4352
.account-header-info {
4453
min-width: 0;
4554
width: 100%;

packages/experiments-realm/crm/account.gts

+1-5
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ import { LooseGooseyField } from '../loosey-goosey';
2727
import { StatusPill } from '../components/status-pill';
2828

2929
class IsolatedTemplate extends Component<typeof Account> {
30-
get logoURL() {
31-
return this.args.model?.thumbnailURL;
32-
}
33-
3430
get hasCompanyInfo() {
3531
return this.args.model?.website || this.args.model?.headquartersAddress;
3632
}
@@ -45,7 +41,7 @@ class IsolatedTemplate extends Component<typeof Account> {
4541
<template>
4642
<AccountPageLayout>
4743
<:header>
48-
<AccountHeader @logoURL={{this.logoURL}} @name={{@model.name}}>
44+
<AccountHeader @logoURL={{@model.thumbnailURL}} @name={{@model.name}}>
4945
<:name>
5046
{{#if @model.name}}
5147
<h1 class='account-name'>{{@model.name}}</h1>

packages/experiments-realm/crm/contact.gts

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ class AtomTemplate extends Component<typeof Contact> {
634634
class='avatar'
635635
/>
636636
{{/if}}
637-
<span class='name'>{{@model.name}}</span>
637+
<span class='name'>{{this.label}}</span>
638638
</div>
639639
<style scoped>
640640
.contact {

packages/experiments-realm/crm/deal.gts

+2-5
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,11 @@ interface DealSizeSummary {
4949

5050
class IsolatedTemplate extends Component<typeof Deal> {
5151
get logoURL() {
52+
//We default to account thumbnail
5253
return (
53-
this.args.model.thumbnailURL ??
54-
this.args.model.account?.thumbnailURL ??
55-
this.args.model.account?.company?.thumbnailURL ??
56-
'https://picsum.photos/id/237/200/300'
54+
this.args.model.thumbnailURL ?? this.args.model.account?.thumbnailURL
5755
);
5856
}
59-
6057
get primaryContactName() {
6158
console.log(this.args.fields.account?.primaryContact);
6259
return this.args.model.account?.primaryContact?.name;

0 commit comments

Comments
 (0)