mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-19 14:36:22 -05:00
Removing consolidated hook because values were not being passed up.
This commit is contained in:
parent
2053dc46f9
commit
3f08bce9ea
11 changed files with 106 additions and 98 deletions
|
|
@ -443,9 +443,9 @@ class Downloads extends React.Component {
|
|||
export default function Admin(props) {
|
||||
|
||||
const links = [
|
||||
{text: 'Downloads', to: '/admin', exact: true},
|
||||
{text: 'Settings', to: '/admin/settings'},
|
||||
{text: 'WROL Mode', to: '/admin/wrol'},
|
||||
{text: 'Downloads', to: '/admin', exact: true, key: 'admin'},
|
||||
{text: 'Settings', to: '/admin/settings', key: 'settings'},
|
||||
{text: 'WROL Mode', to: '/admin/wrol', key: 'wrol'},
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ import {
|
|||
CardGroupCentered,
|
||||
ClearButton,
|
||||
ExternalLink,
|
||||
PageContainer, Paginator,
|
||||
PageContainer,
|
||||
Paginator,
|
||||
SearchInput,
|
||||
TabLinks,
|
||||
textEllipsis,
|
||||
|
|
@ -202,9 +203,8 @@ export function ArchivesList({archives, searchStr, syncArchive, localDeleteArchi
|
|||
}
|
||||
|
||||
export function Archives() {
|
||||
const {archivesData, setPage, totalPages, searchStr, activePage, setSearchStr, domain, setDomain, search} =
|
||||
useArchives();
|
||||
const {archives} = archivesData;
|
||||
const {archives, setPage, totalPages, searchStr, activePage, setSearchStr, domain, setDomain, search} =
|
||||
useArchives(20);
|
||||
|
||||
const syncArchive = async (url) => {
|
||||
await postDownload(url, 'archive');
|
||||
|
|
@ -237,7 +237,7 @@ export function Archives() {
|
|||
setDomain={setDomain}
|
||||
/>
|
||||
<div style={{marginTop: '3em', textAlign: 'center'}}>
|
||||
<Paginator totalPages={totalPages}/>
|
||||
<Paginator activePage={activePage} totalPages={totalPages} onPageChange={setPage}/>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
|
@ -319,9 +319,9 @@ function Domains() {
|
|||
|
||||
export function ArchiveRoute(props) {
|
||||
const links = [
|
||||
{text: 'Archives', to: '/archive', exact: true},
|
||||
{text: 'Domains', to: '/archive/domains'},
|
||||
{text: 'Manage', to: '/archive/manage'},
|
||||
{text: 'Archives', to: '/archive', exact: true, key: 'archive'},
|
||||
{text: 'Domains', to: '/archive/domains', key: 'domains'},
|
||||
{text: 'Manage', to: '/archive/manage', key: 'manage'},
|
||||
];
|
||||
return <PageContainer>
|
||||
<TabLinks links={links}/>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import Button from "semantic-ui-react/dist/commonjs/elements/Button";
|
|||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
|
||||
import {getConfig} from "../api";
|
||||
import {useSearchParams} from "../hooks/customHooks";
|
||||
|
||||
export const API_URI = `http://${window.location.host}/api`;
|
||||
export const VIDEOS_API = `${API_URI}/videos`;
|
||||
|
|
@ -55,26 +54,21 @@ export default class OldPaginator extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
export function Paginator(props) {
|
||||
let {activePage, setPage} = useSearchParams(props.defaultLimit || 20);
|
||||
|
||||
const handlePaginationChange = (e, {activePage}) => {
|
||||
setPage(activePage);
|
||||
export function Paginator({activePage, onPageChange, totalPages, showFirstAndLast}) {
|
||||
const handlePageChange = (e, {activePage}) => {
|
||||
onPageChange(activePage);
|
||||
}
|
||||
|
||||
return (
|
||||
<Pagination
|
||||
activePage={activePage}
|
||||
boundaryRange={1}
|
||||
onPageChange={handlePaginationChange}
|
||||
onPageChange={handlePageChange}
|
||||
size='mini'
|
||||
siblingRange={2}
|
||||
totalPages={props.totalPages}
|
||||
ellipsisItem={true}
|
||||
firstItem={null}
|
||||
lastItem={null}
|
||||
prevItem={true}
|
||||
nextItem={true}
|
||||
totalPages={totalPages}
|
||||
firstItem={showFirstAndLast ? undefined : null}
|
||||
lastItem={showFirstAndLast ? undefined : null}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
@ -607,6 +601,7 @@ export function TabLinks({links}) {
|
|||
className={'item'}
|
||||
exact={link.exact || false}
|
||||
style={{padding: '1em'}}
|
||||
key={link.key}
|
||||
>
|
||||
{link.text}
|
||||
</NavLink>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const icons = {
|
|||
PDF: <Icon name='file pdf'/>,
|
||||
};
|
||||
|
||||
export function Files(props) {
|
||||
export function Files() {
|
||||
const {searchFiles, setPage, totalPages, activePage, searchStr, setSearchStr} = useSearchFiles(50);
|
||||
const {browseFiles, setOpenFolders, fetchFiles} = useBrowseFiles();
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ export function Files(props) {
|
|||
</>
|
||||
}
|
||||
|
||||
function ManageFiles(props) {
|
||||
function ManageFiles() {
|
||||
return (<>
|
||||
<Button secondary
|
||||
id='refresh_files'
|
||||
|
|
|
|||
|
|
@ -1090,8 +1090,8 @@ class InventoryAddList extends React.Component {
|
|||
|
||||
export function InventoryRoute(props) {
|
||||
const links = [
|
||||
{text: 'List', to: '/inventory', exact: true},
|
||||
{text: 'Summary', to: '/inventory/summary'},
|
||||
{text: 'List', to: '/inventory', exact: true, key: 'inventory'},
|
||||
{text: 'Summary', to: '/inventory/summary', key: 'summary'},
|
||||
];
|
||||
return (
|
||||
<PageContainer>
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@ import {Dropdown, Menu, Responsive} from "semantic-ui-react";
|
|||
const responsiveWidth = 500;
|
||||
|
||||
const links = [
|
||||
{text: 'Videos', to: '/videos'},
|
||||
{text: 'Inventory', to: '/inventory'},
|
||||
{text: 'Archive', to: '/archive'},
|
||||
{text: 'Files', to: '/files'},
|
||||
{text: 'Videos', to: '/videos', key: 'videos'},
|
||||
{text: 'Inventory', to: '/inventory', key: 'inventory'},
|
||||
{text: 'Archive', to: '/archive', key: 'archive'},
|
||||
{text: 'Files', to: '/files', key: 'files'},
|
||||
{
|
||||
text: 'Apps', links: [
|
||||
key: 'apps', text: 'Apps', links: [
|
||||
{to: '/apps/otp', text: 'One Time Pad', exact: true},
|
||||
]
|
||||
},
|
||||
];
|
||||
const admin = {to: '/admin', text: 'Admin', exact: true};
|
||||
const admin = {to: '/admin', text: 'Admin', exact: true, key: 'admin'};
|
||||
const rightLinks = [admin,];
|
||||
|
||||
const collapsedLinks = links.concat([admin,]);
|
||||
|
|
@ -67,22 +67,20 @@ export function NavBar() {
|
|||
{/*Show the links in a menu when on desktop*/}
|
||||
{links.map((link) => {
|
||||
return (
|
||||
<Responsive minWidth={responsiveWidth} as={MenuLink} link={link} key={link.to}/>
|
||||
<Responsive minWidth={responsiveWidth} as={MenuLink} link={link} key={link.key}/>
|
||||
)
|
||||
})}
|
||||
<Responsive minWidth={responsiveWidth} as={Menu.Menu} position="right">
|
||||
{rightLinks.map((link) => {
|
||||
return (<MenuLink link={link} key={link.to}/>)
|
||||
})}
|
||||
{rightLinks.map((link) => <MenuLink link={link} key={link.key}/>)}
|
||||
</Responsive>
|
||||
|
||||
{/*Show the menu items in a dropdown when on mobile*/}
|
||||
<Responsive as={Menu.Menu} maxWidth={responsiveWidth - 1} position='right'>
|
||||
<Dropdown item icon="bars">
|
||||
<Dropdown.Menu>
|
||||
{collapsedLinks.map((link) => {
|
||||
return (<MenuLink link={link} key={link.to}/>)
|
||||
})}
|
||||
{collapsedLinks.map((link) =>
|
||||
<MenuLink link={link} key={link.key}/>
|
||||
)}
|
||||
</Dropdown.Menu>
|
||||
</Dropdown>
|
||||
</Responsive>
|
||||
|
|
|
|||
|
|
@ -496,10 +496,10 @@ function ManageTab(props) {
|
|||
export function VideosRoute(props) {
|
||||
|
||||
const links = [
|
||||
{text: 'Videos', to: '/videos', exact: true},
|
||||
{text: 'Favorites', to: '/videos/favorites'},
|
||||
{text: 'Channels', to: '/videos/channel',},
|
||||
{text: 'Manage', to: '/videos/manage'},
|
||||
{text: 'Videos', to: '/videos', exact: true, key: 'videos'},
|
||||
{text: 'Favorites', to: '/videos/favorites', key: 'favorites'},
|
||||
{text: 'Channels', to: '/videos/channel', key: 'channel'},
|
||||
{text: 'Manage', to: '/videos/manage', key: 'manage'},
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue