diff --git a/src/FilterLists.Web/src/components/LicenseTag.tsx b/src/FilterLists.Web/src/components/LicenseTag.tsx index d6349d4a5..be03f6708 100644 --- a/src/FilterLists.Web/src/components/LicenseTag.tsx +++ b/src/FilterLists.Web/src/components/LicenseTag.tsx @@ -3,19 +3,20 @@ import * as React from 'react'; interface Props { name: string; - descriptionUrl: string; + descriptionUrl?: string; + showLabel?: boolean; }; export const LicenseTag = (props: Props) => props.name - ? <> -

License:

+ ? + {props.showLabel &&

License:

} - +
: null; const TagContents = (props: Props) => diff --git a/src/FilterLists.Web/src/components/ListInfoDrawer.tsx b/src/FilterLists.Web/src/components/ListInfoDrawer.tsx index 41c6b9de1..53216436f 100644 --- a/src/FilterLists.Web/src/components/ListInfoDrawer.tsx +++ b/src/FilterLists.Web/src/components/ListInfoDrawer.tsx @@ -59,7 +59,8 @@ export const ListInfoDrawer = (props: RouteComponentProps & Props) => { {props.license && } + descriptionUrl={props.license.descriptionUrl} + showLabel={true} />} {props.syntax && { className={styles.nogrow} filters={syntaxes.map(s => ({ text: <> - + ({visibleLists.filter(l => l.syntaxId && l.syntaxId === s.id).length}) , value: s.id.toString() @@ -222,6 +223,39 @@ export const ListsTable = (props: RouteComponentProps & Props) => { maintainerIds ? maintainerIds.includes(t.id))} /> : null} />} + {tablePageSize.isNarrowWindow + ? null + : + title="License" + key="License" + dataIndex={nameof("licenseId")} + sorter={(a, b) => { + const licenseA = licenses.find(s => s.id === a.licenseId); + const licenseB = licenses.find(s => s.id === b.licenseId); + return licenseA + ? licenseB + ? licenseA.name.localeCompare(licenseB.name) + : -1 + : 1; + }} + width={215} + className={styles.nogrow} + filters={licenses.map(l => ({ + text: <> + + ({visibleLists.filter(li => li.licenseId && li.licenseId === l.id).length}) + , + value: l.id.toString() + }))} + onFilter={(value, record) => record.licenseId + ? record.licenseId.toString() === value + : false} + render={(licenseId: number) => { + const license = licenses.find(l => l.id === licenseId); + return license + ? + : null + }} />} ); }; \ No newline at end of file