Skip to content

Commit

Permalink
WIP Add scopeNote to search widget #285
Browse files Browse the repository at this point in the history
  • Loading branch information
sroertgen committed Mar 27, 2024
1 parent 828155f commit 0f62218
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ searchableAttributes:
- "hiddenLabel"
- "example"
- "definition"
- "scopeNote"
ui:
title: "SkoHub Vocabs" # Title is mandatory
logo: "skohub-signet-color.svg" # Path
Expand Down
5 changes: 5 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ exports.createPages = async ({ graphql, actions: { createPage } }) => {
"hiddenLabel",
"definition",
"example",
"scopeNote"
],
},
})
Expand Down Expand Up @@ -364,6 +365,10 @@ exports.createPages = async ({ graphql, actions: { createPage } }) => {
Object.hasOwn(concept.example, language) && {
example: i18n(language)(concept.example),
}),
...(concept.scopeNote &&
Object.hasOwn(concept.scopeNote, language) && {
scopeNote: i18n(language)(concept.scopeNote),
}),
notation: concept.notation,
}
indexes[language].add(document)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Search = ({ handleQueryInput, labels, onLabelClick }) => {
closeModal={() => setModal(false)}
id="settingsModal"
>
<p>Which labels do you want to include in the search?</p>
<p>Which fields do you want to include in the search?</p>
<LabelFilter labels={labels} toggleClick={onLabelClick} />
</Modal>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ module.exports.allConceptScheme = (languages) => `
example {
${[...languages].join(" ")}
}
scopeNote {
${[...languages].join(" ")}
}
deprecated
}
`
Expand Down
5 changes: 5 additions & 0 deletions src/templates/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export const handleKeypresses = (labels, setLabels) => {
e.preventDefault()
Object.keys(labels).includes("hiddenLabel") &&
setLabels({ ...labels, ["hiddenLabel"]: !labels["hiddenLabel"] })
} else if (e.altKey && e.which === 83) {
e.preventDefault()
Object.keys(labels).includes("scopeNote") &&
setLabels({ ...labels, ["scopeNote"]: !labels["scopeNote"] })
}
}
document.addEventListener("keydown", handleKeyDown)
Expand Down Expand Up @@ -75,6 +79,7 @@ export const importIndex = async (
"hiddenLabel",
"definition",
"example",
"scopeNote"
],
},
})
Expand Down

0 comments on commit 0f62218

Please sign in to comment.