botui/ui/suite/drive/index.html

1932 lines
65 KiB
HTML

{% extends "suite/base.html" %}
{% block title %}Drive - General Bots Suite{% endblock %}
{% block content %}
<div class="drive-container">
<!-- Sidebar -->
<aside class="drive-sidebar">
<button class="new-btn" onclick="document.getElementById('upload-modal').showModal()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
New
</button>
<nav class="nav-section">
<div class="nav-item active"
hx-get="/api/drive/files?path=/"
hx-target="#file-grid"
hx-swap="innerHTML"
onclick="setActiveNav(this)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
<polyline points="9 22 9 12 15 12 15 22"></polyline>
</svg>
<span class="nav-label">My Drive</span>
</div>
<div class="nav-item"
hx-get="/api/drive/files?filter=shared"
hx-target="#file-grid"
hx-swap="innerHTML"
onclick="setActiveNav(this)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
<circle cx="9" cy="7" r="4"></circle>
<path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
<path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
</svg>
<span class="nav-label">Shared with me</span>
</div>
<div class="nav-item"
hx-get="/api/drive/files?filter=recent"
hx-target="#file-grid"
hx-swap="innerHTML"
onclick="setActiveNav(this)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
<span class="nav-label">Recent</span>
</div>
<div class="nav-item"
hx-get="/api/drive/files?filter=starred"
hx-target="#file-grid"
hx-swap="innerHTML"
onclick="setActiveNav(this)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
</svg>
<span class="nav-label">Starred</span>
</div>
<div class="nav-item"
hx-get="/api/drive/files?filter=trash"
hx-target="#file-grid"
hx-swap="innerHTML"
onclick="setActiveNav(this)">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3 6 5 6 21 6"></polyline>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
</svg>
<span class="nav-label">Trash</span>
</div>
</nav>
<div class="storage-info">
<div class="storage-header">
<span class="storage-label">Storage</span>
<span class="storage-value" id="storage-used"
hx-get="/api/drive/storage"
hx-trigger="load"
hx-swap="innerHTML">
Loading...
</span>
</div>
<div class="storage-bar">
<div class="storage-bar-fill" id="storage-fill" style="width: 0%"></div>
</div>
<div class="storage-details">
<span id="storage-detail">Calculating...</span>
</div>
</div>
<!-- Sync Status Panel -->
<div class="sync-panel">
<div class="storage-header">
<span class="storage-label">Sync Status</span>
<span class="storage-value" id="sync-status"
hx-get="/files/sync/status"
hx-trigger="load, every 10s"
hx-swap="innerHTML">
Checking...
</span>
</div>
<div class="sync-actions" style="display: flex; gap: 8px; margin-top: 8px;">
<button class="btn-secondary" style="flex: 1; padding: 6px 12px; font-size: 12px;"
hx-post="/files/sync/start"
hx-swap="none"
hx-on::after-request="htmx.trigger('#sync-status', 'load')">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="vertical-align: middle; margin-right: 4px;">
<polyline points="23 4 23 10 17 10"></polyline>
<polyline points="1 20 1 14 7 14"></polyline>
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
</svg>
Start
</button>
<button class="btn-secondary" style="flex: 1; padding: 6px 12px; font-size: 12px;"
hx-post="/files/sync/stop"
hx-swap="none"
hx-on::after-request="htmx.trigger('#sync-status', 'load')">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="vertical-align: middle; margin-right: 4px;">
<rect x="6" y="4" width="4" height="16"></rect>
<rect x="14" y="4" width="4" height="16"></rect>
</svg>
Stop
</button>
</div>
</div>
</aside>
<!-- Main Content -->
<main class="drive-main">
<!-- Toolbar -->
<div class="drive-toolbar">
<div class="breadcrumb" id="breadcrumb"
hx-get="/api/drive/breadcrumb"
hx-trigger="load"
hx-swap="innerHTML">
<div class="breadcrumb-item current">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
</svg>
My Drive
</div>
</div>
<div class="toolbar-center">
<div class="search-box">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
<input type="text"
placeholder="Search in Drive..."
name="q"
hx-get="/api/drive/search"
hx-trigger="keyup changed delay:300ms"
hx-target="#file-grid"
hx-swap="innerHTML">
</div>
</div>
<div class="toolbar-actions">
<div class="view-toggle">
<button class="view-btn active" id="grid-view-btn" title="Grid view" onclick="setView('grid')">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="7" height="7"></rect>
<rect x="14" y="3" width="7" height="7"></rect>
<rect x="14" y="14" width="7" height="7"></rect>
<rect x="3" y="14" width="7" height="7"></rect>
</svg>
</button>
<button class="view-btn" id="list-view-btn" title="List view" onclick="setView('list')">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="8" y1="6" x2="21" y2="6"></line>
<line x1="8" y1="12" x2="21" y2="12"></line>
<line x1="8" y1="18" x2="21" y2="18"></line>
<line x1="3" y1="6" x2="3.01" y2="6"></line>
<line x1="3" y1="12" x2="3.01" y2="12"></line>
<line x1="3" y1="18" x2="3.01" y2="18"></line>
</svg>
</button>
</div>
<select class="sort-dropdown" id="sort-dropdown"
hx-get="/api/drive/files"
hx-target="#file-grid"
hx-swap="innerHTML"
hx-include="[name='path']">
<option value="name">Name</option>
<option value="modified">Last modified</option>
<option value="size">File size</option>
<option value="type">Type</option>
</select>
<button class="icon-btn" title="Document Tools" onclick="document.getElementById('docs-modal').showModal()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
<polyline points="14 2 14 8 20 8"></polyline>
<line x1="12" y1="18" x2="12" y2="12"></line>
<line x1="9" y1="15" x2="15" y2="15"></line>
</svg>
</button>
<button class="icon-btn" title="Info" onclick="toggleInfoPanel()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"></circle>
<line x1="12" y1="16" x2="12" y2="12"></line>
<line x1="12" y1="8" x2="12.01" y2="8"></line>
</svg>
</button>
</div>
</div>
<!-- File Content Area -->
<div class="file-content" id="file-content">
<input type="hidden" name="path" id="current-path" value="/">
<!-- File Grid -->
<div class="file-grid" id="file-grid"
hx-get="/api/drive/files?path=/"
hx-trigger="load"
hx-swap="innerHTML">
<div class="loading-state">
<div class="spinner"></div>
<p>Loading files...</p>
</div>
</div>
</div>
<!-- Selection Bar (shown when files selected) -->
<div class="selection-bar" id="selection-bar" style="display: none;">
<span class="selection-count"><span id="selected-count">0</span> selected</span>
<div class="selection-actions">
<button class="action-btn" title="Share"
hx-post="/api/drive/share"
hx-include=".file-checkbox:checked"
hx-swap="none">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="18" cy="5" r="3"></circle>
<circle"" cx="6" cy="12" r="3"></circle>
<circle cx="18" cy="19" r="3"></circle>
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line>
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line>
</svg>
Share
</button>
<button class="action-btn" title="Download"
hx-get="/api/drive/download"
hx-include=".file-checkbox:checked">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
Download
</button>
<button class="action-btn" title="Copy"
onclick="document.getElementById('copy-modal').showModal()">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
Copy
</button>
<button class="action-btn" title="Move"
onclick="document.getElementById('move-modal').showModal()">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
</svg>
Move
</button>
<button class="action-btn danger" title="Delete"
hx-delete="/api/drive/files"
hx-include=".file-checkbox:checked"
hx-confirm="Move selected items to trash?"
hx-target="#file-grid"
hx-swap="innerHTML">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3 6 5 6 21 6"></polyline>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
</svg>
Delete
</button>
</div>
<button class="close-selection" onclick="clearSelection()">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
</main>
<!-- Info Panel (right sidebar) -->
<aside class="info-panel" id="info-panel" style="display: none;">
<div class="info-header">
<h3>Details</h3>
<button class="close-btn" onclick="toggleInfoPanel()">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="info-content" id="info-content">
<div class="info-empty">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<circle cx="12" cy="12" r="10"></circle>
<line x1="12" y1="16" x2="12" y2="12"></line>
<line x1="12" y1="8" x2="12.01" y2="8"></line>
</svg>
<p>Select a file to see details</p>
</div>
</div>
</aside>
</div>
<!-- Upload Modal -->
<dialog class="modal" id="upload-modal">
<div class="modal-content">
<div class="modal-header">
<h2>Upload Files</h2>
<button class="close-btn" onclick="document.getElementById('upload-modal').close()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<div class="upload-zone" id="upload-zone"
hx-post="/api/drive/upload"
hx-encoding="multipart/form-data"
hx-target="#file-grid"
hx-swap="innerHTML">
<input type="file" id="file-input" name="files" multiple hidden>
<input type="hidden" name="path" id="upload-path" value="/">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="17 8 12 3 7 8"></polyline>
<line x1="12" y1="3" x2="12" y2="15"></line>
</svg>
<p class="upload-text">Drag files here or <strong>click to browse</strong></p>
<p class="upload-hint">Maximum file size: 100MB</p>
</div>
<div class="upload-progress" id="upload-progress" style="display: none;">
<div class="progress-bar">
<div class="progress-fill" id="progress-fill"></div>
</div>
<p class="progress-text" id="progress-text">Uploading...</p>
</div>
</div>
<div class="modal-footer">
<button class="btn-secondary" onclick="document.getElementById('upload-modal').close()">Cancel</button>
<button class="btn-primary" onclick="triggerUpload()">Upload</button>
</div>
</div>
</dialog>
<!-- New Folder Modal -->
<dialog class="modal" id="folder-modal">
<form class="modal-content"
hx-post="/api/drive/folder"
hx-target="#file-grid"
hx-swap="innerHTML"
hx-on::after-request="document.getElementById('folder-modal').close()">
<div class="modal-header">
<h2>New Folder</h2>
<button type="button" class="close-btn" onclick="document.getElementById('folder-modal').close()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<input type="hidden" name="path" id="folder-path" value="/">
<div class="form-group">
<label for="folder-name">Folder name</label>
<input type="text" id="folder-name" name="name" placeholder="Untitled folder" required autofocus>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" onclick="document.getElementById('folder-modal').close()">Cancel</button>
<button type="submit" class="btn-primary">Create</button>
</div>
</form>
</dialog>
<!-- Preview Modal -->
<dialog class="modal modal-large" id="preview-modal">
<div class="modal-content">
<div class="modal-header">
<h2 id="preview-title">Preview</h2>
<div class="preview-actions">
<button class="icon-btn" title="Download" id="preview-download">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
</button>
<button class="icon-btn" title="Share" id="preview-share">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="18" cy="5" r="3"></circle>
<circle cx="6" cy="12" r="3"></circle>
<circle cx="18" cy="19" r="3"></circle>
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line>
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line>
</svg>
</button>
<button class="close-btn" onclick="document.getElementById('preview-modal').close()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
</div>
<div class="modal-body preview-body" id="preview-content">
<!-- Preview content loaded dynamically -->
</div>
</div>
</dialog>
<!-- Copy Modal -->
<dialog class="modal" id="copy-modal">
<form class="modal-content"
hx-post="/files/copy"
hx-target="#file-grid"
hx-swap="innerHTML"
hx-on::after-request="document.getElementById('copy-modal').close()">
<div class="modal-header">
<h2>Copy to</h2>
<button type="button" class="close-btn" onclick="document.getElementById('copy-modal').close()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<input type="hidden" name="source" id="copy-source" value="">
<div class="form-group">
<label for="copy-destination">Destination folder</label>
<select id="copy-destination" name="destination" class="sort-dropdown" style="width: 100%;"
hx-get="/api/drive/folders"
hx-trigger="load"
hx-swap="innerHTML">
<option value="/">/ (Root)</option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" onclick="document.getElementById('copy-modal').close()">Cancel</button>
<button type="submit" class="btn-primary">Copy</button>
</div>
</form>
</dialog>
<!-- Move Modal -->
<dialog class="modal" id="move-modal">
<form class="modal-content"
hx-post="/files/move"
hx-target="#file-grid"
hx-swap="innerHTML"
hx-on::after-request="document.getElementById('move-modal').close()">
<div class="modal-header">
<h2>Move to</h2>
<button type="button" class="close-btn" onclick="document.getElementById('move-modal').close()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<input type="hidden" name="source" id="move-source" value="">
<div class="form-group">
<label for="move-destination">Destination folder</label>
<select id="move-destination" name="destination" class="sort-dropdown" style="width: 100%;"
hx-get="/api/drive/folders"
hx-trigger="load"
hx-swap="innerHTML">
<option value="/">/ (Root)</option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" onclick="document.getElementById('move-modal').close()">Cancel</button>
<button type="submit" class="btn-primary">Move</button>
</div>
</form>
</dialog>
<!-- Permissions Modal -->
<dialog class="modal" id="permissions-modal">
<div class="modal-content">
<div class="modal-header">
<h2>Permissions</h2>
<button type="button" class="close-btn" onclick="document.getElementById('permissions-modal').close()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<input type="hidden" name="path" id="permissions-path" value="">
<div id="permissions-content"
hx-get="/files/permissions"
hx-trigger="load"
hx-vals="js:{path: document.getElementById('permissions-path').value}"
hx-swap="innerHTML">
<div class="loading-state">
<div class="spinner"></div>
<p>Loading permissions...</p>
</div>
</div>
<div class="form-group" style="margin-top: 16px;">
<label>Share with</label>
<div style="display: flex; gap: 8px;">
<input type="email" id="share-email" placeholder="Enter email address" style="flex: 1;">
<select id="share-permission" class="sort-dropdown">
<option value="read">Can view</option>
<option value="write">Can edit</option>
<option value="admin">Full access</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" onclick="document.getElementById('permissions-modal').close()">Close</button>
<button type="button" class="btn-primary"
hx-post="/files/shareFolder"
hx-include="#permissions-path, #share-email, #share-permission"
hx-swap="none"
hx-on::after-request="htmx.trigger('#permissions-content', 'load')">
Share
</button>
</div>
</div>
</dialog>
<!-- Document Processing Modal -->
<dialog class="modal modal-large" id="docs-modal">
<div class="modal-content">
<div class="modal-header">
<h2>Document Tools</h2>
<button type="button" class="close-btn" onclick="document.getElementById('docs-modal').close()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<div class="docs-tools-grid">
<!-- Merge Documents -->
<div class="docs-tool-card">
<h3>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M8 6h13"></path>
<path d="M8 12h13"></path>
<path d="M8 18h13"></path>
<path d="M3 6h.01"></path>
<path d="M3 12h.01"></path>
<path d="M3 18h.01"></path>
</svg>
Merge Documents
</h3>
<p>Combine multiple documents into one</p>
<form hx-post="/docs/merge"
hx-target="#docs-result"
hx-swap="innerHTML"
hx-encoding="multipart/form-data">
<input type="file" name="files" multiple accept=".pdf,.docx,.doc,.txt" class="form-group" style="margin-bottom: 8px;">
<input type="text" name="output_name" placeholder="Output filename" class="form-group" style="width: 100%; margin-bottom: 8px;">
<button type="submit" class="btn-primary" style="width: 100%;">Merge</button>
</form>
</div>
<!-- Convert Document -->
<div class="docs-tool-card">
<h3>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="17 1 21 5 17 9"></polyline>
<path d="M3 11V9a4 4 0 0 1 4-4h14"></path>
<polyline points="7 23 3 19 7 15"></polyline>
<path d="M21 13v2a4 4 0 0 1-4 4H3"></path>
</svg>
Convert Format
</h3>
<p>Convert between document formats</p>
<form hx-post="/docs/convert"
hx-target="#docs-result"
hx-swap="innerHTML"
hx-encoding="multipart/form-data">
<input type="file" name="file" accept=".pdf,.docx,.doc,.txt,.md,.html" class="form-group" style="margin-bottom: 8px;">
<select name="format" class="sort-dropdown" style="width: 100%; margin-bottom: 8px;">
<option value="pdf">PDF</option>
<option value="docx">Word (DOCX)</option>
<option value="txt">Plain Text</option>
<option value="md">Markdown</option>
<option value="html">HTML</option>
</select>
<button type="submit" class="btn-primary" style="width: 100%;">Convert</button>
</form>
</div>
<!-- Fill Template -->
<div class="docs-tool-card">
<h3>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
<polyline points="14 2 14 8 20 8"></polyline>
<line x1="16" y1="13" x2="8" y2="13"></line>
<line x1="16" y1="17" x2="8" y2="17"></line>
</svg>
Fill Template
</h3>
<p>Populate template with data</p>
<form hx-post="/docs/fill"
hx-target="#docs-result"
hx-swap="innerHTML"
hx-encoding="multipart/form-data">
<input type="file" name="template" accept=".docx,.doc" class="form-group" style="margin-bottom: 8px;">
<input type="file" name="data" accept=".json,.csv" class="form-group" style="margin-bottom: 8px;">
<button type="submit" class="btn-primary" style="width: 100%;">Fill</button>
</form>
</div>
<!-- Export Document -->
<div class="docs-tool-card">
<h3>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
Export
</h3>
<p>Export document in specified format</p>
<form hx-post="/docs/export"
hx-target="#docs-result"
hx-swap="innerHTML">
<input type="text" name="path" placeholder="File path (e.g., /documents/report.docx)" class="form-group" style="width: 100%; margin-bottom: 8px;">
<select name="format" class="sort-dropdown" style="width: 100%; margin-bottom: 8px;">
<option value="pdf">PDF</option>
<option value="docx">Word (DOCX)</option>
<option value="txt">Plain Text</option>
</select>
<button type="submit" class="btn-primary" style="width: 100%;">Export</button>
</form>
</div>
<!-- Import Document -->
<div class="docs-tool-card">
<h3>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="17 8 12 3 7 8"></polyline>
<line x1="12" y1="3" x2="12" y2="15"></line>
</svg>
Import
</h3>
<p>Import document from URL or upload</p>
<form hx-post="/docs/import"
hx-target="#docs-result"
hx-swap="innerHTML"
hx-encoding="multipart/form-data">
<input type="url" name="url" placeholder="Document URL (optional)" class="form-group" style="width: 100%; margin-bottom: 8px;">
<input type="file" name="file" class="form-group" style="margin-bottom: 8px;">
<input type="text" name="destination" placeholder="Destination folder" value="/" class="form-group" style="width: 100%; margin-bottom: 8px;">
<button type="submit" class="btn-primary" style="width: 100%;">Import</button>
</form>
</div>
</div>
<!-- Result area -->
<div id="docs-result" style="margin-top: 16px;"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" onclick="document.getElementById('docs-modal').close()">Close</button>
</div>
</div>
</dialog>
<!-- Versions Modal -->
<dialog class="modal" id="versions-modal">
<div class="modal-content">
<div class="modal-header">
<h2>Version History</h2>
<button type="button" class="close-btn" onclick="document.getElementById('versions-modal').close()">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<input type="hidden" name="path" id="versions-path" value="">
<div id="versions-list"
hx-get="/files/versions"
hx-trigger="load"
hx-vals="js:{path: document.getElementById('versions-path').value}"
hx-swap="innerHTML">
<div class="loading-state">
<div class="spinner"></div>
<p>Loading versions...</p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" onclick="document.getElementById('versions-modal').close()">Close</button>
</div>
</div>
</dialog>
<!-- Context Menu -->
<div class="context-menu" id="context-menu" style="display: none;">
<button class="context-item" data-action="open">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
<line x1="10" y1="14" x2="21" y2="3"></line>
</svg>
Open
</button>
<button class="context-item" data-action="preview">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
Preview
</button>
<div class="context-divider"></div>
<button class="context-item" data-action="download">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
Download
</button>
<button class="context-item" data-action="share"
onclick="document.getElementById('context-menu').style.display='none'; document.getElementById('permissions-modal').showModal();">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="18" cy="5" r="3"></circle>
<circle cx="6" cy="12" r="3"></circle>
<circle cx="18" cy="19" r="3"></circle>
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line>
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line>
</svg>
Share
</button>
<div class="context-divider"></div>
<button class="context-item" data-action="rename">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
</svg>
Rename
</button>
<button class="context-item" data-action="copy"
onclick="document.getElementById('context-menu').style.display='none'; document.getElementById('copy-modal').showModal();">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
Copy to
</button>
<button class="context-item" data-action="move"
onclick="document.getElementById('context-menu').style.display='none'; document.getElementById('move-modal').showModal();">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
</svg>
Move to
</button>
<button class="context-item" data-action="star">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
</svg>
Add to starred
</button>
<button class="context-item" data-action="versions"
onclick="document.getElementById('context-menu').style.display='none'; document.getElementById('versions-modal').showModal(); htmx.trigger('#versions-list', 'load');">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
Version history
</button>
<div class="context-divider"></div>
<button class="context-item danger" data-action="delete">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3 6 5 6 21 6"></polyline>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
</svg>
Move to trash
</button>
</div>
<!-- Drop Overlay -->
<div class="drop-overlay" id="drop-overlay">
<div class="drop-zone">
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="17 8 12 3 7 8"></polyline>
<line x1="12" y1="3" x2="12" y2="15"></line>
</svg>
<p>Drop files to upload</p>
</div>
</div>
<style>
.drive-container {
display: grid;
grid-template-columns: 240px 1fr;
height: calc(100vh - 56px);
overflow: hidden;
}
/* Sidebar */
.drive-sidebar {
background: var(--surface);
border-right: 1px solid var(--border);
padding: 16px 12px;
display: flex;
flex-direction: column;
overflow-y: auto;
}
.new-btn {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
width: 100%;
padding: 12px 16px;
background: var(--primary);
color: white;
border: none;
border-radius: 24px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
margin-bottom: 20px;
transition: all 0.2s;
}
.new-btn:hover {
background: var(--primary-hover);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.nav-section {
display: flex;
flex-direction: column;
gap: 4px;
margin-bottom: 24px;
}
.nav-item {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 12px;
border-radius: 8px;
color: var(--text-secondary);
text-decoration: none;
cursor: pointer;
transition: all 0.15s;
}
.nav-item:hover {
background: var(--surface-hover);
color: var(--text);
}
.nav-item.active {
background: var(--primary-light);
color: var(--primary);
}
.nav-label {
font-size: 14px;
}
.storage-info {
margin-top: auto;
padding: 16px;
background: var(--surface-hover);
border-radius: 12px;
}
.storage-header {
display: flex;
justify-content: space-between;
margin-bottom: 12px;
}
.storage-label {
font-size: 13px;
color: var(--text-secondary);
}
.storage-value {
font-size: 13px;
font-weight: 500;
}
.storage-bar {
height: 6px;
background: var(--border);
border-radius: 3px;
overflow: hidden;
margin-bottom: 8px;
}
.storage-bar-fill {
height: 100%;
background: linear-gradient(90deg, var(--primary), #a855f7);
border-radius: 3px;
transition: width 0.3s;
}
.storage-details {
font-size: 12px;
color: var(--text-secondary);
}
/* Document Tools Grid */
.docs-tools-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 16px;
}
.docs-tool-card {
background: var(--surface-hover);
border-radius: 12px;
padding: 16px;
border: 1px solid var(--border);
}
.docs-tool-card h3 {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
font-weight: 600;
margin: 0 0 8px 0;
}
.docs-tool-card h3 svg {
color: var(--primary);
}
.docs-tool-card p {
font-size: 12px;
color: var(--text-secondary);
margin: 0 0 12px 0;
}
.docs-tool-card input[type="file"] {
font-size: 12px;
padding: 8px;
border: 1px dashed var(--border);
border-radius: 6px;
background: var(--surface);
width: 100%;
box-sizing: border-box;
}
.docs-tool-card input[type="text"],
.docs-tool-card input[type="url"] {
padding: 8px 12px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--surface);
color: var(--text);
font-size: 13px;
}
.docs-tool-card input[type="text"]:focus,
.docs-tool-card input[type="url"]:focus {
outline: none;
border-color: var(--primary);
}
/* Sync Panel */
.sync-panel {
padding: 16px;
background: var(--surface-hover);
border-radius: 12px;
margin-top: 12px;
}
.sync-panel .storage-header {
margin-bottom: 8px;
}
.sync-actions button {
border: 1px solid var(--border);
border-radius: 6px;
background: var(--surface);
color: var(--text);
cursor: pointer;
transition: background 0.2s, border-color 0.2s;
}
.sync-actions button:hover {
background: var(--surface-hover);
border-color: var(--primary);
}
/* Main Content */
.drive-main {
display: flex;
flex-direction: column;
overflow: hidden;
position: relative;
}
.drive-toolbar {
display: flex;
align-items: center;
gap: 16px;
padding: 12px 24px;
border-bottom: 1px solid var(--border);
background: var(--surface);
}
.breadcrumb {
display: flex;
align-items: center;
gap: 4px;
flex-shrink: 0;
}
.breadcrumb-item {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 10px;
border-radius: 6px;
font-size: 14px;
color: var(--text-secondary);
cursor: pointer;
transition: all 0.15s;
}
.breadcrumb-item:hover {
background: var(--surface-hover);
color: var(--text);
}
.breadcrumb-item.current {
color: var(--text);
font-weight: 500;
}
.breadcrumb-separator {
color: var(--text-secondary);
font-size: 12px;
}
.toolbar-center {
flex: 1;
display: flex;
justify-content: center;
}
.search-box {
display: flex;
align-items: center;
gap: 10px;
background: var(--surface-hover);
border: 1px solid var(--border);
border-radius: 8px;
padding: 8px 16px;
width: 100%;
max-width: 400px;
}
.search-box svg {
color: var(--text-secondary);
flex-shrink: 0;
}
.search-box input {
flex: 1;
background: transparent;
border: none;
outline: none;
color: var(--text);
font-size: 14px;
}
.search-box input::placeholder {
color: var(--text-secondary);
}
.toolbar-actions {
display: flex;
align-items: center;
gap: 8px;
}
.view-toggle {
display: flex;
background: var(--surface-hover);
border-radius: 6px;
padding: 2px;
}
.view-btn {
background: transparent;
border: none;
color: var(--text-secondary);
width: 32px;
height: 32px;
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s;
}
.view-btn:hover {
color: var(--text);
}
.view-btn.active {
background: var(--surface);
color: var(--text);
}
.sort-dropdown {
background: var(--surface-hover);
border: 1px solid var(--border);
border-radius: 6px;
padding: 8px 12px;
color: var(--text);
font-size: 13px;
cursor: pointer;
}
.icon-btn {
background: transparent;
border: none;
color: var(--text-secondary);
width: 36px;
height: 36px;
border-radius: 8px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s;
}
.icon-btn:hover {
background: var(--surface-hover);
color: var(--text);
}
/* File Content */
.file-content {
flex: 1;
overflow-y: auto;
padding: 24px;
}
.file-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 16px;
}
.file-grid.list-view {
display: flex;
flex-direction: column;
gap: 2px;
}
/* File Card */
.file-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 16px;
cursor: pointer;
transition: all 0.2s;
position: relative;
}
.file-card:hover {
background: var(--surface-hover);
border-color: var(--primary);
}
.file-card.selected {
border-color: var(--primary);
background: var(--primary-light);
}
.file-card-checkbox {
position: absolute;
top: 8px;
left: 8px;
width: 20px;
height: 20px;
opacity: 0;
transition: opacity 0.15s;
}
.file-card:hover .file-card-checkbox,
.file-card.selected .file-card-checkbox {
opacity: 1;
}
.file-card-preview {
width: 100%;
aspect-ratio: 4/3;
background: var(--surface-hover);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 12px;
overflow: hidden;
}
.file-card-preview img {
width: 100%;
height: 100%;
object-fit: cover;
}
.file-card-preview svg {
width: 48px;
height: 48px;
color: var(--text-secondary);
}
.file-card-preview.folder svg {
color: #eab308;
}
.file-card-preview.document svg {
color: var(--primary);
}
.file-card-preview.image svg {
color: #a855f7;
}
.file-card-preview.video svg {
color: #ef4444;
}
.file-card-preview.audio svg {
color: #22c55e;
}
.file-card-name {
font-size: 14px;
font-weight: 500;
margin-bottom: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.file-card-meta {
font-size: 12px;
color: var(--text-secondary);
}
.file-card-star {
position: absolute;
top: 8px;
right: 8px;
color: #eab308;
display: none;
}
.file-card.starred .file-card-star {
display: block;
}
/* List View */
.file-grid.list-view .file-card {
display: grid;
grid-template-columns: 20px 40px 1fr 100px 100px 120px;
align-items: center;
gap: 16px;
padding: 12px 16px;
border-radius: 0;
border-left: none;
border-right: none;
border-top: none;
}
.file-grid.list-view .file-card-checkbox {
position: static;
opacity: 1;
}
.file-grid.list-view .file-card-preview {
width: 40px;
height: 40px;
aspect-ratio: 1;
margin-bottom: 0;
}
.file-grid.list-view .file-card-preview svg {
width: 24px;
height: 24px;
}
.file-grid.list-view .file-card-info {
display: contents;
}
.file-grid.list-view .file-card-name {
margin-bottom: 0;
}
.file-grid.list-view .file-card-star {
position: static;
}
/* Selection Bar */
.selection-bar {
position: absolute;
bottom: 24px;
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 16px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 12px 20px;
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}
.selection-count {
font-size: 14px;
font-weight: 500;
}
.selection-actions {
display: flex;
gap: 8px;
}
.action-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 12px;
background: var(--surface-hover);
border: none;
border-radius: 6px;
color: var(--text);
font-size: 13px;
cursor: pointer;
transition: all 0.15s;
}
.action-btn:hover {
background: var(--primary-light);
color: var(--primary);
}
.action-btn.danger:hover {
background: rgba(239, 68, 68, 0.1);
color: var(--error);
}
.close-selection {
background: transparent;
border: none;
color: var(--text-secondary);
cursor: pointer;
padding: 4px;
}
/* Info Panel */
.info-panel {
width: 320px;
background: var(--surface);
border-left: 1px solid var(--border);
overflow-y: auto;
}
.info-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid var(--border);
}
.info-header h3 {
font-size: 16px;
font-weight: 600;
margin: 0;
}
.close-btn {
background: transparent;
border: none;
color: var(--text-secondary);
cursor: pointer;
padding: 4px;
}
.close-btn:hover {
color: var(--text);
}
.info-content {
padding: 20px;
}
.info-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
padding: 40px 20px;
color: var(--text-secondary);
}
.info-empty svg {
margin-bottom: 16px;
opacity: 0.5;
}
/* Modal */
.modal {
background: transparent;
border: none;
padding: 0;
max-width: 500px;
width: 90%;
}
.modal::backdrop {
background: rgba(0, 0, 0, 0.7);
}
.modal-large {
max-width: 900px;
}
.modal-content {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 16px;
overflow: hidden;
}
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 24px;
border-bottom: 1px solid var(--border);
}
.modal-header h2 {
font-size: 18px;
font-weight: 600;
margin: 0;
}
.preview-actions {
display: flex;
gap: 8px;
}
.modal-body {
padding: 24px;
}
.preview-body {
min-height: 400px;
display: flex;
align-items: center;
justify-content: center;
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
padding: 16px 24px;
border-top: 1px solid var(--border);
}
.btn-secondary {
padding: 10px 20px;
background: var(--surface-hover);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.15s;
}
.btn-secondary:hover {
background: var(--border);
}
.btn-primary {
padding: 10px 20px;
background: var(--primary);
border: none;
border-radius: 8px;
color: white;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.15s;
}
.btn-primary:hover {
background: var(--primary-hover);
}
/* Upload Zone */
.upload-zone {
border: 2px dashed var(--border);
border-radius: 12px;
padding: 48px 24px;
text-align: center;
cursor: pointer;
transition: all 0.2s;
}
.upload-zone:hover,
.upload-zone.dragover {
border-color: var(--primary);
background: var(--primary-light);
}
.upload-zone svg {
color: var(--text-secondary);
margin-bottom: 16px;
}
.upload-text {
font-size: 15px;
color: var(--text-secondary);
margin: 0 0 8px 0;
}
.upload-text strong {
color: var(--primary);
}
.upload-hint {
font-size: 13px;
color: var(--text-secondary);
margin: 0;
}
.upload-progress {
padding: 20px;
}
.progress-bar {
height: 8px;
background: var(--surface-hover);
border-radius: 4px;
overflow: hidden;
margin-bottom: 12px;
}
.progress-fill {
height: 100%;
background: var(--primary);
border-radius: 4px;
transition: width 0.3s;
}
.progress-text {
font-size: 13px;
color: var(--text-secondary);
text-align: center;
margin: 0;
}
/* Form */
.form-group {
margin-bottom: 16px;
}
.form-group label {
display: block;
font-size: 14px;
font-weight: 500;
margin-bottom: 8px;
}
.form-group input {
width: 100%;
padding: 10px 12px;
background: var(--surface-hover);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-size: 14px;
}
.form-group input:focus {
outline: none;
border-color: var(--primary);
}
/* Context Menu */
.context-menu {
position: fixed;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 8px;
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
z-index: 1000;
min-width: 180px;
}
.context-item {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
padding: 10px 12px;
background: transparent;
border: none;
border-radius: 6px;
color: var(--text);
font-size: 13px;
cursor: pointer;
transition: all 0.15s;
text-align: left;
}
.context-item:hover {
background: var(--surface-hover);
}
.context-item.danger {
color: var(--error);
}
.context-item.danger:hover {
background: rgba(239, 68, 68, 0.1);
}
.context-divider {
height: 1px;
background: var(--border);
margin: 8px 0;
}
/* Drop Overlay */
.drop-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.8);
display: none;
align-items: center;
justify-content: center;
z-index: 1000;
}
.drop-overlay.visible {
display: flex;
}
.drop-zone {
border: 3px dashed var(--primary);
border-radius: 24px;
padding: 64px;
text-align: center;
color: white;
}
.drop-zone svg {
margin-bottom: 16px;
color: var(--primary);
}
.drop-zone p {
font-size: 18px;
margin: 0;
}
/* Loading State */
.loading-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 60px;
color: var(--text-secondary);
}
.spinner {
width: 40px;
height: 40px;
border: 3px solid var(--border);
border-top-color: var(--primary);
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 16px;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Empty State */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 80px 20px;
text-align: center;
}
.empty-state svg {
width: 64px;
height: 64px;
color: var(--text-secondary);
margin-bottom: 16px;
opacity: 0.5;
}
.empty-state h3 {
font-size: 18px;
font-weight: 600;
margin: 0 0 8px 0;
}
.empty-state p {
color: var(--text-secondary);
margin: 0 0 24px 0;
}
/* Responsive */
@media (max-width: 1024px) {
.drive-container {
grid-template-columns: 1fr;
}
.drive-sidebar {
display: none;
}
.info-panel {
display: none;
}
}
@media (max-width: 768px) {
.drive-toolbar {
flex-wrap: wrap;
gap: 12px;
}
.toolbar-center {
order: 3;
width: 100%;
}
.search-box {
max-width: none;
}
.file-grid {
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.selection-bar {
flex-direction: column;
width: calc(100% - 48px);
}
.selection-actions {
flex-wrap: wrap;
justify-content: center;
}
}
</style>
<script>
// View toggle
function setView(view) {
const grid = document.getElementById('file-grid');
const gridBtn = document.getElementById('grid-view-btn');
const listBtn = document.getElementById('list-view-btn');
if (view === 'list') {
grid.classList.add('list-view');
listBtn.classList.add('active');
gridBtn.classList.remove('active');
} else {
grid.classList.remove('list-view');
gridBtn.classList.add('active');
listBtn.classList.remove('active');
}
}
// Navigation active state
function setActiveNav(el) {
document.querySelectorAll('.nav-item').forEach(item => item.classList.remove('active'));
el.classList.add('active');
}
// Info panel toggle
function toggleInfoPanel() {
const panel = document.getElementById('info-panel');
panel.style.display = panel.style.display === 'none' ? 'block' : 'none';
}
// Selection handling
function updateSelection() {
const checked = document.querySelectorAll('.file-checkbox:checked');
const count = checked.length;
const bar = document.getElementById('selection-bar');
const countEl = document.getElementById('selected-count');
countEl.textContent = count;
bar.style.display = count > 0 ? 'flex' : 'none';
// Update hidden inputs for copy/move modals
const paths = Array.from(checked).map(cb => cb.value).join(',');
document.getElementById('copy-source').value = paths;
document.getElementById('move-source').value = paths;
}
function clearSelection() {
document.querySelectorAll('.file-checkbox:checked').forEach(cb => {
cb.checked = false;
});
updateSelection();
}
// File upload handling
function triggerUpload() {
document.getElementById('file-input').click();
}
// Context menu handling
let contextTarget = null;
document.addEventListener('contextmenu', function(e) {
const fileCard = e.target.closest('.file-card');
if (fileCard) {
e.preventDefault();
contextTarget = fileCard;
const menu = document.getElementById('context-menu');
menu.style.display = 'block';
menu.style.left = e.pageX + 'px';
menu.style.top = e.pageY + 'px';
// Update copy/move/permissions/versions source for single file
const filePath = fileCard.dataset.path || '';
document.getElementById('copy-source').value = filePath;
document.getElementById('move-source').value = filePath;
document.getElementById('permissions-path').value = filePath;
document.getElementById('versions-path').value = filePath;
}
});
document.addEventListener('click', function(e) {
const menu = document.getElementById('context-menu');
if (!menu.contains(e.target)) {
menu.style.display = 'none';
}
});
// Drag and drop
const dropOverlay = document.getElementById('drop-overlay');
document.addEventListener('dragenter', function(e) {
e.preventDefault();
dropOverlay.classList.add('visible');
});
dropOverlay.addEventListener('dragleave', function(e) {
if (e.target === dropOverlay) {
dropOverlay.classList.remove('visible');
}
});
dropOverlay.addEventListener('drop', function(e) {
e.preventDefault();
dropOverlay.classList.remove('visible');
// Handle file drop via HTMX
});
dropOverlay.addEventListener('dragover', function(e) {
e.preventDefault();
});
// Listen for checkbox changes
document.addEventListener('change', function(e) {
if (e.target.classList.contains('file-checkbox')) {
updateSelection();
}
});
</script>