diff --git a/web/src/components/listInfoDrawer/ListInfoDrawer.tsx b/web/src/components/listInfoDrawer/ListInfoDrawer.tsx index 3a262b423..072595829 100644 --- a/web/src/components/listInfoDrawer/ListInfoDrawer.tsx +++ b/web/src/components/listInfoDrawer/ListInfoDrawer.tsx @@ -24,40 +24,40 @@ import { RouteComponentProps } from "react-router-dom"; import { SoftwareCloud } from "../softwareCloud"; import { SubscribeButtons } from "../SubscribeButtons"; import { TagCloud } from "../tagCloud"; -import { - useListDetails, - useLanguages, - useLicenses, - useMaintainers, - useSoftware, - useSyntaxes, - useTags, -} from "../../hooks"; +import { useListDetails } from "../../hooks"; import { SyntaxCloud } from "../syntaxCloud"; +import { Tag } from "../../interfaces/Tag"; +import { License } from "../../interfaces/License"; +import { Maintainer } from "../../interfaces/Maintainer"; +import { Software } from "../../interfaces/Software"; +import { Syntax } from "../../interfaces/Syntax"; +import { Language } from "../../interfaces/Language"; interface Props { listId: number; + languages: Language[]; + licenses: License[]; + maintainers: Maintainer[]; + software: Software[]; + syntaxes: Syntax[]; + tags: Tag[]; } export const ListInfoDrawer = (props: RouteComponentProps & Props) => { const list = useListDetails(props.listId); - const languages = useLanguages(); - const licenses = useLicenses(); - const maintainers = useMaintainers(); - const software = useSoftware(); - const syntaxes = useSyntaxes(); - const tags = useTags(); - const listLanguage = languages.filter((l) => + const listLanguage = props.languages.filter((l) => list?.languageIso6391s.includes(l.iso6391) ); - const listTags = tags.filter((t) => list?.tagIds.includes(t.id)); - const listLicense = licenses.find((l) => l.id === list?.id); - const listSyntaxes = syntaxes.filter((s) => list?.syntaxIds.includes(s.id)); - const listSoftware = software.filter((s) => + const listTags = props.tags.filter((t) => list?.tagIds.includes(t.id)); + const listLicense = props.licenses.find((l) => l.id === list?.id); + const listSyntaxes = props.syntaxes.filter((s) => + list?.syntaxIds.includes(s.id) + ); + const listSoftware = props.software.filter((s) => s.syntaxIds.some((sid) => list?.syntaxIds.includes(sid)) ); - const listMaintainers = maintainers.filter((m) => + const listMaintainers = props.maintainers.filter((m) => list?.maintainerIds.includes(m.id) ); diff --git a/web/src/components/listsTable/ListDrawer.tsx b/web/src/components/listsTable/ListDrawer.tsx index 46b0edd97..ea6deb487 100644 --- a/web/src/components/listsTable/ListDrawer.tsx +++ b/web/src/components/listsTable/ListDrawer.tsx @@ -8,16 +8,37 @@ import { import { List } from "../../interfaces/List"; import { ListInfoDrawer } from "../listInfoDrawer"; +import { Language } from "../../interfaces/Language"; +import { License } from "../../interfaces/License"; +import { Maintainer } from "../../interfaces/Maintainer"; +import { Software } from "../../interfaces/Software"; +import { Syntax } from "../../interfaces/Syntax"; +import { Tag } from "../../interfaces/Tag"; interface Props { lists: List[]; + languages: Language[]; + licenses: License[]; + maintainers: Maintainer[]; + software: Software[]; + syntaxes: Syntax[]; + tags: Tag[]; } export const ListDrawer = (props: Props) => { const renderDrawer = (rp: RouteComponentProps) => { const list = props.lists.find((l) => l.slug === rp.match.params.listSlug); return list ? ( - + ) : props.lists && props.lists.length ? ( ) : null; diff --git a/web/src/components/listsTable/ListsTableHoc.tsx b/web/src/components/listsTable/ListsTableHoc.tsx index 036cfd61c..6c4b4c72a 100644 --- a/web/src/components/listsTable/ListsTableHoc.tsx +++ b/web/src/components/listsTable/ListsTableHoc.tsx @@ -33,7 +33,15 @@ export const ListsTableHoc = (props: RouteComponentProps) => { tags={tags} {...props} /> - + ); };