traveling-salesman-bangkok/src/hooks/useAlgorithmInfo.js
Narongpol Kijrangsan f1054502b0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
first and last commit
2025-03-10 17:06:16 +07:00

44 lines
935 B
JavaScript

import { useStaticQuery, graphql } from "gatsby";
export const useAlgorithmInfo = () => {
const {
allMarkdownRemark: { edges: algorithms }
} = useStaticQuery(graphql`
query AlgorithmModalsQuery {
allMarkdownRemark(
filter: {
frontmatter: {
type: {
in: [
"exhaustive"
"heuristic-construction"
]
}
}
}
sort: { fields: frontmatter___order }
) {
edges {
node {
frontmatter {
order
friendlyName
solverKey
type
defaults {
evaluatingDetailLevel
maxEvaluatingDetailLevel
}
}
html
}
}
}
}
`);
return algorithms.map(alg => ({
...alg.node.frontmatter,
html: alg.node.html
}));
};