Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into cs-6946-flatten-produ…
Browse files Browse the repository at this point in the history
…ction-index-db-requests
  • Loading branch information
habdelra committed Jan 8, 2025
2 parents 87ef92c + f12d695 commit c939417
Show file tree
Hide file tree
Showing 117 changed files with 4,244 additions and 400 deletions.
23 changes: 14 additions & 9 deletions packages/base/card-api.gts
Original file line number Diff line number Diff line change
Expand Up @@ -1297,17 +1297,22 @@ class LinksToMany<FieldT extends CardDefConstructor>
cachedInstance[isSavedInstance] = true;
return cachedInstance;
}
let resourceId = new URL(value.links.self, relativeTo).href;
let resourceId = new URL(
value.links.self,
!Array.isArray(doc.data) && 'id' in doc.data && doc.data.id
? doc.data.id
: relativeTo,
).href;
if (loadedValues && Array.isArray(loadedValues)) {
let loadedValue = loadedValues.find(
(v) => isCardOrField(v) && 'id' in v && v.id === resourceId,
);
if (loadedValue) {
return loadedValue;
}
}
let resource = resourceFrom(doc, resourceId);
if (!resource) {
if (loadedValues && Array.isArray(loadedValues)) {
let loadedValue = loadedValues.find(
(v) => isCardOrField(v) && 'id' in v && v.id === resourceId,
);
if (loadedValue) {
return loadedValue;
}
}
return {
type: 'not-loaded',
reference: value.links.self,
Expand Down
10 changes: 7 additions & 3 deletions packages/base/cards-grid.gts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class Isolated extends Component<typeof CardsGrid> {
</style>
</template>

filters: { displayName: string; icon: IconComponent; query: any }[] =
filters: { displayName: string; icon: IconComponent | string; query: any }[] =
new TrackedArray([
{
displayName: 'All Cards',
Expand Down Expand Up @@ -424,7 +424,11 @@ class Isolated extends Component<typeof CardsGrid> {
}
let cardTypeSummaries = (await response.json()).data as {
id: string;
attributes: { displayName: string; total: number };
attributes: {
displayName: string;
total: number;
iconHTML: string | null;
};
}[];
let excludedCardTypeIds = [
`${baseRealm.url}card-api/CardDef`,
Expand All @@ -441,7 +445,7 @@ class Isolated extends Component<typeof CardsGrid> {
const lastIndex = summary.id.lastIndexOf('/');
this.filters.push({
displayName: summary.attributes.displayName,
icon: Captions,
icon: summary.attributes.iconHTML ?? Captions,
query: {
filter: {
type: {
Expand Down
32 changes: 27 additions & 5 deletions packages/boxel-ui/addon/src/components/filter-list/index.gts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ export interface FilterListIconSignature {

export type FilterListIcon = ComponentLike<FilterListIconSignature>;

import { htmlSafe } from '@ember/template';

import { cn, eq } from '../../helpers.ts';

export type Filter = {
displayName: string;
icon: FilterListIcon;
icon: FilterListIcon | string;
};

interface Signature {
Expand All @@ -39,9 +41,16 @@ export default class FilterList extends Component<Signature> {
class={{cn 'filter-list__button' selected=(eq @activeFilter filter)}}
{{on 'click' (fn this.onChanged filter)}}
data-test-boxel-filter-list-button={{filter.displayName}}
><filter.icon
class='filter-list__icon'
/>{{filter.displayName}}</button>
>
{{#if (isIconString filter.icon)}}
{{htmlSafe
(addClassToSVG filter.icon 'filter-list__icon')
}}{{filter.displayName}}
{{else}}
<filter.icon
class='filter-list__icon'
/>{{filter.displayName}}{{/if}}</button>

{{/each}}
</div>
<style scoped>
Expand All @@ -58,6 +67,9 @@ export default class FilterList extends Component<Signature> {
font: 500 var(--boxel-font-sm);
padding: var(--boxel-sp-xxs);
margin-bottom: var(--boxel-sp-4xs);
display: flex;
gap: var(--boxel-sp-4xs);
}
.filter-list__button.selected {
color: var(--boxel-light);
Expand All @@ -68,11 +80,21 @@ export default class FilterList extends Component<Signature> {
background: var(--boxel-300);
border-radius: 6px;
}
.filter-list__icon {
:global(.filter-list__icon) {
width: var(--boxel-icon-xs);
height: var(--boxel-icon-xs);
vertical-align: top;
}
</style>
</template>
}

function addClassToSVG(svgString: string, className: string) {
return svgString
.replace(/<svg\b([^>]*)\sclass="([^"]*)"/, `<svg$1 class="$2 ${className}"`)
.replace(/<svg\b([^>]*)>/, `<svg$1 class="${className}">`);
}

function isIconString(icon: FilterListIcon | string): icon is string {
return typeof icon === 'string';
}
20 changes: 20 additions & 0 deletions packages/experiments-realm/CatalogEntry/tag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"data": {
"type": "card",
"attributes": {
"title": "Tag",
"description": "Catalog entry for Tag",
"ref": {
"name": "Tag",
"module": "../tag"
},
"isField": false
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
}
}
}
}
20 changes: 20 additions & 0 deletions packages/experiments-realm/CatalogEntry/team-member.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"data": {
"type": "card",
"attributes": {
"title": "Team Member",
"description": "Catalog entry for Team Member",
"ref": {
"name": "TeamMember",
"module": "../sprint-task"
},
"isField": false
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
}
}
}
}
20 changes: 20 additions & 0 deletions packages/experiments-realm/CatalogEntry/team.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"data": {
"type": "card",
"attributes": {
"title": "Team",
"description": "Catalog entry for Team",
"ref": {
"name": "Team",
"module": "../sprint-task"
},
"isField": false
},
"meta": {
"adoptsFrom": {
"module": "https://cardstack.com/base/catalog-entry",
"name": "CatalogEntry"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"meta": {
"adoptsFrom": {
"module": "../productivity/task",
"module": "../sprint-task",
"name": "Project"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"meta": {
"adoptsFrom": {
"module": "../productivity/task",
"module": "../sprint-task",
"name": "Project"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
"data": {
"type": "card",
"attributes": {
"tabs": [],
"headerIcon": {
"altText": null,
"size": "actual",
"height": null,
"width": null,
"base64": null
},
"moduleId": null,
"title": "Engineering Team Sprint",
"description": null,
"thumbnailURL": null
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"type": "card",
"attributes": {
"status": {
"completed": false,
"index": 1,
"label": "Next Sprint",
"color": "#64B5F6"
"color": "#64B5F6",
"completed": false
},
"dateRange": {
"start": "2024-12-08",
Expand All @@ -16,8 +16,8 @@
"index": 1,
"label": "Medium"
},
"name": "Pill Picker Example",
"details": "Use multi-select but for pills",
"name": "Create Pill Picker Example",
"details": "Implementation of a multi-select component using pills UI pattern, intended for use in the multi-filter feature. Users can select multiple pills simultaneously.\n\n**Note:** *This ticket is no longer relevant*",
"description": null,
"thumbnailURL": null
},
Expand All @@ -39,28 +39,18 @@
},
"assignee": {
"links": {
"self": null
"self": "../TeamMember/f832cfb6-959e-4d0d-bc83-8712a36a910a"
}
},
"tags.0": {
"links": {
"self": "../Tag/ad921cba-ffc7-4fdb-af34-ab8b93eae228"
}
},
"tags.1": {
"links": {
"self": "../Tag/6b8446c8-b185-4de9-ba81-88f8b9eee7f5"
}
},
"tags.2": {
"links": {
"self": "../Tag/f00a2177-df10-4ad7-8eac-2fbf8448de98"
}
}
},
"meta": {
"adoptsFrom": {
"module": "../productivity/task",
"module": "../sprint-task",
"name": "SprintTask"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"type": "card",
"attributes": {
"status": {
"completed": false,
"index": 2,
"label": "Current Sprint",
"color": "#00BCD4"
"index": 4,
"label": "In Review",
"color": "#9575CD",
"completed": false
},
"dateRange": {
"start": "2024-10-09",
"end": "2024-10-11"
"start": "2024-10-10",
"end": "2025-01-09"
},
"priority": {
"index": null,
Expand Down Expand Up @@ -44,7 +44,7 @@
},
"assignee": {
"links": {
"self": "../TeamMember/f832cfb6-959e-4d0d-bc83-8712a36a910a"
"self": "../TeamMember/5c42e6e9-59c8-4585-a721-e3414d7e7c9e"
}
},
"tags.0": {
Expand All @@ -60,7 +60,7 @@
},
"meta": {
"adoptsFrom": {
"module": "../productivity/task",
"module": "../sprint-task",
"name": "SprintTask"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,21 @@
"type": "card",
"attributes": {
"status": {
"completed": false,
"index": 2,
"label": "Current Sprint",
"color": "#00BCD4"
"color": "#00BCD4",
"completed": false
},
"dateRange": {
"start": "2024-11-18",
"end": "2024-11-19"
"start": "2024-12-19",
"end": "2025-01-09"
},
"priority": {
"index": null,
"label": null,
"color": null,
"colorScheme": {
"foregroundColor": null,
"backgroundColor": null
}
"index": 2,
"label": "Medium"
},
"name": "Embedded Template for Status and Priority",
"details": null,
"name": "Implement Status and Priority Template Component with Dynamic Rendering",
"details": "Technical implementation of a reusable template component for displaying status and priority indicators across the application. Requirements include:\n- Create base template structure\n- Implement dynamic color rendering based on status\n- Add priority level visualization\n- Ensure accessibility compliance\n- Add unit tests for component",
"description": null,
"thumbnailURL": null
},
Expand Down Expand Up @@ -55,7 +50,7 @@
},
"meta": {
"adoptsFrom": {
"module": "../productivity/task",
"module": "../sprint-task",
"name": "SprintTask"
}
}
Expand Down
Loading

0 comments on commit c939417

Please sign in to comment.