diff --git a/src/components.d.ts b/src/components.d.ts index 736e1a4ec..d0cee62ca 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -11,9 +11,6 @@ import '@stencil/state-tunnel'; import { Collection, } from 'types/Collection'; -import { - Service, -} from 'types/Service'; import { Connection, Env, @@ -63,13 +60,13 @@ export namespace Components { 'collections': Collection[]; 'featured'?: string; 'serviceLink'?: string; - 'services': Service[]; + 'services': Catalog.Product[]; } interface ManiTunnelAttributes extends StencilHTMLAttributes { 'collections'?: Collection[]; 'featured'?: string; 'serviceLink'?: string; - 'services'?: Service[]; + 'services'?: Catalog.Product[]; } interface ManifoldConnection { @@ -126,12 +123,12 @@ export namespace Components { interface MarketplaceResults { 'featured'?: string; 'serviceLink'?: string; - 'services': Service[]; + 'services': Catalog.Product[]; } interface MarketplaceResultsAttributes extends StencilHTMLAttributes { 'featured'?: string; 'serviceLink'?: string; - 'services'?: Service[]; + 'services'?: Catalog.Product[]; } interface MfBadge {} diff --git a/src/components/mani-tunnel/mani-tunnel.tsx b/src/components/mani-tunnel/mani-tunnel.tsx index 4453e7331..0dbd5e117 100644 --- a/src/components/mani-tunnel/mani-tunnel.tsx +++ b/src/components/mani-tunnel/mani-tunnel.tsx @@ -1,6 +1,4 @@ import { Component, Prop } from '@stencil/core'; - -import { Service } from 'types/Service'; import { Collection } from 'types/Collection'; import Tunnel from '../../data/marketplace'; @@ -10,7 +8,7 @@ export class ManiTunnel { @Prop() serviceLink?: string; @Prop() featured?: string; @Prop() collections: Collection[] = []; - @Prop() services: Service[]; + @Prop() services: Catalog.Product[]; render() { return ( diff --git a/src/components/mani-tunnel/readme.md b/src/components/mani-tunnel/readme.md index bca98c678..811922272 100644 --- a/src/components/mani-tunnel/readme.md +++ b/src/components/mani-tunnel/readme.md @@ -12,7 +12,7 @@ | `collections` | -- | | `Collection[]` | `[]` | | `featured` | `featured` | | `string \| undefined` | `undefined` | | `serviceLink` | `service-link` | | `string \| undefined` | `undefined` | -| `services` | -- | | `Service[]` | `undefined` | +| `services` | -- | | `Product[]` | `undefined` | ---------------------------------------------- diff --git a/src/components/manifold-marketplace/manifold-marketplace.tsx b/src/components/manifold-marketplace/manifold-marketplace.tsx index d0c46439a..3fff5e6e8 100644 --- a/src/components/manifold-marketplace/manifold-marketplace.tsx +++ b/src/components/manifold-marketplace/manifold-marketplace.tsx @@ -1,5 +1,4 @@ import { Component, Prop, State, Element } from '@stencil/core'; -import { Service } from 'types/Service'; import { Collection } from 'types/Collection'; import Tunnel from '../../data/connection'; @@ -12,7 +11,7 @@ export class ManifoldMarketplace { @Prop() featured?: string; @Prop() connection: Connection; @Prop() collections: Collection[] = []; - @State() services: Service[] = []; + @State() services: Catalog.Product[] = []; componentWillLoad() { return fetch(`${this.connection.catalog}/products`) diff --git a/src/components/marketplace-collection/marketplace-collection.tsx b/src/components/marketplace-collection/marketplace-collection.tsx index 1a65bfc32..487c00b16 100644 --- a/src/components/marketplace-collection/marketplace-collection.tsx +++ b/src/components/marketplace-collection/marketplace-collection.tsx @@ -1,7 +1,4 @@ import { Component, Prop } from '@stencil/core'; - -import { Service } from 'types/Service'; - import Tunnel, { State } from '../../data/marketplace'; @Component({ tag: 'marketplace-collection' }) @@ -22,7 +19,9 @@ export class Collection { tagline={this.tagLine} > this.labels.includes(s.body.label))} + services={state.services.filter((s: Catalog.Product) => + this.labels.includes(s.body.label) + )} /> )} diff --git a/src/components/marketplace-results/marketplace-results.tsx b/src/components/marketplace-results/marketplace-results.tsx index e50c3ce42..867e51a01 100644 --- a/src/components/marketplace-results/marketplace-results.tsx +++ b/src/components/marketplace-results/marketplace-results.tsx @@ -1,11 +1,10 @@ import { Component, Prop } from '@stencil/core'; -import { Service } from 'types/Service'; @Component({ tag: 'marketplace-results', styleUrl: 'marketplace-results.css' }) export class ManifoldMarketplace { @Prop() featured?: string; @Prop() serviceLink?: string; - @Prop() services: Service[]; + @Prop() services: Catalog.Product[]; private formatHref(label: string): string { if (typeof label !== 'string') return ''; diff --git a/src/components/marketplace-results/readme.md b/src/components/marketplace-results/readme.md index 82ae3eead..2ae28afe9 100644 --- a/src/components/marketplace-results/readme.md +++ b/src/components/marketplace-results/readme.md @@ -11,7 +11,7 @@ | ------------- | -------------- | ----------- | --------------------- | ----------- | | `featured` | `featured` | | `string \| undefined` | `undefined` | | `serviceLink` | `service-link` | | `string \| undefined` | `undefined` | -| `services` | -- | | `Service[]` | `undefined` | +| `services` | -- | | `Product[]` | `undefined` | ---------------------------------------------- diff --git a/src/data/marketplace.tsx b/src/data/marketplace.tsx index a56668522..b7e9bf8bf 100644 --- a/src/data/marketplace.tsx +++ b/src/data/marketplace.tsx @@ -1,10 +1,9 @@ import { createProviderConsumer } from '@stencil/state-tunnel'; -import { Service } from 'types/Service'; import { Collection } from 'types/Collection'; export interface State { collections: Collection[]; - services: Service[]; + services: Catalog.Product[]; serviceLink?: string; featured?: string; } diff --git a/src/types/Service.ts b/src/types/Service.ts deleted file mode 100644 index 98769229a..000000000 --- a/src/types/Service.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface Service { - body: { - label: string; - logo_url: string; - name: string; - tagline: string; - tags?: Array; - }; -} diff --git a/src/utils/marketplace.ts b/src/utils/marketplace.ts index d842fd791..b8a068bca 100644 --- a/src/utils/marketplace.ts +++ b/src/utils/marketplace.ts @@ -1,7 +1,5 @@ -import { Service } from 'types/Service'; - export type CategoryMap = { - [category: string]: Service[]; + [category: string]: Catalog.Product[]; }; export function formatCategoryLabel(tag: string): string { switch (tag) { @@ -14,7 +12,7 @@ export function formatCategoryLabel(tag: string): string { } } -export function categories(services?: Service[]): CategoryMap { +export function categories(services?: Catalog.Product[]): CategoryMap { const categoryMap: CategoryMap = {}; if (Array.isArray(services)) { @@ -32,7 +30,7 @@ export function categories(services?: Service[]): CategoryMap { return categoryMap; } -export function filteredServices(filter: string, services?: Service[]) { +export function filteredServices(filter: string, services?: Catalog.Product[]) { if (!filter || !services) { return []; }