Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web-app/django/VIM/templates/instruments/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ <h4 class="ms-3 me-2 my-auto">
</div>
<div class="d-flex">
<button type="button"
class="btn me-1 px-1 py-0 justify-content-center display-btn masonry-btn"
class="btn me-2 me-md-1 px-1 py-0 justify-content-center display-btn masonry-btn"
id="masonry-btn"
title="Masonry View"
aria-label="Masonry View"
aria-pressed="true">
<i class="bi bi-columns-gap"></i>
</button>
<button type="button"
class="btn me-2 px-1 py-0 justify-content-center display-btn std-btn"
class="btn me-2 px-1 py-0 justify-content-center display-btn std-btn d-none d-md-inline-flex"
id="std-btn"
title="Standard View"
aria-label="Standard View">
Expand Down
13 changes: 13 additions & 0 deletions web-app/frontend/src/instruments/DisplaySettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ class DisplayManager {
this.currentMasonry.layout();
}
});

// Force Masonry view on small screens
window.addEventListener('resize', () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resize event listeners are usually not performant, and can cause performance problems. Use ResizeObserver instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Thank you.

if (window.matchMedia('(max-width: 767.98px)').matches) {
this.setDisplayMode('masonry');
}
this.updateDisplayMode();

// Re-layout masonry if active
if (this.getDisplayMode() === 'masonry' && this.currentMasonry) {
this.currentMasonry.layout();
}
});
}

private setDisplayMode(displayMode: DisplayMode): void {
Expand Down
Loading