- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files. - Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter. - Updated project structure and references to reflect these removals.
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import React, {useContext, useState} from "react";
|
|
import {ChapterContext, ChapterContextProps} from "@/context/ChapterContext";
|
|
import {BookContext, BookContextProps} from "@/context/BookContext";
|
|
import {SettingBookContext, SettingBookContextProps} from "@/context/SettingBookContext";
|
|
import TextEditor from "./TextEditor";
|
|
import BookList from "@/components/book/BookList";
|
|
import BookSettingOption from "@/components/book/settings/BookSettingOption";
|
|
import NoBookHome from "@/components/editor/NoBookHome";
|
|
|
|
export default function ScribeEditor() {
|
|
const {chapter}: ChapterContextProps = useContext<ChapterContextProps>(ChapterContext);
|
|
const {book}: BookContextProps = useContext<BookContextProps>(BookContext);
|
|
|
|
const [bookSettingId, setBookSettingId] = useState<string>('');
|
|
|
|
return (
|
|
<SettingBookContext.Provider value={{bookSettingId, setBookSettingId}}>
|
|
<div className="flex-1 min-w-0 bg-darkest-background">
|
|
{
|
|
chapter ? (
|
|
<TextEditor/>
|
|
) : book ? (
|
|
<NoBookHome/>
|
|
) : book === null ? (
|
|
<BookList/>
|
|
) : bookSettingId && (
|
|
<BookSettingOption setting={bookSettingId}/>
|
|
)
|
|
}
|
|
</div>
|
|
</SettingBookContext.Provider>
|
|
);
|
|
}
|