diff --git a/src/FilterLists.Web/ClientApp/boot.tsx b/src/FilterLists.Web/ClientApp/boot.tsx index 4ea39e0e0..5e0e276c1 100644 --- a/src/FilterLists.Web/ClientApp/boot.tsx +++ b/src/FilterLists.Web/ClientApp/boot.tsx @@ -8,11 +8,7 @@ import * as RoutesModule from "./routes"; let routes = RoutesModule.routes; import * as ReactModal from "react-modal"; -ReactModal.setAppElement("#react-app"); - function renderApp() { - // This code starts up the React app when it runs in a browser. It sets up the routing - // configuration and injects the app into a DOM element. const baseUrl = document.getElementsByTagName("base")[0].getAttribute("href")!; ReactDOM.render( @@ -24,11 +20,12 @@ function renderApp() { renderApp(); -// Allow Hot Module Replacement if (module.hot) { module.hot.accept("./routes", () => { routes = require("./routes").routes; renderApp(); }); -} \ No newline at end of file +} + +ReactModal.setAppElement("#react-app"); \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/components/Home.tsx b/src/FilterLists.Web/ClientApp/components/Home.tsx index 30396660b..179a33474 100644 --- a/src/FilterLists.Web/ClientApp/components/Home.tsx +++ b/src/FilterLists.Web/ClientApp/components/Home.tsx @@ -6,7 +6,7 @@ import "react-table/react-table.css" import ListDetailsModal from "./ListDetailsModal"; interface IFilterListsState { - filterLists: IFilterList[]; + filterLists: IFilterListSummaryDto[]; loading: boolean; } @@ -15,7 +15,7 @@ export class Home extends React.Component, IFilterListsS super(props); this.state = { filterLists: [], loading: true }; fetch("https://api.filterlists.com/v1/lists") - .then(response => response.json() as Promise) + .then(response => response.json() as Promise) .then(data => { this.setState({ filterLists: data, loading: false }); }); } @@ -30,13 +30,14 @@ export class Home extends React.Component, IFilterListsS ; } - private static renderFilterListsTable(filterLists: IFilterList[]) { + private static renderFilterListsTable(filterLists: IFilterListSummaryDto[]) { return , IFilterListsS Cell: (d: any) => , style: { textAlign: "center" }, width: 100 + }, + { + Header: "Subscribe", + accessor: "viewUrl", + Cell: (d: any) => + Subscribe, + style: { textAlign: "center" }, + width: 100 } ]}/>; } } -interface IFilterList { +interface IFilterListSummaryDto { id: number; name: string; + viewUrl: string; } \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/components/ListDetailsModal.tsx b/src/FilterLists.Web/ClientApp/components/ListDetailsModal.tsx index dd7948f67..5d2d56732 100644 --- a/src/FilterLists.Web/ClientApp/components/ListDetailsModal.tsx +++ b/src/FilterLists.Web/ClientApp/components/ListDetailsModal.tsx @@ -16,8 +16,8 @@ export default class ListDetailsModal extends React.Component { handleOpenModal() { this.setState({ showModal: true }); fetch(`https://api.filterlists.com/v1/lists/${this.listId}`) - .then(response => response.json() as Promise) - .then(data => { this.setState({ filterListdetails: data, loading: false }); }); + .then(response => response.json() as Promise) + .then(data => { this.setState({ filterListDetails: data, loading: false }); }); } handleCloseModal() { @@ -29,23 +29,10 @@ export default class ListDetailsModal extends React.Component { ? null : -

{this.state.filterListdetails.name}

-

{this.state.filterListdetails.description}

- - View - - - Subscribe - - + shouldCloseOnOverlayClick={true}> + +
; return (
@@ -54,13 +41,79 @@ export default class ListDetailsModal extends React.Component {
); } - } -interface IFilterListDetails { - id: number; - name: string; +function FilterListDetails(props: any) { + return
+ + + + + + +
; +} + +function Name(props: any) { + return

{props.name}

; +} + +function PublishedDate(props: any) { + if (props.date) { + return

Published: props.date

; + } else { + return null; + } +} + +function DiscontinuedDate(props: any) { + if (props.date) { + return

Discontinued: props.date

; + } else { + return null; + } +} + +function Description(props: any) { + if (props.description) { + if (props.url) { + return

{props.description}

; + } else { + return

{props.description}

; + } + } else { + return null; + } +} + +function ViewUrl(props: any) { + return + View + ; +} + +function SubscribeUrl(props: any) { + return + Subscribe + ; +} + +interface IFilterListDetailsDto { description: string; descriptionSourceUrl: string; + discontinuedDate: string; + donateUrl: string; + emailAddress: string; + forumUrl: string; + homeUrl: string; + issuesUrl: string; + name: string; + policyUrl: string; + publishedDate: string; + submissionUrl: string; viewUrl: string; } \ No newline at end of file