feat: remember layout
This commit is contained in:
@@ -20,7 +20,7 @@ const layoutDropdown = document.getElementById('layoutDropdown');
|
|||||||
let allLinks = [];
|
let allLinks = [];
|
||||||
let searchTimeout = null;
|
let searchTimeout = null;
|
||||||
let showArchived = false;
|
let showArchived = false;
|
||||||
let currentLayout = 'masonry'; // Default layout
|
let currentLayout = localStorage.getItem('linkdingLayout') || 'masonry'; // Load from localStorage or default
|
||||||
|
|
||||||
// Initialize app
|
// Initialize app
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
@@ -150,6 +150,9 @@ function applyLayout(layout) {
|
|||||||
linksContainer.className = 'links-container';
|
linksContainer.className = 'links-container';
|
||||||
linksContainer.classList.add(`layout-${layout}`);
|
linksContainer.classList.add(`layout-${layout}`);
|
||||||
|
|
||||||
|
// Save to localStorage
|
||||||
|
localStorage.setItem('linkdingLayout', layout);
|
||||||
|
|
||||||
// Update active state in dropdown
|
// Update active state in dropdown
|
||||||
layoutDropdown.querySelectorAll('.layout-option').forEach(option => {
|
layoutDropdown.querySelectorAll('.layout-option').forEach(option => {
|
||||||
option.classList.toggle('active', option.dataset.layout === layout);
|
option.classList.toggle('active', option.dataset.layout === layout);
|
||||||
|
|||||||
Reference in New Issue
Block a user