Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 6x 16x 16x 16x 16x 1x 1x 1x 16x 1x 1x 1x 2x 6x | import LZ from "lz-string";
import { useState } from "react";
import { Link, useNavigate } from "react-router";
import { Button, RadioGroup, RadioGroupItem } from "@/components";
import { sendGAEvent } from "@/utils/ReactGA/SendGAEvent";
export const PackageSearch = () => {
const [searchText, setSearchText] = useState("");
const [tabChoice, setTabChoice] = useState("spas");
const navigate = useNavigate();
const handleSearch = () => {
const compressedValue = LZ.compressToEncodedURIComponent(
JSON.stringify({
filters: [],
search: searchText,
tab: tabChoice,
pagination: { number: 0, size: 100 },
sort: { field: "makoChangedDate", order: "desc" },
}),
);
navigate(`/dashboard?os=${compressedValue}`);
sendGAEvent("home_search_text", null);
};
const triggerGAEvent = (eventType, option) => {
sendGAEvent(eventType, {
option: option,
});
};
return (
<div className="w-full h-[202px] space-y-3 flex flex-col items-center text-center justify-center mb-8 mt-8">
<p className="text-[24px] font-bold">Search for package</p>
<p className="text-[16px]">
You can search by SPA ID, waiver number, CPOC name, or submitter name.
</p>
<RadioGroup
value={tabChoice}
onValueChange={(e) => {
setTabChoice(e);
triggerGAEvent("home_search_radio", e);
}}
className="flex space-x-4"
>
<div className="flex space-x-2">
<RadioGroupItem value="spas" id="r1" aria-label="Search SPAs" />
<label htmlFor="r1">Search SPAs</label>
</div>
<div className="flex space-x-2">
<RadioGroupItem value="waivers" id="r2" aria-label="Search waivers" />
<label htmlFor="r2">Search waivers</label>
</div>
</RadioGroup>
<div className="flex items-center border rounded w-[434px]">
<input
aria-label="Search for text"
className="flex h-9 w-full rounded-sm bg-transparent px-3 py-1 text-sm shadow-sm"
value={searchText}
onChange={(e) => setSearchText(e.target.value)}
/>
<div className="h-full border-l-2" />
<svg
xmlns="http://www.w3.org/2000/svg"
className="w-6 h-6 mx-2 text-gray-500"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
/>
</svg>
</div>
<Button className="w-[304px]" onClick={handleSearch}>
Search
</Button>
</div>
);
};
export const BrowseDash = () => {
return (
<div className="w-full h-[202px] space-y-4 flex flex-col items-center text-center justify-center mb-8 mt-8">
<p className="text-[24px] font-bold">Browse dashboard</p>
<p className="text-[16px]">Find a complete list of packages on the dashboard.</p>
<Link to={"/dashboard"}>
<button className="w-[304px] h-[38px] bg-[#0071BC] text-white px-4 py-2 rounded-md text-sm font-semibold">
Go to dashboard
</button>
</Link>
</div>
);
};
|