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:
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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(`
|
||||
<div class="rpg-dashboard-widget rpg-temp-widget">
|
||||
<div class="rpg-thermometer">
|
||||
|
||||
@@ -443,7 +443,7 @@ function renderPresentCharactersTab() {
|
||||
<input type="text" value="${relationship}" class="rpg-relationship-name" placeholder="Relationship type">
|
||||
<span class="rpg-arrow">→</span>
|
||||
<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>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
======================================== */
|
||||
|
||||
Reference in New Issue
Block a user