Skip to content

Conversation

@sagely1
Copy link
Contributor

@sagely1 sagely1 commented Oct 10, 2025

Description

This PR adds CT components and updates the config handling logic.

Related Issues

  • Adds Filter Panel and displays filter (MG-246).

Changelog

  • Filter Panel created. Note: Actual filtering logic will need to be created in a service (FilterPanelService).
  • Addresses a hydration error: NG05001
  • adds an http interceptor for error handling
  • changed config fetching logic to grab all CT configs and cache them
  • added basic components to serve as the foundation
  • SvgIconService was missing preloading of a few svgs
  • Added custom filters for FilterPanelService
  • FilterList and FilterListItem components were added but will need to be adapted to work with FilterPanelService in a future PR (MG-435)
  • Added SearchInputComponent (MG-423)

Preview

https://www.loom.com/share/6f86e3dab89a43bcb7eb0df699ef64f1

}

const result = await ComparisonToolConfigCollection.find({ page }).lean().exec();
const result = await ComparisonToolConfigCollection.find().lean().exec();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get all configs going forward and cache it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind expanding on the benefits of returning all of the possible configs rather than just the config for a single page?

Comment on lines +28 to +68
shouldShowList() {
return this.hasSelectedFilters() || this.significanceThresholdActive;
}

clearList() {
this.removeSignificanceThresholdFilter();
this.clearSelectedFilters();
}

/* ----------------------------------------------------------------------- */
/* Filters
/* ----------------------------------------------------------------------- */
hasSelectedFilters() {
for (const filter of this.filters) {
if (filter.options.filter((option) => option.selected).length > 0) {
return true;
}
}
return false;
}

clearSelectedFilters(option?: GCTFilterOption) {
if (option) {
option.selected = false;
} else {
for (const filter of this.filters) {
for (const o of filter.options) {
o.selected = false;
}
}
}
this.changeEvent.emit(this.filters);
}

/* ----------------------------------------------------------------------- */
/* Significance Threshold
/* ----------------------------------------------------------------------- */
removeSignificanceThresholdFilter(): void {
this.significanceThresholdActive = false;
this.onremoveSignificanceThresholdFilter.emit(this.significanceThresholdActive);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic should be handled in FilterPanelService in the future (MG-435)

Comment on lines 1 to 32
export const intersectFilterCallback = function (value: any, filters: any): boolean {
if (filters === undefined || filters === null || filters.length < 1) {
return true;
} else if (value === undefined || value === null || filters.length < 1) {
return false;
}

for (const filter of filters) {
if (value.indexOf(filter) !== -1) {
return true;
}
}

return false;
};

export const urlLinkCallback = function (value: any, filters: any): boolean {
console.log('urlLinkCallback', value, filters);
if (filters === undefined || filters === null || filters.length < 1) {
return true;
} else if (value === undefined || value === null || filters.length < 1) {
return false;
}

for (const filter of filters) {
if (value.link_url && value.link_url.indexOf(filter) !== -1) {
return true;
}
}

return false;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are custom filters not found in PrimeNG defaults

Comment on lines +32 to +42
'/explorers-assets/icons/card-arrow.svg',
'/explorers-assets/icons/close.svg',
'/explorers-assets/icons/cog.svg',
'/explorers-assets/icons/column.svg',
'/explorers-assets/icons/download.svg',
'/explorers-assets/icons/external-link.svg',
'/explorers-assets/icons/gct.svg',
'/explorers-assets/icons/info-circle.svg',
'/explorers-assets/icons/link.svg',
'/explorers-assets/icons/pin.svg',
'/explorers-assets/icons/search.svg',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding missing svgs

@sagely1 sagely1 changed the title feat(model-ad): add comparison-tool components (MG-246) feat(model-ad): add comparison-tool components (MG-246) (MG-423) Oct 10, 2025
Comment on lines +27 to +40
button {
position: absolute;
top: 0;
right: 0;
width: 40px;
height: 100%;
cursor: pointer;

&:hover explorers-svg-icon {
path {
fill: var(--color-action-primary);
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be adjusted in the future as the main-table equivalent in Agora is under this element.

alert('Filter panel toggled');
}
filterResultsButtonTooltip = input.required<string>();
shareUrlButtonTooltip = input.required<string>();
Copy link
Collaborator

@hallieswan hallieswan Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shareUrlButtonTooltip input was removed in #3545 - the tooltip value is now managed in libs/explorers/comparison-tools/src/lib/comparison-tool-header/comparison-tool-share-url-button/comparison-tool-share-url-button.component.ts. See below comment -- if we want to bring back the shareUrlButtonTooltip, then we would need to update the comparison-tool-share-url-button.

styleUrls: ['./comparison-tool-share-url-button.component.scss'],
})
export class ComparisonToolShareURLButtonComponent {
tooltip = input('');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip input is currently unused -- if we want to pass in a tooltip value here, we would need to use it in getTooltipText.

@sagely1 sagely1 changed the title feat(model-ad): add comparison-tool components (MG-246) (MG-423) feat(model-ad): add comparison-tool components (MG-246) (MG-423) (MG-435) Oct 10, 2025
@sagely1 sagely1 changed the title feat(model-ad): add comparison-tool components (MG-246) (MG-423) (MG-435) feat(model-ad): add comparison-tool components (MG-246) (MG-423) Oct 10, 2025
@sagely1 sagely1 marked this pull request as draft October 10, 2025 23:19
@tschaffter
Copy link
Member

@sagely1 Please set the assignee to yourself on PRs. List Jira ticket IDs using a single parenthesis "(MG-246) (MG-423)" --> "(MG-246, MG-423)"

@sagely1 sagely1 changed the title feat(model-ad): add comparison-tool components (MG-246) (MG-423) feat(model-ad): add comparison-tool components (MG-423) Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants