Skip to content

Conversation

@jjroelofs
Copy link
Contributor

Summary

Adds intuitive time window configuration UI to Views AI Sorting plugin, enabling content marketers to focus recommendations on recently active content. Features opt-in design, progressive disclosure, and content-type specific guidance.

Implementation Details

New Configuration Options

  • "Favor recent content" checkbox - Opt-in design (unchecked by default)
  • "Count interactions from" dropdown - Time window selector (only visible when enabled)
  • Contextual help section - Content-type specific recommendations

UI/UX Enhancements

  • Progressive disclosure using Drupal #states API - dropdown only appears when checkbox enabled
  • Marketing-friendly language - "Favor recent content" instead of technical jargon
  • Hardcoded second values - Prevents future migration issues
  • Content-type guidance - Reduces configuration errors and support tickets

Time Window Options

  • Last month (2,592,000 seconds) - News & announcements
  • Last 3 months (7,776,000 seconds) - Blog posts [default]
  • Last 6 months (15,552,000 seconds) - Products
  • Last year (31,536,000 seconds) - Long-term campaigns

Technical Integration

  • Query method updated - Uses getThompsonScoresWithWindow() when time window enabled
  • Admin summary enhanced - Shows active time window in Views configuration
  • Backward compatibility - Existing configurations unchanged (checkbox starts unchecked)

User Experience Flow

  1. Default state: Standard Thompson Sampling behavior (no time filtering)
  2. Enable checkbox: "Count interactions from" dropdown appears
  3. Select timeframe: Choose appropriate window for content type
  4. Contextual help: Click "Which timeframe should I choose?" for guidance
  5. Save configuration: Time window filtering applied to AI recommendations

Code Quality

  • PHP syntax validation (all files pass)
  • Drupal coding standards compliance (21 auto-fixes applied)
  • Form states validation - Progressive disclosure working
  • Options persistence - Configuration saves correctly

Performance Considerations

  • No performance impact when disabled - checkbox unchecked = existing behavior
  • Optimized queries when enabled - leverages new RL module covering indexes
  • Client-side progressive disclosure - no additional server requests for UI state

Related Issues & PRs

Resolves: #5
Paired with: dxpr/rl#4 (API backend)
Related issues: dxpr/rl#2, #5

Testing Requirements

  • Form states JavaScript functionality in Views admin
  • Configuration persistence across save/reload cycles
  • Time window filtering behavior with sample content
  • Progressive disclosure in different browsers
  • Accessibility compliance (keyboard navigation, screen readers)

Deployment Dependencies

Requires: RL module API enhancements (dxpr/rl#4) to be deployed first
Database: No schema changes required (leverages existing RL module infrastructure)


🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

- Add "Favor recent content" checkbox with opt-in design philosophy
- Add "Count interactions from" dropdown with hardcoded second values
- Implement progressive disclosure using #states API
- Add contextual help section with content-type specific recommendations
- Update query() method to use getThompsonScoresWithWindow() when enabled
- Update adminSummary() to display active time window settings
- Support time windows: Last month, 3 months, 6 months, year
- Maintain backward compatibility when checkbox is disabled

Enables content marketers to focus AI recommendations on recently active content.
Perfect for news sites, blogs, seasonal products, and campaign-driven content.
Evergreen content sites can leave the feature disabled.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@jjroelofs jjroelofs merged commit 4edaa27 into 1.x Aug 11, 2025
0 of 2 checks passed
@jjroelofs jjroelofs deleted the jur/1.x/sliding-time-window-clean branch August 11, 2025 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants