2023-12-08 19:47:48 +00:00
|
|
|
import { useContext, useState } from "react";
|
2023-12-07 16:33:37 +00:00
|
|
|
import { Container } from "react-bootstrap";
|
|
|
|
|
import { TorrentId, ErrorDetails as ApiErrorDetails } from "../api-types";
|
2023-12-08 19:47:48 +00:00
|
|
|
import { APIContext, AppContext } from "../context";
|
2023-12-07 16:33:37 +00:00
|
|
|
import { TorrentsList } from "./TorrentsList";
|
|
|
|
|
import { ErrorComponent } from "./ErrorComponent";
|
|
|
|
|
import { Buttons } from "./Buttons";
|
|
|
|
|
|
|
|
|
|
export const RootContent = (props: {
|
|
|
|
|
closeableError: ApiErrorDetails | null;
|
|
|
|
|
otherError: ApiErrorDetails | null;
|
|
|
|
|
torrents: Array<TorrentId> | null;
|
|
|
|
|
torrentsLoading: boolean;
|
|
|
|
|
}) => {
|
|
|
|
|
let ctx = useContext(AppContext);
|
|
|
|
|
return (
|
|
|
|
|
<Container>
|
|
|
|
|
<ErrorComponent
|
|
|
|
|
error={props.closeableError}
|
|
|
|
|
remove={() => ctx.setCloseableError(null)}
|
|
|
|
|
/>
|
|
|
|
|
<ErrorComponent error={props.otherError} />
|
|
|
|
|
<TorrentsList torrents={props.torrents} loading={props.torrentsLoading} />
|
|
|
|
|
<Buttons />
|
|
|
|
|
</Container>
|
|
|
|
|
);
|
|
|
|
|
};
|