Compare commits

..

2 Commits

Author SHA1 Message Date
8312cfe13f Merge pull request 'fix(web): restore 3-column NPC chat modal layout for desktop' (#4) from bug/non-mobile-ui-fix-for-npcs into dev
Reviewed-on: #4
2025-11-26 04:17:13 +00:00
16171dc34a fix(web): restore 3-column NPC chat modal layout for desktop
- Fixed grid layout not applying to modal content (grid was on wrong parent element)
- Applied grid to .npc-chat-container instead of .npc-modal-body--three-col
- Removed htmx-indicator class from history panel (was causing content to disappear)
- Made history loading indicator visible by default
- Updated responsive breakpoints to target correct selectors
- Added warning to HTMX_PATTERNS.md about htmx-indicator hidden behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 22:16:33 -06:00
3 changed files with 32 additions and 20 deletions

View File

@@ -564,6 +564,8 @@ def create_character():
<span id="spinner" class="htmx-indicator"></span> <span id="spinner" class="htmx-indicator"></span>
``` ```
> **IMPORTANT:** The `htmx-indicator` class is **hidden by default** (opacity: 0) and only shown during active requests. Never put this class on a container that should remain visible - only use it on loading spinners/messages that should appear during requests and disappear after.
### 4. Debounce Search Inputs ### 4. Debounce Search Inputs
```html ```html
<input hx-get="/search" <input hx-get="/search"
@@ -646,6 +648,6 @@ document.body.addEventListener('htmx:responseError', (event) => {
--- ---
**Document Version:** 1.1 **Document Version:** 1.2
**Created:** November 18, 2025 **Created:** November 18, 2025
**Last Updated:** November 21, 2025 **Last Updated:** November 26, 2025

View File

@@ -1436,10 +1436,28 @@
/* 3-column layout for chat modal with history sidebar */ /* 3-column layout for chat modal with history sidebar */
.npc-modal-body--three-col { .npc-modal-body--three-col {
padding: 0; /* Let container handle padding */
max-height: 70vh;
}
/* Apply grid to the actual container holding the three columns */
.npc-modal-body--three-col .npc-chat-container {
display: grid; display: grid;
grid-template-columns: 200px 1fr 280px; /* Profile | Chat | History */ grid-template-columns: 200px 1fr 280px; /* Profile | Chat | History */
gap: 1rem; gap: 1rem;
max-height: 70vh; padding: 1rem 1.25rem;
height: 100%;
}
/* Override hardcoded widths for grid children - let grid define sizes */
.npc-modal-body--three-col .npc-profile {
width: auto;
}
/* Ensure history panel is visible in modal grid */
.npc-modal-body--three-col .npc-history-panel {
min-height: 200px;
overflow-y: auto;
} }
/* NPC Profile (Left Column) */ /* NPC Profile (Left Column) */
@@ -1699,24 +1717,13 @@
font-style: italic; font-style: italic;
} }
/* HTMX Loading Indicator */ /* HTMX Loading Indicator - visible by default, replaced by HTMX response */
.history-loading { .history-loading {
text-align: center; text-align: center;
color: var(--text-muted); color: var(--text-muted);
font-size: 0.875rem; font-size: 0.875rem;
padding: 1rem 0; padding: 1rem 0;
font-style: italic; font-style: italic;
display: none;
}
/* Show loading indicator when HTMX is making a request */
.htmx-indicator.htmx-request .history-loading {
display: block;
}
/* Hide other content while loading */
.htmx-indicator.htmx-request > *:not(.history-loading) {
opacity: 0.5;
} }
/* Responsive NPC Modal */ /* Responsive NPC Modal */
@@ -1763,20 +1770,23 @@
/* Responsive: 3-column modal stacks on smaller screens */ /* Responsive: 3-column modal stacks on smaller screens */
@media (max-width: 1024px) { @media (max-width: 1024px) {
.npc-modal-body--three-col { .npc-modal-body--three-col .npc-chat-container {
grid-template-columns: 1fr; /* Single column */ grid-template-columns: 1fr; /* Single column */
grid-template-rows: auto 1fr auto; grid-template-rows: auto 1fr auto;
} }
.npc-profile { .npc-modal-body--three-col .npc-profile {
order: 1; order: 1;
width: 100%;
flex-direction: row;
flex-wrap: wrap;
} }
.npc-conversation { .npc-modal-body--three-col .npc-conversation {
order: 2; order: 2;
} }
.npc-history-panel { .npc-modal-body--three-col .npc-history-panel {
order: 3; order: 3;
border-left: none; border-left: none;
border-top: 1px solid var(--play-border); border-top: 1px solid var(--play-border);

View File

@@ -109,7 +109,7 @@ Displays NPC profile, conversation interface, and message history
</div> </div>
{# Right Column: Message History Sidebar #} {# Right Column: Message History Sidebar #}
<aside class="npc-history-panel htmx-indicator" <aside class="npc-history-panel"
id="npc-history-{{ npc.npc_id }}" id="npc-history-{{ npc.npc_id }}"
hx-get="{{ url_for('game.npc_chat_history', session_id=session_id, npc_id=npc.npc_id) }}" hx-get="{{ url_for('game.npc_chat_history', session_id=session_id, npc_id=npc.npc_id) }}"
hx-trigger="load, newMessage from:body" hx-trigger="load, newMessage from:body"