Skip to content

Commit 4090f6b

Browse files
committed
feat: switch to Masonry view on small screens
- Hide the standard view button - Add window resize listener resolves #468
1 parent 1515530 commit 4090f6b

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

web-app/django/VIM/templates/instruments/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ <h4 class="ms-3 me-2 my-auto">
138138
</div>
139139
<div class="d-flex">
140140
<button type="button"
141-
class="btn me-1 px-1 py-0 justify-content-center display-btn masonry-btn"
141+
class="btn me-2 me-md-1 px-1 py-0 justify-content-center display-btn masonry-btn"
142142
id="masonry-btn"
143143
title="Masonry View"
144144
aria-label="Masonry View"
145145
aria-pressed="true">
146146
<i class="bi bi-columns-gap"></i>
147147
</button>
148148
<button type="button"
149-
class="btn me-2 px-1 py-0 justify-content-center display-btn std-btn"
149+
class="btn me-2 px-1 py-0 justify-content-center display-btn std-btn d-none d-md-inline-flex"
150150
id="std-btn"
151151
title="Standard View"
152152
aria-label="Standard View">

web-app/frontend/src/instruments/DisplaySettings.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ class DisplayManager {
5353
this.currentMasonry.layout();
5454
}
5555
});
56+
57+
// Force Masonry view on small screens
58+
window.addEventListener('resize', () => {
59+
if (window.matchMedia('(max-width: 767.98px)').matches) {
60+
this.setDisplayMode('masonry');
61+
}
62+
this.updateDisplayMode();
63+
64+
// Re-layout masonry if active
65+
if (this.getDisplayMode() === 'masonry' && this.currentMasonry) {
66+
this.currentMasonry.layout();
67+
}
68+
});
5669
}
5770

5871
private setDisplayMode(displayMode: DisplayMode): void {

0 commit comments

Comments
 (0)