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,
|
Resume videos and audio where the user left off; show progress on cards (#791)
* Resume videos and audio where the user left off; show progress on cards
Videos and audio resume where the user left off, on the video page and in
the file preview, and keep playing. `?t=` starts at an explicit time
instead.
useFileProgress saves how far the user is through a file: every 15 seconds
while it changes, and a final save (a beacon, which survives the page
closing) on pause, end, hiding the page, leaving it, or switching files.
Each save is also kept in sessionStorage; on open the newer of that and the
server's position wins, so coming straight back resumes exactly even if the
final save is still in flight.
Cards show a progress bar along the bottom of their poster. The dashboard's
Recently Viewed Files gains All / Continue; Continue uses the new
`in_progress` file search filter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Progress review fixes: in_progress totals, latest dashboard request, preview viewed
- The in_progress search filter skips the uncounted fast path and is part of
the totals cache key, so Continue never reports All's (or the library's)
count.
- The dashboard's Recently Viewed hook applies only its latest response, and
clears the list when switching All/Continue until the new files arrive.
- POST /api/files/file returns `viewed`, so a preview can tell a file
finished elsewhere from an older position this tab holds.
- The progress hook tests restore Blob, fetch and sendBeacon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:29:12 -06:00
|
|
|
|
useLocalStorage,
|
2025-01-26 12:44:16 -07:00
|
|
|
|
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,
|
Resume videos and audio where the user left off; show progress on cards (#791)
* Resume videos and audio where the user left off; show progress on cards
Videos and audio resume where the user left off, on the video page and in
the file preview, and keep playing. `?t=` starts at an explicit time
instead.
useFileProgress saves how far the user is through a file: every 15 seconds
while it changes, and a final save (a beacon, which survives the page
closing) on pause, end, hiding the page, leaving it, or switching files.
Each save is also kept in sessionStorage; on open the newer of that and the
server's position wins, so coming straight back resumes exactly even if the
final save is still in flight.
Cards show a progress bar along the bottom of their poster. The dashboard's
Recently Viewed Files gains All / Continue; Continue uses the new
`in_progress` file search filter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Progress review fixes: in_progress totals, latest dashboard request, preview viewed
- The in_progress search filter skips the uncounted fast path and is part of
the totals cache key, so Continue never reports All's (or the library's)
count.
- The dashboard's Recently Viewed hook applies only its latest response, and
clears the list when switching All/Continue until the new files arrive.
- POST /api/files/file returns `viewed`, so a preview can tell a file
finished elsewhere from an older position this tab holds.
- The progress hook tests restore Blob, fetch and sendBeacon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:29:12 -06:00
|
|
|
|
ButtonGroup,
|
2023-04-18 22:03:45 -06:00
|
|
|
|
Divider,
|
|
|
|
|
|
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";
|
ui: two upload dialogs that had drifted apart (#664)
* ui: two upload dialogs that had drifted apart
The dashboard and the file browser each had their own upload component: two
dropzones, two overwrite toggles, two copies of the progress-bar rendering,
against the same `useUploadFile` state. The file browser's dialog was made
fullscreen with a drop target that grows; the dashboard's stayed a `large`
dialog with a strip to drop onto, because it was a different file.
They differ in one thing that is real: the file browser knows the destination
because the user selected it, and the dashboard has to ask. That is now the
`destination` prop -- `undefined` asks, a string uploads there, and '' is the
media directory rather than a missing destination.
Everything else is one component, so the next change to either entry point
lands on both.
* review: an upload dialog that looped on the media directory
Pressing Upload in the file browser with nothing selected passes `''` -- the
media directory. Three checks along that path read it as "no destination":
* The clearing effect ran, and `doClear` is a new function every render whose
own setState scheduled the next one. React ended it with "Maximum update
depth exceeded", 16 warnings deep, on the default Upload path. The effect
now clears only while asking, and `doClear` is stable.
* The title read `Upload to: /media/wrolpi/`.
* `doUpload` bailed, so a drop on the media root uploaded nothing.
All three predate this branch; moving the dialog is what put them behind one
component. Tests cover the title, what the hook is told, and that a fixed
destination is never the thing that empties the queue.
2026-08-13 15:14:53 -06:00
|
|
|
|
import {UploadModal} 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>
|
ui: three from the dashboard and the video pages
The Download/Or/Upload panel. Semantic drew it as a `Segment placeholder` with
a vertical `Divider`: two equal fields, a rule down the true middle, a button
centred in each. The migrated version was a `Group` with a divider between two
buttons, so the halves were sized to their labels -- the pair huddled in the
middle with the rule wherever they left it. `.wrolpi-or-split` is a grid, so
the halves stay equal whatever the labels say, and the rule is the second
column's border rather than an element between them (an element would be a third
grid item and push the middle off centre by its own width). Below the tablet
breakpoint the halves stack and the rule turns horizontal, as Semantic's
`stackable` grid did.
The video page's panels touched the left edge. Its route is deliberately
outside `VideosTabLayout`'s `PageContainer` so the player can run to both edges
-- which is the most viewing area a phone can give it, and worth keeping -- but
everything below the player inherited that too. `.wrolpi-page-inset` gives the
stack under the player the same inset `PageContainer` gives a page, at the same
breakpoint, so a phone still has no side padding anywhere.
A video's duration chip was a literal `#ffffff` with black text. The poster
under it IS filtered by night mode, being a `.media` leaf, but the chip is drawn
beside the image rather than inside it, so the filter never reached it: a white
tile on a card whose picture had gone dim red, and the brightest thing on the
videos page in the theme whose whole point is that nothing is bright. Tokens
now, opaque because it sits on an arbitrary poster.
Nine guards, all verified to fail against the old code. One thing they turned
up: cypress component tests default to a 500x500 viewport, which is BELOW the
699px breakpoint, so viewport-keyed CSS is exercised in its phone branch unless
a test says otherwise. The desktop assertions set the viewport explicitly and
say why; the stacked branch has a test of its own.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 17:38:19 -06:00
|
|
|
|
<div className='wrolpi-or-split'>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<Button role='primary' icon='download' onClick={e => handleSetGetter(e, 'downloads')}>
|
|
|
|
|
|
Download
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<Button role='save' icon='upload' onClick={e => handleSetGetter(e, 'upload')}>
|
|
|
|
|
|
Upload
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span className='wrolpi-or-label'>Or</span>
|
|
|
|
|
|
</div>
|
2026-10-13 16:07:04 -06:00
|
|
|
|
{status?.flags && gettersDisabled &&
|
|
|
|
|
|
<p>Download and Upload are available after your files are refreshed.</p>}
|
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>;
|
2023-11-02 15:24:07 -06:00
|
|
|
|
|
2023-04-18 22:03:45 -06:00
|
|
|
|
let getterModal;
|
|
|
|
|
|
if (selectedGetter === 'downloads') {
|
ui: only the top modal answers Escape, and the audited widths
Two things, both reported from the running app.
Nested modals could not exist. Mantine binds a window-level keydown listener
per open modal, gated only on whether that modal is open -- nothing checks which
one the user is looking at:
useWindowEvent('keydown', (event) => {
if (event.key === 'Escape' && closeOnEscape && ... && opened) onClose();
}, {capture: true});
Two open modals meant two listeners, so one Escape closed both. Reproduced on
the dashboard: the download modal plus the search modal over it, one press, both
gone, back to the page. Both also sat at z-index 200, so which one drew on top
was DOM order rather than which the user opened.
Mantine's own answer is Modal.Stack with a stackId, which is the only thing that
gates closeOnEscape. Not used, for two reasons: every call site would have to
be rewritten to hoist its modal into a stack, and it sets `__hidden` on
everything below the top -- the parent disappears while the child is open. The
parent should be dimmed and still there, as it was before the migration.
So the wrapper keeps the register itself: a module-level list of open modals,
most recent on top, from which each modal takes closeOnEscape, trapFocus and a
z-index two above its parent. Module-level rather than React context because
the two modals in the bug are not nested in the JSX at all -- the search modal
is rendered by KeyboardShortcutsProvider near the app root and the download
modal by the dashboard. They are siblings that happen to be open together, and
no context relates them. The increment is small on purpose: Mantine puts
popovers at 300, and a stack that climbed past it would paint over the select
dropdowns inside its own forms.
Widths: Roland audited the modal list and chose sizes against Mantine's scale.
Sixteen get wider -- twelve to `large` (620), four to `fullscreen` -- and eleven
keep the width they had, with the size now written down so the decision is in
the source rather than in a default. Flasher was passing Mantine's raw `sm`,
which worked but bypassed the naming the audit used; it says `tiny` now.
The size table itself is guarded, because it is the single thing that halved
every modal during the migration and a quiet edit to it moves seventy at once.
Semantic's widths, measured on the pre-migration build still running on the QA
Pi: mini 360, tiny 540, small 720, large 1080, no-size 900. Mantine's, read out
of its stylesheet: 320/380/440/620/780. A `small` modal went 720 -> 440 and one
with no size went 900 -> 440. Three cases now hold the scale, the mapping, and
the rule that no call site may name a size the table does not know -- an unknown
name is passed to Mantine, ignored, and silently rendered at the default.
Tested in a real browser: none of it is visible to jsdom -- the listener is on
window with capture, the stacking is z-index, and "still visible behind" is
geometry. Note that `should('be.visible')` is the wrong assertion for the
parent: it is an occlusion check, so a child drawn correctly over its parent
trips it. The test uses a wide viewport and asserts the parent is rendered and
shows to both sides of the child. Planting the pre-fix behaviour reddens three.
1124 jest / 62 suites, 8 in modal-stack.cy.js, clean npm run build. The 12
failures in Tags/Channels/Download/Inventory.cy.js are the known pre-existing
Semantic-era selector failures, unchanged.
2026-08-02 15:26:15 -06:00
|
|
|
|
getterModal = <Modal size='large' 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') {
|
ui: two upload dialogs that had drifted apart (#664)
* ui: two upload dialogs that had drifted apart
The dashboard and the file browser each had their own upload component: two
dropzones, two overwrite toggles, two copies of the progress-bar rendering,
against the same `useUploadFile` state. The file browser's dialog was made
fullscreen with a drop target that grows; the dashboard's stayed a `large`
dialog with a strip to drop onto, because it was a different file.
They differ in one thing that is real: the file browser knows the destination
because the user selected it, and the dashboard has to ask. That is now the
`destination` prop -- `undefined` asks, a string uploads there, and '' is the
media directory rather than a missing destination.
Everything else is one component, so the next change to either entry point
lands on both.
* review: an upload dialog that looped on the media directory
Pressing Upload in the file browser with nothing selected passes `''` -- the
media directory. Three checks along that path read it as "no destination":
* The clearing effect ran, and `doClear` is a new function every render whose
own setState scheduled the next one. React ended it with "Maximum update
depth exceeded", 16 warnings deep, on the default Upload path. The effect
now clears only while asking, and `doClear` is stable.
* The title read `Upload to: /media/wrolpi/`.
* `doUpload` bailed, so a drop on the media root uploaded nothing.
All three predate this branch; moving the dialog is what put them behind one
component. Tests cover the title, what the hook is told, and that a fixed
destination is never the thing that empties the queue.
2026-08-13 15:14:53 -06:00
|
|
|
|
// The same dialog the file browser opens; it asks for a destination because, unlike the
|
|
|
|
|
|
// browser, the dashboard has no selected directory to upload into.
|
|
|
|
|
|
getterModal = <UploadModal
|
|
|
|
|
|
open={true}
|
|
|
|
|
|
onClose={() => handleSetGetter(null, null)}
|
|
|
|
|
|
disabled={gettersDisabled}
|
|
|
|
|
|
/>;
|
2023-04-18 22:03:45 -06:00
|
|
|
|
}
|
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
|
|
|
|
|
2026-08-05 19:25:56 -06:00
|
|
|
|
export function DashboardStatus() {
|
2025-01-26 12:44:16 -07:00
|
|
|
|
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>
|
2026-08-05 19:25:56 -06:00
|
|
|
|
{/*
|
|
|
|
|
|
* The panel is a link, but it should not read as one.
|
|
|
|
|
|
*
|
|
|
|
|
|
* `a` takes `color: var(--blue)` and an underline on hover from tokens.css, and a
|
|
|
|
|
|
* statistic's value sets no color of its own -- so the three load figures inherited
|
|
|
|
|
|
* the link color, and crossing the panel underlined them together. The same pair
|
|
|
|
|
|
* every card title uses says "this text belongs to what contains it": the pointer
|
|
|
|
|
|
* cursor still comes from the UA stylesheet, which is the affordance that matters.
|
|
|
|
|
|
*/}
|
|
|
|
|
|
<Link to='/admin/status' className='no-link-underscore card-link'>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
<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'}}/>
|
|
|
|
|
|
|
2026-08-05 19:25:56 -06:00
|
|
|
|
<Link to='/admin' className='no-link-underscore card-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
|
|
|
|
<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() {
|
Resume videos and audio where the user left off; show progress on cards (#791)
* Resume videos and audio where the user left off; show progress on cards
Videos and audio resume where the user left off, on the video page and in
the file preview, and keep playing. `?t=` starts at an explicit time
instead.
useFileProgress saves how far the user is through a file: every 15 seconds
while it changes, and a final save (a beacon, which survives the page
closing) on pause, end, hiding the page, leaving it, or switching files.
Each save is also kept in sessionStorage; on open the newer of that and the
server's position wins, so coming straight back resumes exactly even if the
final save is still in flight.
Cards show a progress bar along the bottom of their poster. The dashboard's
Recently Viewed Files gains All / Continue; Continue uses the new
`in_progress` file search filter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Progress review fixes: in_progress totals, latest dashboard request, preview viewed
- The in_progress search filter skips the uncounted fast path and is part of
the totals cache key, so Continue never reports All's (or the library's)
count.
- The dashboard's Recently Viewed hook applies only its latest response, and
clears the list when switching All/Continue until the new files arrive.
- POST /api/files/file returns `viewed`, so a preview can tell a file
finished elsewhere from an older position this tab holds.
- The progress hook tests restore Blob, fetch and sendBeacon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:29:12 -06:00
|
|
|
|
// Show only the files the user is part way through.
|
|
|
|
|
|
const [continueOnly, setContinueOnly] = useLocalStorage('dashboard_recent_continue', false);
|
|
|
|
|
|
const {searchFiles, loading, fetchFiles} = useSearchRecentFiles(continueOnly);
|
|
|
|
|
|
|
|
|
|
|
|
let files = <FileCards files={searchFiles} loading={loading}/>;
|
|
|
|
|
|
if (continueOnly && searchFiles && searchFiles.length === 0) {
|
|
|
|
|
|
files = <p>Nothing in progress. A video, audio file, ebook or comic you stop part way through will be here.</p>;
|
|
|
|
|
|
}
|
2025-01-26 12:44:16 -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 <Panel>
|
2025-01-26 12:44:16 -07:00
|
|
|
|
<RefreshHeader
|
|
|
|
|
|
header='Recently Viewed Files'
|
|
|
|
|
|
popupContents='Fetch the most recent files again'
|
|
|
|
|
|
onRefresh={fetchFiles}
|
|
|
|
|
|
/>
|
Resume videos and audio where the user left off; show progress on cards (#791)
* Resume videos and audio where the user left off; show progress on cards
Videos and audio resume where the user left off, on the video page and in
the file preview, and keep playing. `?t=` starts at an explicit time
instead.
useFileProgress saves how far the user is through a file: every 15 seconds
while it changes, and a final save (a beacon, which survives the page
closing) on pause, end, hiding the page, leaving it, or switching files.
Each save is also kept in sessionStorage; on open the newer of that and the
server's position wins, so coming straight back resumes exactly even if the
final save is still in flight.
Cards show a progress bar along the bottom of their poster. The dashboard's
Recently Viewed Files gains All / Continue; Continue uses the new
`in_progress` file search filter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Progress review fixes: in_progress totals, latest dashboard request, preview viewed
- The in_progress search filter skips the uncounted fast path and is part of
the totals cache key, so Continue never reports All's (or the library's)
count.
- The dashboard's Recently Viewed hook applies only its latest response, and
clears the list when switching All/Continue until the new files arrive.
- POST /api/files/file returns `viewed`, so a preview can tell a file
finished elsewhere from an older position this tab holds.
- The progress hook tests restore Blob, fetch and sendBeacon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:29:12 -06:00
|
|
|
|
<ButtonGroup>
|
|
|
|
|
|
<Button size='small' variant={continueOnly ? 'default' : 'filled'} onClick={() => setContinueOnly(false)}>
|
|
|
|
|
|
All
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button size='small' variant={continueOnly ? 'filled' : 'default'} onClick={() => setContinueOnly(true)}>
|
|
|
|
|
|
Continue
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</ButtonGroup>
|
|
|
|
|
|
<div style={{marginTop: '1em'}}>{files}</div>
|
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';
|
|
|
|
|
|
}
|
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:09:12 -06:00
|
|
|
|
/*
|
|
|
|
|
|
* No `marginBottom`. This row is a top-level block of the dashboard, so its own 2em was
|
|
|
|
|
|
* added to the page stack's gap -- 52.8px below the search box against 17.6px between
|
|
|
|
|
|
* every other pair of blocks, on the most-looked-at page in the app. One source of
|
|
|
|
|
|
* spacing, and it is the stack.
|
|
|
|
|
|
*/
|
|
|
|
|
|
return <div style={{display: 'flex', alignItems: 'center', gap: '0.5em'}}>
|
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
|
|
|
|
{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
|
|
|
|
}
|