Fixing bug where file search would issue twice on load.

This commit is contained in:
Roland 2023-04-09 14:34:33 -06:00
parent bab10a0c96
commit 0b0e6346a7
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
13 changed files with 21775 additions and 20852 deletions

View file

@ -17,7 +17,8 @@ You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more
information.
### `npm run build`
@ -33,38 +34,50 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will
remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right
into your project so you have full control over them. All of the commands except `eject` will still work, but they will
point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you
shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't
customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
You can learn more in
the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
This section has moved
here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
This section has moved
here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
This section has moved
here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
This section has moved
here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
This section has moved
here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
This section has moved
here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

File diff suppressed because it is too large Load diff

View file

@ -1,107 +1,106 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="200mm"
height="200mm"
version="1.1"
viewBox="0 0 200 200"
id="svg913"
sodipodi:docname="icon.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<defs
id="defs917" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1043"
id="namedview915"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="0.79138507"
inkscape:cx="227.60837"
inkscape:cy="471.78646"
inkscape:window-x="1920"
inkscape:window-y="419"
inkscape:window-maximized="1"
inkscape:current-layer="g911"
inkscape:document-rotation="0" />
<metadata
id="metadata893">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
stroke="#fff"
id="g911">
<ellipse
cx="100.5856"
cy="96.210335"
rx="11.632192"
ry="11.050488"
fill-rule="evenodd"
stroke-width="7.9375"
style="fill:#1b1c1d;fill-opacity:1;stroke:#ffffff;stroke-width:19.1897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="ellipse895" />
<path
d="m 26.406936,146.98572 c -0.517279,-6.18447 6.97959,-7.10491 12.963476,-10.71793 19.080213,-14.11505 27.52486,-15.63571 35.994331,-17.9243 10.059105,-2.87236 22.960062,-2.92582 34.429517,-2.75444 10.31102,0.90256 19.97203,3.07627 29.08784,5.61804 7.2554,2.89229 15.18841,3.73174 20.31955,11.18905 1.85746,0.98141 3.87443,2.66791 5.72002,3.00217 3.55668,0.60332 7.7414,2.98312 7.70334,8.73615 -0.38941,4.86584 -3.14709,6.60454 -7.73092,6.61876 l -7.16356,21.30891 c -34.23277,20.87175 -78.814255,13.3203 -118.9238,5.94702 l -7.255133,-26.85248 c -2.346573,-0.92133 -4.520208,-2.23343 -5.144661,-4.17095 z"
stroke-linecap="round"
stroke-width="7.9375"
style="fill:#1b1c1d;fill-opacity:1;stroke:#ffffff;stroke-width:19.1897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="path897" />
<path
d="m 67.255675,133.57602 c 2.092452,-3.08727 4.752631,-5.86862 8.760919,-7.92335 v 0"
fill="none"
stroke-linecap="round"
stroke-width="3.8379"
id="path899" />
<path
d="m 98.867248,125.80733 c 0.528892,3.27152 0.677512,6.01372 0.810171,8.73374"
fill="none"
stroke-linecap="round"
stroke-width="3.8379"
id="path901" />
<path
d="m 125.5288,125.83415 c 3.27893,2.71242 6.57395,5.41519 8.70869,8.82314"
fill="none"
stroke-linecap="round"
stroke-width="3.8379"
id="path903" />
<path
d="m 30.720739,152.1708 c 1.723683,-1.09029 3.39542,-1.88924 5.124159,-2.04891 6.078031,-0.56119 10.515125,2.59558 14.267178,4.32338 0.963435,0.64794 5.873466,-0.1855 14.840881,-1.24836 4.387355,0.12399 8.743543,0.40569 12.581927,3.30853 2.793491,1.62723 5.651432,-2.52156 13.558324,-3.2135 5.979656,0.0828 8.872074,3.71592 14.086062,2.0912 5.11027,-0.0812 10.42502,-3.82552 16.22089,-2.86672 5.18245,-0.5213 7.91701,1.98883 12.62973,1.33569 3.35396,-0.0794 5.01503,-2.56635 8.3129,-2.43672 4.18785,0.17902 8.51232,0.95844 12.63801,0.0137 3.21127,-1.25953 1.81231,-2.232 3.79168,-1.3652 2.05862,0.72189 4.20449,2.12115 6.97417,3.02612"
fill="none"
stroke-width="3.8379"
id="path905" />
<path
d="m 38.85772,40.385745 c 35.308462,-33.0629589 88.80532,-34.9054519 123.98967,0.543728 6.75038,6.563782 -4.63182,20.516124 -12.1807,13.175926 C 123.27606,29.025681 83.227192,23.921949 51.23407,53.82291 42.755882,62.06673 31.274855,47.758993 38.85772,40.385745 Z"
stroke-width="7.9375"
style="fill:#1b1c1d;fill-opacity:1;stroke:#ffffff;stroke-width:19.1897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="path907"
sodipodi:nodetypes="ccccc" />
<path
d="m 63.023698,63.841995 c 32.309394,-26.027336 60.953162,-14.854373 75.859312,0.608613 8.20871,7.981784 -4.5496,21.016007 -12.46804,13.316459 C 111.47296,63.974742 93.832519,61.36879 74.647495,77.809799 67.878296,84.391873 55.535866,71.122837 63.023698,63.841995 Z"
stroke-width="7.9375"
style="fill:#1b1c1d;fill-opacity:1;stroke:#ffffff;stroke-width:19.1897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="path909"
sodipodi:nodetypes="ccccc" />
</g>
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="200mm"
height="200mm"
version="1.1"
viewBox="0 0 200 200"
id="svg913"
sodipodi:docname="icon.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<defs
id="defs917"/>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1043"
id="namedview915"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="0.79138507"
inkscape:cx="227.60837"
inkscape:cy="471.78646"
inkscape:window-x="1920"
inkscape:window-y="419"
inkscape:window-maximized="1"
inkscape:current-layer="g911"
inkscape:document-rotation="0"/>
<metadata
id="metadata893">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g
stroke="#fff"
id="g911">
<ellipse
cx="100.5856"
cy="96.210335"
rx="11.632192"
ry="11.050488"
fill-rule="evenodd"
stroke-width="7.9375"
style="fill:#1b1c1d;fill-opacity:1;stroke:#ffffff;stroke-width:19.1897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="ellipse895"/>
<path
d="m 26.406936,146.98572 c -0.517279,-6.18447 6.97959,-7.10491 12.963476,-10.71793 19.080213,-14.11505 27.52486,-15.63571 35.994331,-17.9243 10.059105,-2.87236 22.960062,-2.92582 34.429517,-2.75444 10.31102,0.90256 19.97203,3.07627 29.08784,5.61804 7.2554,2.89229 15.18841,3.73174 20.31955,11.18905 1.85746,0.98141 3.87443,2.66791 5.72002,3.00217 3.55668,0.60332 7.7414,2.98312 7.70334,8.73615 -0.38941,4.86584 -3.14709,6.60454 -7.73092,6.61876 l -7.16356,21.30891 c -34.23277,20.87175 -78.814255,13.3203 -118.9238,5.94702 l -7.255133,-26.85248 c -2.346573,-0.92133 -4.520208,-2.23343 -5.144661,-4.17095 z"
stroke-linecap="round"
stroke-width="7.9375"
style="fill:#1b1c1d;fill-opacity:1;stroke:#ffffff;stroke-width:19.1897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="path897"/>
<path
d="m 67.255675,133.57602 c 2.092452,-3.08727 4.752631,-5.86862 8.760919,-7.92335 v 0"
fill="none"
stroke-linecap="round"
stroke-width="3.8379"
id="path899"/>
<path
d="m 98.867248,125.80733 c 0.528892,3.27152 0.677512,6.01372 0.810171,8.73374"
fill="none"
stroke-linecap="round"
stroke-width="3.8379"
id="path901"/>
<path
d="m 125.5288,125.83415 c 3.27893,2.71242 6.57395,5.41519 8.70869,8.82314"
fill="none"
stroke-linecap="round"
stroke-width="3.8379"
id="path903"/>
<path
d="m 30.720739,152.1708 c 1.723683,-1.09029 3.39542,-1.88924 5.124159,-2.04891 6.078031,-0.56119 10.515125,2.59558 14.267178,4.32338 0.963435,0.64794 5.873466,-0.1855 14.840881,-1.24836 4.387355,0.12399 8.743543,0.40569 12.581927,3.30853 2.793491,1.62723 5.651432,-2.52156 13.558324,-3.2135 5.979656,0.0828 8.872074,3.71592 14.086062,2.0912 5.11027,-0.0812 10.42502,-3.82552 16.22089,-2.86672 5.18245,-0.5213 7.91701,1.98883 12.62973,1.33569 3.35396,-0.0794 5.01503,-2.56635 8.3129,-2.43672 4.18785,0.17902 8.51232,0.95844 12.63801,0.0137 3.21127,-1.25953 1.81231,-2.232 3.79168,-1.3652 2.05862,0.72189 4.20449,2.12115 6.97417,3.02612"
fill="none"
stroke-width="3.8379"
id="path905"/>
<path
d="m 38.85772,40.385745 c 35.308462,-33.0629589 88.80532,-34.9054519 123.98967,0.543728 6.75038,6.563782 -4.63182,20.516124 -12.1807,13.175926 C 123.27606,29.025681 83.227192,23.921949 51.23407,53.82291 42.755882,62.06673 31.274855,47.758993 38.85772,40.385745 Z"
stroke-width="7.9375"
style="fill:#1b1c1d;fill-opacity:1;stroke:#ffffff;stroke-width:19.1897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="path907"
sodipodi:nodetypes="ccccc"/>
<path
d="m 63.023698,63.841995 c 32.309394,-26.027336 60.953162,-14.854373 75.859312,0.608613 8.20871,7.981784 -4.5496,21.016007 -12.46804,13.316459 C 111.47296,63.974742 93.832519,61.36879 74.647495,77.809799 67.878296,84.391873 55.535866,71.122837 63.023698,63.841995 Z"
stroke-width="7.9375"
style="fill:#1b1c1d;fill-opacity:1;stroke:#ffffff;stroke-width:19.1897;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="path909"
sodipodi:nodetypes="ccccc"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Before After
Before After

