Files
mc-webui/app/templates/contacts-manage.html
T
MarekWo a1f91816af refactor: Improve Contact Management modal pages layout
After removing navbars from modal embedded pages, add proper page headers
and optimize button layout for better mobile UX.

Changes to Pending Contacts page:
- Add H4 page header "Pending Contacts" with badge counter
- Replace two large buttons (Contact Management + Home) with smaller ones
- Change Home button to Refresh button (more useful in modal context)
- Use btn-sm for compact button sizes
- Replace back-buttons class with d-flex gap-2 for simpler layout

Changes to Existing Contacts page:
- Add H4 page header "Existing Contacts" with counter badge
- Same button improvements as Pending Contacts
- Replace Home button with Refresh button

Changes to Contact Management settings:
- Set default "Days of Inactivity" value to 0 (ignore) instead of 2
- This is safer default as 0 means "do not filter by inactivity"

Result:
- Clear page headers indicate current location in modal
- Smaller, more compact buttons save screen space
- Refresh buttons are more useful than Home (which is Close in modal)
- Safer default value for cleanup prevents accidental bulk deletions

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-01 21:50:18 +01:00

165 lines
7.9 KiB
HTML

{% extends "contacts_base.html" %}
{% block title %}Contact Management Settings - mc-webui{% endblock %}
{% block page_content %}
<div id="managePageContent" class="p-3">
<!-- Page Header -->
<div class="mb-4">
<h2 class="mb-1">
<i class="bi bi-gear"></i> Settings
</h2>
<p class="text-muted small mb-0">Configure contact management preferences</p>
</div>
<!-- Manual Approval Settings Section -->
<div class="compact-setting">
<div class="form-check form-switch mb-0 d-flex align-items-center gap-2">
<input class="form-check-input" type="checkbox" role="switch" id="manualApprovalSwitch" style="cursor: pointer; min-width: 3rem; min-height: 1.5rem;">
<label class="form-check-label mb-0" for="manualApprovalSwitch" style="cursor: pointer; font-weight: 500;">
<span id="switchLabel">Loading...</span>
</label>
</div>
<i class="bi bi-info-circle info-icon"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="When enabled, new contacts must be manually approved before they can communicate with your node"></i>
</div>
<!-- Navigation Section -->
<div class="mb-4">
<h5 class="mb-3">
<i class="bi bi-list-ul"></i> Manage Contacts
</h5>
<!-- Pending Contacts Card -->
<div class="nav-card" onclick="navigateTo('/contacts/pending');">
<div>
<h6><i class="bi bi-hourglass-split"></i> Pending Contacts</h6>
<small class="text-muted">Contacts awaiting manual approval</small>
</div>
<span class="badge bg-primary rounded-pill" id="pendingBadge" style="font-size: 1.1rem;">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
</span>
</div>
<!-- Existing Contacts Card -->
<div class="nav-card" onclick="navigateTo('/contacts/existing');">
<div>
<h6><i class="bi bi-person-lines-fill"></i> Existing Contacts</h6>
<small class="text-muted">View and manage your approved contacts</small>
</div>
<span class="badge counter-badge counter-ok rounded-pill" id="existingBadge" style="font-size: 1.1rem;">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
</span>
</div>
</div>
<!-- Cleanup Contacts Section -->
<div class="cleanup-section">
<h6>
<i class="bi bi-trash"></i>
<span>Cleanup Contacts</span>
<i class="bi bi-info-circle info-icon"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Remove contacts based on various filter criteria"></i>
</h6>
<!-- Basic Filters (Always visible) -->
<div class="mb-3">
<label for="cleanupNameFilter" class="form-label">Name Filter (optional):</label>
<input type="text" class="form-control" id="cleanupNameFilter" placeholder="Enter partial name to search...">
</div>
<!-- Advanced Filters (Collapsible) -->
<div class="mb-3">
<button class="btn btn-sm btn-outline-secondary w-100" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilters" aria-expanded="false" aria-controls="advancedFilters">
<i class="bi bi-sliders"></i> Advanced Filters
</button>
</div>
<div class="collapse" id="advancedFilters">
<!-- Contact Types -->
<div class="mb-3">
<label class="form-label">Contact Types:</label>
<div class="d-flex flex-wrap gap-2">
<div class="form-check">
<input class="form-check-input cleanup-type-filter" type="checkbox" value="1" id="cleanupTypeCLI" checked>
<label class="form-check-label" for="cleanupTypeCLI">CLI</label>
</div>
<div class="form-check">
<input class="form-check-input cleanup-type-filter" type="checkbox" value="2" id="cleanupTypeREP" checked>
<label class="form-check-label" for="cleanupTypeREP">REP</label>
</div>
<div class="form-check">
<input class="form-check-input cleanup-type-filter" type="checkbox" value="3" id="cleanupTypeROOM" checked>
<label class="form-check-label" for="cleanupTypeROOM">ROOM</label>
</div>
<div class="form-check">
<input class="form-check-input cleanup-type-filter" type="checkbox" value="4" id="cleanupTypeSENS" checked>
<label class="form-check-label" for="cleanupTypeSENS">SENS</label>
</div>
</div>
</div>
<!-- Date Field -->
<div class="mb-3">
<label class="form-label">Date Field:</label>
<div class="d-flex gap-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="cleanupDateField" id="cleanupDateLastAdvert" value="last_advert" checked>
<label class="form-check-label" for="cleanupDateLastAdvert">Last Advert</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="cleanupDateField" id="cleanupDateLastMod" value="lastmod">
<label class="form-check-label" for="cleanupDateLastMod">Last Modified</label>
</div>
</div>
</div>
<!-- Days of Inactivity -->
<div class="mb-3">
<label for="cleanupDays" class="form-label">Days of Inactivity (0 = ignore):</label>
<input type="number" class="form-control" id="cleanupDays" value="0" min="0">
<small class="form-text text-muted">Contacts inactive for more than this many days will be selected</small>
</div>
</div>
<button class="btn btn-warning" id="cleanupPreviewBtn">
<i class="bi bi-eye"></i> Preview Cleanup
</button>
</div>
</div>
<!-- Cleanup Confirmation Modal -->
<div class="modal fade" id="cleanupConfirmModal" tabindex="-1" aria-labelledby="cleanupConfirmModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header bg-warning">
<h5 class="modal-title" id="cleanupConfirmModalLabel">
<i class="bi bi-exclamation-triangle"></i> Confirm Contact Cleanup
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="fw-bold">The following <span id="cleanupContactCount">0</span> contact(s) will be permanently deleted:</p>
<div id="cleanupContactList" class="list-group mb-3" style="max-height: 300px; overflow-y: auto;">
<!-- Contact list will be populated here -->
</div>
<div class="alert alert-warning mb-0">
<i class="bi bi-exclamation-circle"></i>
<strong>Warning:</strong> This action cannot be undone!
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" id="confirmCleanupBtn">
<i class="bi bi-trash"></i> Delete Contacts
</button>
</div>
</div>
</div>
</div>
{% endblock %}