diff --git a/src/FilterLists.Web.V2/.gitignore b/src/FilterLists.Web.V2/.gitignore index 4d29575de..24cdedf82 100644 --- a/src/FilterLists.Web.V2/.gitignore +++ b/src/FilterLists.Web.V2/.gitignore @@ -20,4 +20,4 @@ npm-debug.log* yarn-debug.log* -yarn-error.log* +yarn-error.log* \ No newline at end of file diff --git a/src/FilterLists.Web.V2/package-lock.json b/src/FilterLists.Web.V2/package-lock.json index f45471209..316000e1f 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/package.json b/src/FilterLists.Web.V2/package.json index b9d130dda..ad140b771 100644 --- a/src/FilterLists.Web.V2/package.json +++ b/src/FilterLists.Web.V2/package.json @@ -39,4 +39,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/App.tsx b/src/FilterLists.Web.V2/src/App.tsx index e623a8f4e..c56bff830 100644 --- a/src/FilterLists.Web.V2/src/App.tsx +++ b/src/FilterLists.Web.V2/src/App.tsx @@ -53,25 +53,25 @@ const Community = () => title="FilterLists Discourse community forum" target="_blank" rel="noopener noreferrer"> Community - ; + ; const GitHub = () => GitHub - ; + ; const Api = () => API - ; + ; const Donate = () => Donate - ; \ No newline at end of file + ; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/LicenseTag.tsx b/src/FilterLists.Web.V2/src/components/LicenseTag.tsx index 80a527e07..cd4a939ff 100644 --- a/src/FilterLists.Web.V2/src/components/LicenseTag.tsx +++ b/src/FilterLists.Web.V2/src/components/LicenseTag.tsx @@ -23,4 +23,6 @@ const TagContents = (props: Props) => ? {props.license.name} - : {props.license.name} \ No newline at end of file + : <> + {props.license.name} + ; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/ListInfoButton.tsx b/src/FilterLists.Web.V2/src/components/ListInfoButton.tsx index d17d0a21c..13d0abd51 100644 --- a/src/FilterLists.Web.V2/src/components/ListInfoButton.tsx +++ b/src/FilterLists.Web.V2/src/components/ListInfoButton.tsx @@ -10,12 +10,14 @@ interface Props { export const ListInfoButton = (props: RouteComponentProps & Props) => { const listPath = `/lists/${props.list.id}`; - return + return ( + + ); }; \ 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 68e76212e..0aebf639e 100644 --- a/src/FilterLists.Web.V2/src/components/ListInfoDrawer.tsx +++ b/src/FilterLists.Web.V2/src/components/ListInfoDrawer.tsx @@ -23,15 +23,11 @@ interface Props { export const ListInfoDrawer = (props: RouteComponentProps & Props) => { const [originalTitle] = useState(document.title); - useEffect(() => { - const updateTitle = () => { - document.title = props.list.name + " | " + originalTitle; - } + const updateTitle = () => document.title = props.list.name + " | " + originalTitle; updateTitle(); - return () => { document.title = originalTitle; } + return () => { document.title = originalTitle; }; }, [props.list, originalTitle]); - return ( { icon="dollar" />} - ) -} \ No newline at end of file + ); +}; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/SubscribeButtons.tsx b/src/FilterLists.Web.V2/src/components/SubscribeButtons.tsx index 60a3897ee..c0a5eac18 100644 --- a/src/FilterLists.Web.V2/src/components/SubscribeButtons.tsx +++ b/src/FilterLists.Web.V2/src/components/SubscribeButtons.tsx @@ -23,7 +23,7 @@ const PrimaryButton = (props: Props) => { {...buttonProps[0]}> Subscribe - ) + ); }; const MirrorButtons = (props: Props) => @@ -39,7 +39,7 @@ interface MirrorButtonProps { index: number; viewUrlMirror: string; name: string; -} +}; const MirrorButton = (props: MirrorButtonProps) => { const buttonProps = buildButtonProps(props.name, props.viewUrlMirror); @@ -52,8 +52,8 @@ const MirrorButton = (props: MirrorButtonProps) => { {...buttonProps[0]}> {`Subscribe (Mirror ${props.index + 1})`} - ) -} + ); +}; const buildButtonProps = (name: string, viewUrl: string): [ButtonProps, boolean] => { let type: ButtonType = "primary"; @@ -70,22 +70,22 @@ const buildButtonProps = (name: string, viewUrl: string): [ButtonProps, boolean] if (viewUrl.includes(".onion/")) { type = "dashed"; prefixes.push("TOR"); - } + }; if (viewUrl.includes("http://")) { type = "danger"; prefixes.push("INSECURE"); - } + }; // Software protocols if (viewUrl.includes(".tpl")) { disabled = true; // IE not supported by FilterLists - } + }; if (viewUrl.includes(".lsrules") || viewUrl.includes("?hostformat=littlesnitch")) { href = `x-littlesnitch:subscribe-rules?url=${hrefLocation}`; message = `Subscribe to ${name} with Little Snitch's rule group subscription feature.`; - } + }; const title = `${prefixes.length ? prefixes.join(" | ") + " | " : ""}${message}`; - return [{ type, href, title }, disabled] -} \ No newline at end of file + return [{ type, href, title }, disabled]; +}; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/languageCloud/LanguageCloud.tsx b/src/FilterLists.Web.V2/src/components/languageCloud/LanguageCloud.tsx index 36781bce1..4c64ca1e2 100644 --- a/src/FilterLists.Web.V2/src/components/languageCloud/LanguageCloud.tsx +++ b/src/FilterLists.Web.V2/src/components/languageCloud/LanguageCloud.tsx @@ -5,8 +5,8 @@ import { Language } from '../../interfaces/Language'; import styles from './LanguageCloud.module.css'; interface Props { - languages: Language[] - showLabel?: boolean + languages: Language[]; + showLabel?: boolean; }; export const LanguageCloud = (props: Props) => diff --git a/src/FilterLists.Web.V2/src/components/listsTable/ListDrawer.tsx b/src/FilterLists.Web.V2/src/components/listsTable/ListDrawer.tsx index c71162dbc..67a53b176 100644 --- a/src/FilterLists.Web.V2/src/components/listsTable/ListDrawer.tsx +++ b/src/FilterLists.Web.V2/src/components/listsTable/ListDrawer.tsx @@ -12,7 +12,7 @@ interface Props { languages: Language[]; licenses: License[]; tags: Tag[]; -} +}; export const ListDrawer = (props: Props) => { const renderDrawer = (rp: RouteComponentProps) => { @@ -24,7 +24,7 @@ export const ListDrawer = (props: Props) => { license={list.licenseId ? props.licenses.find((l: License) => list.licenseId === l.id) : undefined} tags={list.tagIds && props.tags.filter((t: Tag) => list.tagIds.includes(t.id))} {...rp} /> - : props.lists && props.lists.length && + : props.lists && props.lists.length && ; }; - return -} \ No newline at end of file + return ; +}; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx b/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx index 37ad94a76..0e2db3d73 100644 --- a/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx +++ b/src/FilterLists.Web.V2/src/components/listsTable/ListsTable.tsx @@ -20,7 +20,7 @@ interface Props { languages: Language[]; licenses: License[]; tags: Tag[]; -} +}; export const ListsTable = (props: RouteComponentProps & Props) => { const tablePageSize = useTablePageSizer(); @@ -80,5 +80,5 @@ export const ListsTable = (props: RouteComponentProps & Props) => { className={styles.nogrow} render={(tagIds: number[]) => tagIds ? tagIds.includes(t.id))} /> : null} />} - ) -} \ No newline at end of file + ); +}; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/listsTable/ListsTableHoc.tsx b/src/FilterLists.Web.V2/src/components/listsTable/ListsTableHoc.tsx index 8884df941..690927159 100644 --- a/src/FilterLists.Web.V2/src/components/listsTable/ListsTableHoc.tsx +++ b/src/FilterLists.Web.V2/src/components/listsTable/ListsTableHoc.tsx @@ -15,5 +15,5 @@ export const ListsTableHoc = (props: RouteComponentProps) => { - ) -} \ No newline at end of file + ); +}; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/listsTable/arraySorter.ts b/src/FilterLists.Web.V2/src/components/listsTable/arraySorter.ts index f6dfb8aee..60dc733a2 100644 --- a/src/FilterLists.Web.V2/src/components/listsTable/arraySorter.ts +++ b/src/FilterLists.Web.V2/src/components/listsTable/arraySorter.ts @@ -1,17 +1,18 @@ interface ArraySortableEntity { id: number; name: string; -} +}; -export const arraySorter = (a: number[], b: number[], entities: ArraySortableEntity[]): number => a && a.length - ? b && b.length - ? a.length === b.length - ? entities.filter((e: ArraySortableEntity) => a.indexOf(e.id) > -1).map((e: ArraySortableEntity) => e.name).join().toLowerCase() - > entities.filter((e: ArraySortableEntity) => b.indexOf(e.id) > -1).map((e: ArraySortableEntity) => e.name).join().toLowerCase() - ? 1 - : -1 - : a.length > b.length - ? -1 - : 1 - : -1 - : 1; \ No newline at end of file +export const arraySorter = (a: number[], b: number[], entities: ArraySortableEntity[]) => + a && a.length + ? b && b.length + ? a.length === b.length + ? entities.filter((e: ArraySortableEntity) => a.indexOf(e.id) > -1).map((e: ArraySortableEntity) => e.name).join().toLowerCase() + > entities.filter((e: ArraySortableEntity) => b.indexOf(e.id) > -1).map((e: ArraySortableEntity) => e.name).join().toLowerCase() + ? 1 + : -1 + : a.length > b.length + ? -1 + : 1 + : -1 + : 1; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/listsTable/index.ts b/src/FilterLists.Web.V2/src/components/listsTable/index.ts index 595fade9b..e69706c2e 100644 --- a/src/FilterLists.Web.V2/src/components/listsTable/index.ts +++ b/src/FilterLists.Web.V2/src/components/listsTable/index.ts @@ -1,3 +1,3 @@ import { ListsTableHoc } from './ListsTableHoc'; -export { ListsTableHoc as ListsTable } \ No newline at end of file +export { ListsTableHoc as ListsTable }; \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/components/tagCloud/TagCloud.tsx b/src/FilterLists.Web.V2/src/components/tagCloud/TagCloud.tsx index 38525cf89..45b0d4073 100644 --- a/src/FilterLists.Web.V2/src/components/tagCloud/TagCloud.tsx +++ b/src/FilterLists.Web.V2/src/components/tagCloud/TagCloud.tsx @@ -5,8 +5,8 @@ import { Tag as TagInterface } from '../../interfaces/Tag'; import styles from './TagCloud.module.css'; interface Props { - tags: TagInterface[] - showLabel?: boolean + tags: TagInterface[]; + showLabel?: boolean; }; export const TagCloud = (props: Props) => diff --git a/src/FilterLists.Web.V2/src/hooks/useApiData.tsx b/src/FilterLists.Web.V2/src/hooks/useApiData.tsx index 81e2dba8d..14522fa90 100644 --- a/src/FilterLists.Web.V2/src/hooks/useApiData.tsx +++ b/src/FilterLists.Web.V2/src/hooks/useApiData.tsx @@ -3,11 +3,10 @@ import { useEffect, useState } from 'react'; export const useApiData = (url: string) => { const [data, setData] = useState(); useEffect(() => { - const fetchData = async () => { + const fetchData = async () => (await fetch(url)) .json() .then(r => setData(r)); - }; fetchData(); }, [url]); return data; diff --git a/src/FilterLists.Web.V2/src/hooks/useTablePageSizer.tsx b/src/FilterLists.Web.V2/src/hooks/useTablePageSizer.tsx index 419f568c6..979cf8258 100644 --- a/src/FilterLists.Web.V2/src/hooks/useTablePageSizer.tsx +++ b/src/FilterLists.Web.V2/src/hooks/useTablePageSizer.tsx @@ -3,18 +3,19 @@ import { useEffect, useState } from 'react'; interface TablePageSize { pageSize: number; isNarrowWindow: boolean; -} +}; export const useTablePageSizer = () => { - const calculateSize = () => ({ - pageSize: Math.floor((window.innerHeight - 211.5) / 56), - isNarrowWindow: window.innerWidth < 576 ? true : false - }); const [state, setState] = useState(calculateSize()); useEffect(() => { - const updatePageSize = () => setState(calculateSize()) + const updatePageSize = () => setState(calculateSize()); window.addEventListener('resize', updatePageSize); return () => window.removeEventListener('resize', updatePageSize); }, []); return state; -} \ No newline at end of file +}; + +const calculateSize = () => ({ + pageSize: Math.floor((window.innerHeight - 211.5) / 56), + isNarrowWindow: window.innerWidth < 576 ? true : false +}); \ No newline at end of file diff --git a/src/FilterLists.Web.V2/src/utils/index.ts b/src/FilterLists.Web.V2/src/utils/index.ts index 61acd744c..d22b49973 100644 --- a/src/FilterLists.Web.V2/src/utils/index.ts +++ b/src/FilterLists.Web.V2/src/utils/index.ts @@ -1,3 +1,3 @@ import { nameof } from './nameof'; -export { nameof } \ No newline at end of file +export { nameof }; \ No newline at end of file