2023-12-14 10:37:29 +00:00
|
|
|
import { useContext } from "react";
|
2023-12-07 16:33:37 +00:00
|
|
|
import { TorrentId, ErrorDetails as ApiErrorDetails } from "../api-types";
|
2023-12-14 10:37:29 +00:00
|
|
|
import { AppContext } from "../context";
|
2023-12-07 16:33:37 +00:00
|
|
|
import { TorrentsList } from "./TorrentsList";
|
|
|
|
|
import { ErrorComponent } from "./ErrorComponent";
|
|
|
|
|
|
|
|
|
|
export const RootContent = (props: {
|
|
|
|
|
closeableError: ApiErrorDetails | null;
|
|
|
|
|
otherError: ApiErrorDetails | null;
|
|
|
|
|
torrents: Array<TorrentId> | null;
|
|
|
|
|
torrentsLoading: boolean;
|
|
|
|
|
}) => {
|
|
|
|
|
let ctx = useContext(AppContext);
|
|
|
|
|
return (
|
2023-12-14 10:37:29 +00:00
|
|
|
<div className="container mx-auto">
|
2023-12-07 16:33:37 +00:00
|
|
|
<ErrorComponent
|
|
|
|
|
error={props.closeableError}
|
|
|
|
|
remove={() => ctx.setCloseableError(null)}
|
|
|
|
|
/>
|
|
|
|
|
<ErrorComponent error={props.otherError} />
|
|
|
|
|
<TorrentsList torrents={props.torrents} loading={props.torrentsLoading} />
|
2023-12-14 10:37:29 +00:00
|
|
|
</div>
|
2023-12-07 16:33:37 +00:00
|
|
|
);
|
|
|
|
|
};
|