Skip to content

Latest commit

 

History

History
169 lines (137 loc) · 4.77 KB

File metadata and controls

169 lines (137 loc) · 4.77 KB

OllamaMax Bottom Input Feature

Overview

The search bar and OllamaMax logo now automatically move to the bottom of the page after the first message is sent, creating a more natural chat experience.

Behavior

Initial State (Before First Message)

  • Center Content: Logo and search bar displayed in the center of the screen
  • Bottom Input: Hidden
  • Purpose: Clean, focused landing page experience

After First Message

  • Center Content: Automatically hidden
  • Bottom Input: Appears at the bottom of the page
  • Chat Messages: Adjust to make room for bottom input
  • Purpose: Traditional chat interface with input at bottom

Implementation Details

HTML Structure

Center Content (Initial)

<div class="center-content">
    <div class="brand-container">
        <img src="images/ollama.png" alt="Ollama Logo">
        <h1 class="brand-title">OllamaMax</h1>
    </div>
    <div class="center-input-container">
        <!-- Initial input area with action buttons -->
    </div>
</div>

Bottom Input Area (Shown After First Message)

<div class="bottom-input-area" id="bottom-input-area">
    <div class="bottom-input-wrapper">
        <textarea id="user-input-bottom"></textarea>
        <button id="send-button-bottom">Send</button>
    </div>
</div>

CSS Layout

Bottom Input Area Styling

.bottom-input-area {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);  /* 60px */
    right: 0;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
    z-index: 100;
}

Chat Messages Adjustment

.chat-messages {
    padding-bottom: 100px;  /* Extra space for scrolling */
}

.chat-messages.with-bottom-input {
    bottom: 90px;  /* Make room for bottom input */
}

JavaScript Logic

Transition Flow

  1. User sends first message
  2. hideCenterContent() is called
  3. Center content gets hide class
  4. Bottom input area display changes from none to flex
  5. Chat messages get with-bottom-input class
  6. All subsequent messages use bottom input

Event Handlers

  • Bottom Send Button: Sends message and clears input
  • Enter Key: Same as clicking send (Shift+Enter for new line)
  • Auto-resize: Textarea grows/shrinks with content

Visual Design

Bottom Input Features

  • Max width: 800px (matches chat messages)
  • Centered: Horizontally centered in available space
  • Rounded: 24px border radius for modern look
  • Accent color: Send button uses primary accent color
  • Responsive: Adjusts to sidebar width

Spacing

  • Padding: 16px vertical, 20px horizontal
  • Gap: 12px between textarea and send button
  • Bottom margin: Chat messages have 100px padding-bottom for smooth scrolling

User Experience Benefits

Before (Center Only)

  • ❌ Input moves to top after sending
  • ❌ User must scroll to see input after responses
  • ❌ Feels disjointed

After (Bottom Input)

  • ✅ Input stays at bottom (natural chat UX)
  • ✅ Always visible and accessible
  • ✅ Smooth conversation flow
  • ✅ Matches popular chat apps (Slack, Discord, etc.)

Browser Compatibility

  • Modern browsers: Full support
  • Position fixed: Widely supported
  • Flexbox: Standard layout
  • Textarea auto-resize: JavaScript-based, universal

Mobile Responsiveness

The bottom input area adapts to mobile screens:

  • Adjusts for sidebar collapse
  • Touch-friendly button size
  • Native keyboard handling

Testing

Test Scenario 1: Initial Load

  1. Open http://localhost:8888
  2. Expected: Logo and search bar in center
  3. Expected: No bottom input visible

Test Scenario 2: First Message

  1. Type message in center input
  2. Click send or press Enter
  3. Expected: Center content disappears
  4. Expected: Bottom input appears
  5. Expected: Chat messages adjust spacing

Test Scenario 3: Continued Chat

  1. Type message in bottom input
  2. Send message
  3. Expected: Input clears but remains at bottom
  4. Expected: New messages appear above
  5. Expected: Auto-scroll to latest message

Test Scenario 4: Textarea Resize

  1. Type multiple lines in bottom input
  2. Expected: Textarea grows vertically
  3. Send message
  4. Expected: Textarea resets to single line height

Cache Busting

Updated CSS version to v=4 to force browser reload.

To see changes:

  • Hard refresh: Ctrl+Shift+R (Linux/Windows) or Cmd+Shift+R (Mac)
  • Or open in incognito/private window

Future Enhancements

Potential Improvements

  • Smooth transition animation when switching from center to bottom
  • Option to toggle between center and bottom input
  • Voice input button in bottom area
  • File upload button in bottom area
  • Typing indicator above bottom input
  • Quick actions/shortcuts in bottom area