Skip to content

Commit f127c9d

Browse files
committed
Merge branch 'main' into cs-7985-implement-sliding-sync
2 parents 1576b13 + e4f19c8 commit f127c9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2489
-1804
lines changed

packages/experiments-realm/components/base-task-planner.gts

+7-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { TrackedMap } from 'tracked-built-ins';
88
import GlimmerComponent from '@glimmer/component';
99
import { IconPlus } from '@cardstack/boxel-ui/icons';
1010
import { action } from '@ember/object';
11-
import { getCards } from '@cardstack/runtime-common';
11+
import { type getCards } from '@cardstack/runtime-common';
1212
import { FilterDropdown } from './filter/filter-dropdown';
1313
import { StatusPill } from './filter/filter-dropdown-item';
1414
import { FilterTrigger } from './filter/filter-trigger';
@@ -178,15 +178,8 @@ export class TaskPlanner extends GlimmerComponent<TaskPlannerArgs> {
178178
options: () => any[];
179179
}
180180
>;
181-
cards: {
182-
instances: CardDef[]; // possible can be generic type
183-
isLoading?: boolean;
184-
};
185-
assigneeQuery: {
186-
// should be assignee
187-
instances: CardDef[];
188-
isLoading?: boolean;
189-
};
181+
cards: ReturnType<getCards> | undefined;
182+
assigneeQuery: ReturnType<getCards> | undefined;
190183

