Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Add review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
acouch committed Jul 30, 2024
1 parent df65dbc commit 94cbc76
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 28 deletions.
10 changes: 5 additions & 5 deletions frontend/src/app/[locale]/search/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import BetaAlert from "src/components/BetaAlert";
import Breadcrumbs from "src/components/Breadcrumbs";
import PageSEO from "src/components/PageSEO";
import QueryProvider from "./QueryProvider";
import QueryProvider from "src/app/[locale]/search/QueryProvider";
import SearchBar from "src/components/search/SearchBar";
import SearchCallToAction from "src/components/search/SearchCallToAction";
import SearchFilterAccordion from "src/components/search/SearchFilterAccordion/SearchFilterAccordion";
Expand Down Expand Up @@ -86,25 +86,25 @@ export default function Error({ error }: ErrorProps) {
<div className="tablet:grid-col-4">
<SearchOpportunityStatus query={status} />
<SearchFilterAccordion
options={fundingOptions}
filterOptions={fundingOptions}
title="Funding instrument"
queryParamKey="fundingInstrument"
query={fundingInstrument}
/>
<SearchFilterAccordion
options={eligibilityOptions}
filterOptions={eligibilityOptions}
title="Eligibility"
queryParamKey="eligibility"
query={eligibility}
/>
<SearchFilterAccordion
options={agencyOptions}
filterOptions={agencyOptions}
title="Agency"
queryParamKey="agency"
query={agency}
/>
<SearchFilterAccordion
options={categoryOptions}
filterOptions={categoryOptions}
title="Category"
queryParamKey="category"
query={category}
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/app/[locale]/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Breadcrumbs from "src/components/Breadcrumbs";
import Loading from "src/app/[locale]/search/loading";
import PageSEO from "src/components/PageSEO";
import SearchResultsListFetch from "src/components/search/SearchResultsListFetch";
import QueryProvider from "./QueryProvider";
import QueryProvider from "src/app/[locale]/search/QueryProvider";
import SearchBar from "src/components/search/SearchBar";
import SearchCallToAction from "src/components/search/SearchCallToAction";
import SearchFilterAccordion from "src/components/search/SearchFilterAccordion/SearchFilterAccordion";
Expand Down Expand Up @@ -84,25 +84,25 @@ function Search({ searchParams }: { searchParams: searchParamsTypes }) {
<div className="tablet:grid-col-4">
<SearchOpportunityStatus query={status} />
<SearchFilterAccordion
options={fundingOptions}
filterOptions={fundingOptions}
title="Funding instrument"
queryParamKey="fundingInstrument"
query={fundingInstrument}
/>
<SearchFilterAccordion
options={eligibilityOptions}
filterOptions={eligibilityOptions}
title="Eligibility"
queryParamKey="eligibility"
query={eligibility}
/>
<SearchFilterAccordion
options={agencyOptions}
filterOptions={agencyOptions}
title="Agency"
queryParamKey="agency"
query={agency}
/>
<SearchFilterAccordion
options={categoryOptions}
filterOptions={categoryOptions}
title="Category"
queryParamKey="category"
query={category}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/search/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import { Icon } from "@trussworks/react-uswds";
import { QueryContext } from "../../app/[locale]/search/QueryProvider";
import { QueryContext } from "src/app/[locale]/search/QueryProvider";
import { useContext } from "react";
import { useSearchParamUpdater } from "src/hooks/useSearchParamUpdater";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import SearchFilterCheckbox from "./SearchFilterCheckbox";
import SearchFilterSection from "./SearchFilterSection/SearchFilterSection";
import SearchFilterToggleAll from "./SearchFilterToggleAll";
import SearchFilterCheckbox from "src/components/search/SearchFilterAccordion/SearchFilterCheckbox";
import SearchFilterSection from "src/components/search/SearchFilterAccordion/SearchFilterSection/SearchFilterSection";
import SearchFilterToggleAll from "src/components/search/SearchFilterAccordion/SearchFilterToggleAll";
import { Accordion } from "@trussworks/react-uswds";
import { QueryParamKey } from "src/types/search/searchResponseTypes";
import { QueryContext } from "src/app/[locale]/search/QueryProvider";
Expand Down Expand Up @@ -34,14 +34,14 @@ export interface FilterOptionWithChildren {
}

interface SearchFilterAccordionProps {
options: FilterOption[];
filterOptions: FilterOption[];
title: string; // Title in header of accordion
query: Set<string>;
queryParamKey: QueryParamKey; // Ex - In query params, search?{key}=first,second,third
}

export function SearchFilterAccordion({
options,
filterOptions,
title,
queryParamKey,
query,
Expand All @@ -50,7 +50,7 @@ export function SearchFilterAccordion({
const { updateQueryParams } = useSearchParamUpdater();
const totalCheckedCount = query.size;
// These are all of the available selectedable options.
const allOptionValues = options.map((options) => options.value);
const allOptionValues = filterOptions.map((options) => options.value);
// This is the setting if all are selected.
const allSelected = new Set(allOptionValues);

Expand Down Expand Up @@ -106,7 +106,7 @@ export function SearchFilterAccordion({
/>

<ul className="usa-list usa-list--unstyled">
{options.map((option) => (
{filterOptions.map((option) => (
<li key={option.id}>
{/* If we have children, show a "section" dropdown, otherwise show just a checkbox */}
{option.children ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import FilterCheckbox from "src/components/FilterCheckbox";
import { FilterOption } from "./SearchFilterAccordion";
import { FilterOption } from "src/components/search/SearchFilterAccordion/SearchFilterAccordion";

interface SearchFilterCheckboxProps {
option: FilterOption;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterOption } from "./SearchFilterAccordion";
import { FilterOption } from "src/components/search/SearchFilterAccordion/SearchFilterAccordion";

export const eligibilityOptions: FilterOption[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";
import { useState } from "react";
import { FilterOptionWithChildren } from "../SearchFilterAccordion";
import SearchFilterCheckbox from "../SearchFilterCheckbox";
import SearchFilterToggleAll from "../SearchFilterToggleAll";
import SectionLinkCount from "./SectionLinkCount";
import SectionLinkLabel from "./SectionLinkLabel";
import { FilterOptionWithChildren } from "src/components/search/SearchFilterAccordion/SearchFilterAccordion";
import SearchFilterCheckbox from "src/components/search/SearchFilterAccordion/SearchFilterCheckbox";
import SearchFilterToggleAll from "src/components/search/SearchFilterAccordion/SearchFilterToggleAll";
import SectionLinkCount from "src/components/search/SearchFilterAccordion/SearchFilterSection/SectionLinkCount";
import SectionLinkLabel from "src/components/search/SearchFilterAccordion/SearchFilterSection/SectionLinkLabel";

interface SearchFilterSectionProps {
option: FilterOptionWithChildren;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/search/SearchOpportunityStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import { Checkbox } from "@trussworks/react-uswds";
import { QueryContext } from "../../app/[locale]/search/QueryProvider";
import { QueryContext } from "src/app/[locale]/search/QueryProvider";
import { useContext } from "react";
import { useSearchParamUpdater } from "src/hooks/useSearchParamUpdater";

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/search/SearchPaginationFetch.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";
import { getSearchFetcher } from "src/services/search/searchfetcher/SearchFetcherUtil";
import { QueryParamData } from "src/services/search/searchfetcher/SearchFetcher";
import SearchPagination from "./SearchPagination";
import SearchPagination from "src/components/search/SearchPagination";

interface SearchPaginationProps {
searchParams: QueryParamData;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useSearchParamUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function useSearchParamUpdater() {
params.delete("page");
}

sendGAEvent("event", "search", { key: finalQueryParamValue });
sendGAEvent("event", "search_term", { key: finalQueryParamValue });
let newPath = `${pathname}?${params.toString()}`;
newPath = removeURLEncodedCommas(newPath);
newPath = removeQuestionMarkIfNoParams(params, newPath);
Expand Down

0 comments on commit 94cbc76

Please sign in to comment.