dns searching

This commit is contained in:
2022-02-25 12:28:47 +00:00
parent 76cbd66a2f
commit f123787f1d
10 changed files with 189 additions and 127 deletions
+3 -14
View File
@@ -469,17 +469,7 @@ const Breadcrumbs = (props) => {
{router.pathname == "/dns" ? (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale + "/dns"
: "/dns"
}
>
<a className="govuk-breadcrumbs__link">
{t("dnsCommon:service-name")}
</a>
</Link>
{t("dnsCommon:service-name")}
</li>
</>
) : (
@@ -491,9 +481,8 @@ const Breadcrumbs = (props) => {
<Link
href={
router.locale == "en"
? router.locale +
"/../../dnsapplications"
: "/../../dnsapplications"
? router.locale + "/../../dns"
: "/../../dns"
}
>
<a className="govuk-breadcrumbs__link">
+6 -6
View File
@@ -13,7 +13,7 @@ const DNSLinks = (props) => {
<ul className="govuk-list">
<li>
<h3 className="govuk-heading-l govuk-!-font-size-27">
<Link href="/dns/applications">
<Link href="/dnsapplications">
<a className="govuk-link govuk-link--no-underline">
{t("dnsHome:links-applications-title")}
</a>
@@ -25,7 +25,7 @@ const DNSLinks = (props) => {
</p>
</h3>
</li>
<li>
{/* <li>
<h3 className="govuk-heading-l govuk-!-font-size-27">
<Link href="/dns/help">
<a className="govuk-link govuk-link--no-underline">
@@ -36,14 +36,14 @@ const DNSLinks = (props) => {
{t("dnsHome:links-help-intro-paragraph")}
</p>
</h3>
</li>
</li> */}
</ul>
</div>
<div className="govuk-grid-column-one-half">
<ul className="govuk-list">
<li>
<h3 className="govuk-heading-l govuk-!-font-size-27">
<Link href="/dns/application-process">
<Link href="https://gov.wales/developments-national-significance-dns-guidance">
<a className="govuk-link govuk-link--no-underline ">
{t("dnsHome:links-help-title")}
</a>
@@ -53,7 +53,7 @@ const DNSLinks = (props) => {
</p>
</h3>
</li>
<li>
{/* <li>
<h3 className="govuk-heading-l govuk-!-font-size-27">
<Link href="/dns/contact-us">
<a className="govuk-link govuk-link--no-underline">
@@ -65,7 +65,7 @@ const DNSLinks = (props) => {
{t("dnsHome:links-contactus-intro-paragraph")}
</p>
</h3>
</li>
</li> */}
</ul>
</div>
</div>
+21 -26
View File
@@ -4,9 +4,13 @@ import useTranslation from "next-translate/useTranslation";
const LatestApplications = (props) => {
let { t } = useTranslation();
const { dnsList } = props;
dnsList = dnsList.value;
let dnsListArr = dnsList.slice(0, 3);
const router = useRouter();
const { locale } = router;
return (
<div className="govuk-panel govuk-grid-column-one-third govuk-panel--latest">
<h2 className="govuk-heading-m">
@@ -15,32 +19,23 @@ const LatestApplications = (props) => {
</h2>
<div className="govuk-panel__body">
<ul className="govuk-list">
<li className="govuk-body-s ">
{" "}
<Link href="/dns/application-view">
<a href="">Brynrhyd Solar Farm</a>
</Link>
</li>
<li className="govuk-body-s ">
{" "}
<Link href="/dns/application-view">
<a href="">Brynrhyd Solar Farm</a>
</Link>
</li>
<li className="govuk-body-s ">
{" "}
<Link href="/dns/application-view">
<a href="">Brynrhyd Solar Farm</a>
</Link>
</li>
<li className="govuk-body-s ">
{" "}
<Link href="/dns/application-view">
<a href="">Brynrhyd Solar Farm</a>
</Link>
</li>
{Object.keys(dnsListArr).map((key, index) => {
return (
<li className="govuk-body-s " key={key}>
<Link
href={
"/dns/" +
dnsList[key].title
.split(" - ")[1]
.split(" ")
.join("-")
}
>
<a href="">{dnsList[key].title}</a>
</Link>
</li>
);
})}
</ul>
</div>
</div>
+24 -72
View File
@@ -1,75 +1,21 @@
import Link from "next/link";
import { useState } from "react";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import Link from "next/link";
import { useRouter } from "next/router";
import { useState } from "react";
import AutoSuggest from "react-autosuggest";
const dnsSites = [
{ id: 1, name: "30MW Energy Plant - Wrexham" },
{ id: 1, name: "Abertillery Wind Farm" },
{ id: 1, name: "Alaw Mon Solar Farm" },
{ id: 1, name: "Alwen Forest - Wind" },
{ id: 1, name: "Blackberry Lane Solar Park" },
{ id: 1, name: "Bretton Hall Solar Farm" },
{ id: 1, name: "Brynllewelyn Farm - Renewable Energy Project" },
{ id: 1, name: "Brynrhyd Solar Farm" },
{ id: 1, name: "Brynwell Farm Renewable Energy Hub" },
{ id: 1, name: "Buttington Quarry - ERF" },
{ id: 1, name: "Coed Darcy - STOR" },
{ id: 1, name: "Coity Road - STOR" },
{ id: 1, name: "Craig Y Perchyll Solar" },
{ id: 1, name: "Egnedol - Sustainable Energy" },
{ id: 1, name: "Elwy Solar Energy" },
{ id: 1, name: "Erebus - Floating Offshore Wind Demonstration Project" },
{ id: 1, name: "Felindre Road - STOR" },
{ id: 1, name: "Gaerwen Wind Farm" },
{ id: 1, name: "Garn Fach Wind Farm" },
{ id: 1, name: "Holyhead Harbour Revision Order" },
{ id: 1, name: "Holyhead Marina Harbour Revision Order" },
{ id: 1, name: "Holyhead Waterfront Regeneration Scheme HRO" },
{ id: 1, name: "Legacy Substation Gas Peaking Plant" },
{ id: 1, name: "Llantarnam - SToR" },
{ id: 1, name: "Llanwern - Solar" },
{ id: 1, name: "Lluest y Gwynt Wind Farm" },
{ id: 1, name: "Llynfi Energy Recovery Facility" },
{ id: 1, name: "Manmoel Wind Farm" },
{ id: 1, name: "Môn Solar Farm" },
{ id: 1, name: "Mor Hafren: Energy Recovery Facility" },
{ id: 1, name: "Mynydd Carn-y-Cefn Wind Farm" },
{ id: 1, name: "Mynydd Llanhilleth Wind Farm" },
{ id: 1, name: "Pancross &amp; Oaklands Solar Farm" },
{ id: 1, name: "Parc Dyffryn Solar Park" },
{ id: 1, name: "Parc Solar Traffwll" },
{ id: 1, name: "Pen March Wind Farm" },
{ id: 1, name: "Pen-y-Fan - Power Plant" },
{ id: 1, name: "Pencaerlan Solar Farm" },
{ id: 1, name: "Penderi Solar Farm" },
{ id: 1, name: "Penpergwm Solar Farm" },
{ id: 1, name: "Pentre Bach Solar Farm" },
{ id: 1, name: "Plas Power Estate Solar Farm" },
{ id: 1, name: "Project Valorous" },
{ id: 1, name: "Rhoscrowther Wind Farm" },
{ id: 1, name: "Rush Wall Solar Park Ltd" },
{ id: 1, name: "Sudbrook - Peaking Gas" },
{ id: 1, name: "TWA - Morlais Demonstration Zone" },
{ id: 1, name: "Twyn Hywel Energy Park" },
{ id: 1, name: "Tycroes Solar" },
{ id: 1, name: "Upper Ogmore - Wind Turbines" },
{ id: 1, name: "Valero - Cogeneration Facility" },
{ id: 1, name: "Vattenfall - Renewable Energy" },
{ id: 1, name: "Wauntysswg - Solar" },
{ id: 1, name: "Wentlooge - renewable energy hub" },
{ id: 1, name: "Y Bryn Wind Farm" },
];
const lowerCasedCompanies = dnsSites.map((company) => {
return {
id: company.id,
name: company.name,
};
});
const TitleContent = (props) => {
const { dnsList } = props;
const dnsSites = dnsList.value;
const lowerCasedCompanies = dnsSites.map((company) => {
return {
id: company.ticketnumber,
name: company.title,
};
});
let { t } = useTranslation();
const router = useRouter();
@@ -92,12 +38,11 @@ const TitleContent = (props) => {
<div className="govuk-panel__body">
<p className="govuk-body-s">{t("dnsHome:title-paragraph")}</p>
</div>
<div className="govuk-form-group govuk-!-margin-bottom-0 flex-container">
<div className="govuk-form-group govuk-!-margin-bottom-0 flex-container react-autosuggest">
<AutoSuggest
suggestions={suggestions}
onSuggestionsClearRequested={() => setSuggestions([])}
onSuggestionsFetchRequested={({ value }) => {
console.log(value);
setValue(value);
setSuggestions(getSuggestions(value));
}}
@@ -120,8 +65,15 @@ const TitleContent = (props) => {
}}
highlightFirstSuggestion={true}
/>
<Link href="/dns/application-view">
<a className="govuk-button govuk-!-margin-bottom-0 govuk-!-margin-left-2">
<Link
href={
"/dns/" +
(value.indexOf(" - ") > 0
? value.split(" - ")[1].split(" ").join("-")
: "")
}
>
<a className="govuk-button govuk-!-margin-bottom-0 ">
{t("dnsHome:title-application-search-button")}
</a>
</Link>
+8 -4
View File
@@ -7,7 +7,7 @@ import LatestApplications from "./homepage/latestApplications";
import DNSLinks from "./homepage/dnsLinks";
import ApplicationsForComment from "./homepage/applicationsForComment";
export default function Main({ children, pages }) {
export default function Main({ children, pages, props }) {
let { t } = useTranslation();
const router = useRouter();
@@ -22,8 +22,12 @@ export default function Main({ children, pages }) {
<div className="govuk-grid-row govuk-!-margin-bottom-0">
<div className="govuk-grid-column-full govuk-!-padding-bottom-0">
<div className="flex-container grid-row govuk-body govuk-!-margin-bottom-0 ">
<TitleContent />
<LatestApplications />
<TitleContent
dnsList={props.searchResultsObj.searchResultsObj}
/>
<LatestApplications
dnsList={props.searchResultsObj.searchResultsObj}
/>
</div>
</div>
</div>
@@ -31,7 +35,7 @@ export default function Main({ children, pages }) {
<div className="govuk-grid-column-full">
<div className="flex-container grid-row govuk-body ">
<DNSLinks />
<ApplicationsForComment />
{/* <ApplicationsForComment /> */}
</div>
</div>
</div>
-1
View File
@@ -35,7 +35,6 @@ const Header = (props) => {
"/details-about-cookies",
];
const hasContactLink = [
"/dns",
"/dns/application-process",
"/dns/help",
"/dns/contact-us",