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
This commit is contained in:
Spicy_Marinara
2025-11-02 10:59:06 +01:00
parent 82b9564e07
commit 718696e611
5 changed files with 44 additions and 22 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ export function generateTrackerInstructions(includeHtmlPrompt = true, includeCon
instructions += 'Weather: [Weather Emoji, Forecast]\n'; instructions += 'Weather: [Weather Emoji, Forecast]\n';
} }
if (widgets.temperature?.enabled) { 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`; instructions += `Temperature: [Temperature in ${unit}]\n`;
} }
if (widgets.time?.enabled) { if (widgets.time?.enabled) {
+13 -3
View File
@@ -99,6 +99,7 @@ export async function onMessageReceived(data) {
// console.log('[RPG Companion] Parsing together mode response:', responseText); // console.log('[RPG Companion] Parsing together mode response:', responseText);
const parsedData = parseResponse(responseText); const parsedData = parseResponse(responseText);
// console.log('[RPG Companion] Parsed data:', parsedData);
// Update stored data // Update stored data
if (parsedData.userStats) { if (parsedData.userStats) {
@@ -158,15 +159,24 @@ export async function onMessageReceived(data) {
lastMessage.swipes[currentSwipeId] = cleanedMessage.trim(); lastMessage.swipes[currentSwipeId] = cleanedMessage.trim();
} }
// console.log('[RPG Companion] Cleaned message, removed tracker code blocks'); // Render the updated data FIRST (before cleaning DOM)
// Render the updated data
renderUserStats(); renderUserStats();
renderInfoBox(); renderInfoBox();
renderThoughts(); renderThoughts();
renderInventory(); renderInventory();
renderQuests(); 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 // Save to chat metadata
saveChatData(); saveChatData();
} }
+9 -7
View File
@@ -329,18 +329,18 @@ export function renderInfoBox() {
let tempValue = data.tempValue || 20; let tempValue = data.tempValue || 20;
// Apply temperature unit conversion // Apply temperature unit conversion
const preferredUnit = config.widgets.temperature.unit || 'celsius'; const preferredUnit = config.widgets.temperature.unit || 'C';
if (data.temperature) { if (data.temperature) {
// Detect current unit in the data // Detect current unit in the data
const isCelsius = tempDisplay.includes('°C'); const isCelsius = tempDisplay.includes('°C');
const isFahrenheit = tempDisplay.includes('°F'); const isFahrenheit = tempDisplay.includes('°F');
if (preferredUnit === 'fahrenheit' && isCelsius) { if (preferredUnit === 'F' && isCelsius) {
// Convert C to F // Convert C to F
const fahrenheit = Math.round((tempValue * 9/5) + 32); const fahrenheit = Math.round((tempValue * 9/5) + 32);
tempDisplay = `${fahrenheit}°F`; tempDisplay = `${fahrenheit}°F`;
tempValue = fahrenheit; tempValue = fahrenheit;
} else if (preferredUnit === 'celsius' && isFahrenheit) { } else if (preferredUnit === 'C' && isFahrenheit) {
// Convert F to C // Convert F to C
const celsius = Math.round((tempValue - 32) * 5/9); const celsius = Math.round((tempValue - 32) * 5/9);
tempDisplay = `${celsius}°C`; tempDisplay = `${celsius}°C`;
@@ -348,12 +348,14 @@ export function renderInfoBox() {
} }
} else { } else {
// No data yet, use default for preferred unit // No data yet, use default for preferred unit
tempDisplay = preferredUnit === 'fahrenheit' ? '68°F' : '20°C'; tempDisplay = preferredUnit === 'F' ? '68°F' : '20°C';
tempValue = preferredUnit === 'fahrenheit' ? 68 : 20; tempValue = preferredUnit === 'F' ? 68 : 20;
} }
const tempPercent = Math.min(100, Math.max(0, ((tempValue + 20) / 60) * 100)); // Calculate thermometer display (convert to Celsius for consistent thresholds)
const tempColor = tempValue < 10 ? '#4a90e2' : tempValue < 25 ? '#67c23a' : '#e94560'; 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(` row1Widgets.push(`
<div class="rpg-dashboard-widget rpg-temp-widget"> <div class="rpg-dashboard-widget rpg-temp-widget">
<div class="rpg-thermometer"> <div class="rpg-thermometer">
+1 -1
View File
@@ -443,7 +443,7 @@ function renderPresentCharactersTab() {
<input type="text" value="${relationship}" class="rpg-relationship-name" placeholder="Relationship type"> <input type="text" value="${relationship}" class="rpg-relationship-name" placeholder="Relationship type">
<span class="rpg-arrow">→</span> <span class="rpg-arrow">→</span>
<input type="text" value="${emoji}" class="rpg-relationship-emoji" placeholder="Emoji" maxlength="4"> <input type="text" value="${emoji}" class="rpg-relationship-emoji" placeholder="Emoji" maxlength="4">
<button class="rpg-field-remove rpg-remove-relationship" data-relationship="${relationship}" title="Remove"><i class="fa-solid fa-trash"></i></button> <button class="rpg-remove-relationship" data-relationship="${relationship}" title="Remove"><i class="fa-solid fa-trash"></i></button>
</div> </div>
`; `;
} }
+20 -10
View File
@@ -1980,19 +1980,14 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
.rpg-character-stat { .rpg-character-stat {
flex-shrink: 0; flex-shrink: 0;
}
.rpg-character-stat .rpg-stat-name {
font-size: clamp(0.5vw, 0.6vw, 0.7vw) !important; font-size: clamp(0.5vw, 0.6vw, 0.7vw) !important;
font-weight: 600 !important; font-weight: 600 !important;
white-space: nowrap !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 */ /* Placeholder styles for empty sections */
.rpg-thoughts-placeholder, .rpg-thoughts-placeholder,
.rpg-placeholder-widget { .rpg-placeholder-widget {
@@ -3885,7 +3880,8 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
font-size: 0.95em; font-size: 0.95em;
} }
.rpg-field-remove { .rpg-field-remove,
.rpg-remove-relationship {
flex-shrink: 0; flex-shrink: 0;
padding: 0.375em 0.625em; padding: 0.375em 0.625em;
background: var(--rpg-highlight); background: var(--rpg-highlight);
@@ -3896,7 +3892,8 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
transition: opacity 0.2s; transition: opacity 0.2s;
} }
.rpg-field-remove:hover { .rpg-field-remove:hover,
.rpg-remove-relationship:hover {
opacity: 0.8; opacity: 0.8;
} }
@@ -4938,6 +4935,19 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
font-size: clamp(16px, 4.1vw, 20px) !important; 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 MOBILE STATS TAB LAYOUT IMPROVEMENTS
======================================== */ ======================================== */