add software icons to table
|
|
@ -6,11 +6,13 @@ import { useTablePageSizer } from '../../hooks';
|
|||
import { Language } from '../../interfaces/Language';
|
||||
import { License } from '../../interfaces/License';
|
||||
import { List } from '../../interfaces/List';
|
||||
import { Software } from '../../interfaces/Software';
|
||||
import { Tag } from '../../interfaces/Tag';
|
||||
import { nameof } from '../../utils';
|
||||
import { Description } from '../Description';
|
||||
import { LanguageCloud } from '../languageCloud';
|
||||
import { ListInfoButton } from '../ListInfoButton';
|
||||
import { SoftwareCloud } from '../softwareCloud';
|
||||
import { TagCloud } from '../tagCloud';
|
||||
import { arraySorter } from './arraySorter';
|
||||
import styles from './ListsTable.module.css';
|
||||
|
|
@ -19,6 +21,7 @@ interface Props {
|
|||
lists: List[];
|
||||
languages: Language[];
|
||||
licenses: License[];
|
||||
software: Software[];
|
||||
tags: Tag[];
|
||||
};
|
||||
|
||||
|
|
@ -59,8 +62,9 @@ export const ListsTable = (props: RouteComponentProps & Props) => {
|
|||
: <Table.Column<List>
|
||||
title="Software"
|
||||
dataIndex={nameof<List>("syntaxId")}
|
||||
width={160}
|
||||
className={styles.nogrow}
|
||||
render={(text: string) => <div>{text}</div>} />}
|
||||
render={(syntaxId: number) => syntaxId ? <SoftwareCloud software={props.software.filter((s: Software) => s.syntaxIds.includes(syntaxId))} /> : null} />}
|
||||
{tablePageSize.isNarrowWindow
|
||||
? null
|
||||
: <Table.Column<List>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { RouteComponentProps } from 'react-router-dom';
|
||||
|
||||
import { useLanguages, useLicenses, useLists, useTags } from '../../hooks';
|
||||
import { useLanguages, useLicenses, useLists, useSoftware, useTags } from '../../hooks';
|
||||
import { ListDrawer } from './ListDrawer';
|
||||
import { ListsTable } from './ListsTable';
|
||||
|
||||
|
|
@ -9,10 +9,11 @@ export const ListsTableHoc = (props: RouteComponentProps) => {
|
|||
const lists = useLists();
|
||||
const languages = useLanguages();
|
||||
const licenses = useLicenses();
|
||||
const software = useSoftware();
|
||||
const tags = useTags();
|
||||
return (
|
||||
<>
|
||||
<ListsTable lists={lists} languages={languages} licenses={licenses} tags={tags} {...props} />
|
||||
<ListsTable lists={lists} languages={languages} licenses={licenses} software={software} tags={tags} {...props} />
|
||||
<ListDrawer lists={lists} languages={languages} licenses={licenses} tags={tags} />
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
import React from 'react';
|
||||
|
||||
import { Software } from '../../interfaces/Software';
|
||||
import { SoftwareIcon } from './SoftwareIcon';
|
||||
|
||||
interface Props {
|
||||
software: Software[];
|
||||
};
|
||||
|
||||
export const SoftwareCloud = (props: Props) =>
|
||||
props.software && props.software.length
|
||||
? <div>
|
||||
{props.software.map((s: Software, i: number) =>
|
||||
s.homeUrl
|
||||
? <a key={i} href={s.homeUrl} target="_blank" rel="noopener noreferrer">
|
||||
<SoftwareIcon id={s.id} />
|
||||
</a>
|
||||
: <SoftwareIcon key={i} id={s.id} />)}
|
||||
</div>
|
||||
: null;
|
||||
|
Before Width: | Height: | Size: 623 B After Width: | Height: | Size: 623 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 921 B After Width: | Height: | Size: 921 B |
|
Before Width: | Height: | Size: 851 B After Width: | Height: | Size: 851 B |
|
Before Width: | Height: | Size: 698 B After Width: | Height: | Size: 698 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 658 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 547 B After Width: | Height: | Size: 547 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 636 B |
|
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 476 B After Width: | Height: | Size: 476 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 403 B |
|
Before Width: | Height: | Size: 789 B After Width: | Height: | Size: 789 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 917 B After Width: | Height: | Size: 917 B |
|
Before Width: | Height: | Size: 998 B After Width: | Height: | Size: 998 B |
|
Before Width: | Height: | Size: 750 B After Width: | Height: | Size: 750 B |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 565 B After Width: | Height: | Size: 565 B |
|
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 520 B |
|
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 878 B |
|
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 713 B |
|
Before Width: | Height: | Size: 867 B After Width: | Height: | Size: 867 B |
|
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 470 B |
|
|
@ -0,0 +1,3 @@
|
|||
import { SoftwareCloud } from './SoftwareCloud';
|
||||
|
||||
export { SoftwareCloud };
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
import { SoftwareIcon } from './SoftwareIcon';
|
||||
|
||||
export { SoftwareIcon };
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
import { useLanguages } from './useLanguages';
|
||||
import { useLicenses } from './useLicenses';
|
||||
import { useLists } from './useLists';
|
||||
import { useSoftware } from './useSoftware';
|
||||
import { useTablePageSizer } from './useTablePageSizer';
|
||||
import { useTags } from './useTags';
|
||||
|
||||
export { useLanguages, useLicenses, useLists, useTablePageSizer, useTags };
|
||||
export { useLanguages, useLicenses, useLists, useSoftware, useTablePageSizer, useTags };
|
||||
4
src/FilterLists.Web.V2/src/hooks/useSoftware.tsx
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { Software } from '../interfaces/Software';
|
||||
import { useApiData } from './useApiData';
|
||||
|
||||
export const useSoftware = () => useApiData<Software[]>("/api/v1/software") || [];
|
||||
7
src/FilterLists.Web.V2/src/interfaces/Software.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export interface Software {
|
||||
id: number;
|
||||
homeUrl: string;
|
||||
isAbpSubscribable: boolean;
|
||||
name: string;
|
||||
syntaxIds: number[];
|
||||
};
|
||||