chore: enforce British English and translate share/conflict UI copy
@@ -1,31 +1,35 @@
1
# AI Coding Agent Instructions for Filemanager
2
3
## Architecture Essentials
4
5
### Technical Specifications
6
- For every file and implementation, log the file and all of its classes and functions in `.github/technical-reference.md`
7
- When functionality is modified or added, update that file.
8
- Reference the file before making changes to ensure no duplicate functionality is made
9
- the file serves as an index and reference for the code architecture, as well as individual classes and methods.
10
- Keep it short and specific; no paragraphs of explanation, only a simple notation of a file, class or method and a one-line description of what it does, what it should be used for, and what to keep into account when using it.
11
- `.github/tests.md` is an index of every test file and every test name inside it. Keep it up to date whenever tests are added, removed, or renamed. Reference it to understand existing coverage before deciding whether to add a new test.
12
13
14
## Developer Workflows
15
16
### Git authoring
17
- When starting work on something, create a feature or fix branch
18
- When concrete, complete steps are made, create a commit in that branch
19
- Try to commit frequently, chunking work into individual steps
20
- When all work is done, merge the branch into master, and then delete it so only master remains
21
- Ensure you don't leave old branches you've made in git and that everything is merged neatly.
22
- Always run the full test suite and fix any issues (including unrelated to your work) before merging to master.
23
24
## Testing Expectations
25
- **Default rule:** every new feature should receive a test that verifies it behaves as requested.
26
- If a very similar test already exists, expand or adapt that test instead of creating duplicate coverage.
27
- When a change affects an area that existing tests are meant to cover, update those tests so the new behavior is validated too.
28
- After modifying any function or module, check `tests.md` for tests that exercise that code path — directly or indirectly — and verify those tests still reflect the current behavior. If they no longer do, update them before finishing.
29
- When encountering existing functionality that is not covered by tests, automatically add coverage for it unless it is extremely simple; for extremely simple cases, ask the user first before skipping the test.
30
- Only skip adding a test, or ask the user first, when the change is truly tiny or not behaviorally meaningful (for example: wording-only copy edits, comments, or other negligible changes).
31
- Prefer reusing production helpers and real code paths in tests rather than duplicating business logic in test-only code.
1
# AI Coding Agent Instructions for Filemanager
2
3
## Architecture Essentials
4
5
### Language & Copy
6
- User-facing website copy must be in British English.
7
- New or modified UI text (buttons, labels, dialogs, errors, tooltips, share pages) must be in British English.
8
9
### Technical Specifications
10
- For every file and implementation, log the file and all of its classes and functions in `.github/technical-reference.md`
11
- When functionality is modified or added, update that file.
12
- Reference the file before making changes to ensure no duplicate functionality is made
13
- the file serves as an index and reference for the code architecture, as well as individual classes and methods.
14
- Keep it short and specific; no paragraphs of explanation, only a simple notation of a file, class or method and a one-line description of what it does, what it should be used for, and what to keep into account when using it.
15
- `.github/tests.md` is an index of every test file and every test name inside it. Keep it up to date whenever tests are added, removed, or renamed. Reference it to understand existing coverage before deciding whether to add a new test.
16
17
18
## Developer Workflows
19
20
### Git authoring
21
- When starting work on something, create a feature or fix branch
22
- When concrete, complete steps are made, create a commit in that branch
23
- Try to commit frequently, chunking work into individual steps
24
- When all work is done, merge the branch into master, and then delete it so only master remains
25
- Ensure you don't leave old branches you've made in git and that everything is merged neatly.
26
- Always run the full test suite and fix any issues (including unrelated to your work) before merging to master.
27
28
## Testing Expectations
29
- **Default rule:** every new feature should receive a test that verifies it behaves as requested.
30
- If a very similar test already exists, expand or adapt that test instead of creating duplicate coverage.
31
- When a change affects an area that existing tests are meant to cover, update those tests so the new behavior is validated too.
32
- After modifying any function or module, check `tests.md` for tests that exercise that code path — directly or indirectly — and verify those tests still reflect the current behavior. If they no longer do, update them before finishing.
33
- When encountering existing functionality that is not covered by tests, automatically add coverage for it unless it is extremely simple; for extremely simple cases, ask the user first before skipping the test.
34
- Only skip adding a test, or ask the user first, when the change is truly tiny or not behaviorally meaningful (for example: wording-only copy edits, comments, or other negligible changes).
35
- Prefer reusing production helpers and real code paths in tests rather than duplicating business logic in test-only code.
@@ -1,31 +1,35 @@1
# AI Coding Agent Instructions for Filemanager1
# AI Coding Agent Instructions for Filemanager
2
2
3
## Architecture Essentials3
## Architecture Essentials
4
4
5
### Technical Specifications5
### Language & Copy
6
- For every file and implementation, log the file and all of its classes and functions in `.github/technical-reference.md`6
- User-facing website copy must be in British English.
7
- When functionality is modified or added, update that file.7
- New or modified UI text (buttons, labels, dialogs, errors, tooltips, share pages) must be in British English.
8
- Reference the file before making changes to ensure no duplicate functionality is made8
9
- the file serves as an index and reference for the code architecture, as well as individual classes and methods.9
### Technical Specifications
10
- Keep it short and specific; no paragraphs of explanation, only a simple notation of a file, class or method and a one-line description of what it does, what it should be used for, and what to keep into account when using it.10
- For every file and implementation, log the file and all of its classes and functions in `.github/technical-reference.md`
11
- `.github/tests.md` is an index of every test file and every test name inside it. Keep it up to date whenever tests are added, removed, or renamed. Reference it to understand existing coverage before deciding whether to add a new test.11
- When functionality is modified or added, update that file.
12
12
- Reference the file before making changes to ensure no duplicate functionality is made
13
13
- the file serves as an index and reference for the code architecture, as well as individual classes and methods.
14
## Developer Workflows14
- Keep it short and specific; no paragraphs of explanation, only a simple notation of a file, class or method and a one-line description of what it does, what it should be used for, and what to keep into account when using it.
15
15
- `.github/tests.md` is an index of every test file and every test name inside it. Keep it up to date whenever tests are added, removed, or renamed. Reference it to understand existing coverage before deciding whether to add a new test.
16
### Git authoring16
17
- When starting work on something, create a feature or fix branch17
18
- When concrete, complete steps are made, create a commit in that branch18
## Developer Workflows
19
- Try to commit frequently, chunking work into individual steps19
20
- When all work is done, merge the branch into master, and then delete it so only master remains20
### Git authoring
21
- Ensure you don't leave old branches you've made in git and that everything is merged neatly.21
- When starting work on something, create a feature or fix branch
22
- Always run the full test suite and fix any issues (including unrelated to your work) before merging to master.22
- When concrete, complete steps are made, create a commit in that branch
23
23
- Try to commit frequently, chunking work into individual steps
24
## Testing Expectations24
- When all work is done, merge the branch into master, and then delete it so only master remains
25
- **Default rule:** every new feature should receive a test that verifies it behaves as requested.25
- Ensure you don't leave old branches you've made in git and that everything is merged neatly.
26
- If a very similar test already exists, expand or adapt that test instead of creating duplicate coverage.26
- Always run the full test suite and fix any issues (including unrelated to your work) before merging to master.
27
- When a change affects an area that existing tests are meant to cover, update those tests so the new behavior is validated too.27
28
- After modifying any function or module, check `tests.md` for tests that exercise that code path — directly or indirectly — and verify those tests still reflect the current behavior. If they no longer do, update them before finishing.28
## Testing Expectations
29
- When encountering existing functionality that is not covered by tests, automatically add coverage for it unless it is extremely simple; for extremely simple cases, ask the user first before skipping the test.29
- **Default rule:** every new feature should receive a test that verifies it behaves as requested.
30
- Only skip adding a test, or ask the user first, when the change is truly tiny or not behaviorally meaningful (for example: wording-only copy edits, comments, or other negligible changes).30
- If a very similar test already exists, expand or adapt that test instead of creating duplicate coverage.
31
- Prefer reusing production helpers and real code paths in tests rather than duplicating business logic in test-only code.31
- When a change affects an area that existing tests are meant to cover, update those tests so the new behavior is validated too.
32
- After modifying any function or module, check `tests.md` for tests that exercise that code path — directly or indirectly — and verify those tests still reflect the current behavior. If they no longer do, update them before finishing.
33
- When encountering existing functionality that is not covered by tests, automatically add coverage for it unless it is extremely simple; for extremely simple cases, ask the user first before skipping the test.
34
- Only skip adding a test, or ask the user first, when the change is truly tiny or not behaviorally meaningful (for example: wording-only copy edits, comments, or other negligible changes).
35
- Prefer reusing production helpers and real code paths in tests rather than duplicating business logic in test-only code.
@@ -563,10 +563,10 @@ function showFileConflictChoice (filename, renameTo, mode = 'upload')
563
563
const btnRename = document.getElementById('file-conflict-rename-btn');
564
564
const btnCancel = document.getElementById('file-conflict-cancel');
565
565
566
title.textContent = mode === 'move' ? 'Bestand verplaatsen' : 'Bestand uploaden';
566
title.textContent = mode === 'move' ? 'Move file' : 'Upload file';
567
567
fileEl.textContent = filename;
568
568
renameEl.textContent = renameTo;
569
btnRename.textContent = `Hernoemen (${renameTo})`;
569
btnRename.textContent = `Rename (${renameTo})`;
570
570
571
571
overlay.classList.remove('hidden');
572
572
@@ -603,9 +603,9 @@ async function openShareModal (item)
603
603
const closeBtn = document.getElementById('share-modal-close');
604
604
const msgEl = document.getElementById('share-modal-msg');
605
605
606
urlInput.value = 'Link aanmaken…';
606
urlInput.value = 'Creating link...';
607
607
copyBtn.disabled = true;
608
msgEl.textContent = 'De link is 24 uur geldig.';
608
msgEl.textContent = 'This link is valid for 24 hours.';
609
609
overlay.classList.remove('hidden');
610
610
611
611
let data;
@@ -614,14 +614,14 @@ async function openShareModal (item)
614
614
data = await api('POST', '/share/create', { filePath: item.path });
615
615
} catch (err)
616
616
{
617
msgEl.textContent = 'Fout: ' + (err.message || 'Kon geen link aanmaken.');
617
msgEl.textContent = 'Error: ' + (err.message || 'Could not create link.');
618
618
urlInput.value = '';
619
619
return;
620
620
}
621
621
622
622
if (!data || !data.token)
623
623
{
624
msgEl.textContent = 'Onbekende fout bij aanmaken van de link.';
624
msgEl.textContent = 'Unknown error while creating link.';
625
625
urlInput.value = '';
626
626
return;
627
627
}
@@ -643,7 +643,7 @@ async function openShareModal (item)
643
643
navigator.clipboard.writeText(shareUrl).then(() =>
644
644
{
645
645
const orig = copyBtn.textContent;
646
copyBtn.textContent = 'Gekopieerd!';
646
copyBtn.textContent = 'Copied!';
647
647
setTimeout(() => { copyBtn.textContent = orig; }, 1500);
648
648
}).catch(() =>
649
649
{
@@ -1275,7 +1275,7 @@ async function openSidebar (item)
1275
1275
1276
1276
// Share button (file)
1277
1277
const btnShareFile = document.createElement('button');
1278
btnShareFile.textContent = 'Delen';
1278
btnShareFile.textContent = 'Share';
1279
1279
btnShareFile.addEventListener('click', () => openShareModal(item));
1280
1280
actions.appendChild(btnShareFile);
1281
1281
} else
@@ -1316,11 +1316,11 @@ async function openSidebar (item)
1316
1316
1317
1317
// Download as zip button (folder)
1318
1318
const btnZip = document.createElement('button');
1319
btnZip.textContent = 'Download als zip';
1319
btnZip.textContent = 'Download as zip';
1320
1320
btnZip.addEventListener('click', () =>
1321
1321
{
1322
1322
btnZip.disabled = true;
1323
btnZip.textContent = 'Bezig…';
1323
btnZip.textContent = 'Working...';
1324
1324
const url = `/api/files/download-zip?dir=${encodeURIComponent(item.path)}`;
1325
1325
const headers = {
1326
1326
Authorization: 'Bearer ' + STATE.token,
@@ -1345,14 +1345,14 @@ async function openSidebar (item)
1345
1345
.finally(() =>
1346
1346
{
1347
1347
btnZip.disabled = false;
1348
btnZip.textContent = 'Download als zip';
1348
btnZip.textContent = 'Download as zip';
1349
1349
});
1350
1350
});
1351
1351
actions.appendChild(btnZip);
1352
1352
1353
1353
// Share button (folder)
1354
1354
const btnShareFolder = document.createElement('button');
1355
btnShareFolder.textContent = 'Delen';
1355
btnShareFolder.textContent = 'Share';
1356
1356
btnShareFolder.addEventListener('click', () => openShareModal(item));
1357
1357
actions.appendChild(btnShareFolder);
1358
1358
@@ -563,10 +563,10 @@ function showFileConflictChoice (filename, renameTo, mode = 'upload')563
const btnRename = document.getElementById('file-conflict-rename-btn');563
const btnRename = document.getElementById('file-conflict-rename-btn');564
const btnCancel = document.getElementById('file-conflict-cancel');564
const btnCancel = document.getElementById('file-conflict-cancel');565
565
566
title.textContent = mode === 'move' ? 'Bestand verplaatsen' : 'Bestand uploaden';566
title.textContent = mode === 'move' ? 'Move file' : 'Upload file';567
fileEl.textContent = filename;567
fileEl.textContent = filename;568
renameEl.textContent = renameTo;568
renameEl.textContent = renameTo;569
btnRename.textContent = `Hernoemen (${renameTo})`;569
btnRename.textContent = `Rename (${renameTo})`;570
570
571
overlay.classList.remove('hidden');571
overlay.classList.remove('hidden');572
572
@@ -603,9 +603,9 @@ async function openShareModal (item)603
const closeBtn = document.getElementById('share-modal-close');603
const closeBtn = document.getElementById('share-modal-close');604
const msgEl = document.getElementById('share-modal-msg');604
const msgEl = document.getElementById('share-modal-msg');605
605
606
urlInput.value = 'Link aanmaken…';606
urlInput.value = 'Creating link...';607
copyBtn.disabled = true;607
copyBtn.disabled = true;608
msgEl.textContent = 'De link is 24 uur geldig.';608
msgEl.textContent = 'This link is valid for 24 hours.';609
overlay.classList.remove('hidden');609
overlay.classList.remove('hidden');610
610
611
let data;611
let data;@@ -614,14 +614,14 @@ async function openShareModal (item)614
data = await api('POST', '/share/create', { filePath: item.path });614
data = await api('POST', '/share/create', { filePath: item.path });615
} catch (err)615
} catch (err)616
{616
{617
msgEl.textContent = 'Fout: ' + (err.message || 'Kon geen link aanmaken.');617
msgEl.textContent = 'Error: ' + (err.message || 'Could not create link.');618
urlInput.value = '';618
urlInput.value = '';619
return;619
return;620
}620
}621
621
622
if (!data || !data.token)622
if (!data || !data.token)623
{623
{624
msgEl.textContent = 'Onbekende fout bij aanmaken van de link.';624
msgEl.textContent = 'Unknown error while creating link.';625
urlInput.value = '';625
urlInput.value = '';626
return;626
return;627
}627
}@@ -643,7 +643,7 @@ async function openShareModal (item)643
navigator.clipboard.writeText(shareUrl).then(() =>643
navigator.clipboard.writeText(shareUrl).then(() =>644
{644
{645
const orig = copyBtn.textContent;645
const orig = copyBtn.textContent;646
copyBtn.textContent = 'Gekopieerd!';646
copyBtn.textContent = 'Copied!';647
setTimeout(() => { copyBtn.textContent = orig; }, 1500);647
setTimeout(() => { copyBtn.textContent = orig; }, 1500);648
}).catch(() =>648
}).catch(() =>649
{649
{@@ -1275,7 +1275,7 @@ async function openSidebar (item)1275
1275
1276
// Share button (file)1276
// Share button (file)1277
const btnShareFile = document.createElement('button');1277
const btnShareFile = document.createElement('button');1278
btnShareFile.textContent = 'Delen';1278
btnShareFile.textContent = 'Share';1279
btnShareFile.addEventListener('click', () => openShareModal(item));1279
btnShareFile.addEventListener('click', () => openShareModal(item));1280
actions.appendChild(btnShareFile);1280
actions.appendChild(btnShareFile);1281
} else1281
} else@@ -1316,11 +1316,11 @@ async function openSidebar (item)1316
1316
1317
// Download as zip button (folder)1317
// Download as zip button (folder)1318
const btnZip = document.createElement('button');1318
const btnZip = document.createElement('button');1319
btnZip.textContent = 'Download als zip';1319
btnZip.textContent = 'Download as zip';1320
btnZip.addEventListener('click', () =>1320
btnZip.addEventListener('click', () =>1321
{1321
{1322
btnZip.disabled = true;1322
btnZip.disabled = true;1323
btnZip.textContent = 'Bezig…';1323
btnZip.textContent = 'Working...';1324
const url = `/api/files/download-zip?dir=${encodeURIComponent(item.path)}`;1324
const url = `/api/files/download-zip?dir=${encodeURIComponent(item.path)}`;1325
const headers = {1325
const headers = {1326
Authorization: 'Bearer ' + STATE.token,1326
Authorization: 'Bearer ' + STATE.token,@@ -1345,14 +1345,14 @@ async function openSidebar (item)1345
.finally(() =>1345
.finally(() =>1346
{1346
{1347
btnZip.disabled = false;1347
btnZip.disabled = false;1348
btnZip.textContent = 'Download als zip';1348
btnZip.textContent = 'Download as zip';1349
});1349
});1350
});1350
});1351
actions.appendChild(btnZip);1351
actions.appendChild(btnZip);1352
1352
1353
// Share button (folder)1353
// Share button (folder)1354
const btnShareFolder = document.createElement('button');1354
const btnShareFolder = document.createElement('button');1355
btnShareFolder.textContent = 'Delen';1355
btnShareFolder.textContent = 'Share';1356
btnShareFolder.addEventListener('click', () => openShareModal(item));1356
btnShareFolder.addEventListener('click', () => openShareModal(item));1357
actions.appendChild(btnShareFolder);1357
actions.appendChild(btnShareFolder);1358
1358
@@ -253,17 +253,17 @@
253
253
<div id="file-conflict-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
254
254
aria-labelledby="file-conflict-title">
255
255
<div class="modal small">
256
<h2 id="file-conflict-title">Bestand conflict</h2>
256
<h2 id="file-conflict-title">File conflict</h2>
257
257
<p class="dialog-message">
258
<strong id="file-conflict-filename"></strong> bestaat al in de doelmap.
258
<strong id="file-conflict-filename"></strong> already exists in the destination folder.
259
259
</p>
260
260
<p class="dialog-message">
261
Hernoemen naar <strong id="file-conflict-rename"></strong>?
261
Rename to <strong id="file-conflict-rename"></strong>?
262
262
</p>
263
263
<div class="dialog-actions">
264
<button id="file-conflict-cancel">Annuleren</button>
265
<button id="file-conflict-overwrite" class="primary">Overschrijven</button>
266
<button id="file-conflict-rename-btn" class="primary">Hernoemen</button>
264
<button id="file-conflict-cancel">Cancel</button>
265
<button id="file-conflict-overwrite" class="primary">Overwrite</button>
266
<button id="file-conflict-rename-btn" class="primary">Rename</button>
267
267
</div>
268
268
</div>
269
269
</div>
@@ -276,13 +276,13 @@
276
276
<div id="share-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
277
277
aria-labelledby="share-modal-title">
278
278
<div class="modal small">
279
<button class="modal-close" id="share-modal-close" aria-label="Sluiten">✕</button>
280
<h2 id="share-modal-title">Delen</h2>
281
<p class="dialog-message" id="share-modal-msg">De link is 24 uur geldig.</p>
279
<button class="modal-close" id="share-modal-close" aria-label="Close">✕</button>
280
<h2 id="share-modal-title">Share</h2>
281
<p class="dialog-message" id="share-modal-msg">This link is valid for 24 hours.</p>
282
282
<div id="share-url-row" style="display:flex;gap:0.5rem;margin:0.8rem 0">
283
283
<input id="share-url-input" type="text" readonly
284
284
style="flex:1;font-size:0.82rem;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:0.45rem 0.65rem;color:var(--text);min-width:0" />
285
<button id="share-copy-btn" title="Kopieer link">Kopieer</button>
285
<button id="share-copy-btn" title="Copy link">Copy</button>
286
286
</div>
287
287
<div class="dialog-actions">
288
288
<button class="primary" id="share-modal-ok">OK</button>
@@ -253,17 +253,17 @@253
<div id="file-conflict-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"253
<div id="file-conflict-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"254
aria-labelledby="file-conflict-title">254
aria-labelledby="file-conflict-title">255
<div class="modal small">255
<div class="modal small">256
<h2 id="file-conflict-title">Bestand conflict</h2>256
<h2 id="file-conflict-title">File conflict</h2>257
<p class="dialog-message">257
<p class="dialog-message">258
<strong id="file-conflict-filename"></strong> bestaat al in de doelmap.258
<strong id="file-conflict-filename"></strong> already exists in the destination folder.259
</p>259
</p>260
<p class="dialog-message">260
<p class="dialog-message">261
Hernoemen naar <strong id="file-conflict-rename"></strong>?261
Rename to <strong id="file-conflict-rename"></strong>?262
</p>262
</p>263
<div class="dialog-actions">263
<div class="dialog-actions">264
<button id="file-conflict-cancel">Annuleren</button>264
<button id="file-conflict-cancel">Cancel</button>265
<button id="file-conflict-overwrite" class="primary">Overschrijven</button>265
<button id="file-conflict-overwrite" class="primary">Overwrite</button>266
<button id="file-conflict-rename-btn" class="primary">Hernoemen</button>266
<button id="file-conflict-rename-btn" class="primary">Rename</button>267
</div>267
</div>268
</div>268
</div>269
</div>269
</div>@@ -276,13 +276,13 @@276
<div id="share-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"276
<div id="share-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"277
aria-labelledby="share-modal-title">277
aria-labelledby="share-modal-title">278
<div class="modal small">278
<div class="modal small">279
<button class="modal-close" id="share-modal-close" aria-label="Sluiten">✕</button>279
<button class="modal-close" id="share-modal-close" aria-label="Close">✕</button>280
<h2 id="share-modal-title">Delen</h2>280
<h2 id="share-modal-title">Share</h2>281
<p class="dialog-message" id="share-modal-msg">De link is 24 uur geldig.</p>281
<p class="dialog-message" id="share-modal-msg">This link is valid for 24 hours.</p>282
<div id="share-url-row" style="display:flex;gap:0.5rem;margin:0.8rem 0">282
<div id="share-url-row" style="display:flex;gap:0.5rem;margin:0.8rem 0">283
<input id="share-url-input" type="text" readonly283
<input id="share-url-input" type="text" readonly284
style="flex:1;font-size:0.82rem;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:0.45rem 0.65rem;color:var(--text);min-width:0" />284
style="flex:1;font-size:0.82rem;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:0.45rem 0.65rem;color:var(--text);min-width:0" />285
<button id="share-copy-btn" title="Kopieer link">Kopieer</button>285
<button id="share-copy-btn" title="Copy link">Copy</button>286
</div>286
</div>287
<div class="dialog-actions">287
<div class="dialog-actions">288
<button class="primary" id="share-modal-ok">OK</button>288
<button class="primary" id="share-modal-ok">OK</button>