diff --git a/src/FilterLists.Web.V2/package-lock.json b/src/FilterLists.Web.V2/package-lock.json index 1f6d43ece..877afcf52 100644 Binary files a/src/FilterLists.Web.V2/package-lock.json and b/src/FilterLists.Web.V2/package-lock.json differ diff --git a/src/FilterLists.Web.V2/src/components/LicenseTag.tsx b/src/FilterLists.Web.V2/src/components/LicenseTag.tsx new file mode 100644 index 000000000..a69cb9f2e --- /dev/null +++ b/src/FilterLists.Web.V2/src/components/LicenseTag.tsx @@ -0,0 +1,26 @@ +import { Tag } from 'antd'; +import * as React from 'react'; + +import { License } from '../interfaces/License'; + +interface Props { + license: License; + showLabel?: boolean +}; + +export const LicenseTag = (props: Props): JSX.Element | null => + props.license && props.license.name + ?
+ {props.showLabel &&

License:

} + + + +
+ : null; + +const TagContents = (props: Props): JSX.Element => + props.license.descriptionUrl + ? + {props.license.name} + + : {props.license.name} \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/ListInfoDrawer.tsx b/src/FilterLists.Web.V2/src/components/ListInfoDrawer.tsx index 58d7788d8..db10f89c0 100644 --- a/src/FilterLists.Web.V2/src/components/ListInfoDrawer.tsx +++ b/src/FilterLists.Web.V2/src/components/ListInfoDrawer.tsx @@ -4,10 +4,12 @@ import React from 'react'; import { RouteComponentProps } from 'react-router-dom'; import { Language } from '../interfaces/Language'; +import { License } from '../interfaces/License'; import { List } from '../interfaces/List'; import { Tag } from '../interfaces/Tag'; import { Description } from './Description'; import { LanguageCloud } from './languageCloud'; +import { LicenseTag } from './LicenseTag'; import { LinkButton } from './LinkButton'; import { SubscribeButton } from './SubscribeButton'; import { TagCloud } from './tagCloud'; @@ -15,6 +17,7 @@ import { TagCloud } from './tagCloud'; interface Props { list: List; languages: Language[]; + license?: License; tags: Tag[]; }; @@ -45,10 +48,13 @@ export class ListInfoDrawer extends React.Component this.props.history.push("/")}> {this.props.list.languageIds - ? this.props.list.languageIds.includes(l.id))} showLabel={true} /> + ? : null} {this.props.list.tagIds - ? this.props.list.tagIds.includes(t.id))} showLabel={true} /> + ? + : null} + {this.props.license + ? : null} {this.props.list.publishedDate ?
diff --git a/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx b/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx index ca403032d..b0b657d89 100644 --- a/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx +++ b/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx @@ -59,10 +59,10 @@ export class ListsTable extends React.Component { .then(json => (json as Tag[]).sort((a, b) => a.name.localeCompare(b.name))) .then(tags => { this.setState({ tags: tags }); }) - // fetch("/api/v1/licenses") - // .then(response => response.json()) - // .then(json => (json as License[]).sort((a, b) => a.name.localeCompare(b.name))) - // .then(licenses => { this.setState({ licenses: licenses }); }) + fetch("/api/v1/licenses") + .then(response => response.json()) + .then(json => (json as License[]).sort((a, b) => a.name.localeCompare(b.name))) + .then(licenses => { this.setState({ licenses: licenses }); }) } private updatePageSize() { @@ -144,7 +144,12 @@ export class ListsTable extends React.Component { { const list = this.state.lists.find(l => l.id === +props.match.params.id); return list - ? + ? list.languageIds.includes(l.id))} + license={list.licenseId ? this.state.licenses.find((l: License) => list.licenseId === l.id) : undefined} + tags={list.tagIds && this.state.tags.filter((t: Tag) => list.tagIds.includes(t.id))} + {...this.props} /> : this.state.lists && this.state.lists.length && }} /> diff --git a/src/FilterLists.Web.V2/src/components/tagCloud/TagCloud.tsx b/src/FilterLists.Web.V2/src/components/tagCloud/TagCloud.tsx index 48dbed300..c63c775f4 100644 --- a/src/FilterLists.Web.V2/src/components/tagCloud/TagCloud.tsx +++ b/src/FilterLists.Web.V2/src/components/tagCloud/TagCloud.tsx @@ -1,15 +1,11 @@ import { Tag } from 'antd'; import React from 'react'; +import { Tag as TagInterface } from '../../interfaces/Tag'; import styles from './TagCloud.module.css'; -interface TagData { - description: string; - name: string; -}; - interface Props { - tags: TagData[] + tags: TagInterface[] showLabel?: boolean }; @@ -17,7 +13,7 @@ export const TagCloud = (props: Props): JSX.Element | null => props.tags && props.tags.length ?
{props.showLabel &&

{`Tag${props.tags.length > 1 ? "s" : ""}:`}

} - {props.tags.map((t: TagData, i: number) => + {props.tags.map((t: TagInterface, i: number) => {t.name})}
: null; \ No newline at end of file