@mitodl/smoot-design 0.0.0-1967631
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/LICENSE +28 -0
- package/README.md +35 -0
- package/dist/bundles/remoteTutorDrawer.es.js +38609 -0
- package/dist/bundles/remoteTutorDrawer.es.js.map +1 -0
- package/dist/bundles/remoteTutorDrawer.umd.js +241 -0
- package/dist/bundles/remoteTutorDrawer.umd.js.map +1 -0
- package/dist/cjs/VERSION.d.ts +6 -0
- package/dist/cjs/VERSION.js +9 -0
- package/dist/cjs/ai.d.ts +3 -0
- package/dist/cjs/ai.js +9 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.d.ts +9 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/FlashcardsScreen.js +87 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +56 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +283 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +17 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +302 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
- package/dist/cjs/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +247 -0
- package/dist/cjs/bundles/remoteTutorDrawer.d.ts +7 -0
- package/dist/cjs/bundles/remoteTutorDrawer.js +43 -0
- package/dist/cjs/components/AiChat/AiChat.d.ts +5 -0
- package/dist/cjs/components/AiChat/AiChat.js +233 -0
- package/dist/cjs/components/AiChat/AiChat.stories.d.ts +21 -0
- package/dist/cjs/components/AiChat/AiChat.stories.js +257 -0
- package/dist/cjs/components/AiChat/AiChat.test.d.ts +1 -0
- package/dist/cjs/components/AiChat/AiChat.test.js +211 -0
- package/dist/cjs/components/AiChat/AiChatContext.d.ts +26 -0
- package/dist/cjs/components/AiChat/AiChatContext.js +105 -0
- package/dist/cjs/components/AiChat/AiChatContext.stories.d.ts +14 -0
- package/dist/cjs/components/AiChat/AiChatContext.stories.js +75 -0
- package/dist/cjs/components/AiChat/ChatTitle.d.ts +8 -0
- package/dist/cjs/components/AiChat/ChatTitle.js +43 -0
- package/dist/cjs/components/AiChat/EntryScreen.d.ts +11 -0
- package/dist/cjs/components/AiChat/EntryScreen.js +123 -0
- package/dist/cjs/components/AiChat/Markdown.d.ts +7 -0
- package/dist/cjs/components/AiChat/Markdown.js +14 -0
- package/dist/cjs/components/AiChat/TimLogo.d.ts +5 -0
- package/dist/cjs/components/AiChat/TimLogo.js +15 -0
- package/dist/cjs/components/AiChat/test-utils/api.d.ts +2 -0
- package/dist/cjs/components/AiChat/test-utils/api.js +164 -0
- package/dist/cjs/components/AiChat/types.d.ts +91 -0
- package/dist/cjs/components/AiChat/types.js +3 -0
- package/dist/cjs/components/AiChat/utils.d.ts +9 -0
- package/dist/cjs/components/AiChat/utils.js +41 -0
- package/dist/cjs/components/Alert/Alert.d.ts +15 -0
- package/dist/cjs/components/Alert/Alert.js +62 -0
- package/dist/cjs/components/Alert/Alert.stories.d.ts +8 -0
- package/dist/cjs/components/Alert/Alert.stories.js +53 -0
- package/dist/cjs/components/Button/ActionButton.d.ts +30 -0
- package/dist/cjs/components/Button/ActionButton.js +73 -0
- package/dist/cjs/components/Button/ActionButton.stories.d.ts +15 -0
- package/dist/cjs/components/Button/ActionButton.stories.js +113 -0
- package/dist/cjs/components/Button/Button.d.ts +54 -0
- package/dist/cjs/components/Button/Button.js +240 -0
- package/dist/cjs/components/Button/Button.stories.d.ts +17 -0
- package/dist/cjs/components/Button/Button.stories.js +135 -0
- package/dist/cjs/components/Button/Button.test.d.ts +1 -0
- package/dist/cjs/components/Button/Button.test.js +46 -0
- package/dist/cjs/components/ImageAdapter/ImageAdapter.d.ts +23 -0
- package/dist/cjs/components/ImageAdapter/ImageAdapter.js +30 -0
- package/dist/cjs/components/Input/Input.d.ts +116 -0
- package/dist/cjs/components/Input/Input.js +237 -0
- package/dist/cjs/components/Input/Input.stories.d.ts +19 -0
- package/dist/cjs/components/Input/Input.stories.js +135 -0
- package/dist/cjs/components/Input/Input.test.d.ts +1 -0
- package/dist/cjs/components/Input/Input.test.js +32 -0
- package/dist/cjs/components/LinkAdapter/LinkAdapter.d.ts +23 -0
- package/dist/cjs/components/LinkAdapter/LinkAdapter.js +34 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.d.ts +19 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.js +59 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.d.ts +6 -0
- package/dist/cjs/components/ScrollSnap/ScrollSnap.stories.js +43 -0
- package/dist/cjs/components/ScrollSnap/useScrollSnap.d.ts +6 -0
- package/dist/cjs/components/ScrollSnap/useScrollSnap.js +36 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.d.ts +25 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.js +43 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.stories.d.ts +6 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.stories.js +44 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.test.d.ts +1 -0
- package/dist/cjs/components/SrAnnouncer/SrAnnouncer.test.js +62 -0
- package/dist/cjs/components/TabButtons/TabButtonList.d.ts +25 -0
- package/dist/cjs/components/TabButtons/TabButtonList.js +97 -0
- package/dist/cjs/components/TabButtons/TabButtonList.stories.d.ts +24 -0
- package/dist/cjs/components/TabButtons/TabButtonList.stories.js +139 -0
- package/dist/cjs/components/TextField/TextField.d.ts +29 -0
- package/dist/cjs/components/TextField/TextField.js +33 -0
- package/dist/cjs/components/TextField/TextField.stories.d.ts +10 -0
- package/dist/cjs/components/TextField/TextField.stories.js +136 -0
- package/dist/cjs/components/TextField/TextField.test.d.ts +1 -0
- package/dist/cjs/components/TextField/TextField.test.js +77 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.d.ts +21 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.js +86 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.d.ts +63 -0
- package/dist/cjs/components/ThemeProvider/ThemeProvider.stories.js +102 -0
- package/dist/cjs/components/ThemeProvider/Typography.stories.d.ts +39 -0
- package/dist/cjs/components/ThemeProvider/Typography.stories.js +65 -0
- package/dist/cjs/components/ThemeProvider/breakpoints.d.ts +4 -0
- package/dist/cjs/components/ThemeProvider/breakpoints.js +19 -0
- package/dist/cjs/components/ThemeProvider/buttons.d.ts +7 -0
- package/dist/cjs/components/ThemeProvider/buttons.js +20 -0
- package/dist/cjs/components/ThemeProvider/chips.d.ts +3 -0
- package/dist/cjs/components/ThemeProvider/chips.js +154 -0
- package/dist/cjs/components/ThemeProvider/colors.d.ts +32 -0
- package/dist/cjs/components/ThemeProvider/colors.js +35 -0
- package/dist/cjs/components/ThemeProvider/typography.d.ts +18 -0
- package/dist/cjs/components/ThemeProvider/typography.js +173 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.js +33 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.stories.js +13 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.d.ts +39 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.js +78 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.test.d.ts +1 -0
- package/dist/cjs/components/internal/FormHelpers/FormHelpers.test.js +93 -0
- package/dist/cjs/index.d.ts +16 -0
- package/dist/cjs/index.js +30 -0
- package/dist/cjs/jest-setup.d.ts +1 -0
- package/dist/cjs/jest-setup.js +18 -0
- package/dist/cjs/jsdom-extended.d.ts +6 -0
- package/dist/cjs/jsdom-extended.js +14 -0
- package/dist/cjs/story-utils/index.d.ts +6 -0
- package/dist/cjs/story-utils/index.js +17 -0
- package/dist/cjs/utils/composeRefs.d.ts +7 -0
- package/dist/cjs/utils/composeRefs.js +20 -0
- package/dist/cjs/utils/composeRefs.test.d.ts +1 -0
- package/dist/cjs/utils/composeRefs.test.js +19 -0
- package/dist/cjs/utils/useDevCheckStable.d.ts +8 -0
- package/dist/cjs/utils/useDevCheckStable.js +29 -0
- package/dist/cjs/utils/useInterval.d.ts +7 -0
- package/dist/cjs/utils/useInterval.js +25 -0
- package/dist/esm/VERSION.d.ts +6 -0
- package/dist/esm/VERSION.js +6 -0
- package/dist/esm/ai.d.ts +3 -0
- package/dist/esm/ai.js +2 -0
- package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.d.ts +9 -0
- package/dist/esm/bundles/RemoteTutorDrawer/FlashcardsScreen.js +83 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.d.ts +56 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.js +280 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.d.ts +17 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.stories.js +299 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.d.ts +1 -0
- package/dist/esm/bundles/RemoteTutorDrawer/RemoteTutorDrawer.test.js +245 -0
- package/dist/esm/bundles/remoteTutorDrawer.d.ts +7 -0
- package/dist/esm/bundles/remoteTutorDrawer.js +40 -0
- package/dist/esm/components/AiChat/AiChat.d.ts +5 -0
- package/dist/esm/components/AiChat/AiChat.js +229 -0
- package/dist/esm/components/AiChat/AiChat.stories.d.ts +21 -0
- package/dist/esm/components/AiChat/AiChat.stories.js +254 -0
- package/dist/esm/components/AiChat/AiChat.test.d.ts +1 -0
- package/dist/esm/components/AiChat/AiChat.test.js +209 -0
- package/dist/esm/components/AiChat/AiChatContext.d.ts +26 -0
- package/dist/esm/components/AiChat/AiChatContext.js +101 -0
- package/dist/esm/components/AiChat/AiChatContext.stories.d.ts +14 -0
- package/dist/esm/components/AiChat/AiChatContext.stories.js +72 -0
- package/dist/esm/components/AiChat/ChatTitle.d.ts +8 -0
- package/dist/esm/components/AiChat/ChatTitle.js +40 -0
- package/dist/esm/components/AiChat/EntryScreen.d.ts +11 -0
- package/dist/esm/components/AiChat/EntryScreen.js +120 -0
- package/dist/esm/components/AiChat/Markdown.d.ts +7 -0
- package/dist/esm/components/AiChat/Markdown.js +12 -0
- package/dist/esm/components/AiChat/TimLogo.d.ts +5 -0
- package/dist/esm/components/AiChat/TimLogo.js +13 -0
- package/dist/esm/components/AiChat/test-utils/api.d.ts +2 -0
- package/dist/esm/components/AiChat/test-utils/api.js +161 -0
- package/dist/esm/components/AiChat/types.d.ts +91 -0
- package/dist/esm/components/AiChat/types.js +2 -0
- package/dist/esm/components/AiChat/utils.d.ts +9 -0
- package/dist/esm/components/AiChat/utils.js +38 -0
- package/dist/esm/components/Alert/Alert.d.ts +15 -0
- package/dist/esm/components/Alert/Alert.js +59 -0
- package/dist/esm/components/Alert/Alert.stories.d.ts +8 -0
- package/dist/esm/components/Alert/Alert.stories.js +50 -0
- package/dist/esm/components/Button/ActionButton.d.ts +30 -0
- package/dist/esm/components/Button/ActionButton.js +68 -0
- package/dist/esm/components/Button/ActionButton.stories.d.ts +15 -0
- package/dist/esm/components/Button/ActionButton.stories.js +110 -0
- package/dist/esm/components/Button/Button.d.ts +54 -0
- package/dist/esm/components/Button/Button.js +232 -0
- package/dist/esm/components/Button/Button.stories.d.ts +17 -0
- package/dist/esm/components/Button/Button.stories.js +132 -0
- package/dist/esm/components/Button/Button.test.d.ts +1 -0
- package/dist/esm/components/Button/Button.test.js +44 -0
- package/dist/esm/components/ImageAdapter/ImageAdapter.d.ts +23 -0
- package/dist/esm/components/ImageAdapter/ImageAdapter.js +27 -0
- package/dist/esm/components/Input/Input.d.ts +116 -0
- package/dist/esm/components/Input/Input.js +232 -0
- package/dist/esm/components/Input/Input.stories.d.ts +19 -0
- package/dist/esm/components/Input/Input.stories.js +132 -0
- package/dist/esm/components/Input/Input.test.d.ts +1 -0
- package/dist/esm/components/Input/Input.test.js +30 -0
- package/dist/esm/components/LinkAdapter/LinkAdapter.d.ts +23 -0
- package/dist/esm/components/LinkAdapter/LinkAdapter.js +31 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.d.ts +19 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.js +56 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.stories.d.ts +6 -0
- package/dist/esm/components/ScrollSnap/ScrollSnap.stories.js +40 -0
- package/dist/esm/components/ScrollSnap/useScrollSnap.d.ts +6 -0
- package/dist/esm/components/ScrollSnap/useScrollSnap.js +33 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.d.ts +25 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.js +40 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.stories.d.ts +6 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.stories.js +41 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.test.d.ts +1 -0
- package/dist/esm/components/SrAnnouncer/SrAnnouncer.test.js +60 -0
- package/dist/esm/components/TabButtons/TabButtonList.d.ts +25 -0
- package/dist/esm/components/TabButtons/TabButtonList.js +92 -0
- package/dist/esm/components/TabButtons/TabButtonList.stories.d.ts +24 -0
- package/dist/esm/components/TabButtons/TabButtonList.stories.js +136 -0
- package/dist/esm/components/TextField/TextField.d.ts +29 -0
- package/dist/esm/components/TextField/TextField.js +30 -0
- package/dist/esm/components/TextField/TextField.stories.d.ts +10 -0
- package/dist/esm/components/TextField/TextField.stories.js +133 -0
- package/dist/esm/components/TextField/TextField.test.d.ts +1 -0
- package/dist/esm/components/TextField/TextField.test.js +75 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.d.ts +21 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.js +82 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.stories.d.ts +63 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.stories.js +99 -0
- package/dist/esm/components/ThemeProvider/Typography.stories.d.ts +39 -0
- package/dist/esm/components/ThemeProvider/Typography.stories.js +62 -0
- package/dist/esm/components/ThemeProvider/breakpoints.d.ts +4 -0
- package/dist/esm/components/ThemeProvider/breakpoints.js +15 -0
- package/dist/esm/components/ThemeProvider/buttons.d.ts +7 -0
- package/dist/esm/components/ThemeProvider/buttons.js +17 -0
- package/dist/esm/components/ThemeProvider/chips.d.ts +3 -0
- package/dist/esm/components/ThemeProvider/chips.js +151 -0
- package/dist/esm/components/ThemeProvider/colors.d.ts +32 -0
- package/dist/esm/components/ThemeProvider/colors.js +32 -0
- package/dist/esm/components/ThemeProvider/typography.d.ts +18 -0
- package/dist/esm/components/ThemeProvider/typography.js +167 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +30 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.stories.js +10 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.d.ts +39 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.js +73 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.test.d.ts +1 -0
- package/dist/esm/components/internal/FormHelpers/FormHelpers.test.js +91 -0
- package/dist/esm/index.d.ts +16 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/jest-setup.d.ts +1 -0
- package/dist/esm/jest-setup.js +16 -0
- package/dist/esm/jsdom-extended.d.ts +6 -0
- package/dist/esm/jsdom-extended.js +12 -0
- package/dist/esm/story-utils/index.d.ts +6 -0
- package/dist/esm/story-utils/index.js +13 -0
- package/dist/esm/utils/composeRefs.d.ts +7 -0
- package/dist/esm/utils/composeRefs.js +17 -0
- package/dist/esm/utils/composeRefs.test.d.ts +1 -0
- package/dist/esm/utils/composeRefs.test.js +17 -0
- package/dist/esm/utils/useDevCheckStable.d.ts +8 -0
- package/dist/esm/utils/useDevCheckStable.js +26 -0
- package/dist/esm/utils/useInterval.d.ts +7 -0
- package/dist/esm/utils/useInterval.js +22 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/type-augmentation/TypescriptDocs.mdx +17 -0
- package/dist/type-augmentation/imports.d.ts +3 -0
- package/dist/type-augmentation/index.d.ts +3 -0
- package/dist/type-augmentation/theme.d.ts +105 -0
- package/dist/type-augmentation/typography.d.ts +54 -0
- package/package.json +158 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VERSION = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This file is auto-generated at build time.
|
|
6
|
+
* Run node ./scripts/set_version.js to update the version.
|
|
7
|
+
* Do not update this file manually.
|
|
8
|
+
*/
|
|
9
|
+
exports.VERSION = "0.0.0-1967631";
|
package/dist/cjs/ai.d.ts
ADDED
package/dist/cjs/ai.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAiChat = exports.AiChatProvider = exports.AiChatDisplay = exports.AiChat = void 0;
|
|
4
|
+
var AiChat_1 = require("./components/AiChat/AiChat");
|
|
5
|
+
Object.defineProperty(exports, "AiChat", { enumerable: true, get: function () { return AiChat_1.AiChat; } });
|
|
6
|
+
Object.defineProperty(exports, "AiChatDisplay", { enumerable: true, get: function () { return AiChat_1.AiChatDisplay; } });
|
|
7
|
+
var AiChatContext_1 = require("./components/AiChat/AiChatContext");
|
|
8
|
+
Object.defineProperty(exports, "AiChatProvider", { enumerable: true, get: function () { return AiChatContext_1.AiChatProvider; } });
|
|
9
|
+
Object.defineProperty(exports, "useAiChat", { enumerable: true, get: function () { return AiChatContext_1.useAiChat; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type Flashcard = {
|
|
3
|
+
question: string;
|
|
4
|
+
answer: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const FlashcardsScreen: ({ flashcards, wasKeyboardFocus, }: {
|
|
7
|
+
flashcards?: Flashcard[];
|
|
8
|
+
wasKeyboardFocus: boolean;
|
|
9
|
+
}) => React.JSX.Element | null;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlashcardsScreen = void 0;
|
|
4
|
+
const ActionButton_1 = require("../../components/Button/ActionButton");
|
|
5
|
+
const Typography_1 = require("@mui/material/Typography");
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const styled_1 = require("@emotion/styled");
|
|
9
|
+
const react_2 = require("@remixicon/react");
|
|
10
|
+
const Container = styled_1.default.div ``;
|
|
11
|
+
const FlashcardContainer = styled_1.default.div(({ theme }) => ({
|
|
12
|
+
display: "flex",
|
|
13
|
+
height: 300,
|
|
14
|
+
padding: 40,
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
alignSelf: "stretch",
|
|
19
|
+
borderRadius: 8,
|
|
20
|
+
border: `1px solid ${theme.custom.colors.lightGray2}`,
|
|
21
|
+
marginTop: "8px",
|
|
22
|
+
cursor: "pointer",
|
|
23
|
+
textAlign: "center",
|
|
24
|
+
}));
|
|
25
|
+
const Navigation = styled_1.default.div({
|
|
26
|
+
display: "flex",
|
|
27
|
+
justifyContent: "space-between",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
width: "100%",
|
|
30
|
+
marginTop: "24px",
|
|
31
|
+
});
|
|
32
|
+
const Page = styled_1.default.div(({ theme }) => (Object.assign({ color: theme.custom.colors.silverGrayDark }, theme.typography.body2)));
|
|
33
|
+
const Flashcard = React.forwardRef(({ content, "aria-label": ariaLabel }, ref) => {
|
|
34
|
+
const [screen, setScreen] = (0, react_1.useState)(0);
|
|
35
|
+
(0, react_1.useEffect)(() => setScreen(0), [content]);
|
|
36
|
+
const handleKeyDown = (e) => {
|
|
37
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
38
|
+
setScreen(screen === 0 ? 1 : 0);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return (React.createElement(FlashcardContainer, { ref: ref, onClick: () => setScreen(screen === 0 ? 1 : 0), onKeyDown: handleKeyDown, tabIndex: 0, "aria-label": ariaLabel, role: "button" },
|
|
42
|
+
React.createElement(Typography_1.default, { variant: "h5" }, screen === 0 ? `Q: ${content.question}` : `Answer: ${content.answer}`)));
|
|
43
|
+
});
|
|
44
|
+
Flashcard.displayName = "Flashcard";
|
|
45
|
+
const FlashcardsScreen = ({ flashcards, wasKeyboardFocus, }) => {
|
|
46
|
+
const [cardIndex, setCardIndex] = (0, react_1.useState)(0);
|
|
47
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
48
|
+
const flashcardRef = (0, react_1.useRef)(null);
|
|
49
|
+
const handleKeyDown = (0, react_1.useCallback)((e) => {
|
|
50
|
+
var _a;
|
|
51
|
+
if (!flashcards)
|
|
52
|
+
return;
|
|
53
|
+
if (!((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement)) &&
|
|
54
|
+
wasKeyboardFocus) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (e.key === "ArrowRight") {
|
|
58
|
+
setCardIndex((prevIndex) => (prevIndex + 1) % flashcards.length);
|
|
59
|
+
}
|
|
60
|
+
else if (e.key === "ArrowLeft") {
|
|
61
|
+
setCardIndex((prevIndex) => (prevIndex - 1 + flashcards.length) % flashcards.length);
|
|
62
|
+
}
|
|
63
|
+
}, [flashcards, wasKeyboardFocus]);
|
|
64
|
+
(0, react_1.useEffect)(() => {
|
|
65
|
+
var _a;
|
|
66
|
+
(_a = flashcardRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
67
|
+
}, [cardIndex]);
|
|
68
|
+
(0, react_1.useEffect)(() => {
|
|
69
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
70
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
71
|
+
}, [handleKeyDown]);
|
|
72
|
+
if (!(flashcards === null || flashcards === void 0 ? void 0 : flashcards.length)) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return (React.createElement(Container, { ref: containerRef },
|
|
76
|
+
React.createElement(Flashcard, { ref: flashcardRef, content: flashcards[cardIndex], "aria-label": `Flashcard ${cardIndex + 1} of ${flashcards.length}` }),
|
|
77
|
+
React.createElement(Navigation, null,
|
|
78
|
+
React.createElement(ActionButton_1.ActionButton, { onClick: () => setCardIndex(cardIndex - 1), disabled: cardIndex === 0, variant: "secondary", color: "secondary", size: "small", "aria-label": "Previous card" },
|
|
79
|
+
React.createElement(react_2.RiArrowLeftLine, { "aria-hidden": true })),
|
|
80
|
+
React.createElement(Page, null,
|
|
81
|
+
cardIndex + 1,
|
|
82
|
+
" / ",
|
|
83
|
+
flashcards.length),
|
|
84
|
+
React.createElement(ActionButton_1.ActionButton, { onClick: () => setCardIndex(cardIndex + 1), disabled: cardIndex === flashcards.length - 1, variant: "secondary", color: "secondary", size: "small", "aria-label": "Next card" },
|
|
85
|
+
React.createElement(react_2.RiArrowRightLine, { "aria-hidden": true })))));
|
|
86
|
+
};
|
|
87
|
+
exports.FlashcardsScreen = FlashcardsScreen;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import type { AiChatProps, AiChatMessage } from "../../components/AiChat/types";
|
|
3
|
+
type RemoteTutorDrawerInitMessage = {
|
|
4
|
+
type: "smoot-design::tutor-drawer-open";
|
|
5
|
+
payload: {
|
|
6
|
+
blockType?: "problem" | "video";
|
|
7
|
+
target?: string;
|
|
8
|
+
/**
|
|
9
|
+
* If the title begins "AskTIM", it is styled as the AskTIM logo.
|
|
10
|
+
*/
|
|
11
|
+
title?: string;
|
|
12
|
+
chat: {
|
|
13
|
+
chatId?: AiChatProps["chatId"];
|
|
14
|
+
conversationStarters?: AiChatProps["conversationStarters"];
|
|
15
|
+
initialMessages?: AiChatProps["initialMessages"];
|
|
16
|
+
apiUrl: AiChatProps["requestOpts"]["apiUrl"];
|
|
17
|
+
requestBody?: Record<string, unknown>;
|
|
18
|
+
entryScreenEnabled?: AiChatProps["entryScreenEnabled"];
|
|
19
|
+
entryScreenTitle?: AiChatProps["entryScreenTitle"];
|
|
20
|
+
};
|
|
21
|
+
summary?: {
|
|
22
|
+
apiUrl: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type RemoteTutorDrawerProps = {
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The origin of the messages that will be received to open the chat.
|
|
30
|
+
* The drawer will ignore all message events not from this origin.
|
|
31
|
+
*/
|
|
32
|
+
messageOrigin: string;
|
|
33
|
+
/**
|
|
34
|
+
* Transform the body of the request before sending it to the server.
|
|
35
|
+
* Its result will be merged with the per-message requestBody opt, with
|
|
36
|
+
* transformBody taking precedence.
|
|
37
|
+
*
|
|
38
|
+
* *This cannot be supplied via message events since the function is not serializable.*
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
transformBody?: (messages: AiChatMessage[]) => Iterable<unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* Fetch options to be passed to the fetch call.
|
|
44
|
+
*
|
|
45
|
+
* NOTE: By default, the credentials are set to "include" to enable thread-
|
|
46
|
+
* identifying cookies.
|
|
47
|
+
*/
|
|
48
|
+
fetchOpts?: AiChatProps["requestOpts"]["fetchOpts"];
|
|
49
|
+
/**
|
|
50
|
+
* Pass to target a specific drawer instance where multiple are on the page.
|
|
51
|
+
*/
|
|
52
|
+
target?: string;
|
|
53
|
+
};
|
|
54
|
+
declare const RemoteTutorDrawer: FC<RemoteTutorDrawerProps>;
|
|
55
|
+
export { RemoteTutorDrawer };
|
|
56
|
+
export type { RemoteTutorDrawerProps, RemoteTutorDrawerInitMessage };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RemoteTutorDrawer = void 0;
|
|
13
|
+
// @format
|
|
14
|
+
const React = require("react");
|
|
15
|
+
const react_1 = require("react");
|
|
16
|
+
const styled_1 = require("@emotion/styled");
|
|
17
|
+
const react_markdown_1 = require("react-markdown");
|
|
18
|
+
const rehype_raw_1 = require("rehype-raw");
|
|
19
|
+
const react_2 = require("@remixicon/react");
|
|
20
|
+
const Drawer_1 = require("@mui/material/Drawer");
|
|
21
|
+
const TabButtonList_1 = require("../../components/TabButtons/TabButtonList");
|
|
22
|
+
const Typography_1 = require("@mui/material/Typography");
|
|
23
|
+
const TabContext_1 = require("@mui/lab/TabContext");
|
|
24
|
+
const TabPanel_1 = require("@mui/lab/TabPanel");
|
|
25
|
+
const AiChat_1 = require("../../components/AiChat/AiChat");
|
|
26
|
+
const ActionButton_1 = require("../../components/Button/ActionButton");
|
|
27
|
+
const FlashcardsScreen_1 = require("./FlashcardsScreen");
|
|
28
|
+
const VERSION_1 = require("../../VERSION");
|
|
29
|
+
const Header = styled_1.default.div(({ theme }) => ({
|
|
30
|
+
display: "flex",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
justifyContent: "space-between",
|
|
33
|
+
gap: "4px",
|
|
34
|
+
color: theme.custom.colors.white,
|
|
35
|
+
position: "sticky",
|
|
36
|
+
top: 0,
|
|
37
|
+
padding: "32px 0 16px 0",
|
|
38
|
+
zIndex: 2,
|
|
39
|
+
backgroundColor: theme.custom.colors.white,
|
|
40
|
+
borderRadius: 0,
|
|
41
|
+
}));
|
|
42
|
+
const Title = styled_1.default.div(({ theme }) => ({
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
gap: "8px",
|
|
46
|
+
color: theme.custom.colors.darkGray2,
|
|
47
|
+
img: {
|
|
48
|
+
width: "24px",
|
|
49
|
+
height: "24px",
|
|
50
|
+
},
|
|
51
|
+
svg: {
|
|
52
|
+
fill: theme.custom.colors.red,
|
|
53
|
+
width: "24px",
|
|
54
|
+
height: "24px",
|
|
55
|
+
flexShrink: 0,
|
|
56
|
+
},
|
|
57
|
+
overflow: "hidden",
|
|
58
|
+
p: {
|
|
59
|
+
textOverflow: "ellipsis",
|
|
60
|
+
overflow: "hidden",
|
|
61
|
+
whiteSpace: "nowrap",
|
|
62
|
+
},
|
|
63
|
+
}));
|
|
64
|
+
const CloseButton = (0, styled_1.default)(ActionButton_1.ActionButton)(({ theme }) => ({
|
|
65
|
+
backgroundColor: theme.custom.colors.lightGray2,
|
|
66
|
+
"&&:hover": {
|
|
67
|
+
backgroundColor: theme.custom.colors.red,
|
|
68
|
+
color: theme.custom.colors.white,
|
|
69
|
+
},
|
|
70
|
+
zIndex: 3,
|
|
71
|
+
flexShrink: 0,
|
|
72
|
+
}));
|
|
73
|
+
const StyledTabButtonList = (0, styled_1.default)(TabButtonList_1.TabButtonList)(({ theme }) => ({
|
|
74
|
+
padding: "0 0 16px",
|
|
75
|
+
backgroundColor: theme.custom.colors.white,
|
|
76
|
+
position: "sticky",
|
|
77
|
+
top: "88px",
|
|
78
|
+
zIndex: 2,
|
|
79
|
+
overflow: "visible",
|
|
80
|
+
}));
|
|
81
|
+
const StyledTabPanel = (0, styled_1.default)(TabPanel_1.default)({
|
|
82
|
+
padding: "0",
|
|
83
|
+
height: "calc(100% - 138px)",
|
|
84
|
+
position: "relative",
|
|
85
|
+
});
|
|
86
|
+
const StyledAiChat = (0, styled_1.default)(AiChat_1.AiChat)(({ hasTabs, theme }) => ({
|
|
87
|
+
".MitAiChat--entryScreenContainer": {
|
|
88
|
+
padding: hasTabs ? "114px 0 24px" : "168px 32px 24px",
|
|
89
|
+
[theme.breakpoints.down("md")]: {
|
|
90
|
+
padding: hasTabs ? "114px 0 24px" : "168px 16px 24px",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
".MitAiChat--chatScreenContainer": {
|
|
94
|
+
padding: hasTabs ? 0 : "0 32px",
|
|
95
|
+
[theme.breakpoints.down("md")]: {
|
|
96
|
+
padding: hasTabs ? 0 : "0 16px",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
".MitAiChat--messagesContainer": {
|
|
100
|
+
paddingTop: hasTabs ? "8px" : "88px",
|
|
101
|
+
},
|
|
102
|
+
}));
|
|
103
|
+
const StyledHTML = styled_1.default.div(({ theme }) => (Object.assign(Object.assign({ color: theme.custom.colors.darkGray2, backgroundColor: theme.custom.colors.white, padding: "12px 0 100px" }, theme.typography.body2), { "p:first-of-type": {
|
|
104
|
+
marginTop: 0,
|
|
105
|
+
}, "p:last-of-type": {
|
|
106
|
+
marginBottom: 0,
|
|
107
|
+
}, "ol, ul": {
|
|
108
|
+
paddingInlineStart: "32px",
|
|
109
|
+
li: {
|
|
110
|
+
margin: "16px 0",
|
|
111
|
+
},
|
|
112
|
+
}, ul: {
|
|
113
|
+
marginInlineStart: "-16px",
|
|
114
|
+
}, a: {
|
|
115
|
+
color: theme.custom.colors.red,
|
|
116
|
+
fontWeight: "normal",
|
|
117
|
+
} })));
|
|
118
|
+
const identity = (x) => x;
|
|
119
|
+
const DEFAULT_FETCH_OPTS = {
|
|
120
|
+
credentials: "include",
|
|
121
|
+
};
|
|
122
|
+
const useContentFetch = (contentUrl) => {
|
|
123
|
+
const [response, setResponse] = (0, react_1.useState)(null);
|
|
124
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
125
|
+
(0, react_1.useEffect)(() => {
|
|
126
|
+
if (!contentUrl)
|
|
127
|
+
return;
|
|
128
|
+
const fetchData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
setLoading(true);
|
|
130
|
+
try {
|
|
131
|
+
const response = yield fetch(contentUrl);
|
|
132
|
+
const result = yield response.json();
|
|
133
|
+
if (!result.results) {
|
|
134
|
+
throw new Error("Unexpected response");
|
|
135
|
+
}
|
|
136
|
+
const [contentFile] = result.results;
|
|
137
|
+
if (!contentFile) {
|
|
138
|
+
throw new Error("No result found");
|
|
139
|
+
}
|
|
140
|
+
setResponse({
|
|
141
|
+
summary: contentFile.summary,
|
|
142
|
+
flashcards: contentFile.flashcards,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
console.error("Error fetching content", error);
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
setLoading(false);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
fetchData();
|
|
153
|
+
}, [contentUrl]);
|
|
154
|
+
return { response, loading };
|
|
155
|
+
};
|
|
156
|
+
const DEFAULT_PROBLEM_INITIAL_MESSAGES = [
|
|
157
|
+
{
|
|
158
|
+
role: "assistant",
|
|
159
|
+
content: "Let's try to work on this problem together. It would be great to hear how you're thinking about solving it. Can you walk me through the approach you're considering?",
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
const DEFAULT_VIDEO_ENTRY_SCREEN_TITLE = "What do you want to know about this video?";
|
|
163
|
+
const DEFAULT_VIDEO_STARTERS = [
|
|
164
|
+
{ content: "What are the most important concepts introduced in the video?" },
|
|
165
|
+
{
|
|
166
|
+
content: "What examples are used to illustrate concepts covered in the video?",
|
|
167
|
+
},
|
|
168
|
+
{ content: "What are the key terms introduced in this video?" },
|
|
169
|
+
];
|
|
170
|
+
const ChatComponent = ({ payload, transformBody, fetchOpts, scrollElement, entryScreenEnabled, entryScreenTitle, conversationStarters, initialMessages, hasTabs, needsMathJax, }) => {
|
|
171
|
+
if (!payload)
|
|
172
|
+
return null;
|
|
173
|
+
return (React.createElement(StyledAiChat, { chatId: payload.chatId, conversationStarters: conversationStarters, initialMessages: initialMessages, scrollElement: scrollElement, entryScreenEnabled: entryScreenEnabled, entryScreenTitle: entryScreenTitle, requestOpts: {
|
|
174
|
+
transformBody: (messages) => (Object.assign(Object.assign({}, payload.requestBody), transformBody === null || transformBody === void 0 ? void 0 : transformBody(messages))),
|
|
175
|
+
apiUrl: payload.apiUrl,
|
|
176
|
+
fetchOpts: Object.assign(Object.assign({}, DEFAULT_FETCH_OPTS), fetchOpts),
|
|
177
|
+
}, hasTabs: hasTabs, useMathJax: needsMathJax }));
|
|
178
|
+
};
|
|
179
|
+
const randomItems = (array, count) => {
|
|
180
|
+
const shuffled = [...array].sort(() => 0.5 - Math.random());
|
|
181
|
+
return shuffled.slice(0, count);
|
|
182
|
+
};
|
|
183
|
+
const RemoteTutorDrawer = ({ messageOrigin, transformBody = identity, className, fetchOpts, target, }) => {
|
|
184
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
185
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
186
|
+
const [payload, setPayload] = (0, react_1.useState)(null);
|
|
187
|
+
const [tab, setTab] = (0, react_1.useState)("chat");
|
|
188
|
+
const { response } = useContentFetch((_a = payload === null || payload === void 0 ? void 0 : payload.summary) === null || _a === void 0 ? void 0 : _a.apiUrl);
|
|
189
|
+
const [_wasKeyboardFocus, setWasKeyboardFocus] = (0, react_1.useState)(false);
|
|
190
|
+
const mouseInteracted = (0, react_1.useRef)(false);
|
|
191
|
+
const handleMouseDown = () => {
|
|
192
|
+
mouseInteracted.current = true;
|
|
193
|
+
};
|
|
194
|
+
const handleFocus = () => {
|
|
195
|
+
if (!mouseInteracted.current) {
|
|
196
|
+
setWasKeyboardFocus(true);
|
|
197
|
+
}
|
|
198
|
+
mouseInteracted.current = false;
|
|
199
|
+
};
|
|
200
|
+
const [scrollElement, setScrollElement] = (0, react_1.useState)(null);
|
|
201
|
+
const paperRefCallback = (node) => {
|
|
202
|
+
if (node) {
|
|
203
|
+
setScrollElement(node);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
(0, react_1.useEffect)(() => {
|
|
207
|
+
const cb = (event) => {
|
|
208
|
+
if (event.origin !== messageOrigin) {
|
|
209
|
+
if (process.env.NODE_ENV === "development") {
|
|
210
|
+
console.warn(`RemoteTutorDrawer: received message from unexpected origin: ${event.origin}`);
|
|
211
|
+
}
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (event.data.type === "smoot-design::tutor-drawer-open" &&
|
|
215
|
+
event.data.payload.target === target) {
|
|
216
|
+
setOpen(true);
|
|
217
|
+
setPayload(event.data.payload);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
window.addEventListener("message", cb);
|
|
221
|
+
return () => {
|
|
222
|
+
window.removeEventListener("message", cb);
|
|
223
|
+
};
|
|
224
|
+
}, [messageOrigin, target]);
|
|
225
|
+
(0, react_1.useEffect)(() => {
|
|
226
|
+
var _a;
|
|
227
|
+
(_a = scrollElement === null || scrollElement === void 0 ? void 0 : scrollElement.scrollTo) === null || _a === void 0 ? void 0 : _a.call(scrollElement, {
|
|
228
|
+
top: tab === "chat" ? scrollElement.scrollHeight : 0,
|
|
229
|
+
});
|
|
230
|
+
}, [tab, scrollElement]);
|
|
231
|
+
const conversationStarters = (0, react_1.useMemo)(() => {
|
|
232
|
+
var _a;
|
|
233
|
+
if (!payload)
|
|
234
|
+
return [];
|
|
235
|
+
return (payload.chat.conversationStarters ||
|
|
236
|
+
(((_a = response === null || response === void 0 ? void 0 : response.flashcards) === null || _a === void 0 ? void 0 : _a.length) && response.flashcards.length >= 3
|
|
237
|
+
? randomItems(response.flashcards, 3).map((flashcard) => ({
|
|
238
|
+
content: flashcard.question,
|
|
239
|
+
}))
|
|
240
|
+
: DEFAULT_VIDEO_STARTERS));
|
|
241
|
+
}, [payload, response]);
|
|
242
|
+
if (!payload) {
|
|
243
|
+
return React.createElement("div", { "data-testid": "remote-tutor-drawer-waiting" });
|
|
244
|
+
}
|
|
245
|
+
const { blockType, chat } = payload;
|
|
246
|
+
const hasTabs = blockType === "video";
|
|
247
|
+
return (React.createElement(Drawer_1.default, { "data-testid": "remote-tutor-drawer", "data-smoot-version": VERSION_1.VERSION, className: className, PaperProps: {
|
|
248
|
+
ref: paperRefCallback,
|
|
249
|
+
sx: {
|
|
250
|
+
width: "900px",
|
|
251
|
+
maxWidth: "100%",
|
|
252
|
+
boxSizing: "border-box",
|
|
253
|
+
padding: {
|
|
254
|
+
xs: "0 16px",
|
|
255
|
+
md: "0 32px",
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
}, anchor: "right", open: open, onClose: () => setOpen(false), role: "dialog", "aria-modal": "true" },
|
|
259
|
+
React.createElement(Header, null,
|
|
260
|
+
React.createElement(Title, null,
|
|
261
|
+
payload.title ? React.createElement(react_2.RiSparkling2Line, null) : null,
|
|
262
|
+
React.createElement(Typography_1.default, { variant: "body1", component: "h1" }, ((_b = payload.title) === null || _b === void 0 ? void 0 : _b.includes("AskTIM")) ? (React.createElement(React.Fragment, null,
|
|
263
|
+
"Ask",
|
|
264
|
+
React.createElement("strong", null, "TIM"),
|
|
265
|
+
payload.title.replace("AskTIM", ""))) : (payload.title))),
|
|
266
|
+
React.createElement(CloseButton, { variant: "text", size: "medium", onClick: () => setOpen(false), "aria-label": "Close" },
|
|
267
|
+
React.createElement(react_2.RiCloseLine, null))),
|
|
268
|
+
blockType === "problem" ? (React.createElement(ChatComponent, { payload: chat, transformBody: transformBody, fetchOpts: fetchOpts, scrollElement: scrollElement, entryScreenEnabled: (_d = (_c = payload.chat) === null || _c === void 0 ? void 0 : _c.entryScreenEnabled) !== null && _d !== void 0 ? _d : false, entryScreenTitle: payload.chat.entryScreenTitle, initialMessages: payload.chat.initialMessages || DEFAULT_PROBLEM_INITIAL_MESSAGES, hasTabs: hasTabs, needsMathJax: true })) : null,
|
|
269
|
+
blockType === "video" ? (React.createElement(TabContext_1.default, { value: tab },
|
|
270
|
+
React.createElement(StyledTabButtonList, { styleVariant: "chat", onChange: (e, tab) => setTab(tab) },
|
|
271
|
+
React.createElement(TabButtonList_1.TabButton, { value: "chat", label: "Chat" }),
|
|
272
|
+
((_e = response === null || response === void 0 ? void 0 : response.flashcards) === null || _e === void 0 ? void 0 : _e.length) ? (React.createElement(TabButtonList_1.TabButton, { value: "flashcards", label: "Flashcards", onMouseDown: handleMouseDown, onFocus: handleFocus })) : null,
|
|
273
|
+
React.createElement(TabButtonList_1.TabButton, { value: "summary", label: "Summary" })),
|
|
274
|
+
React.createElement(StyledTabPanel, { value: "chat", keepMounted: true },
|
|
275
|
+
React.createElement(ChatComponent, { payload: Object.assign({}, chat), transformBody: transformBody, fetchOpts: fetchOpts, scrollElement: scrollElement, entryScreenEnabled: (_g = (_f = payload.chat) === null || _f === void 0 ? void 0 : _f.entryScreenEnabled) !== null && _g !== void 0 ? _g : true, entryScreenTitle: (_h = payload.chat.entryScreenTitle) !== null && _h !== void 0 ? _h : DEFAULT_VIDEO_ENTRY_SCREEN_TITLE, conversationStarters: conversationStarters, initialMessages: payload.chat.initialMessages, hasTabs: hasTabs, needsMathJax: false })),
|
|
276
|
+
((_j = response === null || response === void 0 ? void 0 : response.flashcards) === null || _j === void 0 ? void 0 : _j.length) ? (React.createElement(StyledTabPanel, { value: "flashcards" },
|
|
277
|
+
React.createElement(FlashcardsScreen_1.FlashcardsScreen, { flashcards: response === null || response === void 0 ? void 0 : response.flashcards, wasKeyboardFocus: _wasKeyboardFocus }))) : null,
|
|
278
|
+
React.createElement(StyledTabPanel, { value: "summary" },
|
|
279
|
+
React.createElement(Typography_1.default, { variant: "h4", component: "h4" }),
|
|
280
|
+
React.createElement(StyledHTML, null,
|
|
281
|
+
React.createElement(react_markdown_1.default, { rehypePlugins: [rehype_raw_1.default] }, (_k = response === null || response === void 0 ? void 0 : response.summary) !== null && _k !== void 0 ? _k : ""))))) : null));
|
|
282
|
+
};
|
|
283
|
+
exports.RemoteTutorDrawer = RemoteTutorDrawer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { RemoteTutorDrawer } from "./RemoteTutorDrawer";
|
|
3
|
+
declare const meta: Meta<typeof RemoteTutorDrawer>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof RemoteTutorDrawer>;
|
|
6
|
+
export declare const ProblemStory: Story;
|
|
7
|
+
export declare const ProblemDefaultInitialMessagesStory: Story;
|
|
8
|
+
export declare const EntryScreenStory: Story;
|
|
9
|
+
/**
|
|
10
|
+
* The chat entry screen is shown by default for the video blocks Tutor drawer.
|
|
11
|
+
*/
|
|
12
|
+
export declare const VideoStory: Story;
|
|
13
|
+
/**
|
|
14
|
+
* Where conversation starters are not provided, they will be selected at random from the returned flashcard questions
|
|
15
|
+
* or from `DEFAULT_VIDEO_STARTERS` provided.
|
|
16
|
+
*/
|
|
17
|
+
export declare const FlashcardConversationStartersStory: Story;
|