Files
nextsnap/app/templates/browser.html
kamaji cad4118f72 Add NextSnap PWA with photo gallery viewer and continuous capture
Offline-first photo capture app for Nextcloud with:
- Camera capture with continuous mode (auto-reopens after each photo)
- File browser with fullscreen image gallery, swipe navigation, and rename
- Upload queue with background sync engine
- Admin panel for Nextcloud user management
- Service worker for offline-first caching (v13)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 04:53:13 -06:00

485 lines
9.7 KiB
HTML

{% extends "base.html" %}
{% block title %}Files - NextSnap{% endblock %}
{% block content %}
<div class="container">
<div class="header">
<h1>File Browser</h1>
<button class="btn btn-primary btn-small" id="new-folder-btn">+ New Folder</button>
</div>
<div class="breadcrumb" id="breadcrumb">
<span class="breadcrumb-item">Loading...</span>
</div>
<div class="file-list" id="file-list">
<p class="loading">Loading...</p>
</div>
</div>
<!-- Gallery Overlay -->
<div class="gallery-overlay" id="gallery-overlay" style="display:none">
<div class="gallery-header">
<button class="gallery-btn gallery-close-btn" id="gallery-close-btn">&times;</button>
<span class="gallery-counter" id="gallery-counter">1 / 1</span>
<button class="gallery-btn gallery-rename-btn" id="gallery-rename-btn">Rename</button>
</div>
<div class="gallery-image-container" id="gallery-image-container">
<div class="gallery-spinner" id="gallery-spinner">
<div class="spinner"></div>
</div>
<img class="gallery-image" id="gallery-image" alt="" />
</div>
<button class="gallery-nav gallery-nav-left" id="gallery-prev-btn">&#8249;</button>
<button class="gallery-nav gallery-nav-right" id="gallery-next-btn">&#8250;</button>
<div class="gallery-filename-bar" id="gallery-filename-bar">
<span id="gallery-filename"></span>
</div>
<!-- Gallery toast -->
<div class="gallery-toast" id="gallery-toast"></div>
</div>
<!-- Rename Modal -->
<div class="gallery-rename-backdrop" id="gallery-rename-backdrop" style="display:none">
<div class="gallery-rename-modal">
<h3>Rename File</h3>
<div class="gallery-rename-input-row">
<input type="text" id="gallery-rename-input" class="gallery-rename-input" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
<span class="gallery-rename-ext" id="gallery-rename-ext">.jpg</span>
</div>
<div class="gallery-rename-error" id="gallery-rename-error"></div>
<div class="gallery-rename-buttons">
<button class="btn gallery-rename-cancel" id="gallery-rename-cancel">Cancel</button>
<button class="btn btn-primary gallery-rename-save" id="gallery-rename-save">Save</button>
</div>
</div>
</div>
{% endblock %}
{% block extra_css %}
<style>
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 0;
border-bottom: 1px solid var(--bg-tertiary);
margin-bottom: 1rem;
}
.btn-small {
padding: 0.5rem 1rem;
font-size: 0.9rem;
min-height: auto;
}
.breadcrumb {
padding: 0.75rem 0;
font-size: 0.9rem;
color: var(--text-secondary);
overflow-x: auto;
white-space: nowrap;
}
.breadcrumb-item {
color: var(--accent);
text-decoration: none;
cursor: pointer;
}
.breadcrumb-item:hover {
text-decoration: underline;
}
.breadcrumb-item.current {
color: var(--text-primary);
cursor: default;
}
.breadcrumb-item.current:hover {
text-decoration: none;
}
.file-list {
margin-bottom: 5rem;
}
.file-items {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-bottom: 1rem;
}
.file-item {
display: flex;
align-items: center;
gap: 1rem;
padding: 1rem;
background: var(--bg-secondary);
border-radius: 8px;
cursor: pointer;
transition: background 0.2s;
}
.file-item:hover {
background: var(--bg-tertiary);
}
.file-item:active {
transform: scale(0.98);
}
.file-icon {
font-size: 2rem;
flex-shrink: 0;
}
.file-info {
flex: 1;
min-width: 0;
}
.file-name {
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-size {
font-size: 0.85rem;
color: var(--text-secondary);
margin-top: 0.25rem;
}
.chevron {
font-size: 1.5rem;
color: var(--text-secondary);
}
.btn-select-folder {
margin-top: 1rem;
position: sticky;
bottom: 5rem;
}
.loading,
.empty-state,
.error-state {
text-align: center;
color: var(--text-secondary);
padding: 2rem 1rem;
}
.error-state {
color: var(--error);
}
.bottom-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
max-width: 480px;
margin: 0 auto;
background: var(--bg-secondary);
border-top: 1px solid var(--bg-tertiary);
display: flex;
justify-content: space-around;
padding: 0.5rem 0;
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
padding: 0.5rem;
color: var(--text-secondary);
text-decoration: none;
}
.nav-item.active {
color: var(--accent);
}
.nav-icon {
font-size: 1.5rem;
}
.nav-label {
font-size: 0.75rem;
}
/* Gallery Overlay */
body.gallery-open {
overflow: hidden;
}
.gallery-overlay {
position: fixed;
inset: 0;
background: #000;
z-index: 9999;
display: flex;
flex-direction: column;
}
.gallery-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1rem;
padding-top: max(0.75rem, env(safe-area-inset-top));
background: rgba(0,0,0,0.7);
z-index: 2;
flex-shrink: 0;
}
.gallery-btn {
background: none;
border: none;
color: #fff;
font-size: 1rem;
padding: 0.5rem;
min-width: 48px;
min-height: 48px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
.gallery-close-btn {
font-size: 2rem;
line-height: 1;
}
.gallery-counter {
color: #fff;
font-size: 1rem;
font-weight: 500;
}
.gallery-rename-btn {
font-size: 0.95rem;
color: var(--accent, #4dabf7);
}
.gallery-image-container {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
touch-action: pan-y;
}
.gallery-image {
max-width: 100%;
max-height: 100%;
object-fit: contain;
user-select: none;
-webkit-user-drag: none;
}
.gallery-spinner {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
}
.gallery-spinner .spinner {
width: 40px;
height: 40px;
border: 3px solid rgba(255,255,255,0.2);
border-top-color: #fff;
border-radius: 50%;
animation: gallery-spin 0.8s linear infinite;
}
@keyframes gallery-spin {
to { transform: rotate(360deg); }
}
.gallery-nav {
position: absolute;
top: 50%;
transform: translateY(-50%);
background: rgba(0,0,0,0.4);
border: none;
color: #fff;
font-size: 2.5rem;
padding: 1rem 0.5rem;
min-width: 48px;
min-height: 48px;
cursor: pointer;
z-index: 3;
border-radius: 4px;
line-height: 1;
}
.gallery-nav:disabled {
opacity: 0.2;
cursor: default;
}
.gallery-nav-left {
left: 0.5rem;
}
.gallery-nav-right {
right: 0.5rem;
}
.gallery-filename-bar {
padding: 0.75rem 1rem;
padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
background: rgba(0,0,0,0.7);
color: #ccc;
font-size: 0.9rem;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex-shrink: 0;
z-index: 2;
}
.gallery-toast {
position: fixed;
bottom: 80px;
left: 50%;
transform: translateX(-50%);
padding: 0.75rem 1.5rem;
border-radius: 8px;
font-size: 0.9rem;
z-index: 10001;
display: none;
white-space: nowrap;
}
.gallery-toast.success {
background: rgba(40, 167, 69, 0.9);
color: #fff;
}
.gallery-toast.error {
background: rgba(220, 53, 69, 0.9);
color: #fff;
}
/* Rename Modal */
.gallery-rename-backdrop {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.6);
z-index: 10000;
display: flex;
align-items: center;
justify-content: center;
padding: 1rem;
}
.gallery-rename-modal {
background: var(--bg-secondary, #2a2a3e);
border-radius: 12px;
padding: 1.5rem;
width: 100%;
max-width: 360px;
}
.gallery-rename-modal h3 {
margin: 0 0 1rem;
color: var(--text-primary, #fff);
font-size: 1.1rem;
}
.gallery-rename-input-row {
display: flex;
align-items: center;
gap: 0;
margin-bottom: 0.5rem;
}
.gallery-rename-input {
flex: 1;
padding: 0.75rem;
border: 1px solid var(--bg-tertiary, #444);
border-radius: 8px 0 0 8px;
background: var(--bg-primary, #1a1a2e);
color: var(--text-primary, #fff);
font-size: 1rem;
outline: none;
}
.gallery-rename-input:focus {
border-color: var(--accent, #4dabf7);
}
.gallery-rename-ext {
padding: 0.75rem 0.75rem;
background: var(--bg-tertiary, #444);
color: var(--text-secondary, #aaa);
border: 1px solid var(--bg-tertiary, #444);
border-left: none;
border-radius: 0 8px 8px 0;
font-size: 1rem;
white-space: nowrap;
}
.gallery-rename-error {
color: var(--error, #ff6b6b);
font-size: 0.85rem;
min-height: 1.25rem;
margin-bottom: 0.5rem;
}
.gallery-rename-buttons {
display: flex;
gap: 0.75rem;
justify-content: flex-end;
}
.gallery-rename-cancel,
.gallery-rename-save {
padding: 0.6rem 1.25rem;
border-radius: 8px;
font-size: 0.95rem;
cursor: pointer;
min-height: 44px;
}
.gallery-rename-cancel {
background: var(--bg-tertiary, #444);
color: var(--text-primary, #fff);
border: none;
}
.gallery-rename-save {
min-width: 80px;
}
</style>
{% endblock %}
{% block extra_js %}
<script src="{{ url_for('static', filename='js/filebrowser.js') }}"></script>
<script>
document.getElementById('logout-btn').addEventListener('click', async (e) => {
e.preventDefault();
if (confirm('Are you sure you want to logout?')) {
await Auth.logout();
}
});
</script>
{% endblock %}