Skip to content

Commit

Permalink
Merge pull request #1969 from cardstack/CS-7718-crm-app-absolute-url
Browse files Browse the repository at this point in the history
CS 7718 Absolute urls on CRM app
  • Loading branch information
richardhjtan authored Dec 27, 2024
2 parents b7f21c2 + 22e030b commit 0e48dfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
18 changes: 2 additions & 16 deletions packages/experiments-realm/crm-app.gts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ import {
} from '@cardstack/boxel-ui/components';
import { IconPlus } from '@cardstack/boxel-ui/icons';
import { AppCard, Tab } from './app-card';
import {
Query,
CardError,
SupportedMimeType,
codeRefWithAbsoluteURL,
} from '@cardstack/runtime-common';
import { Query, CardError, SupportedMimeType } from '@cardstack/runtime-common';
import ContactIcon from '@cardstack/boxel-icons/contact';
import HeartHandshakeIcon from '@cardstack/boxel-icons/heart-handshake';
import TargetArrowIcon from '@cardstack/boxel-icons/target-arrow';
Expand Down Expand Up @@ -172,15 +167,6 @@ class CrmAppTemplate extends Component<typeof AppCard> {
return this.activeTab?.tabId ? this.activeTab.tabId.toLowerCase() : '';
}

get activeTabRef() {
if (!this.activeTab?.ref?.name || !this.activeTab.ref.module) {
return;
}
if (!this.currentRealm) {
return;
}
return codeRefWithAbsoluteURL(this.activeTab.ref, this.currentRealm);
}
setTabs(tabs: Tab[]) {
this.args.model.tabs = tabs ?? [];
}
Expand Down Expand Up @@ -463,7 +449,7 @@ class CrmAppTemplate extends Component<typeof AppCard> {
}

export class CrmApp extends AppCard {
static displayName = 'Crm App';
static displayName = 'CRM App';
static prefersWideFormat = true;
static headerColor = '#4D3FE8';
static isolated = CrmAppTemplate;
Expand Down
12 changes: 2 additions & 10 deletions packages/experiments-realm/crm/deal.gts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class IsolatedTemplate extends Component<typeof Deal> {
);
}
get primaryContactName() {
console.log(this.args.fields.account?.primaryContact);
return this.args.model.account?.primaryContact?.name;
}

Expand Down Expand Up @@ -84,10 +83,6 @@ class IsolatedTemplate extends Component<typeof Deal> {
return this.args.model[realmURL]!;
}

get realmHref() {
return this.realmURL.href;
}

get realmHrefs() {
return [this.realmURL?.href];
}
Expand All @@ -96,7 +91,7 @@ class IsolatedTemplate extends Component<typeof Deal> {
return {
filter: {
type: {
module: `${this.realmHref}crm/deal`,
module: new URL('./crm/deal', import.meta.url).href,
name: 'Deal',
},
},
Expand All @@ -116,14 +111,11 @@ class IsolatedTemplate extends Component<typeof Deal> {
(acc, deal: Deal) => acc + deal.computedValue.amount,
0,
);
nonZeroDeals.map((d) => console.log(d.computedValue.amount));
console.log('totalDealRevenue', totalDealRevenue);
let avgDealSize = totalDealRevenue / nonZeroDeals.length;
console.log('avgDealSize', avgDealSize);

if (this.args.model.computedValue?.amount) {
let percentDiff =
(this.args.model.computedValue?.amount - avgDealSize) / avgDealSize;
console.log('percentDiff', percentDiff);
let positive = percentDiff >= 0 ? true : false;
let summary = `${percentDiff.toFixed(2)}% ${
positive ? 'above' : 'below'
Expand Down

0 comments on commit 0e48dfe

Please sign in to comment.