View file

@ -1,20 +1,20 @@
<!DOCTYPE html>
<html lang="en" style="height: 100%">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<head>
<meta charset="utf-8"/>
<link rel="icon" href="%PUBLIC_URL%/favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#000000" />
<meta name="theme-color" content="#000000"/>
<meta
name="description"
content="The WROLPI webapp"
name="description"
content="The WROLPI webapp"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png"/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"/>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
@ -25,19 +25,19 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>WROLPi: Create your own off-grid library</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

View file

@ -19,7 +19,7 @@ import {Donate} from "./components/Donate";
import {useEventsInterval} from "./Events";
import {SemanticToastContainer} from "react-semantic-toasts-2";
import {FilePreviewWrapper} from "./components/FilePreview";
import {TagsContext, useTags, useTagsInterval} from "./Tags";
import {TagsContext, useTagsInterval} from "./Tags";
function PageNotFound() {
const {t} = useContext(ThemeContext);

View file

@ -1,5 +1,5 @@
import {LoadStatistic, PageContainer, SearchInput, useTitle} from "./components/Common";
import {useSearchFiles} from "./hooks/customHooks";
import {useQuery, useSearchFiles} from "./hooks/customHooks";
import React, {useContext, useState} from "react";
import {StatusContext} from "./contexts/contexts";
import {DownloadMenu} from "./components/Download";
@ -63,7 +63,12 @@ function FlagsMessages({flags}) {
export function Dashboard() {
useTitle('Dashboard');
const {searchStr, setSearchStr, activeTags} = useSearchFiles();
const {searchParams, updateQuery} = useQuery();
const searchStr = searchParams.get('q');
const activeTags = searchParams.getAll('tag');
const setSearchStr = (value) => {
updateQuery({q: value, o: null});
}
const {status} = useContext(StatusContext);
const wrol_mode = status ? status['wrol_mode'] : null;
@ -76,7 +81,7 @@ export function Dashboard() {
// Only show dashboard parts if not searching.
let body;
if (searchStr || (activeTags && activeTags.length > 0)) {
body = <FilesSearchView showSelectButton={true}/>;
body = <FilesSearchView/>;
} else {
body = <>
{!wrol_mode && downloads}

View file

@ -27,7 +27,6 @@ import {Segment} from "./components/Theme";
import _ from "lodash";
import {HexColorPicker} from "react-colorful";
import {useRecurringTimeout} from "./hooks/customHooks";
import {Link} from "react-router-dom";
export const TagsContext = React.createContext({
NameToTagLabel: null,

View file

@ -6,9 +6,10 @@ import {
CardMeta,
Confirm,
Container,
Image,
Dropdown,
Input, Modal,
Image,
Input,
Modal,
PlaceholderHeader,
PlaceholderLine,
TableCell,
@ -28,7 +29,8 @@ import {
mimetypeColor,
PageContainer,
PreviewLink,
SearchInput, SortButton,
SearchInput,
SortButton,
TabLinks,
textEllipsis,
useTitle
@ -37,7 +39,7 @@ import {addTag, deleteArchives, postDownload, removeTag} from "../api";
import {Link, Route, Routes, useNavigate, useParams} from "react-router-dom";
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
import {useArchive, useDomains, useQuery, useSearchArchives, useSearchDomain} from "../hooks/customHooks";
import {FileCards, FileRowTagIcon, FilesView, SearchFilter} from "./Files";
import {FileCards, FileRowTagIcon, FilesView} from "./Files";
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
import _ from "lodash";
import {Media, ThemeContext} from "../contexts/contexts";

View file

@ -2,7 +2,7 @@ import {Button, Icon, Placeholder} from "./Theme";
import {Checkbox, Confirm, PlaceholderLine, TableCell, TableFooter, TableHeaderCell, TableRow} from "semantic-ui-react";
import {FileIcon, humanFileSize} from "./Common";
import React, {useEffect} from "react";
import {deleteFile, fetchFile} from "../api";
import {deleteFile} from "../api";
import _ from 'lodash';
import {SortableTable} from "./SortableTable";
import {useBrowseFiles} from "../hooks/customHooks";

View file

@ -282,7 +282,7 @@ export function SearchLimitDropdown({limits = []}) {
return <Dropdown fluid selection
placeholder='Limit'
options={limitOptions}
value={parseInt(limit || limitOptions[0]['value'])}
value={limit || limitOptions[0]['value']}
onChange={(e, {value}) => setLimit(value)}
/>
}
@ -439,8 +439,7 @@ export function FilesSearchView({
{key: 'model', text: '3D Model', value: 'model'},
];
const {searchFiles, totalPages, activePage, setPage} =
useSearchFiles(24, emptySearch, model);
const {searchFiles, totalPages, activePage, setPage} = useSearchFiles(24, emptySearch, model);
const {body, paginator, selectButton, viewButton, limitDropdown, tagQuerySelector} = FilesView(
searchFiles,
@ -470,7 +469,7 @@ export function FilesSearchView({
<Grid.Column width={1}>{selectButton}</Grid.Column>}
{showView &&
<Grid.Column width={1}>{viewButton}</Grid.Column>}
<Grid.Column width={4}>{limitDropdown}</Grid.Column>
<Grid.Column width={2}>{limitDropdown}</Grid.Column>
<Grid.Column width={1}>{tagQuerySelector}</Grid.Column>
<Grid.Column width={1}><SearchFilter filters={filterOptions}/></Grid.Column>
</Grid.Row>

View file

@ -1,4 +1,4 @@
import React, {useContext} from "react";
import React from "react";
import {NavLink} from "react-router-dom";
import {Dropdown, Menu} from "semantic-ui-react";
import {Media, StatusContext, ThemeContext} from "../contexts/contexts";

View file

@ -1,4 +1,4 @@
import React, {Fragment, useContext, useEffect, useState} from 'react';
import React, {useContext, useEffect, useState} from 'react';
import {Link, Route, Routes, useParams} from "react-router-dom";
import {
CardLink,
@ -14,7 +14,8 @@ import {
mimetypeColor,
PageContainer,
scrollToTop,
SearchInput, SortButton,
SearchInput,
SortButton,
TabLinks,
textEllipsis,
useTitle
@ -26,7 +27,6 @@ import {
CardHeader,
Confirm,
Container,
Dropdown,
Image,
PlaceholderHeader,
PlaceholderLine,
@ -43,7 +43,6 @@ import {Button, Card, Header, Loader, Placeholder, Segment, Statistic, Statistic
import {deleteVideos} from "../api";
import {Media, ThemeContext} from "../contexts/contexts";
import _ from "lodash";
import {SearchDomain} from "./Archive";
export function VideoWrapper() {
const {videoId} = useParams();

View file

@ -25,8 +25,6 @@ import {createSearchParams, useSearchParams} from "react-router-dom";
import {enumerate, filterToMimetypes, humanFileSize, secondsToFullDuration} from "../components/Common";
import {StatusContext} from "../contexts/contexts";
import {toast} from "react-semantic-toasts-2";
import {Modal} from "semantic-ui-react";
import {Button} from "../components/Theme";
const calculatePage = (offset, limit) => {
return offset && limit ? Math.round((offset / limit) + 1) : 1;
@ -140,7 +138,7 @@ export const useOneQuery = (name) => {
export const usePages = (defaultLimit) => {
const {searchParams, updateQuery} = useQuery();
const offset = searchParams.get('o') || 0;
const limit = searchParams.get('l') || defaultLimit || 24;
const limit = parseInt(searchParams.get('l') || defaultLimit || 24);
const [activePage, setActivePage] = useState(calculatePage(offset, limit));
const setLimit = (value) => {