Added relation comment. Changed relation dialog order.

This commit is contained in:
2026-11-21 04:23:09 +01:00
parent 206fe91e27
commit 6176007b06
8 changed files with 164 additions and 35 deletions
+16 -2
View File
@@ -1,14 +1,28 @@
// labels per scene relation type, keyed by which side of the relation the related scene is on
// relations point from the derivation or compilation (source) to the original or compilation part (target)
// symmetric types like variants have no direction, and are keyed 'both'
// listed in the order they're offered, most common first
const relationLabels = {
rerelease: { target: 'Rerelease of', source: 'Rereleased as' },
remaster: { target: 'Remaster of', source: 'Remastered as' },
compilation: { target: 'Compilation features', source: 'Featured in compilation' },
bts: { target: 'Behind the scenes of', source: 'Has behind the scenes' },
variant: { both: 'Variant of' },
compilation: { target: 'Compilation features', source: 'Featured in compilation' },
remaster: { target: 'Remaster of', source: 'Remastered as' },
reedit: { target: 'Re-edit of', source: 'Re-edited as' },
};
const relationOrder = Object.keys(relationLabels);
// types without a label go last, alphabetically
export function sortRelationTypes(types, getType = (type) => type) {
return types.toSorted((typeA, typeB) => {
const indexA = relationOrder.indexOf(getType(typeA));
const indexB = relationOrder.indexOf(getType(typeB));
return (indexA === -1 ? Infinity : indexA) - (indexB === -1 ? Infinity : indexB) || getType(typeA).localeCompare(getType(typeB));
});
}
export function getRelationLabel(type, direction) {
if (relationLabels[type]?.[direction]) {
return relationLabels[type][direction];