Refactor the rqbit-web file by breaking it down into components and helper functions. Improve code organization and maintainability
This commit is contained in:
parent
a5e7a5a5f5
commit
f978ad02fe
25 changed files with 1722 additions and 926 deletions
27
crates/librqbit/webui/src/components/RootContent.tsx
Normal file
27
crates/librqbit/webui/src/components/RootContent.tsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { useContext } from "react";
|
||||
import { Container } from "react-bootstrap";
|
||||
import { TorrentId, ErrorDetails as ApiErrorDetails } from "../api-types";
|
||||
import { AppContext } from "../context";
|
||||
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>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue