diff --git a/src/bits/Primer.js b/src/bits/Primer.js new file mode 100644 index 0000000..d59711b --- /dev/null +++ b/src/bits/Primer.js @@ -0,0 +1,23 @@ +import { memo, useMemo } from "react"; +import { Tag } from "antd"; + +const colors = [ + "magenta", + "red", + "volcano", + "orange", + "gold", + "lime", + "green", + "cyan", + "blue", + "geekblue", + "purple", +]; + +const Primer = memo(({ name }) => { + const colorIndex = Array.from(new TextEncoder().encode(name)).reduce((acc, x) => acc + x, 0) % colors.length; + return {name}; +}); + +export default Primer; diff --git a/src/lib/datasets.js b/src/lib/datasets.js index ebc2ee6..6b00280 100644 --- a/src/lib/datasets.js +++ b/src/lib/datasets.js @@ -1,5 +1,6 @@ import groupBy from "lodash/groupBy"; import { Popover } from "antd"; +import Primer from "../bits/Primer"; export const PRIMER_GROUPINGS = ["Taxa_group", "Phylum", "Order", "Family", "Genus", "Final_ID"]; @@ -23,11 +24,9 @@ const taxaRecGroup = (arr, groupings, pathStr) => { const baseRecord = { title: isSpeciesLevel ? {k.split("_").join(" ")}{" "} - - {v.map(p => - {p["Primer_name"]} - )} - }> + ) + }> ( {v.length} available {v.length === 1 ? "primer" : "primers"} ) diff --git a/src/steps/DatasetStep.js b/src/steps/DatasetStep.js index 67ba2ca..61aa612 100644 --- a/src/steps/DatasetStep.js +++ b/src/steps/DatasetStep.js @@ -30,7 +30,7 @@ const DatasetStep = ({ visible, dataset, setDataset, onFinish }) => { if (onParseFinish) onParseFinish(); const dataset = createDataset(data); - console.log(dataset); + console.debug("dataset:", dataset); setDataset(dataset); }); } finally { diff --git a/src/steps/DiscoverStep.js b/src/steps/DiscoverStep.js index fbbc84e..a5d81a6 100644 --- a/src/steps/DiscoverStep.js +++ b/src/steps/DiscoverStep.js @@ -21,6 +21,8 @@ import { Typography } from "antd"; import { ArrowLeftOutlined, ArrowRightOutlined, SearchOutlined } from "@ant-design/icons"; + +import Primer from "../bits/Primer"; import { pluralize } from "../lib/utils"; const DiscoverStep = ({ visible, dataset, onBack, onFinish }) => { @@ -244,7 +246,7 @@ const DiscoverStep = ({ visible, dataset, onBack, onFinish }) => { Primers: {Array.from(r.primers).map((p) => ( - {p} + ))}