@samitouri / QOSami-HFS / commits / 56151db2

plugins: new frontend events: afterBreadcrumbs, afterFolderStats, afterFilter

Massimo Melina committed Jan 20, 2025 at 15:09 UTC 56151db20c80cb5b617bd49b944c6ed752ae6c47
4 files changed +10 -3
dev-plugins.md
+5 -1
@@ -450,6 +450,9 @@ This is a list of available frontend-events, with respective object parameter an
450 - All of the following have no parameters and you are supposed to output `Html` that will be displayed in the described place:
451 - `appendMenuBar` inside menu-bar, at the end
452 - `afterMenuBar` between menu-bar and breadcrumbs
453 + - `afterBreadcrumbs` between breadcrumbs and folder-stats
454 + - `afterFolderStats` between folder-stats and filter-bar
455 + - `afterFilter` at the input of the filter-bar
456 - `afterList` at the end of the files list
457 - `footer` at the bottom of the screen, even after the clipboard-bar (when visible)
458 - `unauthorized` displayed behind the login dialog accessing a protected folder
@@ -715,8 +718,9 @@ If you want to override a text regardless of the language, use the special langu
718
719 ## API version history
720
718 -- 11 (v0.56.0)
721 +- 11.1 (v0.56.0)
722 - api.setError
723 + - frontend events: afterBreadcrumbs, afterFolderStats, afterFilter
724 - 10.3 (v0.55.0)
725 - HFS.copyTextToClipboard
726 - HFS.urlParams
frontend/src/FilterBar.ts
+2 -1
@@ -1,7 +1,7 @@
1 import { state, useSnapState } from './state'
2 import { createElement as h, useEffect, useState } from 'react'
3 import { useDebounce } from 'usehooks-ts'
4 -import { Checkbox } from './components'
4 +import { Checkbox, CustomCode } from './components'
5 import { usePath } from './useFetchList'
6 import { getHFS, with_ } from './misc'
7 import i18n from './i18n'
@@ -44,6 +44,7 @@ export function FilterBar() {
44 setFilter(ev.target.value)
45 }
46 }),
47 + h(CustomCode, { name: 'afterFilter' }),
48 h('span', {}, [
49 with_(Object.keys(selected).length, n => n && t('select_count', { n }, "{n} selected")),
50 with_(filteredList?.length, n => n !== undefined && n < list.length && t('filter_count', {n}, "{n} filtered")),
frontend/src/Head.ts
+2
@@ -15,6 +15,7 @@ export function Head() {
15 h(MenuPanel),
16 h(CustomCode, { name: 'afterMenuBar' }),
17 h(Breadcrumbs),
18 + h(CustomCode, { name: 'afterBreadcrumbs' }),
19 h(FolderStats),
20 h(FilterBar),
21 )
@@ -44,6 +45,7 @@ function FolderStats() {
45 size ? formatBytes(size) : '',
46 ].filter(Boolean).join(', '),
47 ),
48 + h(CustomCode, { name: 'afterFolderStats' }),
49 h('div', { style:{ clear:'both' }}),
50 )
51 }
src/const.ts
+1 -1
@@ -9,7 +9,7 @@ import { formatTimestamp } from './cross'
9 import { argv } from './argv'
10 export * from './cross-const'
11
12 -export const API_VERSION = 11
12 +export const API_VERSION = 11.1
13 export const COMPATIBLE_API_VERSION = 1 // while changes in the api are not breaking, this number stays the same, otherwise it is made equal to API_VERSION
14
15 // you can add arguments with this file, currently used for the update process on mac/linux