191184
constructor(owner: Owner, args: any) {
192185
super(owner, args);
@@ -215,15 +208,17 @@ export class TaskPlanner extends GlimmerComponent<TaskPlannerArgs> {
215208
};
216209

217210
// Initialize cards and assignee query
218-
this.cards = getCards(
211+
this.cards = this.args.context?.getCards(
212+
this,
219213
() => this.getTaskQuery,
220214
() => this.realmHrefs,
221215
{
222216
isLive: true,
223217
},
224218
);
225219

226-
this.assigneeQuery = getCards(
220+
this.assigneeQuery = this.args.context?.getCards(
221+
this,
227222
() => {
228223
return {
229224
filter: {

packages/experiments-realm/crm-app.gts

+1
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ class CrmAppTemplate extends Component<typeof CrmApp> {
602602
{{#if this.query}}
603603
<div class='content-header-deal-summary'>
604604
<DealSummary
605+
@context={{@context}}
605606
@query={{this.query}}
606607
@realmHrefs={{this.realmHrefs}}
607608
/>

packages/experiments-realm/crm/account.gts

+13-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from 'https://cardstack.com/base/card-api';
1212

1313
import type { LooseSingleCardDocument } from '@cardstack/runtime-common';
14-
import { getCards, Query } from '@cardstack/runtime-common';
14+
import { Query } from '@cardstack/runtime-common';
1515
import { restartableTask } from 'ember-concurrency';
1616

1717
import { Address as AddressField } from '../fields/address';
@@ -144,15 +144,17 @@ class IsolatedTemplate extends Component<typeof Account> {
144144
};
145145
}
146146

147-
deals = getCards(
147+
deals = this.args.context?.getCards(
148+
this,
148149
() => this.dealQuery,
149150
() => this.realmHrefs,
150151
{
151152
isLive: true,
152153
},
153154
);
154155

155-
activeTasks = getCards(
156+
activeTasks = this.args.context?.getCards(
157+
this,
156158
() => this.activeTasksQuery,
157159
() => this.realmHrefs,
158160
{
@@ -279,7 +281,8 @@ class IsolatedTemplate extends Component<typeof Account> {
279281
};
280282
}
281283

282-
lifetimeValueDeals = getCards(
284+
lifetimeValueDeals = this.args.context?.getCards(
285+
this,
283286
() => this.lifetimeValueQuery,
284287
() => this.realmHrefs,
285288
{
@@ -711,15 +714,17 @@ class EmbeddedTemplate extends Component<typeof Account> {
711714
};
712715
}
713716

714-
deals = getCards(
717+
deals = this.args.context?.getCards(
718+
this,
715719
() => this.dealQuery,
716720
() => this.realmHrefs,
717721
{
718722
isLive: true,
719723
},
720724
);
721725

722-
activeTasks = getCards(
726+
activeTasks = this.args.context?.getCards(
727+
this,
723728
() => this.activeTasksQuery,
724729
() => this.realmHrefs,
725730
{
@@ -795,7 +800,8 @@ class EmbeddedTemplate extends Component<typeof Account> {
795800
};
796801
}
797802

798-
lifetimeValueDeals = getCards(
803+
lifetimeValueDeals = this.args.context?.getCards(
804+
this,
799805
() => this.lifetimeValueQuery,
800806
() => this.realmHrefs,
801807
{

packages/experiments-realm/crm/deal-summary.gts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Component from '@glimmer/component';
22

3-
import { getCards } from '@cardstack/runtime-common';
43
import type { Deal } from './deal';
54
import type { Query } from '@cardstack/runtime-common';
65

@@ -11,11 +10,13 @@ import TrendingUpIcon from '@cardstack/boxel-icons/trending-up';
1110
import CalculatorIcon from '@cardstack/boxel-icons/calculator';
1211
import NumbersIcon from '@cardstack/boxel-icons/numbers';
1312
import ChartCovariateIcon from '@cardstack/boxel-icons/chart-covariate';
13+
import { type CardContext } from '../../base/card-api';
1414

1515
interface Signature {
1616
Args: {
1717
query: Query;
1818
realmHrefs: string[];
19+
context?: CardContext;
1920
};
2021
}
2122

@@ -24,7 +25,8 @@ function formatCurrencyValue(value: number, currencySymbol: string) {
2425
}
2526

2627
export class DealSummary extends Component<Signature> {
27-
dealCardsQuery = getCards(
28+
dealCardsQuery = this.args.context?.getCards(
29+
this,
2830
() => this.args.query,
2931
() => this.args.realmHrefs,
3032
{
@@ -33,14 +35,14 @@ export class DealSummary extends Component<Signature> {
3335
);
3436

3537
get deals() {
36-
return (this.dealCardsQuery.instances || []) as Deal[];
38+
return (this.dealCardsQuery?.instances || []) as Deal[];
3739
}
3840

3941
get dealSummaries() {
4042
if (
4143
!this.deals ||
4244
this.deals.length === 0 ||
43-
this.dealCardsQuery.isLoading
45+
this.dealCardsQuery?.isLoading
4446
) {
4547
return undefined;
4648
}

packages/experiments-realm/crm/deal.gts

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import BooleanField from 'https://cardstack.com/base/boolean';
1616
import DateField from 'https://cardstack.com/base/date';
1717
import MarkdownField from 'https://cardstack.com/base/markdown';
1818

19-
import { getCards, Query } from '@cardstack/runtime-common';
19+
import { type Query } from '@cardstack/runtime-common';
2020
import type { LooseSingleCardDocument } from '@cardstack/runtime-common';
2121

2222
import { action } from '@ember/object';
@@ -217,15 +217,17 @@ class IsolatedTemplate extends Component<typeof Deal> {
217217
};
218218
}
219219

220-
query = getCards(
220+
query = this.args.context?.getCards(
221+
this,
221222
() => this.dealQuery,
222223
() => this.realmHrefs,
223224
{
224225
isLive: true,
225226
},
226227
);
227228

228-
activeTasks = getCards(
229+
activeTasks = this.args.context?.getCards(
230+
this,
229231
() => this.activeTasksQuery,
230232
() => this.realmHrefs,
231233
{

packages/experiments-realm/crm/task-planner.gts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import GlimmerComponent from '@glimmer/component';
44
import { TaskPlanner, TaskCard } from '../components/base-task-planner';
55
import type { LooseSingleCardDocument } from '@cardstack/runtime-common';
66
import type { Query, Filter } from '@cardstack/runtime-common/query';
7-
import { getCards } from '@cardstack/runtime-common';
87
import { DndItem } from '@cardstack/boxel-ui/components';
98
import { AppCard } from '../app-card';
109
import { CRMTask } from './task';
@@ -141,7 +140,8 @@ export class CRMTaskPlanner extends GlimmerComponent<CRMTaskPlannerArgs> {
141140
return [this.args.realmURL.href];
142141
}
143142

144-
assigneeQuery = getCards(
143+
assigneeQuery = this.args.context?.getCards(
144+
this,
145145
() => {
146146
return {
147147
filter: {

packages/experiments-realm/garden-design.gts

+4-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type Owner from '@ember/owner';
1616
import { htmlSafe } from '@ember/template';
1717
import { tracked } from '@glimmer/tracking';
1818
import { TrackedMap } from 'tracked-built-ins';
19-
import { baseRealm, getCards } from '@cardstack/runtime-common';
19+
import { baseRealm, type getCards } from '@cardstack/runtime-common';
2020
import LayoutBoardSplitIcon from '@cardstack/boxel-icons/layout-board-split';
2121
import PlantIcon from '@cardstack/boxel-icons/plant';
2222

@@ -196,11 +196,7 @@ class Isolated extends Component<typeof GardenDesign> {
196196
`);
197197
@tracked gridMap: TrackedMap<string, GardenItem | null>;
198198

199-
@tracked
200-
private declare liveQuery: {
201-
instances: CardDef[];
202-
isLoading: boolean;
203-
};
199+
@tracked private liveQuery: ReturnType<getCards> | undefined;
204200

205201
constructor(owner: Owner, args: any) {
206202
super(owner, args);
@@ -213,8 +209,8 @@ class Isolated extends Component<typeof GardenDesign> {
213209
}),
214210
);
215211
this.updateGridModel();
216-
// TODO refactor to use <PrerenderedCardSearch> component from the @context if you want live search
217-
this.liveQuery = getCards(
212+
this.liveQuery = this.args.context?.getCards(
213+
this,
218214
() => {
219215
return {
220216
filter: {

packages/experiments-realm/monetary-amount.gts

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Component } from 'https://cardstack.com/base/card-api';
99
import { Currency } from './asset';
1010
import { action } from '@ember/object';
1111
import { BoxelInputGroup } from '@cardstack/boxel-ui/components';
12-
import { getCards } from '@cardstack/runtime-common';
1312
import { guidFor } from '@ember/object/internals';
1413
import GlimmerComponent from '@glimmer/component';
1514

@@ -36,8 +35,8 @@ class Edit extends Component<typeof MonetaryAmount> {
3635
return guidFor(this);
3736
}
3837

39-
// TODO refactor to use <PrerenderedCardSearch> component from the @context if you want live search
40-
liveCurrencyQuery = getCards(
38+
liveCurrencyQuery = this.args.context?.getCards(
39+
this,
4140
() => {
4241
return {
4342
filter: {

packages/experiments-realm/sprint-planner.gts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
EqFilter,
1717
} from '@cardstack/runtime-common/query';
1818
import { DndItem } from '@cardstack/boxel-ui/components';
19-
import { getCards } from '@cardstack/runtime-common';
2019
import { action } from '@ember/object';
2120

2221
class SprintPlannerIsolated extends Component<typeof SprintPlanner> {
@@ -74,7 +73,8 @@ class SprintPlannerIsolated extends Component<typeof SprintPlanner> {
7473
return [this.currentRealm.href];
7574
}
7675

77-
assigneeQuery = getCards(
76+
assigneeQuery = this.args.context?.getCards(
77+
this,
7878
() => {
7979
return {
8080
filter: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import 'ember-source/types';
2+
import 'ember-source/types/preview';

0 commit comments

Comments
 (0)