2025-01-26 12:44:16 -07:00
|
|
|
|
import {
|
2026-02-20 14:37:58 -07:00
|
|
|
|
CookiesLockedMessage,
|
2025-01-26 12:44:16 -07:00
|
|
|
|
ErrorMessage,
|
|
|
|
|
|
LoadStatistic,
|
|
|
|
|
|
PageContainer,
|
|
|
|
|
|
RefreshHeader,
|
|
|
|
|
|
SearchResultsInput,
|
|
|
|
|
|
useTitle
|
|
|
|
|
|
} from "./components/Common";
|
2022-09-29 14:58:16 -06:00
|
|
|
|
import React, {useContext, useState} from "react";
|
2026-02-23 17:29:09 -07:00
|
|
|
|
import {useHotkeys} from "react-hotkeys-hook";
|
2024-06-12 16:47:31 -06:00
|
|
|
|
import {Media, SettingsContext, StatusContext} from "./contexts/contexts";
|
2022-11-09 08:33:55 -07:00
|
|
|
|
import {DownloadMenu} from "./components/Download";
|
2023-04-18 22:03:45 -06:00
|
|
|
|
import {
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
ActionInput,
|
2023-04-18 22:03:45 -06:00
|
|
|
|
Button,
|
|
|
|
|
|
Divider,
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
Group,
|
2023-04-18 22:03:45 -06:00
|
|
|
|
Header,
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
Icon,
|
|
|
|
|
|
Message,
|
2023-04-18 22:03:45 -06:00
|
|
|
|
Modal,
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
Panel,
|
|
|
|
|
|
Stack,
|
|
|
|
|
|
Statistic,
|
|
|
|
|
|
StatisticGroup,
|
|
|
|
|
|
} from "./components/ui";
|
2026-05-02 14:31:54 -06:00
|
|
|
|
import {Link, useNavigate, useSearchParams} from "react-router";
|
2022-09-29 16:36:39 -06:00
|
|
|
|
import {BandwidthProgressCombined, CPUUsageProgress} from "./components/admin/Status";
|
|
|
|
|
|
import {ProgressPlaceholder} from "./components/Placeholder";
|
2022-12-23 16:04:09 -07:00
|
|
|
|
import {refreshFiles} from "./api";
|
2023-01-31 17:11:31 -07:00
|
|
|
|
import _ from "lodash";
|
2023-04-05 14:48:13 -06:00
|
|
|
|
import {TagsDashboard} from "./Tags";
|
2023-04-18 22:03:45 -06:00
|
|
|
|
import {Upload} from "./components/Upload";
|
2024-01-01 17:11:09 -07:00
|
|
|
|
import {SearchView, useSearch, useSearchSuggestions} from "./components/Search";
|
2025-12-19 17:00:53 -07:00
|
|
|
|
import {OutdatedZimsMessage} from "./components/Zim";
|
2025-01-26 12:44:16 -07:00
|
|
|
|
import {useSearchFilter, useSearchRecentFiles, useWROLMode} from "./hooks/customHooks";
|
2026-05-02 14:31:54 -06:00
|
|
|
|
import {ExtensionInstallSuggestion} from "./components/admin/ExtensionInstallSuggestion";
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
|
import {fileMimetypeFilterOptions, FileCards, SearchFilterButton} from "./components/Files";
|
2025-01-19 11:58:43 -07:00
|
|
|
|
import {useCalculators} from "./components/Calculators";
|
2026-04-04 17:56:08 -06:00
|
|
|
|
import {classifyAndEvaluate} from "./components/calculators/mathConfig";
|
2022-12-23 16:04:09 -07:00
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
// A spinning refresh glyph, used as the `icon` for the "files are being refreshed" Message.
|
|
|
|
|
|
const RefreshingIcon = (props) => <Icon name='circle notched' loading {...props}/>;
|
|
|
|
|
|
|
2026-05-14 15:51:32 -06:00
|
|
|
|
export function FlagsMessages() {
|
2024-02-19 13:45:41 -07:00
|
|
|
|
const {settings, fetchSettings} = React.useContext(SettingsContext);
|
2024-05-08 17:31:15 -06:00
|
|
|
|
const {status} = useContext(StatusContext);
|
2023-05-29 18:04:03 -06:00
|
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
|
if (_.isEmpty(status?.flags)) {
|
2022-12-23 16:04:09 -07:00
|
|
|
|
return <></>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-08 17:31:15 -06:00
|
|
|
|
const flags = status['flags'];
|
|
|
|
|
|
|
2024-10-03 21:58:13 -06:00
|
|
|
|
let refreshingMessage;
|
|
|
|
|
|
let refreshRequiredMessage;
|
2022-12-23 16:04:09 -07:00
|
|
|
|
|
2026-01-09 14:01:25 -07:00
|
|
|
|
// Do not tell the maintainer to refresh the files if the FileWorker is busy.
|
|
|
|
|
|
if (flags.file_worker_busy) {
|
|
|
|
|
|
// FileWorker is busy.
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
refreshingMessage = <Message kind='info' icon={RefreshingIcon} title='Your files are being refreshed.'>
|
|
|
|
|
|
<p><Link to='/files'>Click here to view the progress</Link></p>
|
2022-12-23 16:04:09 -07:00
|
|
|
|
</Message>;
|
2024-10-03 21:58:13 -06:00
|
|
|
|
} else if (!flags.refresh_complete) {
|
2022-12-23 16:04:09 -07:00
|
|
|
|
// `refresh_complete` flag is not set. Tell the maintainer to refresh the files.
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
refreshRequiredMessage = <Message kind='warning' icon='hand point right' title='Refresh required'>
|
|
|
|
|
|
<a href='#' onClick={(e) => {
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
refreshFiles();
|
|
|
|
|
|
}}>Click here</a> to refresh all your files.
|
2022-12-23 16:04:09 -07:00
|
|
|
|
</Message>;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-03 21:58:13 -06:00
|
|
|
|
let dbDownMessage;
|
|
|
|
|
|
if (!flags.db_up) {
|
|
|
|
|
|
dbDownMessage = <ErrorMessage>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
<strong>Database is down</strong>
|
|
|
|
|
|
<p>API is unable to connect to the database. Check the server logs.</p>
|
2024-08-15 20:03:22 -06:00
|
|
|
|
</ErrorMessage>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-03 21:58:13 -06:00
|
|
|
|
let internetDownMessage;
|
2024-10-16 18:20:32 -06:00
|
|
|
|
if (!flags.have_internet && !settings.wrol_mode) {
|
2024-10-03 21:58:13 -06:00
|
|
|
|
internetDownMessage = <ErrorMessage icon='globe'>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
<strong>No Internet</strong>
|
|
|
|
|
|
<p>WROLPi has no Internet. Downloads will not start.</p>
|
2024-08-15 20:03:22 -06:00
|
|
|
|
</ErrorMessage>;
|
2023-01-31 17:11:31 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-14 15:51:32 -06:00
|
|
|
|
let mediaUnmountedMessage;
|
|
|
|
|
|
if (flags.media_mounted === false) {
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
mediaUnmountedMessage = <ErrorMessage icon='hdd'>
|
|
|
|
|
|
<strong>No drive mounted</strong>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
WROLPi has no media drive mounted for one or more storage locations.
|
|
|
|
|
|
Downloads would write to the root filesystem and can fill it.
|
|
|
|
|
|
{' '}<Link to='/admin/controller'>Open the Controller</Link> to mount a drive.
|
|
|
|
|
|
</p>
|
2026-05-14 15:51:32 -06:00
|
|
|
|
</ErrorMessage>;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-23 16:04:09 -07:00
|
|
|
|
return <>
|
2024-10-03 21:58:13 -06:00
|
|
|
|
{refreshingMessage}
|
|
|
|
|
|
{dbDownMessage || refreshRequiredMessage}
|
2026-05-14 15:51:32 -06:00
|
|
|
|
{mediaUnmountedMessage}
|
2024-10-03 21:58:13 -06:00
|
|
|
|
{settings && settings['ignore_outdated_zims'] === false && flags.outdated_zims ?
|
2023-05-29 18:04:03 -06:00
|
|
|
|
<OutdatedZimsMessage onClick={fetchSettings}/> : null}
|
2024-10-03 21:58:13 -06:00
|
|
|
|
{internetDownMessage}
|
2026-02-20 14:37:58 -07:00
|
|
|
|
<CookiesLockedMessage/>
|
2022-12-23 16:04:09 -07:00
|
|
|
|
</>
|
|
|
|
|
|
}
|
2022-09-29 14:58:16 -06:00
|
|
|
|
|
2025-01-22 17:18:16 -07:00
|
|
|
|
function EvaluateForm() {
|
2025-01-19 11:58:43 -07:00
|
|
|
|
|
|
|
|
|
|
const helpContents = <span>
|
2026-04-04 17:56:08 -06:00
|
|
|
|
<p>Enter an equation or a value with units.</p>
|
2025-01-19 11:58:43 -07:00
|
|
|
|
|
2026-04-04 17:56:08 -06:00
|
|
|
|
<h5>Math:</h5>
|
2025-01-19 11:58:43 -07:00
|
|
|
|
<pre>2 + 3</pre>
|
|
|
|
|
|
<pre>sqrt(15)</pre>
|
2026-04-04 17:56:08 -06:00
|
|
|
|
<pre>8 * pi</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<h5>Unit Conversions:</h5>
|
2025-01-19 11:58:43 -07:00
|
|
|
|
<pre>15 km to miles</pre>
|
2025-01-22 08:36:08 -07:00
|
|
|
|
<pre>65 degF to degC</pre>
|
2026-04-04 17:56:08 -06:00
|
|
|
|
<pre>1 gallon to liters</pre>
|
|
|
|
|
|
<pre>5 psi to atm</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<h5>Auto-Convert (enter value + unit):</h5>
|
|
|
|
|
|
<pre>5 miles</pre>
|
|
|
|
|
|
<pre>100 degF</pre>
|
|
|
|
|
|
<pre>1 gallon</pre>
|
|
|
|
|
|
<pre>500 Wh</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<h5>Radiation:</h5>
|
|
|
|
|
|
<pre>0.5 Sv</pre>
|
|
|
|
|
|
<pre>1 Gy to raddose</pre>
|
|
|
|
|
|
<pre>100 remdose to Sv</pre>
|
|
|
|
|
|
|
|
|
|
|
|
<h5>Data:</h5>
|
2025-02-02 10:16:11 -07:00
|
|
|
|
<pre>7 * 750 Mb</pre>
|
2026-04-04 17:56:08 -06:00
|
|
|
|
<pre>2 Tb to Gb</pre>
|
2025-01-19 11:58:43 -07:00
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
const [showMessage, setShowMessage] = React.useState(false);
|
|
|
|
|
|
const [inputValue, setInputValue] = React.useState('');
|
|
|
|
|
|
const [evaluatedValue, setEvaluatedValue] = React.useState(helpContents);
|
|
|
|
|
|
|
|
|
|
|
|
const doEvaluate = () => {
|
2025-05-14 18:25:00 -06:00
|
|
|
|
if (!inputValue) {
|
|
|
|
|
|
setEvaluatedValue(helpContents);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-01-19 11:58:43 -07:00
|
|
|
|
setEvaluatedValue(''); // Clear input temporarily so the user can tell something happened.
|
|
|
|
|
|
try {
|
2026-04-04 17:56:08 -06:00
|
|
|
|
const {primary, conversions} = classifyAndEvaluate(inputValue);
|
|
|
|
|
|
setEvaluatedValue(<div>
|
|
|
|
|
|
<strong>{primary}</strong>
|
|
|
|
|
|
{conversions.length > 0 && <div style={{marginTop: '0.5em'}}>
|
|
|
|
|
|
<em>Also:</em>
|
|
|
|
|
|
{conversions.map((c, i) => <div key={i}>{c}</div>)}
|
|
|
|
|
|
</div>}
|
|
|
|
|
|
</div>);
|
2025-01-19 11:58:43 -07:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error(error);
|
2025-05-14 18:25:00 -06:00
|
|
|
|
setEvaluatedValue(`Unable to evaluate: ${error.message}`);
|
2025-01-19 11:58:43 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
return <form onSubmit={(e) => {
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
doEvaluate();
|
|
|
|
|
|
}}>
|
|
|
|
|
|
<ActionInput
|
|
|
|
|
|
value={inputValue}
|
|
|
|
|
|
leftSection='𝒇'
|
|
|
|
|
|
type='text'
|
|
|
|
|
|
onFocus={() => setShowMessage(true)}
|
|
|
|
|
|
onChange={(e) => setInputValue(e.currentTarget.value)}
|
|
|
|
|
|
action={<Button type='submit' role='primary'>Evaluate</Button>}
|
2025-01-19 11:58:43 -07:00
|
|
|
|
/>
|
|
|
|
|
|
{showMessage &&
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
<Message kind='info' title='Result'>
|
|
|
|
|
|
{evaluatedValue}
|
2025-01-19 11:58:43 -07:00
|
|
|
|
</Message>
|
|
|
|
|
|
}
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
</form>
|
2025-01-19 11:58:43 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function DashboardCalculators() {
|
|
|
|
|
|
const {calculatorLinks} = useCalculators();
|
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
return <Panel>
|
2025-01-22 08:33:05 -07:00
|
|
|
|
<Header as='h2'>Calculators</Header>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
<Stack>
|
|
|
|
|
|
<EvaluateForm/>
|
|
|
|
|
|
<div>{calculatorLinks}</div>
|
|
|
|
|
|
</Stack>
|
|
|
|
|
|
</Panel>
|
2025-01-19 11:58:43 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-02 15:24:07 -06:00
|
|
|
|
export function Getters() {
|
2022-10-16 11:53:44 -06:00
|
|
|
|
const {status} = useContext(StatusContext);
|
2023-07-21 15:14:09 -06:00
|
|
|
|
const wrolModeEnabled = useWROLMode();
|
2022-10-16 11:53:44 -06:00
|
|
|
|
|
2023-04-18 22:03:45 -06:00
|
|
|
|
// Getters are Downloads or Uploads.
|
|
|
|
|
|
const [selectedGetter, setSelectedGetter] = useState(null);
|
2024-05-14 20:30:29 -06:00
|
|
|
|
const gettersDisabled = status?.flags?.refresh_complete !== true;
|
2023-11-02 15:24:07 -06:00
|
|
|
|
|
2026-05-02 14:31:54 -06:00
|
|
|
|
// Deep-link support: the WROLPi browser extension (and anyone else) can open
|
|
|
|
|
|
// /?downloader=<archive|video|...>&download_url=<u1>&download_url=<u2>
|
|
|
|
|
|
// to auto-open the download modal pre-filled with a downloader and URLs.
|
|
|
|
|
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
|
|
|
|
const initialDownloader = searchParams.get('downloader');
|
|
|
|
|
|
const initialUrls = searchParams.getAll('download_url');
|
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
|
if (initialDownloader && selectedGetter !== 'downloads') {
|
|
|
|
|
|
setSelectedGetter('downloads');
|
|
|
|
|
|
}
|
|
|
|
|
|
// Run once on mount per change to query params.
|
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
|
}, [initialDownloader]);
|
|
|
|
|
|
|
2023-04-18 22:03:45 -06:00
|
|
|
|
const handleSetGetter = (e, value) => {
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
}
|
|
|
|
|
|
setSelectedGetter(value);
|
2026-05-02 14:31:54 -06:00
|
|
|
|
// Closing the modal? Clear deep-link params so a refresh doesn't re-open.
|
|
|
|
|
|
if (value === null && (initialDownloader || initialUrls.length)) {
|
|
|
|
|
|
const next = new URLSearchParams(searchParams);
|
|
|
|
|
|
next.delete('downloader');
|
|
|
|
|
|
next.delete('download_url');
|
|
|
|
|
|
setSearchParams(next, {replace: true});
|
|
|
|
|
|
}
|
2023-04-18 22:03:45 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
const getter = <Panel>
|
|
|
|
|
|
<Group justify='center' align='stretch' gap='xl' wrap='wrap'>
|
|
|
|
|
|
<Button role='primary' icon='download' onClick={e => handleSetGetter(e, 'downloads')}>
|
|
|
|
|
|
Download
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Divider orientation='vertical' label='Or' labelPosition='center'/>
|
|
|
|
|
|
<Button role='save' icon='upload' onClick={e => handleSetGetter(e, 'upload')}>
|
|
|
|
|
|
Upload
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</Group>
|
|
|
|
|
|
</Panel>;
|
2023-11-02 15:24:07 -06:00
|
|
|
|
|
2023-04-18 22:03:45 -06:00
|
|
|
|
let getterModal;
|
|
|
|
|
|
if (selectedGetter === 'downloads') {
|
2023-05-03 08:56:35 -06:00
|
|
|
|
getterModal = <Modal closeIcon
|
2023-05-29 18:04:03 -06:00
|
|
|
|
open={true}
|
|
|
|
|
|
centered={false}
|
|
|
|
|
|
onClose={() => handleSetGetter(null, null)}
|
2023-05-03 08:56:35 -06:00
|
|
|
|
>
|
2025-12-07 11:32:07 -07:00
|
|
|
|
<Modal.Header>Download from the Internet</Modal.Header>
|
|
|
|
|
|
<Modal.Content>
|
2026-05-02 14:31:54 -06:00
|
|
|
|
<DownloadMenu
|
|
|
|
|
|
disabled={gettersDisabled}
|
|
|
|
|
|
initialDownloader={initialDownloader}
|
|
|
|
|
|
initialUrls={initialUrls}
|
|
|
|
|
|
/>
|
2025-12-07 11:32:07 -07:00
|
|
|
|
</Modal.Content>
|
2023-04-18 22:03:45 -06:00
|
|
|
|
</Modal>;
|
|
|
|
|
|
} else if (selectedGetter === 'upload') {
|
2023-05-03 08:56:35 -06:00
|
|
|
|
getterModal = <Modal closeIcon
|
2023-05-29 18:04:03 -06:00
|
|
|
|
open={true}
|
|
|
|
|
|
centered={false}
|
|
|
|
|
|
onClose={() => handleSetGetter(null, null)}
|
2023-05-03 08:56:35 -06:00
|
|
|
|
>
|
2025-12-07 11:32:07 -07:00
|
|
|
|
<Modal.Header>Upload from your device</Modal.Header>
|
|
|
|
|
|
<Modal.Content>
|
2023-04-18 22:03:45 -06:00
|
|
|
|
<Upload disabled={gettersDisabled}/>
|
2025-12-07 11:32:07 -07:00
|
|
|
|
</Modal.Content>
|
2023-04-18 22:03:45 -06:00
|
|
|
|
</Modal>;
|
|
|
|
|
|
}
|
2022-09-29 14:58:16 -06:00
|
|
|
|
|
2023-11-02 15:24:07 -06:00
|
|
|
|
if (wrolModeEnabled) {
|
|
|
|
|
|
return <></>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return <>
|
|
|
|
|
|
{getter}
|
|
|
|
|
|
{getterModal}
|
|
|
|
|
|
</>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-26 12:44:16 -07:00
|
|
|
|
|
|
|
|
|
|
function DashboardStatus() {
|
|
|
|
|
|
const {status} = useContext(StatusContext);
|
|
|
|
|
|
|
|
|
|
|
|
let percent = 0;
|
|
|
|
|
|
let load = {};
|
|
|
|
|
|
let cores = 0;
|
|
|
|
|
|
let pending_downloads = '?';
|
|
|
|
|
|
if (status && status['cpu_stats']) {
|
|
|
|
|
|
percent = status['cpu_stats']['percent'];
|
|
|
|
|
|
load = status['load_stats'];
|
|
|
|
|
|
cores = status['cpu_stats']['cores'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const {downloads} = status;
|
|
|
|
|
|
if (!_.isEmpty(downloads)) {
|
|
|
|
|
|
pending_downloads = downloads && downloads['disabled'] ? 'x' : downloads['pending'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let bandwidths = <ProgressPlaceholder/>;
|
|
|
|
|
|
if (status && status['nic_bandwidth_stats']) {
|
|
|
|
|
|
bandwidths = Object.entries(status['nic_bandwidth_stats'])
|
|
|
|
|
|
.map(([name, bandwidth]) => <BandwidthProgressCombined key={name} bandwidth={bandwidth}/>);
|
|
|
|
|
|
} else if (window.apiDown) { // apiDown is set in useStatus
|
|
|
|
|
|
bandwidths = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
return <Panel>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
<Link to='/admin/status'>
|
|
|
|
|
|
<Header as='h2'>Status</Header>
|
|
|
|
|
|
<CPUUsageProgress value={percent} label='CPU Usage'/>
|
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
<StatisticGroup>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
<LoadStatistic label='1 Min. Load' value={load['minute_1']} cores={cores}/>
|
|
|
|
|
|
<LoadStatistic label='5 Min. Load' value={load['minute_5']} cores={cores}/>
|
|
|
|
|
|
<LoadStatistic label='15 Min. Load' value={load['minute_15']} cores={cores}/>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
</StatisticGroup>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
|
|
|
|
|
|
<Header as='h3'>Bandwidth</Header>
|
|
|
|
|
|
{bandwidths}
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
|
|
|
|
<Divider style={{marginTop: '3em'}}/>
|
|
|
|
|
|
|
|
|
|
|
|
<Link to='/admin'>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
<StatisticGroup>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
<Statistic label='Downloading' value={pending_downloads}/>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
</StatisticGroup>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
</Link>
|
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
</Panel>;
|
2025-01-26 12:44:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function DashboardRecentFiles() {
|
|
|
|
|
|
const {searchFiles, loading, fetchFiles} = useSearchRecentFiles();
|
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
return <Panel>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
<RefreshHeader
|
|
|
|
|
|
header='Recently Viewed Files'
|
|
|
|
|
|
popupContents='Fetch the most recent files again'
|
|
|
|
|
|
onRefresh={fetchFiles}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<FileCards files={searchFiles} loading={loading}/>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
|
</Panel>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-02 15:24:07 -06:00
|
|
|
|
export function DashboardPage() {
|
|
|
|
|
|
const navigate = useNavigate();
|
2026-02-23 17:29:09 -07:00
|
|
|
|
const searchInputRef = React.useRef();
|
|
|
|
|
|
|
|
|
|
|
|
useHotkeys('f', (e) => {
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
if (searchInputRef.current) {
|
|
|
|
|
|
searchInputRef.current.focus();
|
|
|
|
|
|
}
|
|
|
|
|
|
}, {enableOnFormTags: false});
|
2023-11-02 15:24:07 -06:00
|
|
|
|
|
2024-01-01 15:16:03 -07:00
|
|
|
|
// The search the user submitted.
|
2024-07-22 16:36:57 -06:00
|
|
|
|
const {searchStr, setSearchStr, activeTags, isEmpty, anyTag} = useSearch();
|
2024-01-01 15:16:03 -07:00
|
|
|
|
// The search that the user is typing.
|
|
|
|
|
|
const [localSearchStr, setLocalSearchStr] = React.useState(searchStr);
|
2024-01-01 11:31:17 -07:00
|
|
|
|
const {
|
2024-01-01 17:11:09 -07:00
|
|
|
|
suggestions,
|
2024-01-01 11:31:17 -07:00
|
|
|
|
suggestionsResults,
|
2024-01-01 17:11:09 -07:00
|
|
|
|
suggestionsSums,
|
2024-01-01 11:31:17 -07:00
|
|
|
|
handleResultSelect,
|
|
|
|
|
|
resultRenderer,
|
|
|
|
|
|
loading,
|
2024-01-01 15:16:03 -07:00
|
|
|
|
setSearchStr: setSuggestionSearchStr,
|
|
|
|
|
|
setSearchTags,
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
|
clearDate,
|
2024-07-22 16:36:57 -06:00
|
|
|
|
} = useSearchSuggestions(searchStr, activeTags, anyTag);
|
2023-11-02 15:24:07 -06:00
|
|
|
|
|
2024-01-01 11:31:17 -07:00
|
|
|
|
React.useEffect(() => {
|
2024-01-01 15:16:03 -07:00
|
|
|
|
setSuggestionSearchStr(localSearchStr);
|
|
|
|
|
|
}, [localSearchStr]);
|
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
|
setLocalSearchStr(searchStr);
|
|
|
|
|
|
}, [searchStr]);
|
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
|
if (activeTags) {
|
|
|
|
|
|
setSearchTags(activeTags);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, [JSON.stringify(activeTags)]);
|
2024-01-01 11:31:17 -07:00
|
|
|
|
|
2023-11-02 18:49:09 -06:00
|
|
|
|
let title = 'Dashboard';
|
|
|
|
|
|
if (searchStr) {
|
|
|
|
|
|
title = `Search: ${searchStr} - Dashboard`;
|
|
|
|
|
|
} else if (activeTags && activeTags.length === 1) {
|
|
|
|
|
|
title = `Tag: ${activeTags[0]} - Dashboard`;
|
|
|
|
|
|
} else if (activeTags && activeTags.length > 1) {
|
|
|
|
|
|
const tagNames = activeTags.join(' & ');
|
|
|
|
|
|
title = `Tags: ${tagNames} - Dashboard`;
|
|
|
|
|
|
}
|
2023-11-02 15:24:07 -06:00
|
|
|
|
useTitle(title);
|
|
|
|
|
|
|
2022-09-29 14:58:16 -06:00
|
|
|
|
// Only show dashboard parts if not searching.
|
2023-11-02 15:24:07 -06:00
|
|
|
|
let body = <React.Fragment>
|
|
|
|
|
|
<Getters/>
|
|
|
|
|
|
<TagsDashboard/>
|
|
|
|
|
|
<DashboardStatus/>
|
2025-01-19 11:58:43 -07:00
|
|
|
|
<DashboardCalculators/>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
<DashboardRecentFiles/>
|
2023-11-02 15:24:07 -06:00
|
|
|
|
</React.Fragment>;
|
2023-04-05 14:37:14 -06:00
|
|
|
|
if (searchStr || (activeTags && activeTags.length > 0)) {
|
2023-11-02 15:24:07 -06:00
|
|
|
|
// User has submitted and wants full search.
|
2024-01-01 17:11:09 -07:00
|
|
|
|
body = <SearchView suggestions={suggestions} suggestionsSums={suggestionsSums} loading={loading}/>;
|
2022-09-29 14:58:16 -06:00
|
|
|
|
}
|
2024-05-25 10:48:08 -06:00
|
|
|
|
const {setFilter} = useSearchFilter();
|
|
|
|
|
|
|
|
|
|
|
|
const clearAllSearch = () => {
|
|
|
|
|
|
clearDate();
|
|
|
|
|
|
setFilter(null);
|
|
|
|
|
|
setSearchStr(null);
|
|
|
|
|
|
navigate('/');
|
|
|
|
|
|
}
|
2022-09-29 14:58:16 -06:00
|
|
|
|
|
2024-01-01 15:16:03 -07:00
|
|
|
|
const getSearchResultsInput = (props) => {
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
|
return <SearchResultsInput clearable={!isEmpty}
|
2024-01-01 15:16:03 -07:00
|
|
|
|
searchStr={localSearchStr}
|
|
|
|
|
|
onChange={setLocalSearchStr}
|
|
|
|
|
|
onSubmit={setSearchStr}
|
|
|
|
|
|
placeholder='Search everywhere...'
|
2024-05-25 10:48:08 -06:00
|
|
|
|
onClear={clearAllSearch}
|
|
|
|
|
|
clearDisabled={isEmpty}
|
2024-01-01 15:16:03 -07:00
|
|
|
|
style={{marginBottom: '2em'}}
|
|
|
|
|
|
results={suggestionsResults}
|
|
|
|
|
|
handleResultSelect={handleResultSelect}
|
|
|
|
|
|
resultRenderer={resultRenderer}
|
|
|
|
|
|
loading={loading}
|
2026-02-23 17:29:09 -07:00
|
|
|
|
inputRef={searchInputRef}
|
2024-01-01 15:16:03 -07:00
|
|
|
|
{...props}
|
|
|
|
|
|
/>;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
|
// The search input grows to fill the row; the Filter button sits immediately after it. Flexbox adapts
|
|
|
|
|
|
// to the client width, so only the control size changes between mobile and larger screens.
|
|
|
|
|
|
const searchRow = (big) => {
|
|
|
|
|
|
const inputProps = {style: {flexGrow: 1, minWidth: 0, marginBottom: 0}};
|
|
|
|
|
|
if (big) {
|
|
|
|
|
|
inputProps.size = 'big';
|
|
|
|
|
|
}
|
|
|
|
|
|
return <div style={{display: 'flex', alignItems: 'center', gap: '0.5em', marginBottom: '2em'}}>
|
|
|
|
|
|
{getSearchResultsInput(inputProps)}
|
Search: fast ABC mode by default, opt-in deep search
The file_group.textsearch tsvector indexes all four text columns;
d_text (captions, document text, zip contents) is ~90% of the data,
making ts_rank searches take seconds on large libraries. Add a
textsearch_abc generated column (title/author/description only, ~8x
smaller) and default all searches to it, with deep=true opting into the
full column.
Database:
- Migration adds the generated column and a GIN index (rewrites the
table; a few minutes on large libraries).
Backend:
- FilesSearchRequest, VideoSearchRequest, ArchiveSearchRequest, and
DocSearchRequest accept `deep`; each search function picks the column.
- /api/search_file_estimates returns both counts in one index-bound
query (COUNT FILTER on the abc subset): `file_groups` (fast) and
`file_groups_deep`.
UI (one coherent story across the count surfaces):
- The typing dropdown always suggests the deep count (what is findable).
- The tab badge shows the active mode's count so it matches the result
list.
- The gap is reconciled by a hint offering deep search: count-aware on
the global search ("No results in fast search. N results available in
deep search." / "N more results available..."), generic on the module
pages (no deep estimate there). The hint resets pagination.
- "Search Depth" toggle in the search filter modals, persisted as
?deep=true.
Tests that relied on d_text matches now pass deep=True, with fast-mode
assertions alongside. Also skip flaky test_download_channel on
CircleCI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:09:08 -06:00
|
|
|
|
<SearchFilterButton fileFilterOptions={fileMimetypeFilterOptions} showDates={true} showDeep={true}
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
|
size={big ? 'big' : undefined}/>
|
|
|
|
|
|
</div>;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-12-23 16:04:09 -07:00
|
|
|
|
return <PageContainer>
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
|
<Media at='mobile'>{searchRow(false)}</Media>
|
|
|
|
|
|
<Media greaterThanOrEqual='tablet'>{searchRow(true)}</Media>
|
2024-05-08 17:31:15 -06:00
|
|
|
|
{!searchStr && <FlagsMessages/>}
|
2026-05-02 14:31:54 -06:00
|
|
|
|
{!searchStr && <ExtensionInstallSuggestion/>}
|
2022-10-22 14:27:18 -06:00
|
|
|
|
{body}
|
2022-12-23 16:04:09 -07:00
|
|
|
|
</PageContainer>
|
2025-05-14 18:25:00 -06:00
|
|
|
|
}
|