diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-03-31 17:45:29 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-04-10 16:02:37 -0300 |
commit | ec8c79787ab330986e9da590fd500c7ceda893f2 (patch) | |
tree | 311920108f22fcf1f8de178f4f7efd654e0f6abc /src/content/dependencies/generateContributionTooltipChronologySection.js | |
parent | 963c84f1bb9fd88cc0873dd6da77da1896c6b5ea (diff) |
content: artwork chronology links
Diffstat (limited to 'src/content/dependencies/generateContributionTooltipChronologySection.js')
-rw-r--r-- | src/content/dependencies/generateContributionTooltipChronologySection.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/content/dependencies/generateContributionTooltipChronologySection.js b/src/content/dependencies/generateContributionTooltipChronologySection.js index 78c9051c..378c0e1c 100644 --- a/src/content/dependencies/generateContributionTooltipChronologySection.js +++ b/src/content/dependencies/generateContributionTooltipChronologySection.js @@ -1,3 +1,19 @@ +import Thing from '#thing'; + +function getName(thing) { + if (!thing) { + return null; + } + + const referenceType = thing.constructor[Thing.referenceType]; + + if (referenceType === 'artwork') { + return thing.thing.name; + } + + return thing.name; +} + export default { contentDependencies: ['linkAnythingMan'], extraDependencies: ['html', 'language'], @@ -30,14 +46,10 @@ export default { data: (query, _contribution) => ({ previousName: - (query.previous - ? query.previous.thing.name - : null), + getName(query.previous?.thing), nextName: - (query.next - ? query.next.thing.name - : null), + getName(query.next?.thing), }), slots: { |