({
loadedParts,
itemCount,
parentCatalogNames,
searchCatalog,
}: {
loadedParts: PartState[];
itemCount: number;
parentCatalogNames: string[];
searchCatalog?: string;
})
| 98 | } |
| 99 | |
| 100 | export default function DashboardPage({ |
| 101 | loadedParts, |
| 102 | itemCount, |
| 103 | parentCatalogNames, |
| 104 | searchCatalog, |
| 105 | }: { |
| 106 | loadedParts: PartState[]; |
| 107 | itemCount: number; |
| 108 | parentCatalogNames: string[]; |
| 109 | searchCatalog?: string; |
| 110 | }) { |
| 111 | const itemsPerPage = 10; |
| 112 | |
| 113 | const [isLoading, setLoading] = useState(false); |
| 114 | const [itemCountState, setItemCountState] = useState(itemCount); |
| 115 | const router = useRouter(); |
| 116 | |
| 117 | const [parts, setParts] = useState<PartState[]>(loadedParts); |
| 118 | const [isSearchResult, setIsSearchResult] = useState( |
| 119 | searchCatalog ? searchCatalog.length > 0 : false ?? false |
| 120 | ); |
| 121 | const [activePage, setPage] = useState(1); |
| 122 | |
| 123 | const [parentCatalogNamesState, setParentCatalogNamesState] = |
| 124 | useState<string[]>(parentCatalogNames); |
| 125 | const voltageSearchRef = useRef<ValueSearchRef>(null); |
| 126 | const resistanceSearchRef = useRef<ValueSearchRef>(null); |
| 127 | const powerSearchRef = useRef<ValueSearchRef>(null); |
| 128 | const currentSearchRef = useRef<ValueSearchRef>(null); |
| 129 | const frequencySearchRef = useRef<ValueSearchRef>(null); |
| 130 | const capacitanceSearchRef = useRef<ValueSearchRef>(null); |
| 131 | const inductanceSearchRef = useRef<ValueSearchRef>(null); |
| 132 | |
| 133 | const searchForm = useForm<FilterState>({ |
| 134 | initialValues: { |
| 135 | productTitle: null, |
| 136 | productCode: null, |
| 137 | productDescription: null, |
| 138 | encapStandard: null, |
| 139 | parentCatalogName: searchCatalog || null, |
| 140 | }, |
| 141 | }); |
| 142 | |
| 143 | useEffect(() => { |
| 144 | if (typeof document !== "undefined") { |
| 145 | if (onScan.isAttachedTo(document) == false) { |
| 146 | console.log("attaching onScan"); |
| 147 | onScan.attachTo(document, { |
| 148 | suffixKeyCodes: [13], // enter-key expected at the end of a scan |
| 149 | keyCodeMapper: function (oEvent) { |
| 150 | if (oEvent.keyCode === 190) { |
| 151 | return ":"; |
| 152 | } |
| 153 | if (oEvent.keyCode === 188) { |
| 154 | return ","; |
| 155 | } |
| 156 | return onScan.decodeKeyEvent(oEvent); |
| 157 | }, |
nothing calls this directly
no test coverage detected