import {useOutdatedZims, useSearchZim} from "../hooks/customHooks"; import { Accordion, Button, Divider, Header, Icon, Modal, ModalActions, ModalContent, ModalHeader, Placeholder, Segment } from "./Theme"; import {HeadlineText} from "./Headline"; import {TextPlaceholder} from "./Placeholder"; import { AccordionContent, AccordionTitle, Button as SButton, Dropdown, Icon as SIcon, Label, Message, PlaceholderHeader, PlaceholderLine, TableCell, TableFooter, TableHeaderCell, TableRow } from "semantic-ui-react"; import React, {useContext, useState} from "react"; import { encodeMediaPath, humanFileSize, normalizeEstimate, PageContainer, Paginator, TabLinks, TagIcon, useTitle } from "./Common"; import Grid from "semantic-ui-react/dist/commonjs/collections/Grid"; import {TagsSelector} from "../Tags"; import { deleteOutdatedZims, fetchZims, fetchZimSubscriptions, refreshFiles, saveSettings, tagZimEntry, untagZimEntry, zimSubscribe, zimUnsubscribe } from "../api"; import {useSearch} from "./Search"; import {TagsQuerySelector} from "./Files"; import {ThemeContext} from "../contexts/contexts"; import {Link, Route, Routes} from "react-router-dom"; import {SortableTable} from "./SortableTable"; import {toast} from "react-semantic-toasts-2"; const VIEWER_URL = `http://${window.location.hostname}:8085/`; export const OutdatedZimsMessage = ({onClick}) => { const [open, setOpen] = React.useState(false); const {outdated, current} = useOutdatedZims(); const onOpen = () => setOpen(true); const onClose = () => setOpen(false); const handleDelete = async (e) => { if (e) { e.preventDefault(); } try { const success = await deleteOutdatedZims(); if (success) { toast({ type: 'info', title: 'Zims deleted', description: 'Outdated Zims have been deleted.', time: 5000, }); } else { toast({ type: 'error', title: 'Failed to delete Zims', description: 'Outdated Zims have NOT been deleted. See server logs.', time: 5000, }); } } finally { onClose(); } } const handleIgnore = async (e) => { if (e) { e.preventDefault(); } const config = {ignore_outdated_zims: true}; await saveSettings(config); if (onClick) { await onClick(); } } let modalContent = ; if (outdated && outdated.length > 0) { modalContent = <>
To Delete
{outdated.map(i =>
{i}
)}
To Keep
{current.map(i =>
{i}
)} } return Outdated Zim Files New Zim files have been downloaded. Outdated Zim files can be removed.

setOpen(true)}>Delete Delete {modalContent} Delete Manually Ignore Forever
} export const KiwixRestartMessage = () => { return Kiwix must be restarted

New Zim files have been downloaded; you must restart your containers.

Run the following to restart your containers:

  docker-compose restart
} const ZimSearchEntry = ({zimId, onTag, onUntag, entry}) => { const {path, title, headline, tag_names} = entry; const [open, setOpen] = React.useState(false); const url = `/api/zim/${zimId}/entry/${encodeMediaPath(path)}`; const handleClick = async (e) => { if (e) { e.preventDefault(); } setOpen(true); } const localAddTag = (name) => { onTag(zimId, path, name); } const localUntag = (name) => { onUntag(zimId, path, name); } const tagIcon = tag_names && tag_names.length > 0 ? : null; return
'} closeTag={''}/> {tagIcon}
setOpen(false)}>