Add mobile long-press sidebar and compact foldable sheet
@@ -27,6 +27,7 @@
27
27
- POST /api/auth/logout - Revokes the active session.
28
28
29
29
## public/app.js
30
- showApp() - Reveals app shell; keeps sidebar folded by default on mobile and shows folder overview sidebar on desktop.
30
31
- getOrCreateClientBindingId() - Creates/loads a persistent local browser binding id used in auth fingerprint derivation.
31
32
- getFingerprint() - Builds a stable fingerprint from binding id + stable browser properties (not viewport metrics) to avoid false session invalidation on UI/window-state changes.
32
33
- saveSessionState() - Persists token, selected path, and last operation timestamp in localStorage.
@@ -47,6 +48,9 @@
47
48
- fileAccentColor(name) - Returns canonical file-type accent color used by icon strokes and preview sheet outline.
48
49
- animatePreviewOpen(sourceSvgEl, sheetEl) - Animates a cloned file icon from its tile position into the full preview sheet.
49
50
- openFolderSidebar() - Persistent sidebar fallback view that shows current folder/root overview when no item is selected.
51
- closeSidebar() - Clears selection; hides the panel entirely on mobile and restores folder overview sidebar on desktop.
52
- isMobileViewport() - Central media-query helper for mobile-only sidebar/interaction behavior.
53
- hideSidebarPanel() - Hides sidebar panel and removes sidebar-open layout class from the app shell.
50
54
- renderBreadcrumb() - Builds clickable breadcrumb path and marks each folder segment as a drag-drop move target via .crumb-drop-target and data-path.
51
55
- fetchFileBlob(item) - Downloads a file as Blob with auth headers for preview/download flows.
52
56
- downloadOrView(item, sourceSvgEl) - Opens preview; prefers in-place expanded tile preview when invoked from a file icon, falls back to overlay when no source tile is available.
@@ -60,7 +64,8 @@
60
64
- createMoveNode(folderPath, label) - Builds an expandable/selectable folder node for the Move To tree.
61
65
- loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.
62
66
- isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.
63
- makeFileItem(item) - Builds a .file-item element; sets data-isdir attribute on folders and calls makeDraggable(el, item) from drag-move.js.
67
- makeFileItem(item) - Builds a .file-item element; wires desktop click-select + dblclick open, and mobile tap-open with long-press sidebar actions.
68
- attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.
64
69
65
70
## public/drag-move.js
66
71
- makeDraggable(el, item) - Attaches pointerdown to a .file-item; starts drag after threshold movement. Depends on: api(), canWrite(), navigateTo(), STATE, closeSidebar(), toast() from app.js.
@@ -27,6 +27,7 @@27
- POST /api/auth/logout - Revokes the active session.27
- POST /api/auth/logout - Revokes the active session.28
28
29
## public/app.js29
## public/app.js30
- showApp() - Reveals app shell; keeps sidebar folded by default on mobile and shows folder overview sidebar on desktop.30
- getOrCreateClientBindingId() - Creates/loads a persistent local browser binding id used in auth fingerprint derivation.31
- getOrCreateClientBindingId() - Creates/loads a persistent local browser binding id used in auth fingerprint derivation.31
- getFingerprint() - Builds a stable fingerprint from binding id + stable browser properties (not viewport metrics) to avoid false session invalidation on UI/window-state changes.32
- getFingerprint() - Builds a stable fingerprint from binding id + stable browser properties (not viewport metrics) to avoid false session invalidation on UI/window-state changes.32
- saveSessionState() - Persists token, selected path, and last operation timestamp in localStorage.33
- saveSessionState() - Persists token, selected path, and last operation timestamp in localStorage.@@ -47,6 +48,9 @@47
- fileAccentColor(name) - Returns canonical file-type accent color used by icon strokes and preview sheet outline.48
- fileAccentColor(name) - Returns canonical file-type accent color used by icon strokes and preview sheet outline.48
- animatePreviewOpen(sourceSvgEl, sheetEl) - Animates a cloned file icon from its tile position into the full preview sheet.49
- animatePreviewOpen(sourceSvgEl, sheetEl) - Animates a cloned file icon from its tile position into the full preview sheet.49
- openFolderSidebar() - Persistent sidebar fallback view that shows current folder/root overview when no item is selected.50
- openFolderSidebar() - Persistent sidebar fallback view that shows current folder/root overview when no item is selected.51
- closeSidebar() - Clears selection; hides the panel entirely on mobile and restores folder overview sidebar on desktop.52
- isMobileViewport() - Central media-query helper for mobile-only sidebar/interaction behavior.53
- hideSidebarPanel() - Hides sidebar panel and removes sidebar-open layout class from the app shell.50
- renderBreadcrumb() - Builds clickable breadcrumb path and marks each folder segment as a drag-drop move target via .crumb-drop-target and data-path.54
- renderBreadcrumb() - Builds clickable breadcrumb path and marks each folder segment as a drag-drop move target via .crumb-drop-target and data-path.51
- fetchFileBlob(item) - Downloads a file as Blob with auth headers for preview/download flows.55
- fetchFileBlob(item) - Downloads a file as Blob with auth headers for preview/download flows.52
- downloadOrView(item, sourceSvgEl) - Opens preview; prefers in-place expanded tile preview when invoked from a file icon, falls back to overlay when no source tile is available.56
- downloadOrView(item, sourceSvgEl) - Opens preview; prefers in-place expanded tile preview when invoked from a file icon, falls back to overlay when no source tile is available.@@ -60,7 +64,8 @@60
- createMoveNode(folderPath, label) - Builds an expandable/selectable folder node for the Move To tree.64
- createMoveNode(folderPath, label) - Builds an expandable/selectable folder node for the Move To tree.61
- loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.65
- loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.62
- isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.66
- isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.63
- makeFileItem(item) - Builds a .file-item element; sets data-isdir attribute on folders and calls makeDraggable(el, item) from drag-move.js.67
- makeFileItem(item) - Builds a .file-item element; wires desktop click-select + dblclick open, and mobile tap-open with long-press sidebar actions.68
- attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.64
69
65
## public/drag-move.js70
## public/drag-move.js66
- makeDraggable(el, item) - Attaches pointerdown to a .file-item; starts drag after threshold movement. Depends on: api(), canWrite(), navigateTo(), STATE, closeSidebar(), toast() from app.js.71
- makeDraggable(el, item) - Attaches pointerdown to a .file-item; starts drag after threshold movement. Depends on: api(), canWrite(), navigateTo(), STATE, closeSidebar(), toast() from app.js.@@ -20,8 +20,7 @@
20
20
- `GET /api/auth/setup-needed`
21
21
- `POST /api/auth/setup`
22
22
- `POST /api/auth/login`
23
- `session lifecycle / POST /api/auth/logout revokes active session`
24
- `session lifecycle / session expires after 1 hour of inactivity`
23
- `session lifecycle`
25
24
26
25
---
27
26
@@ -31,9 +30,17 @@
31
30
32
31
---
33
32
34
## `tests/files.routes.test.js`
35
- `POST /api/files/move / moves a file into another folder and rewrites metadata`
36
- `POST /api/files/move / moves a folder into another folder and rewrites descendant metadata`
37
- `POST /api/files/move / rejects moving a folder into itself`
33
## `test/crypto.test.js`
34
- `hybrid encrypt / decrypt round-trip`
35
36
---
37
38
## `test/files.routes.test.js`
39
- `POST /api/files/move`
40
41
---
42
43
## `test/page.load.test.js`
44
- `page load smoke test`
38
45
39
46
---
@@ -20,8 +20,7 @@20
- `GET /api/auth/setup-needed`20
- `GET /api/auth/setup-needed`21
- `POST /api/auth/setup`21
- `POST /api/auth/setup`22
- `POST /api/auth/login`22
- `POST /api/auth/login`23
- `session lifecycle / POST /api/auth/logout revokes active session`23
- `session lifecycle`24
- `session lifecycle / session expires after 1 hour of inactivity`25
24
26
---25
---27
26
@@ -31,9 +30,17 @@31
30
32
---31
---33
32
34
## `tests/files.routes.test.js`33
## `test/crypto.test.js`35
- `POST /api/files/move / moves a file into another folder and rewrites metadata`34
- `hybrid encrypt / decrypt round-trip`36
- `POST /api/files/move / moves a folder into another folder and rewrites descendant metadata`35
37
- `POST /api/files/move / rejects moving a folder into itself`36
---37
38
## `test/files.routes.test.js`39
- `POST /api/files/move`40
41
---42
43
## `test/page.load.test.js`44
- `page load smoke test`38
45
39
---46
---@@ -55,6 +55,9 @@ const STATE = {
55
55
const SESSION_KEY = 'filemanager.session.v1';
56
56
const SESSION_IDLE_TIMEOUT_MS = 60 * 60 * 1000; // 1 hour
57
57
const CLIENT_BINDING_KEY = 'filemanager.client-binding-id.v1';
58
const MOBILE_BREAKPOINT_QUERY = '(max-width: 600px)';
59
const MOBILE_LONG_PRESS_MS = 420;
60
const MOBILE_LONG_PRESS_MOVE_THRESHOLD = 10;
58
61
59
62
// ───────────────────────────────────────────────────────────────────────────
60
63
// CRYPTO HELPERS (Web Crypto API)
@@ -513,8 +516,13 @@ function showApp ()
513
516
{
514
517
document.getElementById('auth-overlay').classList.add('hidden');
515
518
document.getElementById('app').classList.remove('hidden');
516
document.getElementById('app').classList.add('sidebar-open');
517
document.getElementById('sidebar').classList.remove('hidden');
519
if (isMobileViewport())
520
{
521
hideSidebarPanel();
522
} else
523
{
524
openFolderSidebar();
525
}
518
526
document.getElementById('btn-admin').classList.toggle('hidden', !STATE.isAdmin);
519
527
startAutoRefresh();
520
528
}
@@ -914,6 +922,7 @@ function makeFileItem (item)
914
922
el.appendChild(name);
915
923
916
924
makeDraggable(el, item);
925
attachMobileLongPress(el, item);
917
926
918
927
// Single-click: open sidebar
919
928
el.addEventListener('click', (e) =>
@@ -925,6 +934,25 @@ function makeFileItem (item)
925
934
navigateTo(item.path, item._root);
926
935
return;
927
936
}
937
938
if (isMobileViewport())
939
{
940
if (el.dataset.longPressTriggered === '1')
941
{
942
el.dataset.longPressTriggered = '0';
943
return;
944
}
945
946
if (item.isDir)
947
{
948
navigateTo(item.path, STATE.currentRoot);
949
} else
950
{
951
downloadOrView(item, icon.querySelector('svg'));
952
}
953
return;
954
}
955
928
956
selectItem(el, item);
929
957
});
930
958
@@ -944,6 +972,58 @@ function makeFileItem (item)
944
972
return el;
945
973
}
946
974
975
function attachMobileLongPress (el, item)
976
{
977
if (item._root) return;
978
979
let pressTimer = null;
980
let startX = 0;
981
let startY = 0;
982
983
function clearPress ()
984
{
985
if (!pressTimer) return;
986
clearTimeout(pressTimer);
987
pressTimer = null;
988
}
989
990
function cancelPress ()
991
{
992
clearPress();
993
}
994
995
el.addEventListener('pointerdown', (e) =>
996
{
997
if (!isMobileViewport()) return;
998
if (e.button !== undefined && e.button !== 0) return;
999
if (e.pointerType && e.pointerType === 'mouse') return;
1000
1001
startX = e.clientX;
1002
startY = e.clientY;
1003
clearPress();
1004
1005
pressTimer = setTimeout(() =>
1006
{
1007
pressTimer = null;
1008
el.dataset.longPressTriggered = '1';
1009
selectItem(el, item);
1010
}, MOBILE_LONG_PRESS_MS);
1011
});
1012
1013
el.addEventListener('pointermove', (e) =>
1014
{
1015
if (!pressTimer) return;
1016
if (Math.hypot(e.clientX - startX, e.clientY - startY) > MOBILE_LONG_PRESS_MOVE_THRESHOLD)
1017
{
1018
clearPress();
1019
}
1020
});
1021
1022
el.addEventListener('pointerup', cancelPress);
1023
el.addEventListener('pointercancel', cancelPress);
1024
el.addEventListener('pointerleave', cancelPress);
1025
}
1026
947
1027
function selectItem (el, item)
948
1028
{
949
1029
document.querySelectorAll('.file-item.selected').forEach(e => e.classList.remove('selected'));
@@ -1065,9 +1145,29 @@ function closeSidebar ()
1065
1145
{
1066
1146
document.querySelectorAll('.file-item.selected').forEach(e => e.classList.remove('selected'));
1067
1147
STATE.selectedItem = null;
1148
1149
if (isMobileViewport())
1150
{
1151
hideSidebarPanel();
1152
return;
1153
}
1154
1068
1155
openFolderSidebar();
1069
1156
}
1070
1157
1158
function isMobileViewport ()
1159
{
1160
return window.matchMedia(MOBILE_BREAKPOINT_QUERY).matches;
1161
}
1162
1163
function hideSidebarPanel ()
1164
{
1165
const sidebar = document.getElementById('sidebar');
1166
const app = document.getElementById('app');
1167
sidebar.classList.add('hidden');
1168
app.classList.remove('sidebar-open');
1169
}
1170
1071
1171
function basenameOfPath (p)
1072
1172
{
1073
1173
const parts = String(p || '').split(/[\\/]/).filter(Boolean);
@@ -2959,7 +3059,31 @@ function wireEvents ()
2959
3059
}
2960
3060
});
2961
3061
2962
// Sidebar is persistent; close button is intentionally disabled.
3062
document.getElementById('sidebar-close').addEventListener('click', (e) =>
3063
{
3064
e.stopPropagation();
3065
hideSidebarPanel();
3066
});
3067
3068
const mobileQuery = window.matchMedia(MOBILE_BREAKPOINT_QUERY);
3069
const syncSidebarForViewport = () =>
3070
{
3071
if (isMobileViewport())
3072
{
3073
hideSidebarPanel();
3074
return;
3075
}
3076
3077
if (!STATE.selectedItem) openFolderSidebar();
3078
};
3079
3080
if (typeof mobileQuery.addEventListener === 'function')
3081
{
3082
mobileQuery.addEventListener('change', syncSidebarForViewport);
3083
} else if (typeof mobileQuery.addListener === 'function')
3084
{
3085
mobileQuery.addListener(syncSidebarForViewport);
3086
}
2963
3087
2964
3088
// Click outside grid clears selection and returns to folder sidebar info.
2965
3089
document.getElementById('main-content').addEventListener('click', (e) =>
@@ -55,6 +55,9 @@ const STATE = {55
const SESSION_KEY = 'filemanager.session.v1';55
const SESSION_KEY = 'filemanager.session.v1';56
const SESSION_IDLE_TIMEOUT_MS = 60 * 60 * 1000; // 1 hour56
const SESSION_IDLE_TIMEOUT_MS = 60 * 60 * 1000; // 1 hour57
const CLIENT_BINDING_KEY = 'filemanager.client-binding-id.v1';57
const CLIENT_BINDING_KEY = 'filemanager.client-binding-id.v1';58
const MOBILE_BREAKPOINT_QUERY = '(max-width: 600px)';59
const MOBILE_LONG_PRESS_MS = 420;60
const MOBILE_LONG_PRESS_MOVE_THRESHOLD = 10;58
61
59
// ───────────────────────────────────────────────────────────────────────────62
// ───────────────────────────────────────────────────────────────────────────60
// CRYPTO HELPERS (Web Crypto API)63
// CRYPTO HELPERS (Web Crypto API)@@ -513,8 +516,13 @@ function showApp ()513
{516
{514
document.getElementById('auth-overlay').classList.add('hidden');517
document.getElementById('auth-overlay').classList.add('hidden');515
document.getElementById('app').classList.remove('hidden');518
document.getElementById('app').classList.remove('hidden');516
document.getElementById('app').classList.add('sidebar-open');519
if (isMobileViewport())517
document.getElementById('sidebar').classList.remove('hidden');520
{521
hideSidebarPanel();522
} else523
{524
openFolderSidebar();525
}518
document.getElementById('btn-admin').classList.toggle('hidden', !STATE.isAdmin);526
document.getElementById('btn-admin').classList.toggle('hidden', !STATE.isAdmin);519
startAutoRefresh();527
startAutoRefresh();520
}528
}@@ -914,6 +922,7 @@ function makeFileItem (item)914
el.appendChild(name);922
el.appendChild(name);915
923
916
makeDraggable(el, item);924
makeDraggable(el, item);925
attachMobileLongPress(el, item);917
926
918
// Single-click: open sidebar927
// Single-click: open sidebar919
el.addEventListener('click', (e) =>928
el.addEventListener('click', (e) =>@@ -925,6 +934,25 @@ function makeFileItem (item)925
navigateTo(item.path, item._root);934
navigateTo(item.path, item._root);926
return;935
return;927
}936
}937
938
if (isMobileViewport())939
{940
if (el.dataset.longPressTriggered === '1')941
{942
el.dataset.longPressTriggered = '0';943
return;944
}945
946
if (item.isDir)947
{948
navigateTo(item.path, STATE.currentRoot);949
} else950
{951
downloadOrView(item, icon.querySelector('svg'));952
}953
return;954
}955
928
selectItem(el, item);956
selectItem(el, item);929
});957
});930
958
@@ -944,6 +972,58 @@ function makeFileItem (item)944
return el;972
return el;945
}973
}946
974
975
function attachMobileLongPress (el, item)976
{977
if (item._root) return;978
979
let pressTimer = null;980
let startX = 0;981
let startY = 0;982
983
function clearPress ()984
{985
if (!pressTimer) return;986
clearTimeout(pressTimer);987
pressTimer = null;988
}989
990
function cancelPress ()991
{992
clearPress();993
}994
995
el.addEventListener('pointerdown', (e) =>996
{997
if (!isMobileViewport()) return;998
if (e.button !== undefined && e.button !== 0) return;999
if (e.pointerType && e.pointerType === 'mouse') return;1000
1001
startX = e.clientX;1002
startY = e.clientY;1003
clearPress();1004
1005
pressTimer = setTimeout(() =>1006
{1007
pressTimer = null;1008
el.dataset.longPressTriggered = '1';1009
selectItem(el, item);1010
}, MOBILE_LONG_PRESS_MS);1011
});1012
1013
el.addEventListener('pointermove', (e) =>1014
{1015
if (!pressTimer) return;1016
if (Math.hypot(e.clientX - startX, e.clientY - startY) > MOBILE_LONG_PRESS_MOVE_THRESHOLD)1017
{1018
clearPress();1019
}1020
});1021
1022
el.addEventListener('pointerup', cancelPress);1023
el.addEventListener('pointercancel', cancelPress);1024
el.addEventListener('pointerleave', cancelPress);1025
}1026
947
function selectItem (el, item)1027
function selectItem (el, item)948
{1028
{949
document.querySelectorAll('.file-item.selected').forEach(e => e.classList.remove('selected'));1029
document.querySelectorAll('.file-item.selected').forEach(e => e.classList.remove('selected'));@@ -1065,9 +1145,29 @@ function closeSidebar ()1065
{1145
{1066
document.querySelectorAll('.file-item.selected').forEach(e => e.classList.remove('selected'));1146
document.querySelectorAll('.file-item.selected').forEach(e => e.classList.remove('selected'));1067
STATE.selectedItem = null;1147
STATE.selectedItem = null;1148
1149
if (isMobileViewport())1150
{1151
hideSidebarPanel();1152
return;1153
}1154
1068
openFolderSidebar();1155
openFolderSidebar();1069
}1156
}1070
1157
1158
function isMobileViewport ()1159
{1160
return window.matchMedia(MOBILE_BREAKPOINT_QUERY).matches;1161
}1162
1163
function hideSidebarPanel ()1164
{1165
const sidebar = document.getElementById('sidebar');1166
const app = document.getElementById('app');1167
sidebar.classList.add('hidden');1168
app.classList.remove('sidebar-open');1169
}1170
1071
function basenameOfPath (p)1171
function basenameOfPath (p)1072
{1172
{1073
const parts = String(p || '').split(/[\\/]/).filter(Boolean);1173
const parts = String(p || '').split(/[\\/]/).filter(Boolean);@@ -2959,7 +3059,31 @@ function wireEvents ()2959
}3059
}2960
});3060
});2961
3061
2962
// Sidebar is persistent; close button is intentionally disabled.3062
document.getElementById('sidebar-close').addEventListener('click', (e) =>3063
{3064
e.stopPropagation();3065
hideSidebarPanel();3066
});3067
3068
const mobileQuery = window.matchMedia(MOBILE_BREAKPOINT_QUERY);3069
const syncSidebarForViewport = () =>3070
{3071
if (isMobileViewport())3072
{3073
hideSidebarPanel();3074
return;3075
}3076
3077
if (!STATE.selectedItem) openFolderSidebar();3078
};3079
3080
if (typeof mobileQuery.addEventListener === 'function')3081
{3082
mobileQuery.addEventListener('change', syncSidebarForViewport);3083
} else if (typeof mobileQuery.addListener === 'function')3084
{3085
mobileQuery.addListener(syncSidebarForViewport);3086
}2963
3087
2964
// Click outside grid clears selection and returns to folder sidebar info.3088
// Click outside grid clears selection and returns to folder sidebar info.2965
document.getElementById('main-content').addEventListener('click', (e) =>3089
document.getElementById('main-content').addEventListener('click', (e) =>@@ -127,7 +127,7 @@
127
127
128
128
<!-- SIDEBAR -->
129
129
<aside id="sidebar" class="hidden">
130
<button id="sidebar-close" aria-label="Close sidebar">✕</button>
130
<button id="sidebar-close" aria-label="Fold sidebar">⌄</button>
131
131
<div id="sidebar-icon"></div>
132
132
<h2 id="sidebar-name"></h2>
133
133
<dl id="sidebar-meta"></dl>
@@ -127,7 +127,7 @@127
127
128
<!-- SIDEBAR -->128
<!-- SIDEBAR -->129
<aside id="sidebar" class="hidden">129
<aside id="sidebar" class="hidden">130
<button id="sidebar-close" aria-label="Close sidebar">✕</button>130
<button id="sidebar-close" aria-label="Fold sidebar">⌄</button>131
<div id="sidebar-icon"></div>131
<div id="sidebar-icon"></div>132
<h2 id="sidebar-name"></h2>132
<h2 id="sidebar-name"></h2>133
<dl id="sidebar-meta"></dl>133
<dl id="sidebar-meta"></dl>@@ -344,6 +344,21 @@ button.danger:hover {
344
344
345
345
#sidebar-close {
346
346
display: none;
347
align-items: center;
348
justify-content: center;
349
width: 1.7rem;
350
height: 1.7rem;
351
border: 1px solid transparent;
352
border-radius: 999px;
353
background: transparent;
354
color: var(--text-muted);
355
font-size: 1rem;
356
line-height: 1;
357
}
358
359
#sidebar-close:hover {
360
background: var(--surface2);
361
color: var(--text);
347
362
}
348
363
349
364
#sidebar-icon {
@@ -896,11 +911,40 @@ button.danger:hover {
896
911
897
912
#sidebar {
898
913
top: auto;
914
right: 0;
915
bottom: 0;
899
916
left: 0;
900
height: 60vh;
917
height: auto;
918
max-height: min(68vh, calc(100vh - 0.5rem));
919
padding: 0.9rem 0.9rem 1rem;
901
920
border-left: none;
902
921
border-top: 1px solid var(--border);
903
922
width: 100%;
923
border-radius: 14px 14px 0 0;
924
box-shadow: 0 -12px 26px rgba(0, 0, 0, 0.34);
925
gap: 0.55rem;
926
}
927
928
#sidebar-close {
929
display: inline-flex;
930
position: absolute;
931
top: 0.45rem;
932
right: 0.45rem;
933
border-color: var(--border);
934
background: var(--surface2);
935
}
936
937
#sidebar-name {
938
padding-right: 2rem;
939
}
940
941
#sidebar-icon svg {
942
width: 54px;
943
height: 54px;
944
}
945
946
#sidebar-actions {
947
margin-top: 0.2rem;
904
948
}
905
949
906
950
.modal {
@@ -344,6 +344,21 @@ button.danger:hover {344
344
345
#sidebar-close {345
#sidebar-close {346
display: none;346
display: none;347
align-items: center;348
justify-content: center;349
width: 1.7rem;350
height: 1.7rem;351
border: 1px solid transparent;352
border-radius: 999px;353
background: transparent;354
color: var(--text-muted);355
font-size: 1rem;356
line-height: 1;357
}358
359
#sidebar-close:hover {360
background: var(--surface2);361
color: var(--text);347
}362
}348
363
349
#sidebar-icon {364
#sidebar-icon {@@ -896,11 +911,40 @@ button.danger:hover {896
911
897
#sidebar {912
#sidebar {898
top: auto;913
top: auto;914
right: 0;915
bottom: 0;899
left: 0;916
left: 0;900
height: 60vh;917
height: auto;918
max-height: min(68vh, calc(100vh - 0.5rem));919
padding: 0.9rem 0.9rem 1rem;901
border-left: none;920
border-left: none;902
border-top: 1px solid var(--border);921
border-top: 1px solid var(--border);903
width: 100%;922
width: 100%;923
border-radius: 14px 14px 0 0;924
box-shadow: 0 -12px 26px rgba(0, 0, 0, 0.34);925
gap: 0.55rem;926
}927
928
#sidebar-close {929
display: inline-flex;930
position: absolute;931
top: 0.45rem;932
right: 0.45rem;933
border-color: var(--border);934
background: var(--surface2);935
}936
937
#sidebar-name {938
padding-right: 2rem;939
}940
941
#sidebar-icon svg {942
width: 54px;943
height: 54px;944
}945
946
#sidebar-actions {947
margin-top: 0.2rem;904
}948
}905
949
906
.modal {950
.modal {@@ -40,7 +40,7 @@ describe('page load smoke test', () =>
40
40
41
41
afterAll(() => server.close());
42
42
43
test('requests / and boots the client without runtime errors', async () =>
43
async function bootClient ({ mobile = false } = {})
44
44
{
45
45
const virtualConsole = new VirtualConsole();
46
46
const runtimeErrors = [];
@@ -64,7 +64,7 @@ describe('page load smoke test', () =>
64
64
return fetch(new URL(url, baseUrl).toString(), init);
65
65
};
66
66
window.HTMLElement.prototype.focus = function focus () { };
67
window.matchMedia = () => ({ matches: false, addListener () { }, removeListener () { }, addEventListener () { }, removeEventListener () { } });
67
window.matchMedia = () => ({ matches: mobile, addListener () { }, removeListener () { }, addEventListener () { }, removeEventListener () { } });
68
68
window.scrollTo = () => { };
69
69
70
70
const saved = {
@@ -82,8 +82,27 @@ describe('page load smoke test', () =>
82
82
await new Promise((resolve) => dom.window.addEventListener('load', resolve, { once: true }));
83
83
await new Promise(resolve => dom.window.setTimeout(resolve, 100));
84
84
85
return { dom, runtimeErrors };
86
}
87
88
test('requests / and boots the client without runtime errors', async () =>
89
{
90
const { dom, runtimeErrors } = await bootClient();
91
92
expect(runtimeErrors).toEqual([]);
93
expect(dom.window.document.getElementById('app').classList.contains('hidden')).toBe(false);
94
expect(dom.window.document.getElementById('sidebar').classList.contains('hidden')).toBe(false);
95
96
dom.window.close();
97
});
98
99
test('keeps sidebar folded on initial mobile boot', async () =>
100
{
101
const { dom, runtimeErrors } = await bootClient({ mobile: true });
102
85
103
expect(runtimeErrors).toEqual([]);
86
104
expect(dom.window.document.getElementById('app').classList.contains('hidden')).toBe(false);
105
expect(dom.window.document.getElementById('sidebar').classList.contains('hidden')).toBe(true);
87
106
88
107
dom.window.close();
89
108
});
@@ -40,7 +40,7 @@ describe('page load smoke test', () =>40
40
41
afterAll(() => server.close());41
afterAll(() => server.close());42
42
43
test('requests / and boots the client without runtime errors', async () =>43
async function bootClient ({ mobile = false } = {})44
{44
{45
const virtualConsole = new VirtualConsole();45
const virtualConsole = new VirtualConsole();46
const runtimeErrors = [];46
const runtimeErrors = [];@@ -64,7 +64,7 @@ describe('page load smoke test', () =>64
return fetch(new URL(url, baseUrl).toString(), init);64
return fetch(new URL(url, baseUrl).toString(), init);65
};65
};66
window.HTMLElement.prototype.focus = function focus () { };66
window.HTMLElement.prototype.focus = function focus () { };67
window.matchMedia = () => ({ matches: false, addListener () { }, removeListener () { }, addEventListener () { }, removeEventListener () { } });67
window.matchMedia = () => ({ matches: mobile, addListener () { }, removeListener () { }, addEventListener () { }, removeEventListener () { } });68
window.scrollTo = () => { };68
window.scrollTo = () => { };69
69
70
const saved = {70
const saved = {@@ -82,8 +82,27 @@ describe('page load smoke test', () =>82
await new Promise((resolve) => dom.window.addEventListener('load', resolve, { once: true }));82
await new Promise((resolve) => dom.window.addEventListener('load', resolve, { once: true }));83
await new Promise(resolve => dom.window.setTimeout(resolve, 100));83
await new Promise(resolve => dom.window.setTimeout(resolve, 100));84
84
85
return { dom, runtimeErrors };86
}87
88
test('requests / and boots the client without runtime errors', async () =>89
{90
const { dom, runtimeErrors } = await bootClient();91
92
expect(runtimeErrors).toEqual([]);93
expect(dom.window.document.getElementById('app').classList.contains('hidden')).toBe(false);94
expect(dom.window.document.getElementById('sidebar').classList.contains('hidden')).toBe(false);95
96
dom.window.close();97
});98
99
test('keeps sidebar folded on initial mobile boot', async () =>100
{101
const { dom, runtimeErrors } = await bootClient({ mobile: true });102
85
expect(runtimeErrors).toEqual([]);103
expect(runtimeErrors).toEqual([]);86
expect(dom.window.document.getElementById('app').classList.contains('hidden')).toBe(false);104
expect(dom.window.document.getElementById('app').classList.contains('hidden')).toBe(false);105
expect(dom.window.document.getElementById('sidebar').classList.contains('hidden')).toBe(true);87
106
88
dom.window.close();107
dom.window.close();89
});108
});