Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add thumbnails support for files in grid view #2337

Merged
merged 36 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f22d5a3
feat: Add grid view mode with thumbnails for files page
george-hub331 Feb 20, 2025
b490e6d
feat: Enhance files page with multi-select and keyboard navigation
george-hub331 Feb 21, 2025
47f641f
fix: Improve FilesGrid and GridFile styling and linting
george-hub331 Feb 22, 2025
4b76dde
feat: Improve file selection and view mode in Files Page
george-hub331 Feb 22, 2025
cbd4b03
feat: Add text preview for files in grid view
george-hub331 Feb 23, 2025
ba6383c
Merge branch 'main' into thumbnail-addition
george-hub331 Feb 26, 2025
8507e66
chore: remove yarn.lock file
george-hub331 Mar 1, 2025
1205468
feat: use larger icon size when preview is not available for grids
george-hub331 Mar 1, 2025
6021c9c
feat: Improve view mode UI and file hash display
george-hub331 Mar 1, 2025
b9f8de3
feat: Add view mode translations and adjust UI styling
george-hub331 Mar 1, 2025
f61bf3d
feat: Improve FilesGrid keyboard navigation and responsiveness
george-hub331 Mar 1, 2025
1fe9b1a
style: Reduce border width from 2px to 1px in default state
george-hub331 Mar 1, 2025
175630c
fix: resolve issue with storybook test
george-hub331 Mar 3, 2025
ca63ce4
feat: Add keyboard shortcuts and drag-and-drop support for gridfiles
george-hub331 Mar 4, 2025
0c4a5bc
Merge branch 'main' into thumbnail-addition
george-hub331 Mar 4, 2025
8df9581
fix: avoid jiggling ui
lidel Mar 4, 2025
3deea61
fix: avoid changing unrelated translations
lidel Mar 4, 2025
6430413
fix: remove shadow on hover
lidel Mar 4, 2025
ba6864c
Merge branch 'main' into thumbnail-addition
george-hub331 Mar 12, 2025
0acb827
chore: remove translation edits
SgtPooki Mar 17, 2025
cc3c47e
Merge branch 'main' into thumbnail-addition
SgtPooki Mar 17, 2025
2ab0c2b
chore: rename shortcut model filename
SgtPooki Mar 17, 2025
60b620a
chore: fix mem leak and side effects
SgtPooki Mar 17, 2025
7beaa11
chore: rename new files to kebab case
SgtPooki Mar 17, 2025
933a302
fix: grid keyboard nav
SgtPooki Mar 17, 2025
f1e29c8
fix: migrate to typescript
SgtPooki Mar 17, 2025
f9977b1
chore: fix lint failures
SgtPooki Mar 17, 2025
fe6e294
chore: fix runtime error
SgtPooki Mar 17, 2025
05d7fbe
fix: simplify keyboard shortcut condition
george-hub331 Mar 19, 2025
48c97d3
fix: resolve issue with enter shortcut on grid
george-hub331 Mar 19, 2025
8c33280
chore: remove default props on FilesList
george-hub331 Mar 19, 2025
6272ea9
feat: add grid view step to files tour
george-hub331 Mar 19, 2025
03bfd01
fix: improve keyboard navigation and refactor grid file component
george-hub331 Mar 22, 2025
5a0a185
feat: add e2e tests for grid view functionality
george-hub331 Mar 22, 2025
a85f55b
chore: remove e2e unnecessary setup script
george-hub331 Mar 22, 2025
206215d
fix: resolve error with grid e2e tests
george-hub331 Mar 25, 2025
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
3 changes: 2 additions & 1 deletion public/locales/ar/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "Please wait while the initial 20 copies of the updated IPNS record are stored with the help of DHT peers…"
},
"noPinsInProgress": "All done, no remote pins in progress.",
"remotePinningInProgress": "Remote pinning in progress:"
"remotePinningInProgress": "Remote pinning in progress:",
"selectAllEntries": "حدد كافة إدخالات الجدول"
}
3 changes: 2 additions & 1 deletion public/locales/cs/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "Počkejte prosím, než se pomocí DHT peerů uloží počátečních 20 kopií aktualizovaného záznamu IPNS..."
},
"noPinsInProgress": "Vše je hotovo, žádné vzdálené připnutí neprobíhá.",
"remotePinningInProgress": "Probíhá vzdálené připnutí:"
"remotePinningInProgress": "Probíhá vzdálené připnutí:",
"selectAllEntries": "Vybrat všechny položky tabulky"
}
3 changes: 2 additions & 1 deletion public/locales/da/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
"noFiles": "<0>Ingen filer i dette bibliotek. Klik på “Tilføj” knappen for at tilføje nogle.</0>"
},
"addFilesInfo": "<0>Tilføj filer til din lokale IPFS klient ved at klikke på <1>Tilføj til IPFS</1> knappen foroven.</0>",
"companionInfo": "<0>Eftersom du benytter <1>IPFS Følgesvend</1>, vil fil-visningen være begrænset til filer der benyttes mens udvidelsen benyttes.</0>"
"companionInfo": "<0>Eftersom du benytter <1>IPFS Følgesvend</1>, vil fil-visningen være begrænset til filer der benyttes mens udvidelsen benyttes.</0>",
"selectAllEntries": "Vælg alle indgange"
}
5 changes: 4 additions & 1 deletion public/locales/de/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"individualFilesOnly": "Nur für individuelle Dateien verfügbar",
"noPDFSupport": "Dein Browser unterstützt keine PDFs. Bitte lade das PDF herunter, um es anzusehen:",
"downloadPDF": "PDF herunterladen",
"viewList": "Liste anzeigen",
"viewGrid": "Gitter anzeigen",
"openWithPublicGateway": "Versuche es stattdessen mit Deinem <1>öffentlichen Gateway</1> zu öffnen.",
"openWithLocalAndPublicGateway": "Versuche es stattdessen mit Deinem <1>lokalen Gateway</1> oder <3>öffentlichen Gateway</3> zu öffnen.",
"cantBePreviewed": "Für diese Datei ist keine Vorschau verfügbar",
Expand Down Expand Up @@ -136,5 +138,6 @@
"pleaseWait": "Bitte warte solange die initialen 20 Kopien des geänderten IPNS-Records mit der Hilfe von DHT-Peers gespeichert wurde ..."
},
"noPinsInProgress": "Alles fertig, es wird gerade nichts aus der Ferne angeheftet.",
"remotePinningInProgress": "Es wird gerade aus der Ferne angeheftet:"
"remotePinningInProgress": "Es wird gerade aus der Ferne angeheftet:",
"selectAllEntries": "Alle Tabelleneinträge auswählen"
}
28 changes: 27 additions & 1 deletion public/locales/en/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"addByPath": "From IPFS",
"bulkImport": "Bulk import",
"newFolder": "New folder",
"viewList": "Show items in list",
"viewGrid": "Show items in grid",
"generating": "Generating…",
"dropHere": "Drop here to move",
"actions": {
"copyHash": "Copy CID",
"share": "Share link",
Expand Down Expand Up @@ -45,6 +48,28 @@
"checkboxRemoveLocalPin": "Also remove local pin (recommended)",
"checkboxUnpinFromServices": "Unpin from all pinning services"
},
"shortcutModal": {
"title": "Keyboard Shortcuts",
"description": "The following keyboard shortcuts are available in the Files section:",
"navigation": "Navigation",
"selection": "Selection",
"actions": "Actions",
"other": "Other",
"moveDown": "Move down",
"moveUp": "Move up",
"moveLeft": "Move left",
"moveRight": "Move right",
"navigate": "Navigate to selected item",
"rename": "Rename selected item",
"delete": "Delete selected item(s)",
"toggleSelection": "Toggle selection",
"selectAll": "Select all items",
"deselectAll": "Deselect all items",
"copy": "Copy selected item(s)",
"paste": "Paste item(s)",
"cut": "Cut selected item(s)",
"showShortcuts": "Show keyboard shortcuts"
},
"pinningModal": {
"title": "Select where you would like to pin these items.",
"complianceLabel": "🔍 Check pinning services' compliance",
Expand Down Expand Up @@ -145,5 +170,6 @@
"pleaseWait": "Please wait while the initial 20 copies of the updated IPNS record are stored with the help of DHT peers…"
},
"noPinsInProgress": "All done, no remote pins in progress.",
"remotePinningInProgress": "Remote pinning in progress:"
"remotePinningInProgress": "Remote pinning in progress:",
"selectAllEntries": "Select all entries"
}
3 changes: 2 additions & 1 deletion public/locales/es/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@
"checkboxLabel": "View more options for {name}",
"pinned": "Sujeto",
"cidNotFileNorDir": "El enlace actual no es un archivo ni un directorio. Intenta <0>examinarlo</0> en su lugar.",
"sortBy": "Sort items by {name}"
"sortBy": "Sort items by {name}",
"selectAllEntries": "Seleccionar todas las entradas"
}
3 changes: 2 additions & 1 deletion public/locales/fr/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "Merci d'attendre pendant que les 20 premières copies de l'enregistrement IPNS mis à jour sont stockés avec l'aide des pairs DHT..."
},
"noPinsInProgress": "Terminé, aucun épinglage distant en cours.",
"remotePinningInProgress": "Épinglage distant en cours:"
"remotePinningInProgress": "Épinglage distant en cours:",
"selectAllEntries": "Sélectionner toutes les entrées"
}
3 changes: 2 additions & 1 deletion public/locales/id/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "Harap tunggu sementara 20 salinan awal dari catatan IPNS yang diperbarui disimpan dengan bantuan rekan-rekan DHT…"
},
"noPinsInProgress": "Semua selesai, tidak ada pin jarak jauh yang sedang berlangsung.",
"remotePinningInProgress": "Penyematan jarak jauh sedang berlangsung:"
"remotePinningInProgress": "Penyematan jarak jauh sedang berlangsung:",
"selectAllEntries": "Pilih semua entri tabel"
}
3 changes: 2 additions & 1 deletion public/locales/it/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "Please wait while the initial 20 copies of the updated IPNS record are stored with the help of DHT peers…"
},
"noPinsInProgress": "All done, no remote pins in progress.",
"remotePinningInProgress": "Remote pinning in progress:"
"remotePinningInProgress": "Remote pinning in progress:",
"selectAllEntries": "Seleziona tutte le voci della tabella"
}
3 changes: 2 additions & 1 deletion public/locales/ko-KR/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@
"noFiles": "<0>No files in this directory. Click the “Add to IPFS” button to add some.</0>"
},
"addFilesInfo": "<0>Add files to your local IPFS node by clicking the <1>Add to IPFS</1> button above.</0>",
"companionInfo": "<0>As you are using <1>IPFS Companion</1>, the files view is limited to files added while using the extension.</0>"
"companionInfo": "<0>As you are using <1>IPFS Companion</1>, the files view is limited to files added while using the extension.</0>",
"selectAllEntries": "모든 항목 선택"
}
3 changes: 2 additions & 1 deletion public/locales/nl/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
"noFiles": "<0>No files in this directory. Click the “Add” button to add some.</0>"
},
"addFilesInfo": "<0>Voeg bestanden toe aan je lokale IPFS node door op de <1>Toevoegen aan IPFS</1> knop te klikken.</0>",
"companionInfo": "<0>Waneer je <1>IPFS Companion</1> gebruikt, zie je enkel de files die je hebt toegevoegd tijdens het gebruik van deze extensie.</0>"
"companionInfo": "<0>Waneer je <1>IPFS Companion</1> gebruikt, zie je enkel de files die je hebt toegevoegd tijdens het gebruik van deze extensie.</0>",
"selectAllEntries": "Selecteer alle items"
}
3 changes: 2 additions & 1 deletion public/locales/no/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
"noFiles": "<0>No files in this directory. Click the “Add” button to add some.</0>"
},
"addFilesInfo": "<0>Legg til filer i din lokale IPFS-node ved å klikke på <1>Legg til i IPFS</1> knappen ovenfor.</0>",
"companionInfo": "<0>Ettersom du bruker <1>IPFS Companion</1>, er filvisningen begrenset til filer du har lagt til mens du bruker utvidelsen.</0>"
"companionInfo": "<0>Ettersom du bruker <1>IPFS Companion</1>, er filvisningen begrenset til filer du har lagt til mens du bruker utvidelsen.</0>",
"selectAllEntries": "Velg alle elementer"
}
3 changes: 2 additions & 1 deletion public/locales/pl/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "Proszę poczekać, aż początkowe 20 kopii zaktualizowanego rekordu IPNS zostanie zapisanych za pomocą peerów DHT..."
},
"noPinsInProgress": "Wszystko zrobione, brak zdalnych pinów w toku.",
"remotePinningInProgress": "Trwa zdalne przypinanie:"
"remotePinningInProgress": "Trwa zdalne przypinanie:",
"selectAllEntries": "Wybierz wszystkie pozycje tabeli"
}
3 changes: 2 additions & 1 deletion public/locales/pt/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
"noFiles": "<0>Nenhum ficheiro neste diretório. Clique no botão “Adicionar” para adicionar alguns.</0>"
},
"addFilesInfo": "<0>Adicione ficheiros ao seu nó IPFS local clicando no botão <1>Adicionar ao IPFS</1> abaixo.</0>",
"companionInfo": "<0>Como está a usar o <1>IPFS Companion</1>, a visualização de ficheiros é limitada aos ficheiros adicionados enquanto usar a extensão.</0>"
"companionInfo": "<0>Como está a usar o <1>IPFS Companion</1>, a visualização de ficheiros é limitada aos ficheiros adicionados enquanto usar a extensão.</0>",
"selectAllEntries": "Selecionar todas as entradas"
}
3 changes: 2 additions & 1 deletion public/locales/ru/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "Пожалуйста, подождите, пока первоначальные 20 копий обновленной записи IPNS будут сохранены с помощью узлов DHT…"
},
"noPinsInProgress": "Все готово, никаких удаленных закреплений не выполняется.",
"remotePinningInProgress": "Удаленные закрепления в работе:"
"remotePinningInProgress": "Удаленные закрепления в работе:",
"selectAllEntries": "Выбрать все записи в таблице"
}
3 changes: 2 additions & 1 deletion public/locales/sk/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
"noFiles": "<0>No files in this directory. Click the “Add” button to add some.</0>"
},
"addFilesInfo": "<0>Pridajte súbory do vášho IPFS uzlu kliknutím na <1>Pridať do IPFS</1> tlačítko.</0>",
"companionInfo": "<0>Keďže používate <1>IPFS Companion</1>, zobrazené súbory sú obmedzené iba na tie, ktoré ste pridali počas používania tohoto rozšírenia.</0>"
"companionInfo": "<0>Keďže používate <1>IPFS Companion</1>, zobrazené súbory sú obmedzené iba na tie, ktoré ste pridali počas používania tohoto rozšírenia.</0>",
"selectAllEntries": "Vybrať všetky položky"
}
3 changes: 2 additions & 1 deletion public/locales/sv/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@
"noFiles": "<0>No files in this directory. Click the “Add to IPFS” button to add some.</0>"
},
"addFilesInfo": "<0>Add files to your local IPFS node by clicking the <1>Add to IPFS</1> button above.</0>",
"companionInfo": "<0>As you are using <1>IPFS Companion</1>, the files view is limited to files added while using the extension.</0>"
"companionInfo": "<0>As you are using <1>IPFS Companion</1>, the files view is limited to files added while using the extension.</0>",
"selectAllEntries": "Välj alla objekt"
}
3 changes: 2 additions & 1 deletion public/locales/tr/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "Please wait while the initial 20 copies of the updated IPNS record are stored with the help of DHT peers…"
},
"noPinsInProgress": "All done, no remote pins in progress.",
"remotePinningInProgress": "Remote pinning in progress:"
"remotePinningInProgress": "Remote pinning in progress:",
"selectAllEntries": "Tüm girişleri seç"
}
3 changes: 2 additions & 1 deletion public/locales/zh-CN/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,6 @@
"pleaseWait": "请等待片刻以使得初始的20份IPNS更新记录副本储存至DHT节点"
},
"noPinsInProgress": "全部已完成,没有正在进行的远程固定操作",
"remotePinningInProgress": "远程固定中:"
"remotePinningInProgress": "远程固定中:",
"selectAllEntries": "选择所有条目"
}
3 changes: 2 additions & 1 deletion public/locales/zh-HK/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@
"checkboxLabel": "View more options for {name}",
"pinned": "已固定",
"cidNotFileNorDir": "當前連接不是一個文件或目錄,請檢查 <0>並替換</0> 。",
"sortBy": "Sort items by {name}"
"sortBy": "Sort items by {name}",
"selectAllEntries": "選擇所有條目"
}
3 changes: 2 additions & 1 deletion public/locales/zh-TW/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,6 @@
"pleaseWait": "Please wait while the initial 20 copies of the updated IPNS record are stored with the help of DHT peers…"
},
"noPinsInProgress": "All done, no remote pins in progress.",
"remotePinningInProgress": "Remote pinning in progress:"
"remotePinningInProgress": "Remote pinning in progress:",
"selectAllEntries": "選擇所有條目"
}
13 changes: 13 additions & 0 deletions src/bundles/files/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ const actions = () => ({
}
},

