@samitouri / QOSami-HFS / commits / cffdeffc

admin/options: "title with path"

Massimo Melina committed Dec 15, 2024 at 15:01 UTC cffdeffcddceba3c730f7716a883f8ec3f7956a0
5 files changed +21 -19
admin/src/OptionsPage.ts
+4 -3
@@ -195,9 +195,10 @@ export default function OptionsPage() {
195 { k: 'theme', comp: SelectField, xs: 6, sm: 3, options: THEME_OPTIONS },
196 { k: 'sort_by', comp: SelectField, xs: 6, sm: 3, options: SORT_BY_OPTIONS },
197
198 - { k: 'invert_order', comp: BoolField, xs: 6, sm: 4, md: 3, },
199 - { k: 'folders_first', comp: BoolField, xs: 6, sm: 4, md: 3, },
200 - { k: 'sort_numerics', comp: BoolField, xs: 6, sm: 4, md: true, label: "Sort numeric names" },
198 + { k: 'invert_order', comp: BoolField, xs: 6, sm: 3 },
199 + { k: 'folders_first', comp: BoolField, xs: 6, sm: 3 },
200 + { k: 'sort_numerics', comp: BoolField, xs: 6, sm: 3, label: "Sort numeric names" },
201 + { k: 'title_with_path', comp: BoolField, xs: 6, sm: 3 },
202 { k: 'favicon', comp: FileField, placeholder: "None", fileMask: '*.ico|' + IMAGE_FILEMASK, sm: 12,
203 helperText: "The icon associated to your website" },
204
frontend/src/BrowseFiles.ts
+10 -3
@@ -27,9 +27,16 @@ export const MISSING_PERM = "Missing permission"
27 const originalTitle = document.title
28 export function BrowseFiles() {
29 useFetchList()
30 - useDocumentTitle(originalTitle + ' ' + decodeURIComponent(usePath()).slice(1, -1))
31 - const { error } = useSnapState()
32 - const { props, tile_size=0 } = useSnapState()
30 + const { props, tile_size=0, error, title_with_path } = useSnapState()
31 +
32 + const path = usePath()
33 + const title = originalTitle + (title_with_path ? ' ' + decodeURIComponent(path).slice(1, -1) : '')
34 + useEffect(() => { document.title = title }, [title])
35 + useEffect(() => domOn('popstate', () => {
36 + document.title = '+' // workaround to title not changing after a dialog is closed
37 + document.title = title
38 + }), [title])
39 +
40 const propsDropFiles = useMemo(() => ({
41 id: 'files-dropper',
42 ...acceptDropFiles((files, to) =>
frontend/src/options.ts
+4 -12
@@ -34,27 +34,19 @@ export function showOptions (){
34 label: t("Sort by:", { by: t(x) }, t`Sort by` + ': ' + t(x))
35 })),
36 value: snap.sort_by,
37 - onChange(v) {
38 - state.sort_by = v
39 - }
37 + onChange(v) { state.sort_by = v }
38 }),
39 h(Checkbox, {
40 value: snap.invert_order,
43 - onChange(v) {
44 - state.invert_order = v
45 - }
41 + onChange(v) { state.invert_order = v }
42 }, t`Invert order`),
43 h(Checkbox, {
44 value: snap.folders_first,
49 - onChange(v) {
50 - state.folders_first = v
51 - }
45 + onChange(v) { state.folders_first = v }
46 }, t`Folders first`),
47 h(Checkbox, {
48 value: snap.sort_numerics,
55 - onChange(v) {
56 - state.sort_numerics = v
57 - }
49 + onChange(v) { state.sort_numerics = v }
50 }, t`Numeric names`),
51
52 h('div', {},
src/cross.ts
+1
@@ -20,6 +20,7 @@ export const FRONTEND_OPTIONS = {
20 invert_order: false,
21 folders_first: true,
22 sort_numerics: false,
23 + title_with_path: true,
24 theme: '',
25 auto_play_seconds: 5,
26 disableTranslation: false,
src/langs/hfs-lang-it.json
+2 -1
@@ -168,6 +168,7 @@
168 "Cancel": "Annulla",
169 "allow_session_ip_change": "Permetti cambio IP in questa sessione",
170
171 - "focus_hint": "Scrivendo sulla tastiera cerchi tra gli elementi della lista."
171 + "focus_hint": "Scrivendo sulla tastiera cerchi tra gli elementi della lista.",
172 + "copy_links": "Copia i link"
173 }
174 }