update commit message
This commit is contained in:
@@ -75,6 +75,7 @@ const openAudioNotesEl = document.getElementById("open-audio-notes");
|
||||
const openTarotEl = document.getElementById("open-tarot");
|
||||
const openTarotFrameEl = document.getElementById("open-tarot-frame");
|
||||
const openTarotHouseEl = document.getElementById("open-tarot-house");
|
||||
const settingsTarotPanelEl = document.getElementById("settings-tarot-panel");
|
||||
const openAstronomyEl = document.getElementById("open-astronomy");
|
||||
const openPlanetsEl = document.getElementById("open-planets");
|
||||
const openCyclesEl = document.getElementById("open-cycles");
|
||||
@@ -107,6 +108,9 @@ const connectionGateBaseUrlEl = document.getElementById("connection-gate-base-ur
|
||||
const connectionGateApiKeyEl = document.getElementById("connection-gate-api-key");
|
||||
const connectionGateStatusEl = document.getElementById("connection-gate-status");
|
||||
const connectionGateConnectEl = document.getElementById("connection-gate-connect");
|
||||
const tarotDropdownEl = openTarotEl?.closest(".topbar-dropdown") || null;
|
||||
|
||||
const TAROT_RESTRICTED_SECTIONS = new Set(["tarot", "tarot-frame", "tarot-house"]);
|
||||
|
||||
const nowElements = {
|
||||
nowHourEl: document.getElementById("now-hour"),
|
||||
@@ -128,6 +132,34 @@ const nowElements = {
|
||||
nowStatsPlanetsEl: document.getElementById("now-stats-planets")
|
||||
};
|
||||
|
||||
function hasTarotFeatureAccess() {
|
||||
return window.TarotAppConfig?.hasTarotAccess?.() === true;
|
||||
}
|
||||
|
||||
function isSectionAccessible(section) {
|
||||
if (TAROT_RESTRICTED_SECTIONS.has(String(section || "").trim())) {
|
||||
return hasTarotFeatureAccess();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function syncTarotFeatureVisibility() {
|
||||
const tarotVisible = hasTarotFeatureAccess();
|
||||
|
||||
if (tarotDropdownEl) {
|
||||
tarotDropdownEl.hidden = !tarotVisible;
|
||||
}
|
||||
|
||||
if (settingsTarotPanelEl) {
|
||||
settingsTarotPanelEl.hidden = !tarotVisible;
|
||||
}
|
||||
|
||||
if (!tarotVisible && TAROT_RESTRICTED_SECTIONS.has(sectionStateUi.getActiveSection?.())) {
|
||||
sectionStateUi.setActiveSection?.("home");
|
||||
}
|
||||
}
|
||||
|
||||
const baseWeekOptions = {
|
||||
hourStart: 0,
|
||||
hourEnd: 24,
|
||||
@@ -245,6 +277,7 @@ appRuntime.init?.({
|
||||
nowElements,
|
||||
calendarVisualsUi,
|
||||
homeUi,
|
||||
hasTarotAccess: () => hasTarotFeatureAccess(),
|
||||
onStatus: (text) => setStatus(text),
|
||||
services: {
|
||||
getCenteredWeekStartDay,
|
||||
@@ -390,6 +423,10 @@ function getConnectionSettingsFromGate() {
|
||||
}
|
||||
|
||||
function warmAllDeckImagesInBackground() {
|
||||
if (!hasTarotFeatureAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const activeDeckId = String(window.TarotCardImages?.getActiveDeck?.() || "").trim();
|
||||
|
||||
window.TarotCardImages?.scheduleAllDeckImagePreload?.({
|
||||
@@ -426,6 +463,9 @@ async function ensureConnectedApp(nextConnectionSettings = null) {
|
||||
syncConnectionGateInputs(configuredConnection);
|
||||
}
|
||||
|
||||
window.TarotAppConfig?.updateConnectionAccess?.(probeResult);
|
||||
syncTarotFeatureVisibility();
|
||||
|
||||
hideConnectionGate();
|
||||
if (!hasRenderedConnectedShell) {
|
||||
sectionStateUi.setActiveSection?.("home");
|
||||
@@ -500,6 +540,7 @@ sectionStateUi.init?.({
|
||||
settingsUi,
|
||||
calendarVisualsUi,
|
||||
homeUi,
|
||||
isSectionAccessible: (section) => isSectionAccessible(section),
|
||||
getReferenceData: () => appRuntime.getReferenceData?.() || null,
|
||||
getMagickDataset: () => appRuntime.getMagickDataset?.() || null,
|
||||
elements: {
|
||||
@@ -637,6 +678,10 @@ if (nowOverlayToggleEl && nowPanelEl) {
|
||||
syncNowOverlayVisibility();
|
||||
}
|
||||
|
||||
document.addEventListener("connection:access-updated", () => {
|
||||
syncTarotFeatureVisibility();
|
||||
});
|
||||
|
||||
navigationUi.init?.({
|
||||
tarotSpreadUi,
|
||||
getActiveSection: () => sectionStateUi.getActiveSection?.() || "home",
|
||||
@@ -714,5 +759,6 @@ window.TarotNatal = {
|
||||
|
||||
const initialSettings = settingsUi.loadInitialSettingsAndApply?.() || { ...DEFAULT_SETTINGS };
|
||||
homeUi.syncNowSkyBackground?.({ latitude: initialSettings.latitude, longitude: initialSettings.longitude }, true);
|
||||
syncTarotFeatureVisibility();
|
||||
bindConnectionGate();
|
||||
void ensureConnectedApp();
|
||||
|
||||
Reference in New Issue
Block a user