/**
* Reads data from a CID with optional offset and length.
* @param {import('multiformats/cid').CID} cid - The CID to read from
* @param {number} [offset] - The starting point to read from
* @param {number} [length] - The number of bytes to read
*/
doRead: (cid, offset = 0, length) => perform(ACTIONS.READ_FILE, async (ipfs) => {
if (!ipfs) {
throw new Error('IPFS is not available')
}
return ipfs.cat(cid, { offset, length })
}),

/**
* Fetches conten for the currently selected path. And updates
* `state.pageContent` on succesful completion.
Expand Down
4 changes: 3 additions & 1 deletion src/bundles/files/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export const ACTIONS = {
/** @type {'FILES_WRITE_UPDATED'} */
WRITE_UPDATED: ('FILES_WRITE_UPDATED'),
/** @type {'FILES_UPDATE_SORT'} */
UPDATE_SORT: ('FILES_UPDATE_SORT')
UPDATE_SORT: ('FILES_UPDATE_SORT'),
/** @type {'FILES_READ'} */
READ_FILE: ('FILES_READ')
}

export const SORTING = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const Checkbox = ({ className, label, disabled, checked, onChange, ...props }) =
<span className='dib v-mid br1 w1 h1 pointer'>
<Tick className='w1 h1 o-0 fill-aqua' viewBox='25 25 50 50' />
</span>
<span className='v-mid pl2'>
{Boolean(label) && <span className='v-mid pl2'>
{label}
</span>
</span>}
</label>
)
}
Expand Down
Loading