From 718696e611ea921950537619a24392fb01e464a7 Mon Sep 17 00:00:00 2001 From: Spicy_Marinara Date: Sun, 2 Nov 2025 10:59:06 +0100 Subject: [PATCH] Fix multiple UI and functionality issues - Fixed together mode: Render panels before cleaning DOM so trackers display properly - Fixed temperature unit toggle: Changed from 'celsius'/'fahrenheit' to 'C'/'F' to match config - Fixed temperature widget: Thermometer color thresholds now use Celsius internally for consistency - Fixed relationship remove buttons: Removed duplicate class causing wrong fields to be deleted - Added styling for relationship remove buttons to match custom field buttons - Added mobile font sizes for Past Events widget for better readability - Added parsing debug log to help troubleshoot together mode issues --- src/systems/generation/promptBuilder.js | 2 +- src/systems/integration/sillytavern.js | 16 ++++++++++--- src/systems/rendering/infoBox.js | 16 +++++++------ src/systems/ui/trackerEditor.js | 2 +- style.css | 30 ++++++++++++++++--------- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/systems/generation/promptBuilder.js b/src/systems/generation/promptBuilder.js index 4049536..68f1e5b 100644 --- a/src/systems/generation/promptBuilder.js +++ b/src/systems/generation/promptBuilder.js @@ -170,7 +170,7 @@ export function generateTrackerInstructions(includeHtmlPrompt = true, includeCon instructions += 'Weather: [Weather Emoji, Forecast]\n'; } if (widgets.temperature?.enabled) { - const unit = widgets.temperature.unit === 'fahrenheit' ? '°F' : '°C'; + const unit = widgets.temperature.unit === 'F' ? '°F' : '°C'; instructions += `Temperature: [Temperature in ${unit}]\n`; } if (widgets.time?.enabled) { diff --git a/src/systems/integration/sillytavern.js b/src/systems/integration/sillytavern.js index a0bb38e..b40b0ca 100644 --- a/src/systems/integration/sillytavern.js +++ b/src/systems/integration/sillytavern.js @@ -99,6 +99,7 @@ export async function onMessageReceived(data) { // console.log('[RPG Companion] Parsing together mode response:', responseText); const parsedData = parseResponse(responseText); + // console.log('[RPG Companion] Parsed data:', parsedData); // Update stored data if (parsedData.userStats) { @@ -158,15 +159,24 @@ export async function onMessageReceived(data) { lastMessage.swipes[currentSwipeId] = cleanedMessage.trim(); } - // console.log('[RPG Companion] Cleaned message, removed tracker code blocks'); - - // Render the updated data + // Render the updated data FIRST (before cleaning DOM) renderUserStats(); renderInfoBox(); renderThoughts(); renderInventory(); renderQuests(); + // Then update the DOM to reflect the cleaned message + const lastMessageElement = $('#chat').children('.mes').last(); + if (lastMessageElement.length) { + const messageText = lastMessageElement.find('.mes_text'); + if (messageText.length) { + messageText.html(substituteParams(cleanedMessage.trim())); + } + } + + // console.log('[RPG Companion] Cleaned message, removed tracker code blocks from DOM'); + // Save to chat metadata saveChatData(); } diff --git a/src/systems/rendering/infoBox.js b/src/systems/rendering/infoBox.js index 4a4a5e6..d223e84 100644 --- a/src/systems/rendering/infoBox.js +++ b/src/systems/rendering/infoBox.js @@ -329,18 +329,18 @@ export function renderInfoBox() { let tempValue = data.tempValue || 20; // Apply temperature unit conversion - const preferredUnit = config.widgets.temperature.unit || 'celsius'; + const preferredUnit = config.widgets.temperature.unit || 'C'; if (data.temperature) { // Detect current unit in the data const isCelsius = tempDisplay.includes('°C'); const isFahrenheit = tempDisplay.includes('°F'); - if (preferredUnit === 'fahrenheit' && isCelsius) { + if (preferredUnit === 'F' && isCelsius) { // Convert C to F const fahrenheit = Math.round((tempValue * 9/5) + 32); tempDisplay = `${fahrenheit}°F`; tempValue = fahrenheit; - } else if (preferredUnit === 'celsius' && isFahrenheit) { + } else if (preferredUnit === 'C' && isFahrenheit) { // Convert F to C const celsius = Math.round((tempValue - 32) * 5/9); tempDisplay = `${celsius}°C`; @@ -348,12 +348,14 @@ export function renderInfoBox() { } } else { // No data yet, use default for preferred unit - tempDisplay = preferredUnit === 'fahrenheit' ? '68°F' : '20°C'; - tempValue = preferredUnit === 'fahrenheit' ? 68 : 20; + tempDisplay = preferredUnit === 'F' ? '68°F' : '20°C'; + tempValue = preferredUnit === 'F' ? 68 : 20; } - const tempPercent = Math.min(100, Math.max(0, ((tempValue + 20) / 60) * 100)); - const tempColor = tempValue < 10 ? '#4a90e2' : tempValue < 25 ? '#67c23a' : '#e94560'; + // Calculate thermometer display (convert to Celsius for consistent thresholds) + const tempInCelsius = preferredUnit === 'F' ? Math.round((tempValue - 32) * 5/9) : tempValue; + const tempPercent = Math.min(100, Math.max(0, ((tempInCelsius + 20) / 60) * 100)); + const tempColor = tempInCelsius < 10 ? '#4a90e2' : tempInCelsius < 25 ? '#67c23a' : '#e94560'; row1Widgets.push(`
diff --git a/src/systems/ui/trackerEditor.js b/src/systems/ui/trackerEditor.js index 4e31561..02bcd5f 100644 --- a/src/systems/ui/trackerEditor.js +++ b/src/systems/ui/trackerEditor.js @@ -443,7 +443,7 @@ function renderPresentCharactersTab() { - +
`; } diff --git a/style.css b/style.css index 8e0a61b..76c127e 100644 --- a/style.css +++ b/style.css @@ -1980,19 +1980,14 @@ body:has(.rpg-panel.rpg-position-left) #sheld { .rpg-character-stat { flex-shrink: 0; +} + +.rpg-character-stat .rpg-stat-name { font-size: clamp(0.5vw, 0.6vw, 0.7vw) !important; font-weight: 600 !important; white-space: nowrap !important; } -.rpg-character-stat .rpg-stat-label { - color: var(--rpg-text) !important; -} - -.rpg-character-stat .rpg-stat-value { - font-weight: bold !important; -} - /* Placeholder styles for empty sections */ .rpg-thoughts-placeholder, .rpg-placeholder-widget { @@ -3885,7 +3880,8 @@ body:has(.rpg-panel.rpg-position-left) #sheld { font-size: 0.95em; } -.rpg-field-remove { +.rpg-field-remove, +.rpg-remove-relationship { flex-shrink: 0; padding: 0.375em 0.625em; background: var(--rpg-highlight); @@ -3896,7 +3892,8 @@ body:has(.rpg-panel.rpg-position-left) #sheld { transition: opacity 0.2s; } -.rpg-field-remove:hover { +.rpg-field-remove:hover, +.rpg-remove-relationship:hover { opacity: 0.8; } @@ -4938,6 +4935,19 @@ body:has(.rpg-panel.rpg-position-left) #sheld { font-size: clamp(16px, 4.1vw, 20px) !important; } + /* Recent Events widget - mobile text sizing */ + .rpg-notebook-title { + font-size: clamp(9px, 2.2vw, 11px) !important; + } + + .rpg-bullet { + font-size: clamp(9px, 2.2vw, 11px) !important; + } + + .rpg-event-text { + font-size: clamp(8px, 2vw, 10px) !important; + } + /* ======================================== MOBILE STATS TAB LAYOUT IMPROVEMENTS ======================================== */