clerical: import/doc/format fixes

This commit is contained in:
2024-05-09 23:07:40 -05:00
parent 590908ac68
commit 28f58a362f
4 changed files with 13 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import React, { FunctionComponent, ReactNode } from "react"; import type { FunctionComponent, ReactNode } from "react";
import React from "react";
import { useBoolean } from "usehooks-ts"; import { useBoolean } from "usehooks-ts";
import { CodeBracketIcon } from "@heroicons/react/24/solid"; import { CodeBracketIcon } from "@heroicons/react/24/solid";

View File

@@ -1,4 +1,5 @@
import React, { FunctionComponent, ReactNode } from "react"; import type { FunctionComponent, ReactNode } from "react";
import React from "react";
import Property from "@/components/common/Property"; import Property from "@/components/common/Property";
const PropertyListItem: FunctionComponent<{ const PropertyListItem: FunctionComponent<{

View File

@@ -12,7 +12,7 @@ import {
} from "@heroicons/react/20/solid"; } from "@heroicons/react/20/solid";
import { Listbox, Transition } from "@headlessui/react"; import { Listbox, Transition } from "@headlessui/react";
import clsx from "clsx"; import clsx from "clsx";
import { Maybe } from "true-myth"; import type { Maybe } from "true-myth";
/** /**
* Props for the LookupInput component. * Props for the LookupInput component.
@@ -52,6 +52,7 @@ const LookupInput: FunctionComponent<LookupInputProps> = ({
const { register, handleSubmit, getValues } = useForm<SubmitProps>({ const { register, handleSubmit, getValues } = useForm<SubmitProps>({
defaultValues: { defaultValues: {
target: "", target: "",
// Not used at this time.
followReferral: false, followReferral: false,
requestJSContact: false, requestJSContact: false,
}, },

View File

@@ -1,9 +1,6 @@
import type { TargetType } from "@/types"; import type { TargetType } from "@/types";
import { Result } from "true-myth"; import { Result } from "true-myth";
// keeps track of the elements we've created so we can assign a unique ID
// let elementCounter = 123456;
const cardTitles = { const cardTitles = {
domain: "Domain Name", domain: "Domain Name",
"ip network": "IP Network", "ip network": "IP Network",
@@ -774,6 +771,13 @@ const URIPatterns: [RegExp, TargetType][] = [
], ],
]; ];
/**
* Retrieves the type of a given value based on matching patterns.
*
* @param value - The value to determine the type for.
* @returns A `Result` object containing the determined `TargetType` if a match is found,
* otherwise an `Error` object.
*/
export function getType(value: string): Result<TargetType, Error> { export function getType(value: string): Result<TargetType, Error> {
for (const [pattern, type] of URIPatterns) { for (const [pattern, type] of URIPatterns) {
if (pattern.test(value)) return Result.ok(type); if (pattern.test(value)) return Result.ok(type);