Spaces:
Sleeping
Sleeping
Commit ·
4e3ead6
1
Parent(s): 2642f13
Add interactive link storage section
Browse filesFiles changed (5)
- index.html+47-18
- js/api/hfService.js+48
- js/main.js+339-191
- js/state/stateManager.js+9-2
- styles.css+134-2
105 unmodified lines10610710810911011111211311411511611711811912012112212312412512612712812913013151 unmodified lines1831841851861871881898 unmodified lines198199200201202203204105 unmodified lines</div><div class="content-area" id="contentArea"><div class="section-header"><h2>Folders</h2><div class="view-toggles"><button class="icon-btn active" id="viewGrid" title="Grid"><i class="ph-fill ph-squares-four"></i></button><button class="icon-btn" id="viewList" title="List"><i class="ph-fill ph-list-dashes"></i></button></div></div><div class="grid-container" id="foldersContainer"></div><div class="section-header mt-8"><h2>Files</h2></div><div class="grid-container" id="filesContainer"></div><!-- Links Section --><div id="linksSection" style="display:none;"><div class="section-header mt-8"><h2>Your Links</h2></div><div class="links-container" id="linksContainer"></div></div></div></main>51 unmodified lines<div class="modal-overlay" id="addLinkModal"><div class="modal glass-panel" style="max-width:500px"><button class="close-modal" id="closeAddLinkModal"><i class="ph-bold ph-x"></i></button><h3><i class="ph-fill ph-link-plus" style="color:var(--primary-color);margin-right:10px"></i>Add Link</h3><div class="input-group"><label class="input-label">URL *</label><input type="url" id="linkUrlInput" placeholder="https://example.com" autocomplete="off">8 unmodified lines</div><div class="modal-footer"><button class="btn-secondary" id="cancelLinkBtn">Cancel</button><button class="btn-primary" id="confirmLinkBtn"><i class="ph-fill ph-check"></i> Add Link</button></div></div></div>105 unmodified lines10610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916051 unmodified lines2122132142152162172188 unmodified lines227228229230231232233105 unmodified lines</div><div class="content-area" id="contentArea"><div id="filesView"><div class="section-header"><h2>Folders</h2><div class="view-toggles"><button class="icon-btn active" id="viewGrid" title="Grid"><i class="ph-fill ph-squares-four"></i></button><button class="icon-btn" id="viewList" title="List"><i class="ph-fill ph-list-dashes"></i></button></div></div><div class="grid-container" id="foldersContainer"></div><div class="section-header mt-8"><h2>Files</h2></div><div class="grid-container" id="filesContainer"></div></div><div id="linksView" class="links-view" style="display:none;"><section class="links-hero"><div><span class="links-eyebrow">Interactive Link Storage</span><h2>Save important websites alongside your documents</h2><p>Collect references, dashboards, and research links in one searchable place.</p></div><button class="btn-primary" id="heroAddLinkBtn"><i class="ph-fill ph-link-plus"></i> Add Link</button></section><section class="links-toolbar"><div class="links-stat-card"><span class="links-stat-label">Stored Links</span><strong id="linksCount">0</strong></div><div class="links-stat-card"><span class="links-stat-label">Latest Update</span><strong id="linksUpdatedAt">Just now</strong></div><div class="links-search"><i class="ph-bold ph-magnifying-glass"></i><input type="text" id="linksSearchInput" placeholder="Search title, URL, or notes..."></div></section><section id="linksSection"><div class="section-header"><h2>Your Links</h2></div><div class="links-container" id="linksContainer"></div></section></div></div></main>51 unmodified lines<div class="modal-overlay" id="addLinkModal"><div class="modal glass-panel" style="max-width:500px"><button class="close-modal" id="closeAddLinkModal"><i class="ph-bold ph-x"></i></button><h3 id="addLinkModalTitle"><i class="ph-fill ph-link-plus" style="color:var(--primary-color);margin-right:10px"></i>Add Link</h3><div class="input-group"><label class="input-label">URL *</label><input type="url" id="linkUrlInput" placeholder="https://example.com" autocomplete="off">8 unmodified lines</div><div class="modal-footer"><button class="btn-secondary" id="cancelLinkBtn">Cancel</button><button class="btn-primary" id="confirmLinkBtn"><i class="ph-fill ph-check"></i> Save Link</button></div></div></div>
237 unmodified lines238239240241242243237 unmodified linesreturn await res.json();}clearCache() {this.cache.clear();}237 unmodified lines238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291237 unmodified linesreturn await res.json();}async listLinks() {const apiBase = await this.getApiBase();const res = await this.fetchWithRetry(`${apiBase}/links/list`, {headers: { 'X-User-ID': 'default_user' }});const data = await res.json();return Array.isArray(data.links) ? data.links : [];}async addLink(payload) {const apiBase = await this.getApiBase();const res = await this.fetchWithRetry(`${apiBase}/links/add`, {method: 'POST',headers: {'Content-Type': 'application/json','X-User-ID': 'default_user'},body: JSON.stringify(payload)});return await res.json();}async updateLink(payload) {const apiBase = await this.getApiBase();const res = await this.fetchWithRetry(`${apiBase}/links/update`, {method: 'POST',headers: {'Content-Type': 'application/json','X-User-ID': 'default_user'},body: JSON.stringify(payload)});return await res.json();}async deleteLink(linkId) {const apiBase = await this.getApiBase();const res = await this.fetchWithRetry(`${apiBase}/links/delete`, {method: 'POST',headers: {'Content-Type': 'application/json','X-User-ID': 'default_user'},body: JSON.stringify({ link_id: linkId })});return await res.json();}clearCache() {this.cache.clear();}
9 unmodified lines10111213141510 unmodified lines26272829303132333 unmodified lines3738394041424344454647484950512 unmodified lines54555657585912 unmodified lines727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281292 unmodified lines1321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981 unmodified line2002012022032042052062072082092102112122132144 unmodified lines2192202212222232242252267 unmodified lines23423523623723823924024124216 unmodified lines2592602612622632642652662672682692702712722732744 unmodified lines27928028128228328428528628728828929019 unmodified lines31031131231331431531631712 unmodified lines33033133233333433533633733833934034134234334434534612 unmodified lines3593603613623633641 unmodified line3663673683693703713721 unmodified line3743753763773783793803813823837 unmodified lines3913923933943953963973986 unmodified lines40540640740840941010 unmodified lines42142242342442542642742816 unmodified lines4454464474484494505 unmodified lines45645745845946046146223 unmodified lines48648748848949049149249349449549649712 unmodified lines510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546180 unmodified lines7277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698709 unmodified linesthis.hf = hfService;this.pendingDelete = null;this.pendingRename = null;this.cachedFolders = [];this.currentPreviewObjectUrl = null;this.init();10 unmodified linessetupNetworkHandling() {window.addEventListener('online', () => {this.ui.showToast('Back online! Syncing...', 'success');this.fetchAndRender();});window.addEventListener('offline', () => {this.ui.showToast('You are offline. Some features may be limited.', 'warning');});3 unmodified linesconst area = document.getElementById('contentArea');if (!area) return;['dragenter', 'dragover'].forEach(evt => {area.addEventListener(evt, (e) => {e.preventDefault();e.stopPropagation();area.classList.add('drag-over');});});['dragleave', 'drop'].forEach(evt => {area.addEventListener(evt, (e) => {e.preventDefault();e.stopPropagation();2 unmodified lines});area.addEventListener('drop', (e) => {const files = e.dataTransfer.files;if (files.length > 0) {this.uploadFiles(files);12 unmodified lines}};// Navdocument.getElementById('navMyFiles').onclick = (e) => {e.preventDefault();this.state.setBrowseMode('files');this.state.setPath([]);this.fetchAndRender();};document.getElementById('navRecent').onclick = (e) => {e.preventDefault();this.state.setBrowseMode('recent');this.render();};document.getElementById('navStarred').onclick = (e) => {e.preventDefault();this.state.setBrowseMode('starred');this.render();};document.getElementById('navLinks').onclick = (e) => {e.preventDefault();this.state.setBrowseMode('links');this.fetchAndRenderLinks();this.updateActiveNavItem();document.getElementById('contentArea').innerHTML = '';document.getElementById('linksSection').style.display = 'block';document.getElementById('breadcrumbs').innerHTML = '<span class="breadcrumb-item active">Links</span>';};// View Togglesdocument.getElementById('viewGrid').onclick = () => this.state.setViewMode('grid');document.getElementById('viewList').onclick = () => this.state.setViewMode('list');// Searchlet searchDebounce;document.getElementById('searchInput').oninput = (e) => {clearTimeout(searchDebounce);searchDebounce = setTimeout(() => {this.state.setSearchQuery(e.target.value.trim());this.fetchAndRender();}, 400);};// New actionsdocument.getElementById('newBtn').onclick = (e) => {e.stopPropagation();document.getElementById('newDropdown').classList.toggle('active');};document.getElementById('uploadFileBtn').onclick = (e) => {e.preventDefault();e.stopPropagation();document.getElementById('newDropdown').classList.remove('active');document.getElementById('fileInput').click();};document.getElementById('createFolderBtn').onclick = (e) => {e.preventDefault();e.stopPropagation();2 unmodified linesdocument.getElementById('folderNameInput').value = '';document.getElementById('folderNameInput').focus();};document.getElementById('addLinkBtn').onclick = (e) => {e.preventDefault();e.stopPropagation();document.getElementById('newDropdown').classList.remove('active');document.getElementById('addLinkModal').classList.add('active');document.getElementById('linkUrlInput').focus();};// File Inputdocument.getElementById('fileInput').onchange = (e) => {this.uploadFiles(e.target.files);e.target.value = '';};if (contentArea) {contentArea.addEventListener('click', () => {closeSidebarOnCompactView();});contentArea.addEventListener('touchstart', () => {closeSidebarOnCompactView();}, { passive: true });}// Create Folder Modaldocument.getElementById('confirmFolderBtn').onclick = () => this.createFolder();document.getElementById('cancelFolderBtn').onclick = () => document.getElementById('createFolderModal').classList.remove('active');// Enter on folder name inputdocument.getElementById('folderNameInput').addEventListener('keydown', (e) => {if (e.key === 'Enter') this.createFolder();});// Delete Modaldocument.getElementById('confirmDeleteBtn').onclick = () => this.confirmDelete();document.getElementById('cancelDeleteBtn').onclick = () => document.getElementById('deleteModal').classList.remove('active');// Rename Modaldocument.getElementById('confirmRenameBtn').onclick = () => this.renameItem();document.getElementById('cancelRenameBtn').onclick = () => document.getElementById('renameModal').classList.remove('active');// Enter on rename inputdocument.getElementById('renameInput').addEventListener('keydown', (e) => {if (e.key === 'Enter') this.renameItem();if (e.key === 'Escape') document.getElementById('renameModal').classList.remove('active');});// Add Link Modaldocument.getElementById('confirmLinkBtn').onclick = () => this.addLink();document.getElementById('cancelLinkBtn').onclick = () => document.getElementById('addLinkModal').classList.remove('active');// Enter on link URL inputdocument.getElementById('linkUrlInput').addEventListener('keydown', (e) => {if (e.key === 'Enter') document.getElementById('linkTitleInput').focus();});document.addEventListener('click', () => {document.getElementById('newDropdown').classList.remove('active');// Close all dropdown menusdocument.querySelectorAll('.dropdown-menu.open').forEach(m => m.classList.remove('open'));});// Mobile Toggleif (menuToggle && sidebar) {menuToggle.onclick = (e) => {e.stopPropagation();1 unmodified line};}// Close sidebar on navigation (mobile)document.querySelectorAll('.nav-item').forEach(item => {item.addEventListener('click', () => {closeSidebarOnCompactView();});});// Modals Close via X buttondocument.querySelectorAll('.close-modal').forEach(btn => {btn.onclick = () => {const modal = btn.closest('.modal-overlay');if (modal && modal.id === 'previewModal') {4 unmodified lines};});// Modals close on overlay clickdocument.querySelectorAll('.modal-overlay').forEach(overlay => {overlay.addEventListener('click', (e) => {if (e.target === overlay) {if (overlay.id === 'previewModal') {7 unmodified lines});}async fetchAndRender() {if (this.state.isFetching) return;this.state.isFetching = true;this.ui.showSkeletons();try {16 unmodified lines}}async updateStorageStats() {try {const { files } = await this.hf.listFiles('', true);const totalSize = files.reduce((sum, f) => sum + (f.size || 0), 0);const count = files.length;document.getElementById('storageUsageText').textContent = `${count} files • ${this.formatSize(totalSize)} used`;const MAX_STORAGE = 10 * 1024 * 1024 * 1024; // 10GBconst pct = Math.min((totalSize / MAX_STORAGE) * 100, 100);document.getElementById('storageProgress').style.width = pct + '%';} catch (err) {console.error('Storage stats error:', err);}4 unmodified linesconst k = 1024;const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];const i = Math.floor(Math.log(bytes) / Math.log(k));return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];}buildStarredDisplayFiles() {const cachedByPath = new Map(this.state.cachedFiles.map(file => [file.path, file]));const recentByPath = new Map(this.state.recent.map(file => [file.path, file]));return this.state.starred.map((path) => {const cached = cachedByPath.get(path);19 unmodified lines});}render() {const browseMode = this.state.currentBrowse;let displayFiles = [];let displayFolders = [];12 unmodified linesdocument.getElementById('breadcrumbs').innerHTML = '<span class="breadcrumb-item active">Starred</span>';}// Filter by searchif (this.state.searchQuery) {const q = this.state.searchQuery.toLowerCase();displayFiles = displayFiles.filter(f => f.name.toLowerCase().includes(q));displayFolders = displayFolders.filter(f => f.name.toLowerCase().includes(q));}this.ui.renderFolders(displayFolders, (name) => {this.state.setPath([...this.state.currentPath, name]);this.fetchAndRender();}, (path, name) => this.openRenameModal(path, name), (path, name) => this.openDeleteModal(path, name));this.ui.renderFiles(displayFiles, {onPreview: (file) => this.openPreview(file),12 unmodified linesthis.updateActiveNavItem();}updateActiveNavItem() {const items = {files: 'navMyFiles',1 unmodified linestarred: 'navStarred',links: 'navLinks'};Object.values(items).forEach(id => document.getElementById(id).classList.remove('active'));if (items[this.state.currentBrowse]) {document.getElementById(items[this.state.currentBrowse]).classList.add('active');}1 unmodified lineasync uploadFiles(fileList) {const files = Array.from(fileList);const MAX_SIZE = 10 * 1024 * 1024; // 10MB limit for simple APIfor (const file of files) {// 1. Validationif (!this.isValidName(file.name)) {this.ui.showToast(`Invalid file name: ${file.name}`, 'error');continue;7 unmodified linesconst path = this.state.getFolderPath();const destPath = path ? `${path}/${file.name}` : file.name;// 2. Duplicate Checkif (this.state.cachedFiles.some(f => f.path === destPath)) {this.ui.showToast(`File already exists: ${file.name}`, 'warning');continue;}6 unmodified linesthis.ui.showToast(err.message, 'error');}}this.ui.hideProgress();this.fetchAndRender();}10 unmodified linesconst path = this.state.getFolderPath();const destPath = path ? `${path}/${name}` : name;// Check if folder name is already takenif (this.cachedFolders.some(f => f.name === name)) {this.ui.showToast(`Folder already exists: ${name}`, 'warning');return;}16 unmodified linesreturn name && name.length > 0 && !forbidden.test(name) && name.length < 255;}openDeleteModal(path, name) {this.pendingDelete = path;const strong = document.querySelector('#deleteModal p strong');5 unmodified linesconst renameModal = document.getElementById('renameModal');const renameInput = document.getElementById('renameInput');const renameTitle = document.querySelector('#renameModal h3');const isFolder = this.cachedFolders.some(folder => folder.path === path);this.pendingRename = {path,23 unmodified linesif (btn) btn.classList.add('loading');try {const isFolder = this.cachedFolders.some(f => f.path === path);if (isFolder) {await this.hf.deleteFolder(path);this.state.starred.filter(starredPath => starredPath === path || starredPath.startsWith(`${path}/`)).forEach(starredPath => this.state.removeStar(starredPath));} else {await this.hf.deleteFile(path);this.state.removeStar(path);12 unmodified linesasync renameItem() {if (!this.pendingRename) return;const newNameInput = document.getElementById('renameInput');const btn = document.getElementById('confirmRenameBtn');if (!newNameInput || !btn) return;const newName = newNameInput.value.trim();if (!newName) {this.ui.showToast('Please enter a new name', 'warning');return;}if (newName === this.pendingRename.originalName) {document.getElementById('renameModal').classList.remove('active');this.pendingRename = null;return;}if (!this.isValidName(newName)) {this.ui.showToast('Invalid name format (avoid < > : " / \\ | ? *)', 'error');return;}// Client-side Conflict Checkconst isConflict = this.state.cachedFiles.some(f => f.name.toLowerCase() === newName.toLowerCase()) ||this.cachedFolders.some(f => f.name.toLowerCase() === newName.toLowerCase());if (isConflict) {this.ui.showToast(`An item with name "${newName}" already exists in this folder`, 'warning');return;}const path = this.pendingRename.path;const oldName = this.pendingRename.originalName;const parentPath = path.includes('/') ? path.slice(0, path.lastIndexOf('/')) : '';180 unmodified lines}}// =================== LINKS MANAGEMENT ===================async fetchAndRenderLinks() {try {const response = await fetch(`${this.hf.apiBase}/links/list`, {headers: { 'X-User-ID': 'default_user' }});const data = await response.json();if (data.success) {this.renderLinks(data.links || []);} else {this.ui.showToast('Failed to load links', 'error');}} catch (err) {console.error('Fetch links error:', err);}}renderLinks(links) {const linksSection = document.getElementById('linksSection');const linksContainer = document.getElementById('linksContainer');if (!linksContainer) return;linksSection.style.display = links.length > 0 ? 'block' : 'none';if (links.length === 0) {linksContainer.innerHTML = `<div class="links-empty"><i class="ph-fill ph-link"></i><h3>No links yet</h3><p>Add your first link to get started</p></div>`;return;}linksContainer.innerHTML = links.map(link => `<div class="link-card"><div class="link-card-header"><div class="link-icon"><i class="ph-fill ph-link"></i></div><div style="flex: 1;"><div class="link-title">${this.escapeHtml(link.title || link.url)}</div><a href="${this.escapeHtml(link.url)}" target="_blank" class="link-url" title="${this.escapeHtml(link.url)}">${this.escapeHtml(link.url)}</a></div></div>${link.description ? `<div class="link-description">${this.escapeHtml(link.description)}</div>` : ''}<div class="link-actions"><a href="${this.escapeHtml(link.url)}" target="_blank" class="link-action-btn"><i class="ph-fill ph-arrow-up-right"></i> Open</a><button class="link-action-btn delete" data-link-id="${link.id}"><i class="ph-fill ph-trash"></i> Delete</button></div></div>`).join('');// Add delete event listenerslinksContainer.querySelectorAll('.link-action-btn.delete').forEach(btn => {btn.addEventListener('click', (e) => {e.preventDefault();const linkId = btn.dataset.linkId;this.deleteLink(linkId);});});}async deleteLink(linkId) {if (!confirm('Are you sure you want to delete this link?')) return;try {const response = await fetch(`${this.hf.apiBase}/links/delete`, {method: 'POST',headers: {'Content-Type': 'application/json','X-User-ID': 'default_user'},body: JSON.stringify({ link_id: linkId })});const data = await response.json();if (data.success) {this.ui.showToast('Link deleted', 'success');this.fetchAndRenderLinks();} else {this.ui.showToast(data.error || 'Failed to delete link', 'error');}} catch (err) {console.error('Delete link error:', err);this.ui.showToast('Error deleting link', 'error');}}async addLink() {const url = document.getElementById('linkUrlInput').value.trim();const title = document.getElementById('linkTitleInput').value.trim();const description = document.getElementById('linkDescriptionInput').value.trim();if (!url) {this.ui.showToast('URL is required', 'error');return;}try {this.ui.showProgress('Adding link...');const response = await fetch(`${this.hf.apiBase}/links/add`, {method: 'POST',headers: {'Content-Type': 'application/json','X-User-ID': 'default_user'},body: JSON.stringify({url,title,description})});const data = await response.json();this.ui.hideProgress();if (data.success) {this.ui.showToast('Link added successfully', 'success');document.getElementById('addLinkModal').classList.remove('active');document.getElementById('linkUrlInput').value = '';document.getElementById('linkTitleInput').value = '';document.getElementById('linkDescriptionInput').value = '';this.fetchAndRenderLinks();} else {this.ui.showToast(data.error || 'Failed to add link', 'error');}} catch (err) {console.error('Add link error:', err);this.ui.hideProgress();this.ui.showToast('Error adding link', 'error');}}9 unmodified lines1011121314151610 unmodified lines272829303132333435363738393 unmodified lines43444546474849505152535455565758592 unmodified lines6263646566676812 unmodified lines818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461472 unmodified lines1501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142151 unmodified line2172182192202212222232242252262274 unmodified lines2322332342352362372387 unmodified lines24624724824925025125225325425525625725825926026126226326426526626726826927027116 unmodified lines2882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263274 unmodified lines33233333433533633733833934034134234334434534634734834935035135235335435535635735819 unmodified lines37837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740812 unmodified lines42142242342442542642742842943043143243343443543643743843944044112 unmodified lines4544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565571 unmodified line5595605615625635645655661 unmodified line5685695705715725735745755767 unmodified lines5845855865875885895906 unmodified lines59759859960060160260310 unmodified lines61461561661761861962016 unmodified lines6376386396406416426436446456466476485 unmodified lines65465565665765865966023 unmodified lines68468568668768868969069169269369469512 unmodified lines708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743180 unmodified lines92492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710189 unmodified linesthis.hf = hfService;this.pendingDelete = null;this.pendingRename = null;this.pendingLinkEdit = null;this.cachedFolders = [];this.currentPreviewObjectUrl = null;this.init();10 unmodified linessetupNetworkHandling() {window.addEventListener('online', () => {this.ui.showToast('Back online! Syncing...', 'success');if (this.state.currentBrowse === 'links') {this.fetchAndRenderLinks();} else {this.fetchAndRender();}});window.addEventListener('offline', () => {this.ui.showToast('You are offline. Some features may be limited.', 'warning');});3 unmodified linesconst area = document.getElementById('contentArea');if (!area) return;['dragenter', 'dragover'].forEach((evt) => {area.addEventListener(evt, (e) => {e.preventDefault();e.stopPropagation();if (this.state.currentBrowse !== 'links') {area.classList.add('drag-over');}});});['dragleave', 'drop'].forEach((evt) => {area.addEventListener(evt, (e) => {e.preventDefault();e.stopPropagation();2 unmodified lines});area.addEventListener('drop', (e) => {if (this.state.currentBrowse === 'links') return;const files = e.dataTransfer.files;if (files.length > 0) {this.uploadFiles(files);12 unmodified lines}};document.getElementById('navMyFiles').onclick = (e) => {e.preventDefault();this.state.setBrowseMode('files');this.state.setPath([]);this.fetchAndRender();};document.getElementById('navRecent').onclick = (e) => {e.preventDefault();this.state.setBrowseMode('recent');this.render();};document.getElementById('navStarred').onclick = (e) => {e.preventDefault();this.state.setBrowseMode('starred');this.render();};document.getElementById('navLinks').onclick = (e) => {e.preventDefault();this.state.setBrowseMode('links');this.fetchAndRenderLinks();};document.getElementById('viewGrid').onclick = () => this.state.setViewMode('grid');document.getElementById('viewList').onclick = () => this.state.setViewMode('list');let searchDebounce;document.getElementById('searchInput').oninput = (e) => {const value = e.target.value.trim();clearTimeout(searchDebounce);searchDebounce = setTimeout(() => {if (this.state.currentBrowse === 'links') {this.state.setLinksSearchQuery(value);this.render();return;}this.state.setSearchQuery(value);this.fetchAndRender();}, 250);};document.getElementById('linksSearchInput').oninput = (e) => {this.state.setLinksSearchQuery(e.target.value.trim());this.render();};document.getElementById('newBtn').onclick = (e) => {e.stopPropagation();document.getElementById('newDropdown').classList.toggle('active');};document.getElementById('uploadFileBtn').onclick = (e) => {e.preventDefault();e.stopPropagation();document.getElementById('newDropdown').classList.remove('active');document.getElementById('fileInput').click();};document.getElementById('createFolderBtn').onclick = (e) => {e.preventDefault();e.stopPropagation();2 unmodified linesdocument.getElementById('folderNameInput').value = '';document.getElementById('folderNameInput').focus();};document.getElementById('addLinkBtn').onclick = (e) => {e.preventDefault();e.stopPropagation();document.getElementById('newDropdown').classList.remove('active');this.openLinkModal();};document.getElementById('heroAddLinkBtn').onclick = () => this.openLinkModal();document.getElementById('fileInput').onchange = (e) => {this.uploadFiles(e.target.files);e.target.value = '';};if (contentArea) {contentArea.addEventListener('click', () => closeSidebarOnCompactView());contentArea.addEventListener('touchstart',() => closeSidebarOnCompactView(),{ passive: true });}document.getElementById('confirmFolderBtn').onclick = () => this.createFolder();document.getElementById('cancelFolderBtn').onclick = () => document.getElementById('createFolderModal').classList.remove('active');document.getElementById('folderNameInput').addEventListener('keydown', (e) => {if (e.key === 'Enter') this.createFolder();});document.getElementById('confirmDeleteBtn').onclick = () => this.confirmDelete();document.getElementById('cancelDeleteBtn').onclick = () => document.getElementById('deleteModal').classList.remove('active');document.getElementById('confirmRenameBtn').onclick = () => this.renameItem();document.getElementById('cancelRenameBtn').onclick = () => document.getElementById('renameModal').classList.remove('active');document.getElementById('renameInput').addEventListener('keydown', (e) => {if (e.key === 'Enter') this.renameItem();if (e.key === 'Escape') document.getElementById('renameModal').classList.remove('active');});document.getElementById('confirmLinkBtn').onclick = () => this.saveLink();document.getElementById('cancelLinkBtn').onclick = () => document.getElementById('addLinkModal').classList.remove('active');document.getElementById('linkUrlInput').addEventListener('keydown', (e) => {if (e.key === 'Enter') document.getElementById('linkTitleInput').focus();});document.getElementById('linkDescriptionInput').addEventListener('keydown', (e) => {if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {this.saveLink();}});document.addEventListener('click', () => {document.getElementById('newDropdown').classList.remove('active');document.querySelectorAll('.dropdown-menu.open').forEach((m) => m.classList.remove('open'));});if (menuToggle && sidebar) {menuToggle.onclick = (e) => {e.stopPropagation();1 unmodified line};}document.querySelectorAll('.nav-item').forEach((item) => {item.addEventListener('click', () => closeSidebarOnCompactView());});document.querySelectorAll('.close-modal').forEach((btn) => {btn.onclick = () => {const modal = btn.closest('.modal-overlay');if (modal && modal.id === 'previewModal') {4 unmodified lines};});document.querySelectorAll('.modal-overlay').forEach((overlay) => {overlay.addEventListener('click', (e) => {if (e.target === overlay) {if (overlay.id === 'previewModal') {7 unmodified lines});}setContentView(mode) {const filesView = document.getElementById('filesView');const linksView = document.getElementById('linksView');const searchInput = document.getElementById('searchInput');const isLinksMode = mode === 'links';if (filesView) filesView.style.display = isLinksMode ? 'none' : 'block';if (linksView) linksView.style.display = isLinksMode ? 'block' : 'none';if (searchInput) {searchInput.placeholder = isLinksMode? 'Search stored links...': 'Search files or folders...';searchInput.value = isLinksMode ? this.state.linksSearchQuery : this.state.searchQuery;}}async fetchAndRender() {if (this.state.isFetching) return;this.state.isFetching = true;this.setContentView('files');this.ui.showSkeletons();try {16 unmodified lines}}async fetchAndRenderLinks() {this.setContentView('links');const linksContainer = document.getElementById('linksContainer');if (linksContainer) {linksContainer.innerHTML = `<div class="links-empty"><div class="spinner"></div><h3>Loading your links</h3><p>Pulling saved websites from your vault.</p></div>`;}try {this.state.cachedLinks = await this.hf.listLinks();this.render();} catch (err) {console.error('Fetch links error:', err);this.state.cachedLinks = [];this.render();this.ui.showToast(err.message || 'Failed to load links', 'error');}}async updateStorageStats() {try {const { files } = await this.hf.listFiles('');const totalSize = files.reduce((sum, f) => sum + (f.size || 0), 0);const count = files.length;document.getElementById('storageUsageText').textContent = `${count} files • ${this.formatSize(totalSize)} used`;const MAX_STORAGE = 10 * 1024 * 1024 * 1024;const pct = Math.min((totalSize / MAX_STORAGE) * 100, 100);document.getElementById('storageProgress').style.width = `${pct}%`;} catch (err) {console.error('Storage stats error:', err);}4 unmodified linesconst k = 1024;const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];const i = Math.floor(Math.log(bytes) / Math.log(k));return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;}formatRelativeDate(value) {if (!value) return 'Just now';const diffMs = Date.now() - new Date(value).getTime();if (Number.isNaN(diffMs)) return 'Just now';const minutes = Math.floor(diffMs / 60000);if (minutes < 1) return 'Just now';if (minutes < 60) return `${minutes}m ago`;const hours = Math.floor(minutes / 60);if (hours < 24) return `${hours}h ago`;const days = Math.floor(hours / 24);if (days < 7) return `${days}d ago`;return new Date(value).toLocaleDateString();}buildStarredDisplayFiles() {const cachedByPath = new Map(this.state.cachedFiles.map((file) => [file.path, file]));const recentByPath = new Map(this.state.recent.map((file) => [file.path, file]));return this.state.starred.map((path) => {const cached = cachedByPath.get(path);19 unmodified lines});}getFilteredLinks() {const query = this.state.linksSearchQuery.toLowerCase();const links = Array.isArray(this.state.cachedLinks) ? this.state.cachedLinks : [];if (!query) return links;return links.filter((link) => {const haystack = [link.title, link.url, link.description].filter(Boolean).join(' ').toLowerCase();return haystack.includes(query);});}render() {const browseMode = this.state.currentBrowse;this.setContentView(browseMode);if (browseMode === 'links') {document.getElementById('breadcrumbs').innerHTML = '<span class="breadcrumb-item active">Links</span>';this.renderLinks(this.getFilteredLinks());this.updateActiveNavItem();return;}let displayFiles = [];let displayFolders = [];12 unmodified linesdocument.getElementById('breadcrumbs').innerHTML = '<span class="breadcrumb-item active">Starred</span>';}if (this.state.searchQuery) {const q = this.state.searchQuery.toLowerCase();displayFiles = displayFiles.filter((f) => f.name.toLowerCase().includes(q));displayFolders = displayFolders.filter((f) => f.name.toLowerCase().includes(q));}this.ui.renderFolders(displayFolders,(name) => {this.state.setPath([...this.state.currentPath, name]);this.fetchAndRender();},(path, name) => this.openRenameModal(path, name),(path, name) => this.openDeleteModal(path, name));this.ui.renderFiles(displayFiles, {onPreview: (file) => this.openPreview(file),12 unmodified linesthis.updateActiveNavItem();}renderLinks(links) {const linksContainer = document.getElementById('linksContainer');const linksCount = document.getElementById('linksCount');const linksUpdatedAt = document.getElementById('linksUpdatedAt');if (!linksContainer) return;const totalLinks = Array.isArray(this.state.cachedLinks) ? this.state.cachedLinks.length : 0;const latestUpdated = [...(this.state.cachedLinks || [])].map((link) => link.updated_at || link.created_at).filter(Boolean).sort((a, b) => new Date(b) - new Date(a))[0];if (linksCount) linksCount.textContent = String(totalLinks);if (linksUpdatedAt) linksUpdatedAt.textContent = this.formatRelativeDate(latestUpdated);if (!links.length) {const hasSearch = Boolean(this.state.linksSearchQuery);linksContainer.innerHTML = `<div class="links-empty"><i class="ph-fill ph-link"></i><h3>${hasSearch ? 'No links match your search' : 'No links saved yet'}</h3><p>${hasSearch ? 'Try a different title, URL, or note.' : 'Add your first site to start building your link vault.'}</p>${hasSearch ? '' : '<button class="btn-primary" id="emptyStateAddLinkBtn"><i class="ph-fill ph-link-plus"></i> Add Your First Link</button>'}</div>`;const emptyBtn = document.getElementById('emptyStateAddLinkBtn');if (emptyBtn) emptyBtn.onclick = () => this.openLinkModal();return;}linksContainer.innerHTML = links.map((link) => `<article class="link-card"><div class="link-card-header"><div class="link-icon"><i class="ph-fill ph-link"></i></div><div class="link-card-content"><div class="link-title">${this.escapeHtml(link.title || link.url)}</div><a href="${this.escapeHtml(link.url)}" target="_blank" rel="noopener noreferrer" class="link-url" title="${this.escapeHtml(link.url)}">${this.escapeHtml(link.url)}</a></div></div>${link.description ? `<p class="link-description">${this.escapeHtml(link.description)}</p>` : '<p class="link-description muted">No notes added yet.</p>'}<div class="link-meta"><span><i class="ph-fill ph-clock"></i> ${this.formatRelativeDate(link.updated_at || link.created_at)}</span><span><i class="ph-fill ph-bookmark-simple"></i> Saved item</span></div><div class="link-actions"><a href="${this.escapeHtml(link.url)}" target="_blank" rel="noopener noreferrer" class="link-action-btn"><i class="ph-fill ph-arrow-up-right"></i> Open</a><button class="link-action-btn" data-action="copy" data-link-url="${this.escapeHtml(link.url)}"><i class="ph-fill ph-copy"></i> Copy</button><button class="link-action-btn" data-action="edit" data-link-id="${link.id}"><i class="ph-fill ph-pencil-simple"></i> Edit</button><button class="link-action-btn delete" data-action="delete" data-link-id="${link.id}"><i class="ph-fill ph-trash"></i> Delete</button></div></article>`).join('');linksContainer.querySelectorAll('[data-action="copy"]').forEach((btn) => {btn.addEventListener('click', async (e) => {e.preventDefault();const url = btn.dataset.linkUrl || '';try {await navigator.clipboard.writeText(url);this.ui.showToast('Link copied to clipboard', 'success');} catch (err) {this.ui.showToast('Could not copy the link', 'error');}});});linksContainer.querySelectorAll('[data-action="edit"]').forEach((btn) => {btn.addEventListener('click', (e) => {e.preventDefault();const link = (this.state.cachedLinks || []).find((item) => item.id === btn.dataset.linkId);if (link) this.openLinkModal(link);});});linksContainer.querySelectorAll('[data-action="delete"]').forEach((btn) => {btn.addEventListener('click', (e) => {e.preventDefault();this.deleteLink(btn.dataset.linkId);});});}updateActiveNavItem() {const items = {files: 'navMyFiles',1 unmodified linestarred: 'navStarred',links: 'navLinks'};Object.values(items).forEach((id) => document.getElementById(id).classList.remove('active'));if (items[this.state.currentBrowse]) {document.getElementById(items[this.state.currentBrowse]).classList.add('active');}1 unmodified lineasync uploadFiles(fileList) {const files = Array.from(fileList);const MAX_SIZE = 10 * 1024 * 1024;for (const file of files) {if (!this.isValidName(file.name)) {this.ui.showToast(`Invalid file name: ${file.name}`, 'error');continue;7 unmodified linesconst path = this.state.getFolderPath();const destPath = path ? `${path}/${file.name}` : file.name;if (this.state.cachedFiles.some((f) => f.path === destPath)) {this.ui.showToast(`File already exists: ${file.name}`, 'warning');continue;}6 unmodified linesthis.ui.showToast(err.message, 'error');}}this.ui.hideProgress();this.fetchAndRender();}10 unmodified linesconst path = this.state.getFolderPath();const destPath = path ? `${path}/${name}` : name;if (this.cachedFolders.some((f) => f.name === name)) {this.ui.showToast(`Folder already exists: ${name}`, 'warning');return;}16 unmodified linesreturn name && name.length > 0 && !forbidden.test(name) && name.length < 255;}normalizeUrl(url) {if (!url) return '';if (/^https?:\/\//i.test(url)) return url;return `https://${url}`;}openDeleteModal(path, name) {this.pendingDelete = path;const strong = document.querySelector('#deleteModal p strong');5 unmodified linesconst renameModal = document.getElementById('renameModal');const renameInput = document.getElementById('renameInput');const renameTitle = document.querySelector('#renameModal h3');const isFolder = this.cachedFolders.some((folder) => folder.path === path);this.pendingRename = {path,23 unmodified linesif (btn) btn.classList.add('loading');try {const isFolder = this.cachedFolders.some((f) => f.path === path);if (isFolder) {await this.hf.deleteFolder(path);this.state.starred.filter((starredPath) => starredPath === path || starredPath.startsWith(`${path}/`)).forEach((starredPath) => this.state.removeStar(starredPath));} else {await this.hf.deleteFile(path);this.state.removeStar(path);12 unmodified linesasync renameItem() {if (!this.pendingRename) return;const newNameInput = document.getElementById('renameInput');const btn = document.getElementById('confirmRenameBtn');if (!newNameInput || !btn) return;const newName = newNameInput.value.trim();if (!newName) {this.ui.showToast('Please enter a new name', 'warning');return;}if (newName === this.pendingRename.originalName) {document.getElementById('renameModal').classList.remove('active');this.pendingRename = null;return;}if (!this.isValidName(newName)) {this.ui.showToast('Invalid name format (avoid < > : " / \\ | ? *)', 'error');return;}const isConflict = this.state.cachedFiles.some((f) => f.name.toLowerCase() === newName.toLowerCase())|| this.cachedFolders.some((f) => f.name.toLowerCase() === newName.toLowerCase());if (isConflict) {this.ui.showToast(`An item with name "${newName}" already exists in this folder`, 'warning');return;}const path = this.pendingRename.path;const oldName = this.pendingRename.originalName;const parentPath = path.includes('/') ? path.slice(0, path.lastIndexOf('/')) : '';180 unmodified lines}}resetLinkForm() {document.getElementById('linkUrlInput').value = '';document.getElementById('linkTitleInput').value = '';document.getElementById('linkDescriptionInput').value = '';}openLinkModal(link = null) {const modal = document.getElementById('addLinkModal');const title = document.getElementById('addLinkModalTitle');const confirmBtn = document.getElementById('confirmLinkBtn');this.pendingLinkEdit = link;if (link) {title.innerHTML = '<i class="ph-fill ph-pencil-simple" style="color:var(--primary-color);margin-right:10px"></i>Edit Link';confirmBtn.innerHTML = '<i class="ph-fill ph-check"></i> Update Link';document.getElementById('linkUrlInput').value = link.url || '';document.getElementById('linkTitleInput').value = link.title || '';document.getElementById('linkDescriptionInput').value = link.description || '';} else {title.innerHTML = '<i class="ph-fill ph-link-plus" style="color:var(--primary-color);margin-right:10px"></i>Add Link';confirmBtn.innerHTML = '<i class="ph-fill ph-check"></i> Save Link';this.resetLinkForm();}modal.classList.add('active');setTimeout(() => document.getElementById('linkUrlInput').focus(), 50);}async saveLink() {const urlInput = document.getElementById('linkUrlInput');const titleInput = document.getElementById('linkTitleInput');const descriptionInput = document.getElementById('linkDescriptionInput');const confirmBtn = document.getElementById('confirmLinkBtn');const url = this.normalizeUrl(urlInput.value.trim());const title = titleInput.value.trim();const description = descriptionInput.value.trim();if (!url) {this.ui.showToast('URL is required', 'error');return;}try {confirmBtn.classList.add('loading');this.ui.showProgress(this.pendingLinkEdit ? 'Updating link...' : 'Adding link...');const isEditing = Boolean(this.pendingLinkEdit);const payload = { url, title, description };const result = isEditing? await this.hf.updateLink({ link_id: this.pendingLinkEdit.id, ...payload }): await this.hf.addLink(payload);if (!result.success) {throw new Error(result.error || 'Failed to save link');}document.getElementById('addLinkModal').classList.remove('active');this.pendingLinkEdit = null;this.resetLinkForm();this.ui.showToast(isEditing ? 'Link updated successfully' : 'Link added successfully', 'success');await this.fetchAndRenderLinks();} catch (err) {console.error('Save link error:', err);this.ui.showToast(err.message || 'Error saving link', 'error');} finally {this.ui.hideProgress();confirmBtn.classList.remove('loading');}}async deleteLink(linkId) {if (!linkId) return;if (!window.confirm('Are you sure you want to delete this link?')) return;try {this.ui.showProgress('Deleting link...');const data = await this.hf.deleteLink(linkId);if (data.success) {this.ui.showToast('Link deleted', 'success');await this.fetchAndRenderLinks();} else {this.ui.showToast(data.error || 'Failed to delete link', 'error');}} catch (err) {console.error('Delete link error:', err);this.ui.showToast(err.message || 'Error deleting link', 'error');} finally {this.ui.hideProgress();}}
4 unmodified lines56789101112131441 unmodified lines56575859606162634 unmodified linesconstructor() {this.currentPath = [];this.searchQuery = '';this.viewMode = localStorage.getItem('view_mode') || 'grid'; // 'grid' | 'list'this.currentBrowse = 'files'; // 'files' | 'starred' | 'recent'this.isFetching = false;this.cachedFiles = [];this.starred = this.load(STARRED_KEY);this.recent = this.load(RECENT_KEY);this.listeners = [];41 unmodified linesthis.notify('SET_SEARCH', query);}setBrowseMode(mode) {if (!['files', 'starred', 'recent'].includes(mode)) return;this.currentBrowse = mode;this.notify('SET_BROWSE', mode);}4 unmodified lines567891011121314151641 unmodified lines585960616263646566676869704 unmodified linesconstructor() {this.currentPath = [];this.searchQuery = '';this.linksSearchQuery = '';this.viewMode = localStorage.getItem('view_mode') || 'grid'; // 'grid' | 'list'this.currentBrowse = 'files'; // 'files' | 'starred' | 'recent' | 'links'this.isFetching = false;this.cachedFiles = [];this.cachedLinks = [];this.starred = this.load(STARRED_KEY);this.recent = this.load(RECENT_KEY);this.listeners = [];41 unmodified linesthis.notify('SET_SEARCH', query);}setLinksSearchQuery(query) {this.linksSearchQuery = typeof query === 'string' ? query : '';this.notify('SET_LINKS_SEARCH', query);}setBrowseMode(mode) {if (!['files', 'starred', 'recent', 'links'].includes(mode)) return;this.currentBrowse = mode;this.notify('SET_BROWSE', mode);}
447 unmodified lines4484494504514524531042 unmodified lines14961497149814991500150131 unmodified lines153315341535153615371538160 unmodified lines1699170017011702170317041705170617071708170937 unmodified lines1747174817491750175117521753175417551756175717581759176017611762447 unmodified linescolor: var(--primary-color);}/* ── SECTION HEADERS ── */.section-header {display: flex;1042 unmodified lines.sidebar { width: 224px; }.search-bar { width: 100%; max-width: 420px; }.grid-container { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }}@media (max-width: 768px) {31 unmodified lines.folder-card { padding: 12px; min-height: 136px; }.file-card { border-radius: 16px; }.file-preview { height: 92px; }/* Mobile Menu Toggle */.menu-toggle {160 unmodified lines.link-card-header {display: flex;justify-content: space-between;align-items: flex-start;gap: 12px;}.link-icon {width: 40px;height: 40px;37 unmodified linesoverflow: hidden;}.link-actions {display: flex;gap: 8px;justify-content: space-between;padding-top: 8px;border-top: 1px solid var(--border-color);}.link-action-btn {flex: 1;display: flex;align-items: center;justify-content: center;447 unmodified lines4484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505511042 unmodified lines1594159515961597159815991600160131 unmodified lines16331634163516361637163816391640164116421643164416451646160 unmodified lines18071808180918101811181218131814181518161817181818191820182137 unmodified lines185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894447 unmodified linescolor: var(--primary-color);}.links-view {display: flex;flex-direction: column;gap: 24px;padding-top: 12px;}.links-hero {background:radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 32%),linear-gradient(135deg, #0f172a, #1e293b 55%, #164e63);color: #f8fafc;border-radius: 24px;padding: 28px;display: flex;align-items: center;justify-content: space-between;gap: 20px;box-shadow: var(--shadow-lg);}.links-eyebrow {display: inline-flex;font-size: 11px;letter-spacing: 1.4px;text-transform: uppercase;color: rgba(255, 255, 255, 0.7);margin-bottom: 12px;}.links-hero h2 {font-size: 30px;line-height: 1.1;letter-spacing: -1px;margin-bottom: 10px;}.links-hero p {max-width: 560px;color: rgba(241, 245, 249, 0.82);line-height: 1.6;}.links-toolbar {display: grid;grid-template-columns: repeat(2, minmax(0, 180px)) minmax(240px, 1fr);gap: 16px;}.links-stat-card,.links-search {background: var(--card);border: 1px solid var(--border-color);border-radius: 18px;padding: 18px 20px;box-shadow: var(--shadow-sm);}.links-stat-card {display: flex;flex-direction: column;gap: 8px;}.links-stat-label {font-size: 11px;text-transform: uppercase;letter-spacing: 1px;color: var(--text-muted);font-weight: 700;}.links-stat-card strong {font-size: 28px;color: var(--text-main);}.links-search {display: flex;align-items: center;gap: 12px;}.links-search i {color: var(--text-muted);font-size: 18px;}.links-search input {width: 100%;border: none;background: transparent;outline: none;font-family: inherit;font-size: 14px;color: var(--text-main);}/* ── SECTION HEADERS ── */.section-header {display: flex;1042 unmodified lines.sidebar { width: 224px; }.search-bar { width: 100%; max-width: 420px; }.grid-container { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }.links-toolbar { grid-template-columns: 1fr 1fr; }.links-search { grid-column: 1 / -1; }}@media (max-width: 768px) {31 unmodified lines.folder-card { padding: 12px; min-height: 136px; }.file-card { border-radius: 16px; }.file-preview { height: 92px; }.links-hero {padding: 20px;flex-direction: column;align-items: flex-start;}.links-hero h2 { font-size: 24px; }.links-toolbar { grid-template-columns: 1fr; }.links-stat-card strong { font-size: 22px; }/* Mobile Menu Toggle */.menu-toggle {160 unmodified lines.link-card-header {display: flex;align-items: flex-start;gap: 12px;}.link-card-content {flex: 1;min-width: 0;}.link-icon {width: 40px;height: 40px;37 unmodified linesoverflow: hidden;}.link-description.muted {color: #94a3b8;font-style: italic;}.link-meta {display: flex;flex-wrap: wrap;gap: 10px 16px;font-size: 12px;color: var(--text-muted);}.link-meta span {display: inline-flex;align-items: center;gap: 6px;}.link-actions {display: flex;gap: 8px;justify-content: space-between;flex-wrap: wrap;padding-top: 8px;border-top: 1px solid var(--border-color);}.link-action-btn {flex: 1 1 140px;display: flex;align-items: center;justify-content: center;
index.html+47-18
js/api/hfService.js+48
js/main.js+339-191
js/state/stateManager.js+9-2
styles.css+134-2