From 4a2e49cbf327ca4eaec0384adc6d8e9e85761bbe Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Thu, 27 Sep 2018 16:52:30 -0500 Subject: [PATCH] api details refactor ref #505 --- .../V1/Controllers/ListsController.cs | 2 +- .../FilterList/FilterListService.cs | 7 +-- .../FilterList/FilterListServiceExtensions.cs | 20 ------ .../ListDetailsDtoMappingProfile.cs | 55 ---------------- .../ListMaintainerDtoMappingProfile.cs | 20 ------ .../ListSyntaxDtoMappingProfile.cs | 19 ------ .../ListTagDtoMappingProfile.cs | 16 ----- ...ntainerAdditionalListsDtoMappingProfile.cs | 17 ----- ...yntaxSupportedSoftwareDtoMappingProfile.cs | 16 ----- .../FilterList/Models/ListDetails.cs | 35 ----------- .../FilterList/Models/ListLanguagesDto.cs | 11 ---- .../FilterList/Models/ListLicenseDto.cs | 11 ---- .../FilterList/Models/ListMaintainerDto.cs | 16 ----- .../FilterList/Models/ListSyntaxDto.cs | 13 ---- .../FilterList/Models/ListTagDto.cs | 12 ---- .../Models/MaintainerAdditionalListsDto.cs | 11 ---- .../Models/SyntaxSupportedSoftwareDto.cs | 12 ---- .../FilterList/TagColors.cs | 33 ---------- .../ClientApp/modules/home/Home.tsx | 7 ++- .../ClientApp/modules/home/HomeContainer.tsx | 43 ++++++++----- .../components/{Tagline.tsx => Oneliner.tsx} | 2 +- .../home/components/{Tag.tsx => TagGroup.tsx} | 39 +++++++++--- .../detailsExpander/DetailsExpander.tsx | 4 +- .../DetailsExpanderContainer.tsx | 27 ++------ .../detailsExpander/IFilterListDetailsDto.ts | 62 ------------------- .../detailsExpander/IListDetails.ts | 44 +++++++++++++ .../detailsExpander/LinkButtonGroup.tsx | 8 +-- .../home/components/detailsExpander/index.ts | 4 +- .../detailsExpander/infoCard/InfoCard.tsx | 19 +++--- .../detailsExpander/infoCard/Languages.tsx | 9 +-- .../detailsExpander/infoCard/License.tsx | 2 +- .../detailsExpander/infoCard/Syntax.tsx | 2 +- .../detailsExpander/infoCard/Tag.tsx | 19 ------ .../detailsExpander/infoCard/Tags.tsx | 15 ----- .../MaintainerAdditionalLists.tsx | 15 +++-- .../MaintainerInfoCard.tsx | 35 ++++++----- .../MaintainerLinkButtonGroup.tsx | 13 ++-- .../MaintainersInfoCard.tsx | 18 +++--- .../modules/home/components/index.ts | 4 +- .../home/components/listsTable/ListsTable.tsx | 54 ++++++++++++++-- .../components/listsTable/columns/Tags.tsx | 7 +-- .../components/softwareIcon/SoftwareIcon.tsx | 2 +- .../modules/home/interfaces/ILanguage.ts | 1 + .../modules/home/interfaces/IList.ts | 17 +++++ .../modules/home/interfaces/IMaintainer.ts | 8 +++ .../modules/home/interfaces/ISoftware.ts | 2 + .../ClientApp/modules/home/interfaces/ITag.ts | 1 + .../modules/home/interfaces/index.ts | 2 + .../ClientApp/utils/loader.css | 10 +-- 49 files changed, 269 insertions(+), 552 deletions(-) delete mode 100644 src/FilterLists.Services/FilterList/FilterListServiceExtensions.cs delete mode 100644 src/FilterLists.Services/FilterList/MappingProfiles/ListDetailsDtoMappingProfile.cs delete mode 100644 src/FilterLists.Services/FilterList/MappingProfiles/ListMaintainerDtoMappingProfile.cs delete mode 100644 src/FilterLists.Services/FilterList/MappingProfiles/ListSyntaxDtoMappingProfile.cs delete mode 100644 src/FilterLists.Services/FilterList/MappingProfiles/ListTagDtoMappingProfile.cs delete mode 100644 src/FilterLists.Services/FilterList/MappingProfiles/MaintainerAdditionalListsDtoMappingProfile.cs delete mode 100644 src/FilterLists.Services/FilterList/MappingProfiles/SyntaxSupportedSoftwareDtoMappingProfile.cs delete mode 100644 src/FilterLists.Services/FilterList/Models/ListDetails.cs delete mode 100644 src/FilterLists.Services/FilterList/Models/ListLanguagesDto.cs delete mode 100644 src/FilterLists.Services/FilterList/Models/ListLicenseDto.cs delete mode 100644 src/FilterLists.Services/FilterList/Models/ListMaintainerDto.cs delete mode 100644 src/FilterLists.Services/FilterList/Models/ListSyntaxDto.cs delete mode 100644 src/FilterLists.Services/FilterList/Models/ListTagDto.cs delete mode 100644 src/FilterLists.Services/FilterList/Models/MaintainerAdditionalListsDto.cs delete mode 100644 src/FilterLists.Services/FilterList/Models/SyntaxSupportedSoftwareDto.cs delete mode 100644 src/FilterLists.Services/FilterList/TagColors.cs rename src/FilterLists.Web/ClientApp/modules/home/components/{Tagline.tsx => Oneliner.tsx} (93%) rename src/FilterLists.Web/ClientApp/modules/home/components/{Tag.tsx => TagGroup.tsx} (52%) delete mode 100644 src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/IFilterListDetailsDto.ts create mode 100644 src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/IListDetails.ts delete mode 100644 src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Tag.tsx delete mode 100644 src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Tags.tsx create mode 100644 src/FilterLists.Web/ClientApp/modules/home/interfaces/IMaintainer.ts diff --git a/src/FilterLists.Api/V1/Controllers/ListsController.cs b/src/FilterLists.Api/V1/Controllers/ListsController.cs index 05237fe70..d29065727 100644 --- a/src/FilterLists.Api/V1/Controllers/ListsController.cs +++ b/src/FilterLists.Api/V1/Controllers/ListsController.cs @@ -23,7 +23,7 @@ public async Task GetAll() => [HttpGet] [Route("{id}")] public async Task GetById(int id) => - await Get(() => filterListService.GetDetailsAsync(id), id); + await Get(() => filterListService.GetByIdAsync(id), id); [HttpGet("seed")] public async Task Seed() => diff --git a/src/FilterLists.Services/FilterList/FilterListService.cs b/src/FilterLists.Services/FilterList/FilterListService.cs index 93b4c7f15..a73a620cd 100644 --- a/src/FilterLists.Services/FilterList/FilterListService.cs +++ b/src/FilterLists.Services/FilterList/FilterListService.cs @@ -20,10 +20,9 @@ await DbContext.FilterLists .ProjectTo(MapConfig) .ToListAsync(); - public async Task GetDetailsAsync(int id) => + public async Task GetByIdAsync(int id) => await DbContext.FilterLists - .ProjectTo(MapConfig) - .FirstOrDefaultAsync(l => l.Id == id) - .FilterParentListFromMaintainerAdditionalLists(); + .ProjectTo(MapConfig) + .FirstOrDefaultAsync(l => l.Id == id); } } \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/FilterListServiceExtensions.cs b/src/FilterLists.Services/FilterList/FilterListServiceExtensions.cs deleted file mode 100644 index 6315bf396..000000000 --- a/src/FilterLists.Services/FilterList/FilterListServiceExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Linq; -using System.Threading.Tasks; -using FilterLists.Services.FilterList.Models; - -namespace FilterLists.Services.FilterList -{ - public static class FilterListServiceExtensions - { - public static async Task FilterParentListFromMaintainerAdditionalLists( - this Task listDetailsDtos) - { - foreach (var maintainer in listDetailsDtos.Result.Maintainers) - maintainer.AdditionalLists = maintainer - .AdditionalLists.Where(additionalList => - additionalList.Id != listDetailsDtos.Result.Id) - .ToList(); - return await listDetailsDtos; - } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/MappingProfiles/ListDetailsDtoMappingProfile.cs b/src/FilterLists.Services/FilterList/MappingProfiles/ListDetailsDtoMappingProfile.cs deleted file mode 100644 index 2e875eccb..000000000 --- a/src/FilterLists.Services/FilterList/MappingProfiles/ListDetailsDtoMappingProfile.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Linq; -using AutoMapper; -using FilterLists.Services.FilterList.Models; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.MappingProfiles -{ - [UsedImplicitly] - public class ListDetailsDtoMappingProfile : Profile - { - public ListDetailsDtoMappingProfile() => - CreateMap() - .ForMember(dest => dest.Id, - opt => opt.MapFrom(src => - (int)src.Id)) - .ForMember(dest => dest.Languages, - opt => opt.MapFrom(src => - src.FilterListLanguages.Select(la => la.Language.Name))) - .ForMember(dest => dest.Maintainers, - opt => opt.MapFrom(src => - src.FilterListMaintainers.Select(m => m.Maintainer))) - .ForMember(dest => dest.Tags, - opt => opt.MapFrom(src => - src.FilterListTags.Select(m => m.Tag))) - .ForMember(dest => dest.RuleCount, - opt => opt.MapFrom(src => - src.Snapshots - .Count(s => s.WasSuccessful) > 0 - ? src.Snapshots - .Where(s => s.WasSuccessful) - .OrderByDescending(s => s.CreatedDateUtc) - .FirstOrDefault() - .SnapshotRules - .Count - : 0)) - .ForMember(dest => dest.UpdatedDate, - opt => opt.MapFrom(src => - src.DiscontinuedDate ?? - (src.Snapshots - .Count(s => s.WasSuccessful && s.Md5Checksum != null) >= 2 - ? src.Snapshots - .Where(s => s.WasSuccessful && s.Md5Checksum != null) - .Select(s => s.CreatedDateUtc) - .OrderByDescending(c => c) - .FirstOrDefault() - : null))) - .ForMember(dest => dest.ViewUrl, - opt => opt.MapFrom(src => - src.Snapshots - .Where(s => s.WasSuccessful) - .OrderByDescending(s => s.CreatedDateUtc) - .FirstOrDefault() - .WaybackUrl ?? src.ViewUrl)); - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/MappingProfiles/ListMaintainerDtoMappingProfile.cs b/src/FilterLists.Services/FilterList/MappingProfiles/ListMaintainerDtoMappingProfile.cs deleted file mode 100644 index 8e79b4734..000000000 --- a/src/FilterLists.Services/FilterList/MappingProfiles/ListMaintainerDtoMappingProfile.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Linq; -using AutoMapper; -using FilterLists.Services.FilterList.Models; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.MappingProfiles -{ - [UsedImplicitly] - public class ListMaintainerDtoMappingProfile : Profile - { - public ListMaintainerDtoMappingProfile() => - CreateMap() - .ForMember(dest => dest.Id, - opt => opt.MapFrom(src => - (int)src.Id)) - .ForMember(dest => dest.AdditionalLists, - opt => opt.MapFrom(src => - src.FilterListMaintainers.Select(lm => lm.FilterList))); - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/MappingProfiles/ListSyntaxDtoMappingProfile.cs b/src/FilterLists.Services/FilterList/MappingProfiles/ListSyntaxDtoMappingProfile.cs deleted file mode 100644 index 6d58f4a6d..000000000 --- a/src/FilterLists.Services/FilterList/MappingProfiles/ListSyntaxDtoMappingProfile.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Linq; -using AutoMapper; -using FilterLists.Services.FilterList.Models; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.MappingProfiles -{ - [UsedImplicitly] - public class ListSyntaxDtoMappingProfile : Profile - { - public ListSyntaxDtoMappingProfile() => - CreateMap() - .ForMember(dest => dest.SupportedSoftware, - opt => opt.MapFrom(src => - src.SoftwareSyntaxes - .Select(ss => ss.Software) - .OrderBy(s => s.Name))); - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/MappingProfiles/ListTagDtoMappingProfile.cs b/src/FilterLists.Services/FilterList/MappingProfiles/ListTagDtoMappingProfile.cs deleted file mode 100644 index d4ff92e9c..000000000 --- a/src/FilterLists.Services/FilterList/MappingProfiles/ListTagDtoMappingProfile.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AutoMapper; -using FilterLists.Services.FilterList.Models; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.MappingProfiles -{ - [UsedImplicitly] - public class ListTagDtoMappingProfile : Profile - { - public ListTagDtoMappingProfile() => - CreateMap() - .ForMember(dest => dest.ColorHex, - opt => opt.MapFrom(src => - TagColors.Colors[(int)src.Id])); - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/MappingProfiles/MaintainerAdditionalListsDtoMappingProfile.cs b/src/FilterLists.Services/FilterList/MappingProfiles/MaintainerAdditionalListsDtoMappingProfile.cs deleted file mode 100644 index 6e3bcd78b..000000000 --- a/src/FilterLists.Services/FilterList/MappingProfiles/MaintainerAdditionalListsDtoMappingProfile.cs +++ /dev/null @@ -1,17 +0,0 @@ -using AutoMapper; -using FilterLists.Data.Entities; -using FilterLists.Services.FilterList.Models; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.MappingProfiles -{ - [UsedImplicitly] - public class MaintainerAdditionalListsDtoMappingProfile : Profile - { - public MaintainerAdditionalListsDtoMappingProfile() => - CreateMap() - .ForMember(dest => dest.Id, - opt => opt.MapFrom(src => - (int)src.Id)); - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/MappingProfiles/SyntaxSupportedSoftwareDtoMappingProfile.cs b/src/FilterLists.Services/FilterList/MappingProfiles/SyntaxSupportedSoftwareDtoMappingProfile.cs deleted file mode 100644 index 5281f1636..000000000 --- a/src/FilterLists.Services/FilterList/MappingProfiles/SyntaxSupportedSoftwareDtoMappingProfile.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AutoMapper; -using FilterLists.Services.FilterList.Models; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.MappingProfiles -{ - [UsedImplicitly] - public class SyntaxSupportedSoftwareDtoMappingProfile : Profile - { - public SyntaxSupportedSoftwareDtoMappingProfile() => - CreateMap() - .ForMember(dest => dest.Id, - opt => opt.MapFrom(src => - (int)src.Id)); - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/Models/ListDetails.cs b/src/FilterLists.Services/FilterList/Models/ListDetails.cs deleted file mode 100644 index ae2943169..000000000 --- a/src/FilterLists.Services/FilterList/Models/ListDetails.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.Models -{ - [UsedImplicitly] - public class ListDetails - { - public int Id { get; set; } - public string ChatUrl { get; set; } - public string Description { get; set; } - public string DescriptionSourceUrl { get; set; } - public DateTime? DiscontinuedDate { get; set; } - public string DonateUrl { get; set; } - public string EmailAddress { get; set; } - public string ForumUrl { get; set; } - public string HomeUrl { get; set; } - public string IssuesUrl { get; set; } - public IEnumerable Languages { get; set; } - public ListLicenseDto License { get; set; } - public IEnumerable Maintainers { get; set; } - public string Name { get; set; } - public string PolicyUrl { get; set; } - public DateTime? PublishedDate { get; set; } - public int RuleCount { get; set; } - public string SubmissionUrl { get; set; } - public ListSyntaxDto Syntax { get; set; } - public IEnumerable Tags { get; set; } - public DateTime? UpdatedDate { get; set; } - public string ViewUrl { get; set; } - public string ViewUrlMirror1 { get; set; } - public string ViewUrlMirror2 { get; set; } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/Models/ListLanguagesDto.cs b/src/FilterLists.Services/FilterList/Models/ListLanguagesDto.cs deleted file mode 100644 index 547cd3181..000000000 --- a/src/FilterLists.Services/FilterList/Models/ListLanguagesDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.Models -{ - [UsedImplicitly] - public class ListLanguagesDto - { - public string Name { get; set; } - public string Iso6391 { get; set; } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/Models/ListLicenseDto.cs b/src/FilterLists.Services/FilterList/Models/ListLicenseDto.cs deleted file mode 100644 index d051cba00..000000000 --- a/src/FilterLists.Services/FilterList/Models/ListLicenseDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.Models -{ - [UsedImplicitly] - public class ListLicenseDto - { - public string DescriptionUrl { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/Models/ListMaintainerDto.cs b/src/FilterLists.Services/FilterList/Models/ListMaintainerDto.cs deleted file mode 100644 index bcdc8f60d..000000000 --- a/src/FilterLists.Services/FilterList/Models/ListMaintainerDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.Models -{ - [UsedImplicitly] - public class ListMaintainerDto - { - public int Id { get; set; } - public string EmailAddress { get; set; } - public string HomeUrl { get; set; } - public string Name { get; set; } - public string TwitterHandle { get; set; } - public IEnumerable AdditionalLists { get; set; } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/Models/ListSyntaxDto.cs b/src/FilterLists.Services/FilterList/Models/ListSyntaxDto.cs deleted file mode 100644 index 9254b0cc6..000000000 --- a/src/FilterLists.Services/FilterList/Models/ListSyntaxDto.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.Models -{ - [UsedImplicitly] - public class ListSyntaxDto - { - public string DefinitionUrl { get; set; } - public string Name { get; set; } - public IEnumerable SupportedSoftware { get; set; } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/Models/ListTagDto.cs b/src/FilterLists.Services/FilterList/Models/ListTagDto.cs deleted file mode 100644 index f2f1843be..000000000 --- a/src/FilterLists.Services/FilterList/Models/ListTagDto.cs +++ /dev/null @@ -1,12 +0,0 @@ -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.Models -{ - [UsedImplicitly] - public class ListTagDto - { - public string Name { get; set; } - public string ColorHex { get; set; } - public string Description { get; set; } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/Models/MaintainerAdditionalListsDto.cs b/src/FilterLists.Services/FilterList/Models/MaintainerAdditionalListsDto.cs deleted file mode 100644 index 2815848ff..000000000 --- a/src/FilterLists.Services/FilterList/Models/MaintainerAdditionalListsDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.Models -{ - [UsedImplicitly] - public class MaintainerAdditionalListsDto - { - public int Id { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/Models/SyntaxSupportedSoftwareDto.cs b/src/FilterLists.Services/FilterList/Models/SyntaxSupportedSoftwareDto.cs deleted file mode 100644 index 76ec24749..000000000 --- a/src/FilterLists.Services/FilterList/Models/SyntaxSupportedSoftwareDto.cs +++ /dev/null @@ -1,12 +0,0 @@ -using JetBrains.Annotations; - -namespace FilterLists.Services.FilterList.Models -{ - [UsedImplicitly] - public class SyntaxSupportedSoftwareDto - { - public int Id { get; set; } - public string HomeUrl { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/FilterLists.Services/FilterList/TagColors.cs b/src/FilterLists.Services/FilterList/TagColors.cs deleted file mode 100644 index 1e6c5e8f3..000000000 --- a/src/FilterLists.Services/FilterList/TagColors.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections.Generic; -using System.Collections.ObjectModel; - -namespace FilterLists.Services.FilterList -{ - public static class TagColors - { - //https://stackoverflow.com/a/4382138/2343739 - public static readonly IList Colors = new ReadOnlyCollection(new List - { - "FFB300", // Vivid Yellow - "803E75", // Strong Purple - "FF6800", // Vivid Orange - "A6BDD7", // Very Light Blue - "C10020", // Vivid Red - "CEA262", // Grayish Yellow - "817066", // Medium Gray - "007D34", // Vivid Green - "F6768E", // Strong Purplish Pink - "00538A", // Strong Blue - "FF7A5C", // Strong Yellowish Pink - "53377A", // Strong Violet - "FF8E00", // Vivid Orange Yellow - "B32851", // Strong Purplish Red - "F4C800", // Vivid Greenish Yellow - "7F180D", // Strong Reddish Brown - "93AA00", // Vivid Yellowish Green - "593315", // Deep Yellowish Brown - "F13A13", // Vivid Reddish Orange - "232C16" // Dark Olive Green - }); - } -} \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/Home.tsx b/src/FilterLists.Web/ClientApp/modules/home/Home.tsx index 79049687c..54b25ef9c 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/Home.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/Home.tsx @@ -1,6 +1,6 @@ import * as React from "react"; -import { IColumnVisibility, ILanguage, IList, ISoftware, ITag } from "./interfaces"; -import { Tagline, ListsTable } from "./components"; +import { IColumnVisibility, ILanguage, IList, IMaintainer, ISoftware, ITag } from "./interfaces"; +import { ListsTable, Oneliner } from "./components"; const columnVisibilityDefaults: IColumnVisibility[] = [ { column: "Software", visible: true }, @@ -12,6 +12,7 @@ const columnVisibilityDefaults: IColumnVisibility[] = [ interface IProps { languages: ILanguage[]; lists: IList[]; + maintainers: IMaintainer[]; ruleCount: number; software: ISoftware[]; tags: ITag[]; @@ -44,7 +45,7 @@ export class Home extends React.Component { render() { return
- + {this.renderColumnVisibilityCheckboxes()}
; diff --git a/src/FilterLists.Web/ClientApp/modules/home/HomeContainer.tsx b/src/FilterLists.Web/ClientApp/modules/home/HomeContainer.tsx index b1e45eefc..402123f0a 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/HomeContainer.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/HomeContainer.tsx @@ -1,11 +1,12 @@ import * as React from "react"; import "isomorphic-fetch"; -import { ILanguage, IList, ISoftware, ITag } from "./interfaces"; +import { ILanguage, IList, IMaintainer, ISoftware, ITag } from "./interfaces"; import { Home } from "./Home"; interface IState { languages: ILanguage[]; lists: IList[]; + maintainers: IMaintainer[]; ruleCount: number; software: ISoftware[]; tags: ITag[]; @@ -17,6 +18,7 @@ export class HomeContainer extends React.Component<{}, IState> { this.state = { languages: [], lists: [], + maintainers: [], ruleCount: 0, software: [], tags: [] @@ -25,40 +27,47 @@ export class HomeContainer extends React.Component<{}, IState> { componentDidMount() { this.fetchLists(); + this.fetchLanguages(); + this.fetchMaintainers(); this.fetchSoftware(); this.fetchTags(); - this.fetchLanguages(); this.fetchRuleCount(); }; fetchLists() { fetch("https://filterlists.com/api/v1/lists") .then(r => r.json() as Promise) - .then(d => { this.setState({ lists: d }); }); - }; - - fetchSoftware() { - fetch("https://filterlists.com/api/v1/software") - .then(r => r.json() as Promise) - .then(d => { this.setState({ software: d }); }); - }; - - fetchTags() { - fetch("https://filterlists.com/api/v1/tags") - .then(r => r.json() as Promise) - .then(d => { this.setState({ tags: d }); }); + .then(p => { this.setState({ lists: p }); }); }; fetchLanguages() { fetch("https://filterlists.com/api/v1/languages") .then(r => r.json() as Promise) - .then(d => { this.setState({ languages: d }); }); + .then(p => { this.setState({ languages: p }); }); + }; + + fetchMaintainers() { + fetch("https://filterlists.com/api/v1/maintainers") + .then(r => r.json() as Promise) + .then(p => { this.setState({ maintainers: p }); }); + }; + + fetchSoftware() { + fetch("https://filterlists.com/api/v1/software") + .then(r => r.json() as Promise) + .then(p => { this.setState({ software: p }); }); + }; + + fetchTags() { + fetch("https://filterlists.com/api/v1/tags") + .then(r => r.json() as Promise) + .then(p => { this.setState({ tags: p }); }); }; fetchRuleCount() { fetch("https://filterlists.com/api/v1/rules") .then(r => r.json() as Promise) - .then(d => { this.setState({ ruleCount: d }); }); + .then(p => { this.setState({ ruleCount: p }); }); }; render() { diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/Tagline.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/Oneliner.tsx similarity index 93% rename from src/FilterLists.Web/ClientApp/modules/home/components/Tagline.tsx rename to src/FilterLists.Web/ClientApp/modules/home/components/Oneliner.tsx index 91f939a94..e514a3b8a 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/Tagline.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/Oneliner.tsx @@ -5,7 +5,7 @@ interface IProps { ruleCount: number; }; -export const Tagline = (props: IProps) => +export const Oneliner = (props: IProps) => props.listCount > 0 && props.ruleCount > 0 ?

The independent, comprehensive directory of {props.ruleCount.toLocaleString() diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/Tag.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/TagGroup.tsx similarity index 52% rename from src/FilterLists.Web/ClientApp/modules/home/components/Tag.tsx rename to src/FilterLists.Web/ClientApp/modules/home/components/TagGroup.tsx index 59435ea9b..79698a849 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/Tag.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/TagGroup.tsx @@ -2,16 +2,35 @@ import * as React from "react"; import { ITag } from "../interfaces"; import { getContrast } from "../../../utils"; -export const Tag = (props: ITag) => { - const hexColor = kelly_colors_hex[props.id % kelly_colors_hex.length]; - return - {props.name} - ; +interface IProps { + tags: ITag[]; +}; + +export const TagGroup = (props: IProps) => + props.tags && props.tags.length > 0 + ?

+ {props.tags.map((t: ITag, i: number) => )} +
+ : null; + +interface ITagProps { + tag: ITag; +}; + +const Tag = (props: ITagProps) => { + if (props.tag) { + const hexColor = kelly_colors_hex[props.tag.id % kelly_colors_hex.length]; + return + {props.tag.name} + ; + } else { + return null; + } }; //https://stackoverflow.com/a/4382138/2343739 diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/DetailsExpander.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/DetailsExpander.tsx index df1e10b83..4a1747cbd 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/DetailsExpander.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/DetailsExpander.tsx @@ -1,10 +1,10 @@ import * as React from "react"; -import { IFilterListDetailsDto } from "./IFilterListDetailsDto"; +import { IListDetails } from "./IListDetails"; import { InfoCard } from "./infoCard"; import { LinkButtonGroup } from "./LinkButtonGroup"; import { MaintainersInfoCard } from "./maintainersInfoCard"; -export const DetailsExpander = (props: IFilterListDetailsDto) => { +export const DetailsExpander = (props: IListDetails) => { return
diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/DetailsExpanderContainer.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/DetailsExpanderContainer.tsx index 22e0c2389..7ced7b1af 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/DetailsExpanderContainer.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/DetailsExpanderContainer.tsx @@ -1,42 +1,25 @@ import * as React from "react"; import "isomorphic-fetch"; import "../../../../utils/loader.css"; -import { IFilterListDetailsDto } from "./IFilterListDetailsDto"; +import { IListDetails } from "./IListDetails"; import { DetailsExpander } from "./DetailsExpander"; interface IProps { - listId: number; + list: IListDetails; } interface IState { - filterListDetails: IFilterListDetailsDto; } export class DetailsExpanderContainer extends React.Component { constructor(props: IProps) { super(props); - this.state = { - filterListDetails: {} as IFilterListDetailsDto - }; - } - - componentDidMount() { - this.fetchFilterListDetails(); - } - - fetchFilterListDetails() { - fetch(`https://filterlists.com/api/v1/lists/${this.props.listId}`) - .then(r => r.json() as Promise) - .then(d => { - this.setState({ - filterListDetails: d - }); - }); + this.state = {}; } render() { - return this.state.filterListDetails.name - ? + return this.props.list.name + ? :
Loading...
;; } } \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/IFilterListDetailsDto.ts b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/IFilterListDetailsDto.ts deleted file mode 100644 index 1f41ce79b..000000000 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/IFilterListDetailsDto.ts +++ /dev/null @@ -1,62 +0,0 @@ -export interface IFilterListDetailsDto { - chatUrl: string; - description: string; - descriptionSourceUrl: string; - discontinuedDate: string; - donateUrl: string; - emailAddress: string; - forumUrl: string; - homeUrl: string; - issuesUrl: string; - languages: string[]; - license: IListLicenseDto; - maintainers: IListMaintainerDto[]; - name: string; - policyUrl: string; - publishedDate: string; - ruleCount: number; - submissionUrl: string; - syntax: IListSyntaxDto; - tags: IListTagDto[]; - updatedDate: string; - viewUrl: string; - viewUrlMirror1: string; - viewUrlMirror2: string; -} - -export interface IListLicenseDto { - descriptionUrl: string; - name: string; -} - -export interface IListMaintainerDto { - id: number; - emailAddress: string; - homeUrl: string; - name: string; - twitterHandle: string; - additionalLists: IMaintainerAdditionalListDto[]; -} - -export interface IListSyntaxDto { - definitionUrl: string; - name: string; - supportedSoftware: ISyntaxSupportedSoftwareDto[]; -} - -export interface IListTagDto { - name: string; - colorHex: string; - description: string; -} - -export interface IMaintainerAdditionalListDto { - id: number; - name: string; -} - -export interface ISyntaxSupportedSoftwareDto { - homeUrl: string; - id: number; - name: string; -} \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/IListDetails.ts b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/IListDetails.ts new file mode 100644 index 000000000..75b74f657 --- /dev/null +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/IListDetails.ts @@ -0,0 +1,44 @@ +import { ILanguage, IMaintainer, ITag } from "../../interfaces"; + +export interface IListDetails { + id: number; + chatUrl: string; + description: string; + descriptionSourceUrl: string; + discontinuedDate: string; + donateUrl: string; + emailAddress: string; + forumUrl: string; + homeUrl: string; + issuesUrl: string; + languages: ILanguage[]; + license: IListLicense; + maintainers: IMaintainer[]; + name: string; + policyUrl: string; + publishedDate: string; + ruleCount: number; + submissionUrl: string; + syntax: IListSyntax; + tags: ITag[]; + updatedDate: string; + viewUrl: string; + viewUrlMirrors: string[]; +} + +export interface IListLicense { + descriptionUrl: string; + name: string; +} + +export interface IListSyntax { + definitionUrl: string; + name: string; + supportedSoftware: ISyntaxSupportedSoftware[]; +} + +export interface ISyntaxSupportedSoftware { + homeUrl: string; + id: number; + name: string; +} \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/LinkButtonGroup.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/LinkButtonGroup.tsx index 03debc3e5..e165073d5 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/LinkButtonGroup.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/LinkButtonGroup.tsx @@ -23,15 +23,13 @@ interface IProps { policyUrl: string; submissionUrl: string; viewUrl: string; - viewUrlMirror1: string; - viewUrlMirror2: string; + viewUrlMirrors: string[]; } export const LinkButtonGroup = (props: IProps) => { - const viewUrlMirrors = new Array(props.viewUrlMirror1, props.viewUrlMirror2).filter(u => u); return
- - + + diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/index.ts b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/index.ts index 4e47d6e8d..81d9e4ca1 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/index.ts +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/index.ts @@ -1,5 +1,7 @@ import { DetailsExpanderContainer } from "./DetailsExpanderContainer"; +import { IListDetails } from "./IListDetails"; export { - DetailsExpanderContainer as DetailsExpander + DetailsExpanderContainer as DetailsExpander, + IListDetails }; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/InfoCard.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/InfoCard.tsx index 6a1850b17..90662f4b2 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/InfoCard.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/InfoCard.tsx @@ -1,5 +1,6 @@ import * as React from "react"; -import { IListLicenseDto, IListSyntaxDto, IListTagDto, ISyntaxSupportedSoftwareDto } from "../IFilterListDetailsDto"; +import { IListLicense, IListSyntax, ISyntaxSupportedSoftware } from "../IListDetails"; +import { ILanguage, ITag } from "../../../interfaces"; import { Description } from "./Description"; import { DiscontinuedDate } from "./DiscontinuedDate"; import { Languages } from "./Languages"; @@ -8,30 +9,30 @@ import { PublishedDate } from "./PublishedDate"; import { RuleCount } from "./RuleCount"; import { SoftwareIcon } from "../../softwareIcon"; import { Syntax } from "./Syntax"; -import { Tags } from "./Tags"; +import { TagGroup } from "../../TagGroup" import { UpdatedDate } from "./UpdatedDate"; interface IProps { description: string; descriptionSourceUrl: string; discontinuedDate: string; - languages: string[]; - license: IListLicenseDto; + languages: ILanguage[]; + license: IListLicense; name: string; publishedDate: string; ruleCount: number; - syntax: IListSyntaxDto; - tags: IListTagDto[]; + syntax: IListSyntax; + tags: ITag[]; updatedDate: string; } export const InfoCard = (props: IProps) => { return
- +
{props.syntax ? props.syntax.supportedSoftware.map( - (s: ISyntaxSupportedSoftwareDto, i: number) => + (s: ISyntaxSupportedSoftware, i: number) => ) @@ -39,7 +40,7 @@ export const InfoCard = (props: IProps) => {
    - + diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Languages.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Languages.tsx index 0f95f3ec8..ada6383f1 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Languages.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Languages.tsx @@ -1,20 +1,21 @@ import * as React from "react"; +import { ILanguage } from "../../../interfaces"; interface IProps { - languages: string[]; + languages: ILanguage[]; } export const Languages = (props: IProps) => { - return props.languages.length > 0 + return props.languages && props.languages.length > 0 ? props.languages.length > 1 ?
  • Languages:

      - {props.languages.map((language: string, i: number) =>
    • {language}
    • )} + {props.languages.map((language: ILanguage, i: number) =>
    • {language.name}
    • )}
  • :
  • -

    Language: {props.languages[0]}

    +

    Language: {props.languages[0].name}

  • : null; }; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/License.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/License.tsx index 8c8fa65fb..3df282321 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/License.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/License.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { IListLicenseDto } from "../IFilterListDetailsDto"; +import { IListLicense as IListLicenseDto } from "../IListDetails"; export const License = (props: IListLicenseDto) => { return props.name diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Syntax.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Syntax.tsx index 5f92b6cbe..1c743c514 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Syntax.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Syntax.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { IListSyntaxDto } from "../IFilterListDetailsDto"; +import { IListSyntax as IListSyntaxDto } from "../IListDetails"; export const Syntax = (props: IListSyntaxDto) => { return props.name diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Tag.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Tag.tsx deleted file mode 100644 index 7e94a4fa6..000000000 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Tag.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as React from "react"; -import { IListTagDto } from "../IFilterListDetailsDto"; -import { getContrast } from "../../../../../utils"; - -export const Tag = (props: IListTagDto) => { - const style = props.colorHex - ? { - backgroundColor: `#${props.colorHex}`, - color: getContrast(`${props.colorHex}`) - } - : undefined; - return props.name - ? - {props.name} - - : null; -}; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Tags.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Tags.tsx deleted file mode 100644 index 553e00a61..000000000 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/infoCard/Tags.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import * as React from "react"; -import { IListTagDto } from "../IFilterListDetailsDto"; -import { Tag } from "./Tag"; - -interface IProps { - tags: IListTagDto[]; -} - -export const Tags = (props: IProps) => { - return props.tags && props.tags.length > 0 - ?
    - {props.tags.map((t: IListTagDto, i: number) => )} -
    - : null; -}; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerAdditionalLists.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerAdditionalLists.tsx index 42dffeedf..da1efd94a 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerAdditionalLists.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerAdditionalLists.tsx @@ -1,14 +1,13 @@ import * as React from "react"; -import { IMaintainerAdditionalListDto } from "../IFilterListDetailsDto"; -interface IProps { - name: string; - additionalLists: IMaintainerAdditionalListDto[]; -} +//interface IProps { +// name: string; +// additionalLists: IMaintainerAdditionalListDto[]; +//} -export const MaintainerAdditionalLists = (props: IProps) => { +export const MaintainerAdditionalLists = (/*props: IProps*/) => { return
    - {props.additionalLists && props.additionalLists.length > 0 + { /*props.additionalLists && props.additionalLists.length > 0 ?

    More by {props.name}:

      @@ -17,6 +16,6 @@ export const MaintainerAdditionalLists = (props: IProps) => {
    - : null} + : null*/ }
    ; }; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerInfoCard.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerInfoCard.tsx index 7116313a4..d446fc711 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerInfoCard.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerInfoCard.tsx @@ -1,20 +1,23 @@ import * as React from "react"; -import { IListMaintainerDto } from "../IFilterListDetailsDto"; +import { IMaintainer } from "../../../interfaces"; import { MaintainerAdditionalLists } from "./MaintainerAdditionalLists"; import { MaintainerLinkButtonGroup } from "./MaintainerLinkButtonGroup"; -export const MaintainerInfoCard = (props: IListMaintainerDto) => { - return props.name - ?
    -
    -

    Maintained by {props.name}

    -
    -
    - - -
    -
    -
    -
    - : null; -}; \ No newline at end of file +interface IProps { + maintainer: IMaintainer; +} + +export const MaintainerInfoCard = (props: IProps) => + props.maintainer.name + ?
    +
    +

    Maintained by {props.maintainer.name}

    +
    +
    + + +
    +
    +
    +
    + : null; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerLinkButtonGroup.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerLinkButtonGroup.tsx index b2b6c4c46..1d9a19226 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerLinkButtonGroup.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainerLinkButtonGroup.tsx @@ -8,10 +8,9 @@ interface IProps { twitterHandle: string; } -export const MaintainerLinkButtonGroup = (props: IProps) => { - return
    - - - -
    ; -}; \ No newline at end of file +export const MaintainerLinkButtonGroup = (props: IProps) => +
    + + + +
    ; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainersInfoCard.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainersInfoCard.tsx index 33e7b77d6..60aa4361f 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainersInfoCard.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/detailsExpander/maintainersInfoCard/MaintainersInfoCard.tsx @@ -1,16 +1,14 @@ import * as React from "react"; -import { IListMaintainerDto } from "../IFilterListDetailsDto"; +import { IMaintainer } from "../../../interfaces"; import { MaintainerInfoCard } from "./MaintainerInfoCard"; interface IProps { - maintainers: IListMaintainerDto[]; + maintainers: IMaintainer[]; } -export const MaintainersInfoCard = (props: IProps) => { - return props.maintainers && props.maintainers.length > 0 - ?
    - {props.maintainers.map( - (m: IListMaintainerDto, i: number) => )} -
    - : null; -}; \ No newline at end of file +export const MaintainersInfoCard = (props: IProps) => + props.maintainers && props.maintainers.length > 0 + ?
    + {props.maintainers.map((m: IMaintainer, i: number) => )} +
    + : null; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/index.ts b/src/FilterLists.Web/ClientApp/modules/home/components/index.ts index cf8a6d689..180723286 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/index.ts +++ b/src/FilterLists.Web/ClientApp/modules/home/components/index.ts @@ -1,9 +1,9 @@ import { DetailsExpander } from "./detailsExpander"; import { ListsTable } from "./listsTable"; -import { Tagline } from "./Tagline"; +import { Oneliner } from "./Oneliner"; export { DetailsExpander, ListsTable, - Tagline + Oneliner }; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/ListsTable.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/ListsTable.tsx index 41d9bce4a..05cd8aca9 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/ListsTable.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/ListsTable.tsx @@ -1,15 +1,17 @@ import * as React from "react"; -import { IColumnVisibility, ILanguage, IList, ISoftware, ITag } from "../../interfaces"; +import { IColumnVisibility, ILanguage, IList, IMaintainer, ISoftware, ITag } from "../../interfaces"; import "../../../../utils/loader.css"; import ReactTable from "react-table" import "react-table/react-table.css" import "./listsTable.css"; import { DetailsButton, Languages, Name, Software, Tags, UpdatedDate } from "./columns"; +import { IListDetails } from "../../components/detailsExpander"; import { DetailsExpander } from "../../components"; interface IProps { languages: ILanguage[]; lists: IList[]; + maintainers: IMaintainer[]; software: ISoftware[]; tags: ITag[]; columnVisibility: IColumnVisibility[]; @@ -17,7 +19,7 @@ interface IProps { }; export const ListsTable = (props: IProps) => - props.lists.length > 0 && props.languages.length > 0 && props.software.length > 0 + props.languages.length > 0 && props.lists.length > 0 && props.software.length > 0 && props.tags.length > 0 ? DetailsButton ]} defaultSorted={[{ id: "name" }]} - SubComponent={(r: any) => } + SubComponent={(r: any) => } className="-striped -highlight"/> - :
    Loading...
    ; \ No newline at end of file + :
    Loading...
    ; + +interface ICreateListDtoProps { + list: IList; + languages: ILanguage[]; + maintainers: IMaintainer[]; + tags: ITag[]; +}; + +const mapListDetails = (props: ICreateListDtoProps): IListDetails => { + return { + id: props.list.id, + chatUrl: props.list.chatUrl, + description: props.list.description, + descriptionSourceUrl: props.list.descriptionSourceUrl, + discontinuedDate: props.list.discontinuedDate, + donateUrl: props.list.donateUrl, + emailAddress: props.list.emailAddress, + forumUrl: props.list.forumUrl, + homeUrl: props.list.homeUrl, + issuesUrl: props.list.issuesUrl, + languages: props.list.languageIds + ? props.languages.filter((l: ILanguage) => props.list.languageIds.indexOf(l.id) > -1) + : undefined, + //license:, + maintainers: props.list.maintainerIds + ? props.maintainers.filter((m: IMaintainer) => props.list.maintainerIds.indexOf(m.id) > -1) + : undefined, + name: props.list.name, + policyUrl: props.list.policyUrl, + publishedDate: props.list.publishedDate, + ruleCount: props.list.ruleCount, + submissionUrl: props.list.submissionUrl, + //syntax:, + tags: props.list.tagIds ? props.tags.filter((t: ITag) => props.list.tagIds.indexOf(t.id) > -1) : undefined, + updatedDate: props.list.updatedDate, + viewUrl: props.list.viewUrl, + viewUrlMirrors: props.list.viewUrlMirrors + } as IListDetails; +}; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/columns/Tags.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/columns/Tags.tsx index 66be05ebf..e40f76896 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/columns/Tags.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/columns/Tags.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { Column, Filter } from "react-table"; -import { Tag } from "../../Tag" +import { TagGroup } from "../../TagGroup" import { IColumnVisibility, ITag } from "../../../interfaces"; export const Tags = (columnVisibility: IColumnVisibility[], tags: ITag[]) => { @@ -41,9 +41,6 @@ const sortMethod = (a: number[], b: number[]): any => const Cell = (tagIds: number[], tags: ITag[]) => tagIds ?
    - {tagIds.map((tid: number, i: number) => { - const tag = tags.filter((t: ITag) => t.id === tid)[0]; - return ; - })} + tagIds.indexOf(t.id) > -1)}/>
    : null; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/softwareIcon/SoftwareIcon.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/softwareIcon/SoftwareIcon.tsx index 4e94f7cb4..26a2232bd 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/softwareIcon/SoftwareIcon.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/softwareIcon/SoftwareIcon.tsx @@ -57,4 +57,4 @@ const icons: { [id: number]: IIcon; } = { 19: { image: img19, imageTitle: "Samsung Knox" }, 20: { image: img20, imageTitle: "Little Snitch" }, 21: { image: img21, imageTitle: "Privoxy" } -}; +}; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/interfaces/ILanguage.ts b/src/FilterLists.Web/ClientApp/modules/home/interfaces/ILanguage.ts index ba0c62f64..a9dbcef93 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/interfaces/ILanguage.ts +++ b/src/FilterLists.Web/ClientApp/modules/home/interfaces/ILanguage.ts @@ -1,5 +1,6 @@ export interface ILanguage { id: number; + filterListIds: number[]; iso6391: string; name: string; } \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/interfaces/IList.ts b/src/FilterLists.Web/ClientApp/modules/home/interfaces/IList.ts index 9f48d3fa6..d808f0eb9 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/interfaces/IList.ts +++ b/src/FilterLists.Web/ClientApp/modules/home/interfaces/IList.ts @@ -1,8 +1,25 @@ export interface IList { id: number; + chatUrl: string; + description: string; + descriptionSourceUrl: string; + discontinuedDate: string; + donateUrl: string; + emailAddress: string; + forumUrl: string; + homeUrl: string; + issuesUrl: string; languageIds: number[]; + licenseId: string; + maintainerIds: number[]; name: string; + policyUrl: string; + publishedDate: string; + ruleCount: number; + submissionUrl: string; syntaxId: number; tagIds: number[]; updatedDate: string; + viewUrl: string; + viewUrlMirrors: string[]; } \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/interfaces/IMaintainer.ts b/src/FilterLists.Web/ClientApp/modules/home/interfaces/IMaintainer.ts new file mode 100644 index 000000000..e954c7fec --- /dev/null +++ b/src/FilterLists.Web/ClientApp/modules/home/interfaces/IMaintainer.ts @@ -0,0 +1,8 @@ +export interface IMaintainer { + id: number; + emailAddress: string; + filterListIds: number[]; + homeUrl: string; + name: string; + twitterHandle: string; +} \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/interfaces/ISoftware.ts b/src/FilterLists.Web/ClientApp/modules/home/interfaces/ISoftware.ts index 70bf8b27e..e70d0113b 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/interfaces/ISoftware.ts +++ b/src/FilterLists.Web/ClientApp/modules/home/interfaces/ISoftware.ts @@ -1,5 +1,7 @@ export interface ISoftware { id: number; + homeUrl: string; + isAbpSubscribable: boolean; name: string; syntaxIds: number[]; } \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/interfaces/ITag.ts b/src/FilterLists.Web/ClientApp/modules/home/interfaces/ITag.ts index 09fb0ea59..b9e0aaf7f 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/interfaces/ITag.ts +++ b/src/FilterLists.Web/ClientApp/modules/home/interfaces/ITag.ts @@ -1,5 +1,6 @@ export interface ITag { id: number; description: string; + filterListIds: number[]; name: string; } \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/modules/home/interfaces/index.ts b/src/FilterLists.Web/ClientApp/modules/home/interfaces/index.ts index 0f887badc..fb0791091 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/interfaces/index.ts +++ b/src/FilterLists.Web/ClientApp/modules/home/interfaces/index.ts @@ -1,6 +1,7 @@ import { IColumnVisibility } from "./IColumnVisibility"; import { ILanguage } from "./ILanguage"; import { IList } from "./IList"; +import { IMaintainer } from "./IMaintainer"; import { ISoftware } from "./ISoftware"; import { ITag } from "./ITag"; @@ -9,6 +10,7 @@ export { IColumnVisibility, ILanguage, IList, + IMaintainer, ISoftware, ITag }; \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/utils/loader.css b/src/FilterLists.Web/ClientApp/utils/loader.css index 2e33ccc08..d3d86d1e1 100644 --- a/src/FilterLists.Web/ClientApp/utils/loader.css +++ b/src/FilterLists.Web/ClientApp/utils/loader.css @@ -3,11 +3,11 @@ .loader, .loader:before, .loader:after { - -webkit-animation: load1 1s infinite ease-in-out; - animation: load1 1s infinite ease-in-out; - background: #000000; - height: 4em; - width: 1em; + -webkit-animation: load1 1s infinite ease-in-out; + animation: load1 1s infinite ease-in-out; + background: #000000; + height: 4em; + width: 1em; } .loader {