feat(web): update frontend TypeScript modules and API types
This commit updates the web frontend TypeScript modules: Core modules: - admin.ts: Admin panel functionality and user management - analytics.ts: Analytics dashboard and data visualization - api-explorer.ts: Interactive API documentation explorer - api.ts: Core API client with request/response handling - collections.ts: Book collection management UI - conflicts.ts: Sync conflict resolution interface - custom-section-builder.ts: Dynamic section builder for UI - docs.ts: Documentation viewer and navigation - dom.ts: DOM manipulation utilities and helpers - header.ts: Application header with navigation - library.ts: Library view and book grid management - linking.ts: Device-book linking interface - password_validation.ts: Client-side password strength validation - queue.ts: Device sync queue management UI - search.ts: Full-text search with Lunr integration - storage.ts: Local storage and cache management - theme.ts: Theme management and CSS variable updates - themeDropdown.ts: Theme selector dropdown component - toast.ts: Toast notification system - woodPaneling.ts: Visual theme effects - woodPanelingInit.ts: Visual effects initialization Type definitions: - api.d.ts: Updated TypeScript definitions for API responses These updates enhance the frontend with improved functionality for book management, device synchronization, and user experience.
This commit is contained in:
+33
-33
@@ -2,25 +2,25 @@
|
||||
|
||||
// Update visual indicators for theme buttons
|
||||
const updateThemeIndicators = (): void => {
|
||||
const currentTheme = localStorage.getItem('theme') || 'tokyo-night';
|
||||
const currentTheme = localStorage.getItem("theme") || "tokyo-night";
|
||||
|
||||
// Update theme buttons (all buttons with changeThemeTo onclick)
|
||||
document.querySelectorAll('[onclick^="changeThemeTo"]').forEach(btn => {
|
||||
const onclick = btn.getAttribute('onclick') || '';
|
||||
const match = onclick.match(/changeThemeTo\('(.+?)'\)/);
|
||||
if (match) {
|
||||
const theme = match[1];
|
||||
if (theme === currentTheme) {
|
||||
// Active state - use CSS class instead of inline style
|
||||
btn.classList.add('bg-theme-active');
|
||||
btn.classList.remove('bg-theme-inactive');
|
||||
} else {
|
||||
// Inactive state
|
||||
btn.classList.remove('bg-theme-active');
|
||||
btn.classList.add('bg-theme-inactive');
|
||||
}
|
||||
}
|
||||
});
|
||||
// Update theme buttons (all buttons with changeThemeTo onclick)
|
||||
document.querySelectorAll('[onclick^="changeThemeTo"]').forEach((btn) => {
|
||||
const onclick = btn.getAttribute("onclick") || "";
|
||||
const match = onclick.match(/changeThemeTo\('(.+?)'\)/);
|
||||
if (match) {
|
||||
const theme = match[1];
|
||||
if (theme === currentTheme) {
|
||||
// Active state - use CSS class instead of inline style
|
||||
btn.classList.add("bg-theme-active");
|
||||
btn.classList.remove("bg-theme-inactive");
|
||||
} else {
|
||||
// Inactive state
|
||||
btn.classList.remove("bg-theme-active");
|
||||
btn.classList.add("bg-theme-inactive");
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Make function available globally
|
||||
@@ -29,27 +29,27 @@ const updateThemeIndicators = (): void => {
|
||||
// Update on dropdown toggle
|
||||
const originalToggleThemeDropdown = (window as any).toggleThemeDropdown;
|
||||
if (originalToggleThemeDropdown) {
|
||||
(window as any).toggleThemeDropdown = () => {
|
||||
originalToggleThemeDropdown();
|
||||
updateThemeIndicators();
|
||||
(window as any).updateWoodPanelingIndicators?.();
|
||||
};
|
||||
(window as any).toggleThemeDropdown = () => {
|
||||
originalToggleThemeDropdown();
|
||||
updateThemeIndicators();
|
||||
(window as any).updateWoodPanelingIndicators?.();
|
||||
};
|
||||
}
|
||||
|
||||
// Update after theme changes
|
||||
const originalChangeThemeTo = (window as any).changeThemeTo;
|
||||
if (originalChangeThemeTo) {
|
||||
(window as any).changeThemeTo = (...args: unknown[]) => {
|
||||
originalChangeThemeTo(...args);
|
||||
updateThemeIndicators();
|
||||
};
|
||||
(window as any).changeThemeTo = (...args: unknown[]) => {
|
||||
originalChangeThemeTo(...args);
|
||||
updateThemeIndicators();
|
||||
};
|
||||
}
|
||||
|
||||
// Auto-initialize when DOM is ready
|
||||
if (typeof document !== 'undefined') {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', updateThemeIndicators);
|
||||
} else {
|
||||
updateThemeIndicators();
|
||||
}
|
||||
if (typeof document !== "undefined") {
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", updateThemeIndicators);
|
||||
} else {
|
||||
updateThemeIndicators();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user