touchstudy-core 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/iconMore.d.ts +3 -0
- package/dist/assets/iconPlusCircle.d.ts +3 -0
- package/dist/components/Buttons/ActionButtons.d.ts +16 -0
- package/dist/components/Chats/ChatHeader.d.ts +3 -0
- package/dist/components/Chats/ChatItem.d.ts +5 -0
- package/dist/components/Chats/ChatList.d.ts +2 -0
- package/dist/components/Chats/apiClient/conversationService.d.ts +2 -0
- package/dist/components/Chats/components/ContentTooltip.d.ts +7 -0
- package/dist/components/Chats/components/CustomTooltip.d.ts +2 -0
- package/dist/components/Chats/components/UpdateMessageDialog.d.ts +12 -0
- package/dist/components/Chats/configs/types.d.ts +4 -0
- package/dist/components/Chats/hooks/useChatContainer.d.ts +6 -1
- package/dist/components/Chats/hooks/useDialog.d.ts +5 -2
- package/dist/components/Chats/hooks/useMessageList.d.ts +4 -0
- package/dist/components/Chats/hooks/useTooltip.d.ts +6 -0
- package/dist/components/Inputs/SearchInput.d.ts +9 -0
- package/dist/components/List/LayoutList.d.ts +6 -0
- package/dist/components/Selectors/SubjectSelector.d.ts +14 -0
- package/dist/components/Sort/SortIcon.d.ts +7 -0
- package/dist/components/Tables/EmptyRow.d.ts +3 -0
- package/dist/components/Tables/TableHeader.d.ts +9 -0
- package/dist/containers/ExamResult/configs/constants.d.ts +4 -0
- package/dist/containers/ExamResult/configs/types.d.ts +7 -1
- package/dist/containers/ExamResult/hooks/useExamResult.d.ts +1 -0
- package/dist/containers/Textbooks/apiClient/articleService.d.ts +7 -0
- package/dist/containers/Textbooks/apiClient/chapterService.d.ts +7 -0
- package/dist/containers/Textbooks/apiClient/textbookService.d.ts +7 -0
- package/dist/containers/Textbooks/components/ArticleDialog.d.ts +11 -0
- package/dist/containers/Textbooks/components/ChapterBox.d.ts +4 -0
- package/dist/containers/Textbooks/components/ChapterNameDialog.d.ts +10 -0
- package/dist/containers/Textbooks/components/TextbookActionButtons.d.ts +11 -0
- package/dist/containers/Textbooks/configs/constants.d.ts +9 -0
- package/dist/containers/Textbooks/configs/interfaces.d.ts +19 -0
- package/dist/containers/Textbooks/configs/types.d.ts +122 -0
- package/dist/containers/Textbooks/hooks/useTextbookDetail.d.ts +44 -0
- package/dist/containers/Textbooks/hooks/useTextbookList.d.ts +21 -0
- package/dist/containers/Textbooks/views/TextbookDetail.d.ts +10 -0
- package/dist/containers/Textbooks/views/TextbookList.d.ts +8 -0
- package/dist/containers/Textbooks/views/index.d.ts +3 -0
- package/dist/index.css +177 -55
- package/dist/index.d.ts +6 -2
- package/dist/index.js +3474 -767
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +3471 -770
- package/dist/index.modern.js.map +1 -1
- package/dist/layouts/LayoutContext.d.ts +1 -0
- package/dist/redux/commons/action.d.ts +3 -0
- package/dist/services/subjectService.d.ts +2 -0
- package/dist/utils/times.d.ts +4 -0
- package/dist/utils/types/pusher.d.ts +5 -0
- package/package.json +3 -1
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { FC } from "react";
|
3
|
+
export interface ActionButtonsProps {
|
4
|
+
className?: string;
|
5
|
+
backText: string;
|
6
|
+
saveText: string;
|
7
|
+
altSaveText?: string;
|
8
|
+
saveDisabled?: boolean;
|
9
|
+
hideSave?: boolean;
|
10
|
+
saveIcon?: React.ReactNode;
|
11
|
+
onBack: () => void;
|
12
|
+
onSave: () => void;
|
13
|
+
onAltSave?: () => void;
|
14
|
+
}
|
15
|
+
declare const ActionButtons: FC<ActionButtonsProps>;
|
16
|
+
export default ActionButtons;
|
@@ -11,6 +11,9 @@ export interface IChatHeaderProps {
|
|
11
11
|
examTitle?: string;
|
12
12
|
createdAt?: string;
|
13
13
|
durationExam?: string;
|
14
|
+
score?: number | null;
|
15
|
+
courseId?: number | null;
|
16
|
+
category?: string | null;
|
14
17
|
questionOrder?: number;
|
15
18
|
conversationId?: number;
|
16
19
|
isCompleted?: boolean;
|
@@ -9,13 +9,18 @@ export interface IChatItemProps {
|
|
9
9
|
sender?: StudentsConversationResponse;
|
10
10
|
isRead: boolean;
|
11
11
|
contentType?: number;
|
12
|
+
conversationId?: number;
|
12
13
|
}
|
13
14
|
export interface IChatItemWithActionProps extends IChatItemProps {
|
14
15
|
onReTrySendMessage?: () => void;
|
16
|
+
handleUpdateMessage: (conversationId: number, id: number, message: string, callback: any) => void;
|
17
|
+
handleDeleteMessage: (conversationId: number, id: number, callback: any) => void;
|
15
18
|
showTimestamp?: boolean;
|
16
19
|
showName?: boolean;
|
17
20
|
isStudent?: boolean;
|
18
21
|
toggleImageDialog?: () => void;
|
22
|
+
toggleConfirmDialog?: () => void;
|
23
|
+
toggleUpdateDialog?: () => void;
|
19
24
|
}
|
20
25
|
export declare enum ChatItemType {
|
21
26
|
Default = 0,
|
@@ -4,6 +4,8 @@ export interface IChatListProps {
|
|
4
4
|
messages?: IChatItemProps[];
|
5
5
|
onReTrySendMessage?: () => void;
|
6
6
|
roles: Array<String>;
|
7
|
+
handleUpdateMessage: (id: number) => void;
|
8
|
+
handleDeleteMessage: (id: number) => void;
|
7
9
|
}
|
8
10
|
interface Props extends IChatListProps {
|
9
11
|
listItemRef: React.RefObject<HTMLUListElement>;
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { ConversationFilter, MessageFilter, MessageRequest } from "../configs/types";
|
2
2
|
export declare const getListConversation: (query: ConversationFilter) => Promise<import("axios").AxiosResponse<any, any>>;
|
3
3
|
export declare const createConversation: (studentId: number) => Promise<import("axios").AxiosResponse<any, any>>;
|
4
|
+
export declare const deleteMessage: (conversationId: number, messageId: number) => Promise<import("axios").AxiosResponse<any, any>>;
|
5
|
+
export declare const updateMessage: (conversationId: number, messageId: number, content: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
4
6
|
export declare const apiAddMessage: (conversationId: number, message: MessageRequest) => Promise<import("axios").AxiosResponse<any, any>>;
|
5
7
|
export declare const getMessagesByConversation: (conversationId: number, filter: MessageFilter) => Promise<import("axios").AxiosResponse<any, any>>;
|
6
8
|
export declare const updateLastTimeReadConversation: (conversationId: number) => Promise<import("axios").AxiosResponse<any, any>>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { FC } from "react";
|
2
|
+
interface Props {
|
3
|
+
open: boolean;
|
4
|
+
onClose: () => void;
|
5
|
+
content?: string;
|
6
|
+
contentType?: number;
|
7
|
+
selectedFile: any;
|
8
|
+
handleUpdateMessage: (message: string) => void;
|
9
|
+
handleUploadImage: any;
|
10
|
+
}
|
11
|
+
declare const UpdateMessageDialog: FC<Props>;
|
12
|
+
export default UpdateMessageDialog;
|
@@ -9,7 +9,11 @@ export declare type ConversationResponse = {
|
|
9
9
|
export declare type ConversationsResponse = {
|
10
10
|
id: number;
|
11
11
|
studentExamSessionId: number;
|
12
|
+
courseId: number | null;
|
13
|
+
courseTitle: string | null;
|
14
|
+
score?: number | null;
|
12
15
|
studentId: number;
|
16
|
+
category?: string | null;
|
13
17
|
question: ConversationQuestion;
|
14
18
|
isCompleted: boolean;
|
15
19
|
completedAt: string;
|
@@ -9,7 +9,10 @@ declare const useChatContainer: (props: Props) => {
|
|
9
9
|
chatHeaderProps: {
|
10
10
|
fullName: string | undefined;
|
11
11
|
examTitle: string | undefined;
|
12
|
+
courseId: number | null | undefined;
|
13
|
+
score: number | null | undefined;
|
12
14
|
questionOrder: number | undefined;
|
15
|
+
category: string | null | undefined;
|
13
16
|
conversationId: number | undefined;
|
14
17
|
isCompleted: boolean | undefined;
|
15
18
|
durationExam: string | undefined;
|
@@ -21,6 +24,8 @@ declare const useChatContainer: (props: Props) => {
|
|
21
24
|
messages: IChatItemProps[];
|
22
25
|
onReTrySendMessage: () => Promise<void>;
|
23
26
|
roles: any;
|
27
|
+
handleUpdateMessage: (conversationId: number, id: number, message: string, callback: any) => Promise<void>;
|
28
|
+
handleDeleteMessage: (conversationId: number, id: number, callback: any) => Promise<void>;
|
24
29
|
};
|
25
30
|
inputProps: {
|
26
31
|
selectedFile: MessageRequest | null | undefined;
|
@@ -40,7 +45,7 @@ declare const useChatContainer: (props: Props) => {
|
|
40
45
|
handleLoadMoreMessages: () => Promise<true | undefined>;
|
41
46
|
getMessageList: (conversationId: number) => Promise<void>;
|
42
47
|
setMessage: import("react").Dispatch<import("react").SetStateAction<MessageRequest | undefined>>;
|
43
|
-
|
48
|
+
handleConversationChange: () => void;
|
44
49
|
getMessageConversation: () => Promise<void>;
|
45
50
|
};
|
46
51
|
export default useChatContainer;
|
@@ -1,7 +1,10 @@
|
|
1
|
+
import { MessageRequest } from "../configs/types";
|
1
2
|
declare const useDialog: () => {
|
2
|
-
|
3
|
-
|
3
|
+
selectedFile: MessageRequest | null | undefined;
|
4
|
+
openDialog: boolean;
|
5
|
+
toggleDialog: () => void;
|
4
6
|
handleConfirm: (conversationId: number) => Promise<void>;
|
5
7
|
downloadFile: (content: string) => Promise<void>;
|
8
|
+
handleUploadImage: (e: any) => Promise<void>;
|
6
9
|
};
|
7
10
|
export default useDialog;
|
@@ -8,5 +8,9 @@ declare const useMessageList: () => {
|
|
8
8
|
setMessages: import("react").Dispatch<import("react").SetStateAction<MessageResponse[]>>;
|
9
9
|
resetMessages: () => void;
|
10
10
|
handleLoadMore: (conversationId: number) => Promise<true | undefined>;
|
11
|
+
handleUpdateMessage: (conversationId: number, id: number, message: string, callback: any) => Promise<void>;
|
12
|
+
handleDeleteMessage: (conversationId: number, id: number, callback: any) => Promise<void>;
|
13
|
+
deleteMessageState: (data: MessageResponse) => void;
|
14
|
+
updateMessageState: (data: MessageResponse) => void;
|
11
15
|
};
|
12
16
|
export default useMessageList;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ChangeEvent, FC, RefObject } from "react";
|
2
|
+
interface Props {
|
3
|
+
textSearchRef: RefObject<HTMLInputElement>;
|
4
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
5
|
+
placeholder: string;
|
6
|
+
fit?: boolean;
|
7
|
+
}
|
8
|
+
declare const SearchInput: FC<Props>;
|
9
|
+
export default SearchInput;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { FC } from "react";
|
2
|
+
interface Props {
|
3
|
+
value?: any;
|
4
|
+
onChange: any;
|
5
|
+
externalSubjectIds?: number[];
|
6
|
+
title?: string;
|
7
|
+
isMulti?: boolean;
|
8
|
+
minimumTextSearchLength?: number;
|
9
|
+
placeholder?: string;
|
10
|
+
isDisabled?: boolean;
|
11
|
+
defaultValueAtFirst?: boolean;
|
12
|
+
}
|
13
|
+
declare const SubjectSelector: FC<Props>;
|
14
|
+
export default SubjectSelector;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { FC } from "react";
|
2
|
+
import { TableHeaderType, SearchQuery } from "../../utils/types/index";
|
3
|
+
interface TableHeaderProps {
|
4
|
+
headerTemplates: TableHeaderType[];
|
5
|
+
filter: SearchQuery;
|
6
|
+
onSort?: (key: string) => void;
|
7
|
+
}
|
8
|
+
declare const TableHeader: FC<TableHeaderProps>;
|
9
|
+
export default TableHeader;
|
@@ -1,5 +1,9 @@
|
|
1
1
|
import { EffectSize, ExamResult, LongTimeSpendQuestion, TimelyOrderQuestion } from "./types";
|
2
2
|
export declare const ORDER_NUMBERS: any;
|
3
|
+
export declare const TabList: {
|
4
|
+
label: string;
|
5
|
+
value: number;
|
6
|
+
}[];
|
3
7
|
export declare enum Roles {
|
4
8
|
Student = "Student",
|
5
9
|
Teacher = "Teacher",
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Role } from "../../Login/configs/constants";
|
2
|
+
import { ArticleRequest } from "../configs/types";
|
3
|
+
export declare const getArticleListApi: (query: any, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
4
|
+
export declare const getArticleByIdApi: (articleId: number, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
5
|
+
export declare const createArticleApi: (article: ArticleRequest, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
6
|
+
export declare const updateArticleApi: (articleId: number, article: ArticleRequest, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
7
|
+
export declare const deleteArticleApi: (articleId: number, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Role } from "../../Login/configs/constants";
|
2
|
+
import { ChapterRequest } from "../configs/types";
|
3
|
+
export declare const getChapterListApi: (query: any, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
4
|
+
export declare const getChapterByIdApi: (chapterId: number, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
5
|
+
export declare const createChapterApi: (chapter: ChapterRequest, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
6
|
+
export declare const updateChapterApi: (chapterId: number, chapter: ChapterRequest, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
7
|
+
export declare const deleteChapterApi: (chapterId: number, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Role } from "../../Login/configs/constants";
|
2
|
+
import { TextbookRequest, TextbookSearchQuery, TextbookUpdateRequest } from "../configs/types";
|
3
|
+
export declare const getTextbookListApi: (query: TextbookSearchQuery, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
4
|
+
export declare const getTextbookByIdApi: (textbookId: number, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
5
|
+
export declare const createTextbookApi: (data: TextbookRequest, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
6
|
+
export declare const updateTextbookApi: (textbookId: number, data: TextbookUpdateRequest, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
7
|
+
export declare const deleteTextbookApi: (textbookId: number, role: Role) => Promise<import("axios").AxiosResponse<any, any>>;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { FC } from "react";
|
2
|
+
import { ArticleCreateRequest, ChapterOption } from "../configs/types";
|
3
|
+
interface Props {
|
4
|
+
open: boolean;
|
5
|
+
chapter?: ChapterOption;
|
6
|
+
categoryOptions: any[];
|
7
|
+
onClose: () => void;
|
8
|
+
onSubmitForm: (article: ArticleCreateRequest) => void;
|
9
|
+
}
|
10
|
+
declare const ArticleDialog: FC<Props>;
|
11
|
+
export default ArticleDialog;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { FC } from "react";
|
2
|
+
import { ChapterOption } from "../configs/types";
|
3
|
+
interface Props {
|
4
|
+
open: boolean;
|
5
|
+
chapter?: ChapterOption;
|
6
|
+
onClose: () => void;
|
7
|
+
onSubmitForm: (name: string) => void;
|
8
|
+
}
|
9
|
+
declare const ChapterNameDialog: FC<Props>;
|
10
|
+
export default ChapterNameDialog;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { FC } from "react";
|
2
|
+
import { TextbookDetailResponse } from "../configs/types";
|
3
|
+
interface Props {
|
4
|
+
isReadonly: boolean;
|
5
|
+
textbook?: TextbookDetailResponse;
|
6
|
+
hideSave?: boolean;
|
7
|
+
onBack: () => void;
|
8
|
+
onSave: () => void;
|
9
|
+
}
|
10
|
+
declare const TextbookActionButtons: FC<Props>;
|
11
|
+
export default TextbookActionButtons;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ArticleCreateRequest, TextbookDetailResponse, TextbookHeaderTable, TextbookSearchQuery } from "./types";
|
2
|
+
export declare const TEXTBOOK_HEADERS: TextbookHeaderTable[];
|
3
|
+
export declare const TEXTBOOK_PAGE_TITLE: string;
|
4
|
+
export declare const TEXT_BOOK_SEARCH_PLACEHOLDER: string;
|
5
|
+
export declare const TextbookDefaultQuery: TextbookSearchQuery;
|
6
|
+
export declare const TEXTBOOK_URL = "/teacher/textbooks";
|
7
|
+
export declare const ADMIN_TEXTBOOK_URL = "/textbooks";
|
8
|
+
export declare const DEFAULT_TEXTBOOK: TextbookDetailResponse;
|
9
|
+
export declare const DEFAULT_ARTICLE_CREATE_REQUEST: ArticleCreateRequest;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { ChapterResponse, SubjectResponse, ChapterOption, ArticleResponse } from "./types";
|
2
|
+
export interface ChapterBoxProps {
|
3
|
+
parentChapterId?: number;
|
4
|
+
data: ChapterResponse;
|
5
|
+
subject: SubjectResponse;
|
6
|
+
categoryOptions: any[];
|
7
|
+
isReadonly?: boolean;
|
8
|
+
onClickAddSubchapter?: (chapter: ChapterOption) => void;
|
9
|
+
onChangeName?: (text: string, chapterId: number, parentChapterId?: number) => void;
|
10
|
+
onChangePageFrom?: (value: number, chapterId: number, parentChapterId?: number) => void;
|
11
|
+
onChangePageTo?: (value: number, chapterId: number, parentChapterId?: number) => void;
|
12
|
+
onAddArticle?: (chapter: ChapterResponse, callback?: Function) => void;
|
13
|
+
onRemoveArticle?: (articleNumber: number, chapterName: string, articles: ArticleResponse[], chapterId: number, parentChapterId?: number, callback?: Function) => void;
|
14
|
+
onUpdateArticleQuestionCount?: (articleNumber: number, questionCount: number, answerCount: number, articles: ArticleResponse[], chapterId: number, parentChapterId?: number, callback?: Function) => void;
|
15
|
+
onUpdateArticleCategory?: (articleNumber: number, categoryId: number, articles: ArticleResponse[], chapterId: number, parentChapterId?: number, callback?: Function) => void;
|
16
|
+
onUpdateArticleQuestionAnswerCount?: (articleNumber: number, newAnswerCount: number, answerCount: number, articles: ArticleResponse[], chapterId: number, parentChapterId?: number, callback?: Function) => void;
|
17
|
+
onUpdateArticleQuestion?: (articleNumber: number, index: number, value: number | number[], key: string, articles: ArticleResponse[], chapterId: number, parentChapterId?: number, callback?: Function) => void;
|
18
|
+
onRemoveChapter?: (chapterName: string, chapterId: number, parentChapterId?: number) => void;
|
19
|
+
}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
import { SearchQuery } from "../../../utils/types/index";
|
2
|
+
import { TableHeaderType } from "../../../utils/types/index";
|
3
|
+
export declare enum TextbookSortBy {
|
4
|
+
CreatedAt = "CreatedAt",
|
5
|
+
Title = "Name",
|
6
|
+
SubjectName = "Subject.Name"
|
7
|
+
}
|
8
|
+
export declare type TextbookHeaderTable = TableHeaderType;
|
9
|
+
export declare type TextbookSearchQuery = SearchQuery & {};
|
10
|
+
export declare type TextbookResponse = {
|
11
|
+
id: number;
|
12
|
+
name: string;
|
13
|
+
subject: SubjectResponse;
|
14
|
+
totalChapters: number;
|
15
|
+
createdAt: string;
|
16
|
+
isCreatedByAdmin: boolean;
|
17
|
+
};
|
18
|
+
export declare type ChapterOption = {
|
19
|
+
id: number;
|
20
|
+
name: string;
|
21
|
+
};
|
22
|
+
export declare type ChapterRequest = {
|
23
|
+
name: string;
|
24
|
+
textbookId?: number;
|
25
|
+
parentChapterId?: number;
|
26
|
+
pageFrom?: number;
|
27
|
+
pageTo?: number;
|
28
|
+
};
|
29
|
+
export declare type SubjectResponse = {
|
30
|
+
id: number;
|
31
|
+
name: string;
|
32
|
+
createdAt?: string;
|
33
|
+
};
|
34
|
+
export declare type TextbookRequest = {
|
35
|
+
name: string;
|
36
|
+
subjectId: number;
|
37
|
+
};
|
38
|
+
export declare type TextbookUpdateRequest = {
|
39
|
+
name: string;
|
40
|
+
};
|
41
|
+
export declare type TextbookDetailResponse = {
|
42
|
+
id?: number;
|
43
|
+
name: string;
|
44
|
+
subject?: SubjectResponse;
|
45
|
+
chapters: ChapterResponse[];
|
46
|
+
isCreatedByAdmin?: boolean;
|
47
|
+
};
|
48
|
+
export declare type UserResponse = {
|
49
|
+
id: number;
|
50
|
+
email: string;
|
51
|
+
fullName: string;
|
52
|
+
};
|
53
|
+
export declare type ChapterResponse = {
|
54
|
+
id: number;
|
55
|
+
parentChapterId?: number;
|
56
|
+
name: string;
|
57
|
+
pageFrom: number;
|
58
|
+
pageTo: number;
|
59
|
+
createdAt: string;
|
60
|
+
subChapters: SubChapterResponse[];
|
61
|
+
articles: ArticleResponse[];
|
62
|
+
};
|
63
|
+
export declare type ArticleRequest = {
|
64
|
+
articleNumber: number;
|
65
|
+
categoryId: number;
|
66
|
+
chapterId: number;
|
67
|
+
numberOfAnswers: number;
|
68
|
+
questions: QuestionRequest[];
|
69
|
+
};
|
70
|
+
export declare type ArticleResponse = {
|
71
|
+
id?: number;
|
72
|
+
articleNumber: number;
|
73
|
+
questionCount: number;
|
74
|
+
answerCount: number;
|
75
|
+
chapterId: number;
|
76
|
+
category?: CategoryResponse;
|
77
|
+
questions: QuestionResponse[];
|
78
|
+
};
|
79
|
+
export declare type QuestionResponse = {
|
80
|
+
id?: number;
|
81
|
+
numberOfAnswers: number;
|
82
|
+
correctAnswers: number[];
|
83
|
+
score: number;
|
84
|
+
questionOrder: number;
|
85
|
+
};
|
86
|
+
export declare type QuestionRequest = {
|
87
|
+
id?: number;
|
88
|
+
correctAnswer: number;
|
89
|
+
questionOrder: number;
|
90
|
+
score: number;
|
91
|
+
};
|
92
|
+
export declare type CategoryResponse = {
|
93
|
+
parentCategoryId?: null;
|
94
|
+
name?: string;
|
95
|
+
path?: null;
|
96
|
+
numberOfQuestions?: number;
|
97
|
+
numberOfChildren?: number;
|
98
|
+
id: number;
|
99
|
+
subjectId?: number;
|
100
|
+
};
|
101
|
+
export declare type SubChapterResponse = {
|
102
|
+
id: number;
|
103
|
+
name: string;
|
104
|
+
pageFrom: number;
|
105
|
+
pageTo: number;
|
106
|
+
createdAt: string;
|
107
|
+
subChapters: any[];
|
108
|
+
articles: any[];
|
109
|
+
};
|
110
|
+
export declare type ArticleCreateRequest = {
|
111
|
+
answerCount: number;
|
112
|
+
questionCount: number;
|
113
|
+
categoryId: number;
|
114
|
+
};
|
115
|
+
export declare type DeleteItem = {
|
116
|
+
chapterId: number;
|
117
|
+
parentChapterId?: number;
|
118
|
+
articleNumber?: number;
|
119
|
+
name: string;
|
120
|
+
value?: ArticleResponse[];
|
121
|
+
confirmText: string;
|
122
|
+
};
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { ChangeEvent } from "react";
|
2
|
+
import { ArticleCreateRequest, ArticleResponse, ChapterOption, ChapterResponse, DeleteItem, TextbookDetailResponse } from "../configs/types";
|
3
|
+
import { TextbookDetailProps } from "../views/TextbookDetail";
|
4
|
+
declare const useTextbookDetail: (props: TextbookDetailProps) => {
|
5
|
+
id: string;
|
6
|
+
t: any;
|
7
|
+
textbook: TextbookDetailResponse;
|
8
|
+
textbookSubject: {
|
9
|
+
label: string;
|
10
|
+
value: number;
|
11
|
+
} | undefined;
|
12
|
+
isReadonly: boolean;
|
13
|
+
isNotFound: boolean;
|
14
|
+
textbookId: number | undefined;
|
15
|
+
parentChapter: ChapterOption | undefined;
|
16
|
+
selectedChapter: ChapterResponse | undefined;
|
17
|
+
selectedDeleteItem: DeleteItem | undefined;
|
18
|
+
isEditedTitle: boolean;
|
19
|
+
isReadonlyParam: boolean | undefined;
|
20
|
+
handleChangeTextbookTitle: (e: ChangeEvent<HTMLInputElement>) => void;
|
21
|
+
handleCreateOrUpdateTextbook: () => Promise<void>;
|
22
|
+
handleChangeTextbookSubject: (val: any) => void;
|
23
|
+
handleGoToTextbookList: () => void;
|
24
|
+
handleCloseChapterNameDialog: () => void;
|
25
|
+
handleCreateChapter: (chapterName: string) => Promise<void>;
|
26
|
+
handleAddChapterToTextbook: () => void;
|
27
|
+
handleAddChapterToParentSubchapter: (chapter: ChapterOption) => void;
|
28
|
+
handleChangeChapterName: (name: string, chapterId: number, parentChapterId?: number | undefined, callback?: Function | undefined) => void;
|
29
|
+
handleUpdateChapter: (chapterId: number, chapter: ChapterResponse, callback?: Function | undefined) => Promise<void>;
|
30
|
+
handleChangeChapterPageFrom: (value: number, chapterId: number, parentChapterId?: number | undefined, callback?: Function | undefined) => void;
|
31
|
+
handleChangeChapterPageTo: (value: number, chapterId: number, parentChapterId?: number | undefined, callback?: Function | undefined) => void;
|
32
|
+
handleAddArticleToChapter: (article: ArticleCreateRequest) => Promise<void>;
|
33
|
+
handleUpdateArticleQuestionCountFromChapter: (articleNumber: number, questionCount: number, answerCount: number, articles: ArticleResponse[], chapterId: number, parentChapterId?: number | undefined) => void;
|
34
|
+
handleUpdateArticleCategory: (articleNumber: number, categoryId: number, articles: ArticleResponse[], chapterId: number, parentChapterId?: number | undefined) => void;
|
35
|
+
handleUpdateArticleAnswerCount: (articleNumber: number, newAnswerCount: number, answerCount: number, articles: ArticleResponse[], chapterId: number, parentChapterId?: number | undefined) => void;
|
36
|
+
handleUpdateArticleQuestion: (articleNumber: number, index: number, value: number | number[], key: string, articles: ArticleResponse[], chapterId: number, parentChapterId?: number | undefined) => void;
|
37
|
+
handleOpenAddArticleDialog: (chapter: ChapterResponse) => void;
|
38
|
+
handleCloseArticleDialog: () => void;
|
39
|
+
handleOpenRemoveArticleConfirmDialog: (articleNumber: number, chapterName: string, articles: ArticleResponse[], chapterId: number, parentChapterId?: number | undefined) => void;
|
40
|
+
handleCloseConfirmDeleteDialog: () => void;
|
41
|
+
handleRemoveSelectedItem: () => void;
|
42
|
+
handleOpenRemoveChapterConfirmDialog: (chapterName: string, chapterId: number, parentChapterId?: number | undefined) => void;
|
43
|
+
};
|
44
|
+
export default useTextbookDetail;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { TextbookResponse } from "../configs/types";
|
3
|
+
import { TextbookListProps } from "../views/TextbookList";
|
4
|
+
declare const useTextbookList: (props: TextbookListProps) => {
|
5
|
+
filter: import("../../../utils/types").SearchQuery;
|
6
|
+
textSearchRef: import("react").RefObject<HTMLInputElement>;
|
7
|
+
totalPages: number;
|
8
|
+
textbooks: TextbookResponse[];
|
9
|
+
selectedTextbook: TextbookResponse | undefined;
|
10
|
+
handleSort: (sortColumnName: string) => void;
|
11
|
+
handleChangeSearchText: (e: import("react").ChangeEvent<HTMLInputElement>) => void;
|
12
|
+
handleChangePage: (_: any, page: number) => void;
|
13
|
+
calcOrderNumber: (index: number) => number;
|
14
|
+
handleViewTextbook: (id: number) => void;
|
15
|
+
handleUpdateTextbook: (id: number) => void;
|
16
|
+
handleCreateTextbook: () => void;
|
17
|
+
toggleConfirmDialog: () => void;
|
18
|
+
handleDeleteTextbook: () => Promise<void>;
|
19
|
+
handleSelectDeleteTextbook: (textbook: TextbookResponse) => void[];
|
20
|
+
};
|
21
|
+
export default useTextbookList;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { FC } from "react";
|
2
|
+
import { Role } from "../../Login/configs/constants";
|
3
|
+
export interface TextbookDetailProps {
|
4
|
+
role: Role;
|
5
|
+
isReadonlyParam?: boolean;
|
6
|
+
navigate: any;
|
7
|
+
id: string;
|
8
|
+
}
|
9
|
+
declare const TextbookViewDetail: FC<TextbookDetailProps>;
|
10
|
+
export default TextbookViewDetail;
|