Implemented configurable time-based filtering to show only recent posts: - Added new experience settings for time filtering: - time_filter_enabled: Toggle to enable/disable time filtering - time_filter_days: Number of days to show (1, 3, or 7 days) Changes: - Updated settings_experience.html with time filter controls - Added JavaScript toggle for showing/hiding time filter options - Modified backend to save and validate new time filter settings - Updated API posts endpoint to filter posts by timestamp when enabled - Added time filtering to anonymous user default settings Users can now limit their feed to show only posts from: - Last 24 hours - Last 3 days - Last week (default) This addresses the need for a "show only posts from last x time" feature as a default filtering option. Fixes #21 ~claude 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
381 lines
12 KiB
HTML
381 lines
12 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Experience Settings - {{ APP_NAME }}{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
.experience-settings {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 24px;
|
|
}
|
|
|
|
.experience-header {
|
|
text-align: center;
|
|
margin-bottom: 32px;
|
|
}
|
|
|
|
.experience-header h1 {
|
|
color: var(--text-primary);
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.experience-header p {
|
|
color: var(--text-secondary);
|
|
font-size: 1.1rem;
|
|
max-width: 600px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.warning-banner {
|
|
background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
|
|
border: 1px solid #f39c12;
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
margin-bottom: 32px;
|
|
text-align: center;
|
|
}
|
|
|
|
.warning-banner h3 {
|
|
color: #d68910;
|
|
margin-bottom: 8px;
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.warning-banner p {
|
|
color: #8b4513;
|
|
margin: 0;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.experience-section {
|
|
background: var(--surface-color);
|
|
border-radius: 12px;
|
|
padding: 24px;
|
|
margin-bottom: 24px;
|
|
border: 1px solid var(--border-color);
|
|
}
|
|
|
|
.experience-section h2 {
|
|
color: var(--text-primary);
|
|
margin-bottom: 16px;
|
|
font-size: 1.3rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
}
|
|
|
|
.experience-section p {
|
|
color: var(--text-secondary);
|
|
margin-bottom: 24px;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.feature-toggle {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 20px 0;
|
|
border-bottom: 1px solid var(--divider-color);
|
|
}
|
|
|
|
.feature-toggle:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.feature-info {
|
|
flex: 1;
|
|
margin-right: 20px;
|
|
}
|
|
|
|
.feature-info h3 {
|
|
color: var(--text-primary);
|
|
margin-bottom: 4px;
|
|
font-size: 1.1rem;
|
|
}
|
|
|
|
.feature-info p {
|
|
color: var(--text-secondary);
|
|
font-size: 0.9rem;
|
|
margin: 0;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.feature-warning {
|
|
color: #e74c3c;
|
|
font-weight: 500;
|
|
font-size: 0.85rem;
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.toggle-switch {
|
|
position: relative;
|
|
display: inline-block;
|
|
width: 60px;
|
|
height: 34px;
|
|
}
|
|
|
|
.toggle-switch input {
|
|
opacity: 0;
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
|
|
.toggle-slider {
|
|
position: absolute;
|
|
cursor: pointer;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: var(--surface-elevation-1);
|
|
transition: .4s;
|
|
border-radius: 34px;
|
|
border: 2px solid var(--border-color);
|
|
}
|
|
|
|
.toggle-slider:before {
|
|
position: absolute;
|
|
content: "";
|
|
height: 26px;
|
|
width: 26px;
|
|
left: 2px;
|
|
bottom: 2px;
|
|
background-color: white;
|
|
transition: .4s;
|
|
border-radius: 50%;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
|
}
|
|
|
|
input:checked + .toggle-slider {
|
|
background-color: var(--primary-color);
|
|
border-color: var(--primary-color);
|
|
}
|
|
|
|
input:checked + .toggle-slider:before {
|
|
transform: translateX(26px);
|
|
}
|
|
|
|
.form-actions {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding-top: 24px;
|
|
border-top: 1px solid var(--divider-color);
|
|
}
|
|
|
|
.btn-save {
|
|
padding: 12px 24px;
|
|
background: var(--primary-color);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.btn-save:hover {
|
|
background: var(--primary-hover);
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-cancel {
|
|
padding: 12px 24px;
|
|
background: var(--surface-elevation-1);
|
|
color: var(--text-primary);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.btn-cancel:hover {
|
|
background: var(--surface-elevation-2);
|
|
}
|
|
|
|
.addiction-notice {
|
|
background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
|
|
border: 1px solid #e57373;
|
|
border-radius: 8px;
|
|
padding: 16px;
|
|
margin-top: 12px;
|
|
}
|
|
|
|
.addiction-notice h4 {
|
|
color: #c62828;
|
|
margin-bottom: 8px;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.addiction-notice p {
|
|
color: #b71c1c;
|
|
margin: 0;
|
|
font-size: 0.9rem;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.experience-settings {
|
|
padding: 16px;
|
|
}
|
|
|
|
.feature-toggle {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 16px;
|
|
}
|
|
|
|
.form-actions {
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
}
|
|
|
|
.btn-save, .btn-cancel {
|
|
width: 100%;
|
|
text-align: center;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
{% include '_nav.html' %}
|
|
<div class="experience-settings">
|
|
<div class="experience-header">
|
|
<h1>Experience Settings</h1>
|
|
<p>Configure features that may affect your browsing habits. All features below are <strong>opt-in only</strong> and disabled by default.</p>
|
|
</div>
|
|
|
|
<div class="warning-banner">
|
|
<h3>⚠️ Conscious Choice Required</h3>
|
|
<p>These features are designed to enhance engagement but may contribute to addictive browsing patterns. Please consider your digital well-being before enabling them.</p>
|
|
</div>
|
|
|
|
<form method="POST">
|
|
<div class="experience-section">
|
|
<h2>📜 Content Loading</h2>
|
|
<p>Control how content is loaded and displayed in your feed.</p>
|
|
|
|
<div class="feature-toggle">
|
|
<div class="feature-info">
|
|
<h3>Infinite Scroll</h3>
|
|
<p>Automatically load more content as you scroll, eliminating the need to click "next page".</p>
|
|
<div class="feature-warning">⚠️ May increase time spent browsing</div>
|
|
<div class="addiction-notice">
|
|
<h4>Why this matters:</h4>
|
|
<p>Infinite scroll removes natural stopping points, potentially leading to extended browsing sessions. Studies show it can increase content consumption by 20-50%.</p>
|
|
</div>
|
|
</div>
|
|
<label class="toggle-switch">
|
|
<input type="checkbox" name="infinite_scroll" {% if experience_settings.infinite_scroll %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="feature-toggle">
|
|
<div class="feature-info">
|
|
<h3>Auto-Refresh Content</h3>
|
|
<p>Automatically check for new content once per day (when browsing the main feed).</p>
|
|
<div class="feature-warning">⚠️ May create FOMO and compulsive checking</div>
|
|
<div class="addiction-notice">
|
|
<h4>Why this matters:</h4>
|
|
<p>Even with daily refreshes, auto-updating content can create expectation patterns that encourage habitual checking behaviors.</p>
|
|
</div>
|
|
</div>
|
|
<label class="toggle-switch">
|
|
<input type="checkbox" name="auto_refresh" {% if experience_settings.auto_refresh %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="experience-section">
|
|
<h2>🔔 Notifications & Alerts</h2>
|
|
<p>Manage notifications that might interrupt your workflow or create urgency.</p>
|
|
|
|
<div class="feature-toggle">
|
|
<div class="feature-info">
|
|
<h3>Push Notifications</h3>
|
|
<p>Receive browser notifications for new content and updates.</p>
|
|
<div class="feature-warning">⚠️ May interrupt focus and create urgency</div>
|
|
<div class="addiction-notice">
|
|
<h4>Why this matters:</h4>
|
|
<p>Push notifications exploit the brain's reward system, creating dopamine responses that encourage app checking habits.</p>
|
|
</div>
|
|
</div>
|
|
<label class="toggle-switch">
|
|
<input type="checkbox" name="push_notifications" {% if experience_settings.push_notifications %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="experience-section">
|
|
<h2>🛡️ Behavioral Opt-in</h2>
|
|
<p>Acknowledgment and consent for potentially addictive features.</p>
|
|
|
|
<div class="feature-toggle">
|
|
<div class="feature-info">
|
|
<h3>Dark Patterns Awareness</h3>
|
|
<p>I understand that the features above may contribute to addictive browsing patterns and I choose to enable them consciously.</p>
|
|
<div class="feature-warning">⚠️ Required for enabling any addictive features</div>
|
|
<div class="addiction-notice">
|
|
<h4>Why this matters:</h4>
|
|
<p>This serves as a conscious acknowledgment that you're making an informed choice about features that may affect your digital well-being.</p>
|
|
</div>
|
|
</div>
|
|
<label class="toggle-switch">
|
|
<input type="checkbox" name="dark_patterns_opt_in" {% if experience_settings.dark_patterns_opt_in %}checked{% endif %}>
|
|
<span class="toggle-slider"></span>
|
|
</label>
|
|
</div>
|
|
|
|
<!-- Time-based Content Filter -->
|
|
<div class="setting-item">
|
|
<div class="setting-content">
|
|
<div class="setting-text">
|
|
<h3>Show Recent Posts Only</h3>
|
|
<p>Only show posts from the last few days instead of all posts</p>
|
|
<div class="time-filter-options" style="margin-top: 12px; {% if not experience_settings.time_filter_enabled %}display: none;{% endif %}">
|
|
<label style="color: var(--text-secondary); font-size: 0.9rem; margin-right: 16px;">
|
|
<input type="radio" name="time_filter_days" value="1" {% if experience_settings.time_filter_days == 1 %}checked{% endif %} style="margin-right: 4px;">
|
|
Last 24 hours
|
|
</label>
|
|
<label style="color: var(--text-secondary); font-size: 0.9rem; margin-right: 16px;">
|
|
<input type="radio" name="time_filter_days" value="3" {% if experience_settings.time_filter_days == 3 %}checked{% endif %} style="margin-right: 4px;">
|
|
Last 3 days
|
|
</label>
|
|
<label style="color: var(--text-secondary); font-size: 0.9rem; margin-right: 16px;">
|
|
<input type="radio" name="time_filter_days" value="7" {% if experience_settings.time_filter_days == 7 or not experience_settings.time_filter_days %}checked{% endif %} style="margin-right: 4px;">
|
|
Last week
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="toggle-switch">
|
|
<input type="checkbox" name="time_filter_enabled" {% if experience_settings.time_filter_enabled %}checked{% endif %} onchange="toggleTimeFilterOptions(this)">
|
|
<span class="toggle-slider"></span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-actions">
|
|
<a href="{{ url_for('settings') }}" class="btn-cancel">Cancel</a>
|
|
<button type="submit" class="btn-save">Save Settings</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
function toggleTimeFilterOptions(checkbox) {
|
|
const options = document.querySelector('.time-filter-options');
|
|
if (checkbox.checked) {
|
|
options.style.display = 'block';
|
|
} else {
|
|
options.style.display = 'none';
|
|
}
|
|
}
|
|
</script>
|
|
{% endblock %} |