various ui improvements, including a new sequence nav component and a new kabbalah detail view
This commit is contained in:
+20
-12
@@ -837,12 +837,14 @@
|
||||
function normalizeCardRequest(request) {
|
||||
const normalized = normalizeOpenRequest(request);
|
||||
const label = String(normalized.label || normalized.altText || "Tarot card enlarged image").trim() || "Tarot card enlarged image";
|
||||
const cardId = String(normalized.cardId || "").trim();
|
||||
return {
|
||||
src: String(normalized.src || "").trim(),
|
||||
previewSrc: String(normalized.previewSrc || "").trim(),
|
||||
altText: String(normalized.altText || label).trim() || label,
|
||||
label,
|
||||
cardId: String(normalized.cardId || "").trim(),
|
||||
cardId,
|
||||
sequenceId: String(normalized.sequenceId || cardId).trim(),
|
||||
deckId: String(normalized.deckId || "").trim(),
|
||||
deckLabel: String(normalized.deckLabel || normalized.deckId || "").trim(),
|
||||
missingReason: String(normalized.missingReason || "").trim(),
|
||||
@@ -995,19 +997,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
function resolveCardRequestById(cardId) {
|
||||
if (!cardId || typeof lightboxState.resolveCardById !== "function") {
|
||||
function resolveCardRequestById(sequenceId) {
|
||||
if (!sequenceId || typeof lightboxState.resolveCardById !== "function") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const resolved = lightboxState.resolveCardById(cardId);
|
||||
const resolved = lightboxState.resolveCardById(sequenceId);
|
||||
if (!resolved) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return normalizeCardRequest({
|
||||
...resolved,
|
||||
cardId
|
||||
sequenceId: String(resolved.sequenceId || sequenceId).trim() || String(sequenceId),
|
||||
cardId: String(resolved.cardId || sequenceId).trim()
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3277,7 +3280,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const anchorId = lightboxState.secondaryCard?.cardId || lightboxState.primaryCard?.cardId;
|
||||
const anchorId = lightboxState.secondaryCard?.sequenceId
|
||||
|| lightboxState.secondaryCard?.cardId
|
||||
|| lightboxState.primaryCard?.sequenceId
|
||||
|| lightboxState.primaryCard?.cardId;
|
||||
const startIndex = sequence.indexOf(anchorId);
|
||||
if (startIndex < 0) {
|
||||
return;
|
||||
@@ -3285,12 +3291,13 @@
|
||||
|
||||
for (let offset = 1; offset <= sequence.length; offset += 1) {
|
||||
const nextIndex = (startIndex + direction * offset + sequence.length) % sequence.length;
|
||||
const nextCardId = sequence[nextIndex];
|
||||
if (!nextCardId || nextCardId === lightboxState.primaryCard?.cardId) {
|
||||
const nextSequenceId = sequence[nextIndex];
|
||||
const primarySequenceId = lightboxState.primaryCard?.sequenceId || lightboxState.primaryCard?.cardId;
|
||||
if (!nextSequenceId || nextSequenceId === primarySequenceId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const nextCard = resolveCardRequestById(nextCardId);
|
||||
const nextCard = resolveCardRequestById(nextSequenceId);
|
||||
if (nextCard && setSecondaryCard(nextCard, true)) {
|
||||
break;
|
||||
}
|
||||
@@ -3303,14 +3310,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const startIndex = sequence.indexOf(lightboxState.primaryCard?.cardId);
|
||||
const primarySequenceId = lightboxState.primaryCard?.sequenceId || lightboxState.primaryCard?.cardId;
|
||||
const startIndex = sequence.indexOf(primarySequenceId);
|
||||
if (startIndex < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nextIndex = (startIndex + direction + sequence.length) % sequence.length;
|
||||
const nextCardId = sequence[nextIndex];
|
||||
const nextCard = resolveCardRequestById(nextCardId);
|
||||
const nextSequenceId = sequence[nextIndex];
|
||||
const nextCard = resolveCardRequestById(nextSequenceId);
|
||||
if (!nextCard?.src) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user