@learnpack/learnpack 5.0.154 → 5.0.158
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/README.md +13 -13
- package/lib/commands/serve.js +38 -1
- package/lib/creatorDist/assets/{index-BjNDUX4o.js → index-BG3HTk_l.js} +34465 -41991
- package/lib/creatorDist/assets/{index-CztA582_.css → index-C_YTggyk.css} +12 -3
- package/lib/creatorDist/index.html +2 -2
- package/lib/utils/misc.d.ts +1 -0
- package/lib/utils/misc.js +7 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/serve.ts +46 -2
- package/src/creator/src/App.tsx +76 -67
- package/src/creator/src/assets/svgs.tsx +46 -0
- package/src/creator/src/components/FileUploader.tsx +53 -31
- package/src/creator/src/components/Login.tsx +11 -0
- package/src/creator/src/components/PreviewGenerator.tsx +4 -4
- package/src/creator/src/components/Source.tsx +8 -10
- package/src/creator/src/components/StepWizard.tsx +10 -7
- package/src/creator/src/components/Uploader.tsx +7 -10
- package/src/creator/src/components/syllabus/ContentIndex.tsx +37 -1
- package/src/creator/src/components/syllabus/Sidebar.tsx +1 -8
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +3 -2
- package/src/creator/src/main.tsx +0 -2
- package/src/creator/src/utils/store.ts +7 -6
- package/src/creatorDist/assets/{index-BjNDUX4o.js → index-BG3HTk_l.js} +34465 -41991
- package/src/creatorDist/assets/{index-CztA582_.css → index-C_YTggyk.css} +12 -3
- package/src/creatorDist/index.html +2 -2
- package/src/utils/misc.ts +6 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react"
|
2
2
|
import { ParsedLink } from "./LinkUploader"
|
3
|
-
import useStore from "../utils/store"
|
3
|
+
// import useStore from "../utils/store"
|
4
4
|
import { SVGS } from "../assets/svgs"
|
5
5
|
|
6
6
|
interface SourceProps {
|
@@ -14,8 +14,8 @@ interface SourceProps {
|
|
14
14
|
// }
|
15
15
|
|
16
16
|
const Source: React.FC<SourceProps> = ({ source }) => {
|
17
|
-
const setFormState = useStore((state) => state.setFormState)
|
18
|
-
const formState = useStore((state) => state.formState)
|
17
|
+
// const setFormState = useStore((state) => state.setFormState)
|
18
|
+
// const formState = useStore((state) => state.formState)
|
19
19
|
|
20
20
|
const {
|
21
21
|
url,
|
@@ -28,18 +28,16 @@ const Source: React.FC<SourceProps> = ({ source }) => {
|
|
28
28
|
// text,
|
29
29
|
} = source
|
30
30
|
|
31
|
-
|
32
|
-
|
33
31
|
return (
|
34
32
|
<div className="relative max-w-xs bg-white rounded-xl shadow-md overflow-hidden hover:shadow-lg transition-shadow">
|
35
33
|
<div className="p-4 flex flex-col space-y-2">
|
36
34
|
<button
|
37
35
|
className="absolute top-2 right-2"
|
38
|
-
onClick={() => {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
}}
|
36
|
+
// onClick={() => {
|
37
|
+
// setFormState({
|
38
|
+
// sources: formState.sources.filter((s) => s !== source),
|
39
|
+
// })
|
40
|
+
// }}
|
43
41
|
>
|
44
42
|
{SVGS.redClose}
|
45
43
|
</button>
|
@@ -31,7 +31,7 @@ const StepWizard: React.FC<Props> = ({
|
|
31
31
|
|
32
32
|
const goNext = () => {
|
33
33
|
const index = steps.findIndex((step) => step.slug === currentStep)
|
34
|
-
if (steps[index].required && !
|
34
|
+
if (steps[index].required && !steps[index].isCompleted) {
|
35
35
|
toast.error("Please fill out all required fields!")
|
36
36
|
return
|
37
37
|
}
|
@@ -48,6 +48,8 @@ const StepWizard: React.FC<Props> = ({
|
|
48
48
|
setFormState({ ...formState, currentStep: steps[index - 1].slug })
|
49
49
|
}
|
50
50
|
|
51
|
+
console.log(index, totalSteps, steps)
|
52
|
+
|
51
53
|
return (
|
52
54
|
<div className="min-h-screen flex flex-col items-center justify-center text-center px-4">
|
53
55
|
<div className=" rounded-xl p-8 w-full max-w-xl">
|
@@ -87,22 +89,23 @@ const StepWizard: React.FC<Props> = ({
|
|
87
89
|
{steps.find((step) => step.slug === currentStep)?.content}
|
88
90
|
</div>
|
89
91
|
|
90
|
-
{/* Dot Indicators */}
|
91
|
-
|
92
|
-
{/* Navigation */}
|
93
92
|
<div className="flex justify-between">
|
94
93
|
<button
|
95
94
|
onClick={goBack}
|
96
95
|
disabled={index === 0}
|
97
|
-
className=
|
96
|
+
className={`text-sm text-gray-500 hover:text-gray-900 disabled:opacity-40 ${
|
97
|
+
index === 0 ? "cursor-not-allowed" : "cursor-pointer"
|
98
|
+
}`}
|
98
99
|
>
|
99
100
|
⬅ Back
|
100
101
|
</button>
|
101
102
|
<button
|
102
103
|
onClick={index === totalSteps - 1 ? onFinish : goNext}
|
103
|
-
className=
|
104
|
+
className={`text-sm text-blue-600 hover:text-blue-800 cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed p-2 rounded-md ${
|
105
|
+
index === totalSteps - 1 ? "bg-blue-600 text-white" : ""
|
106
|
+
}`}
|
104
107
|
>
|
105
|
-
Next ➡
|
108
|
+
{index === totalSteps - 1 ? "Finish 🚀" : "Next ➡"}
|
106
109
|
</button>
|
107
110
|
</div>
|
108
111
|
</div>
|
@@ -45,17 +45,12 @@ export const Uploader = ({
|
|
45
45
|
icon={SVGS.contentTable}
|
46
46
|
onClick={() => handleSelectOption("text")}
|
47
47
|
/>
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
onFinish(
|
53
|
-
`The following information comes from a PDF file uploaded by the user: ${JSON.stringify(
|
54
|
-
file
|
55
|
-
)}`
|
56
|
-
)
|
57
|
-
}}
|
48
|
+
<ContentCard
|
49
|
+
description="Upload files"
|
50
|
+
icon={SVGS.pdf}
|
51
|
+
onClick={() => handleSelectOption("files")}
|
58
52
|
/>
|
53
|
+
|
59
54
|
<ContentCard
|
60
55
|
description="Share a Youtube link"
|
61
56
|
icon={SVGS.youtube}
|
@@ -66,6 +61,8 @@ export const Uploader = ({
|
|
66
61
|
|
67
62
|
{selectedOption === "text" && <TextUploader onFinish={onFinish} />}
|
68
63
|
|
64
|
+
{selectedOption === "files" && <FileUploader styledAs="card" />}
|
65
|
+
|
69
66
|
{selectedOption === "youtube" && (
|
70
67
|
<LinkUploader
|
71
68
|
onResult={(link) => {
|
@@ -75,11 +75,15 @@ const ContentSecondaryHeader = ({
|
|
75
75
|
|
76
76
|
export const GenerateButton = ({
|
77
77
|
handleSubmit,
|
78
|
+
openLogin,
|
78
79
|
}: {
|
79
80
|
handleSubmit: () => void
|
81
|
+
openLogin: () => void
|
80
82
|
}) => {
|
81
83
|
const history = useStore((state) => state.history)
|
82
84
|
const undo = useStore((state) => state.undo)
|
85
|
+
const auth = useStore((state) => state.auth)
|
86
|
+
const setAuth = useStore((state) => state.setAuth)
|
83
87
|
const prev = history[history.length - 2]
|
84
88
|
return (
|
85
89
|
<div className="flex flex-col space-y-2 sm:flex-row sm:space-y-0 sm:space-x-4 justify-end mt-6">
|
@@ -95,6 +99,33 @@ export const GenerateButton = ({
|
|
95
99
|
Revert changes
|
96
100
|
</button>
|
97
101
|
)}
|
102
|
+
{auth.user && (
|
103
|
+
<div
|
104
|
+
// onClick={handleSubmit}
|
105
|
+
className="text-sm text-gray-500 bg-gray-200 rounded px-4 py-2 flex items-center justify-center flex-col"
|
106
|
+
>
|
107
|
+
<span>
|
108
|
+
Creating the course as <strong>{auth.user.first_name}</strong>
|
109
|
+
</span>
|
110
|
+
<span>
|
111
|
+
or{" "}
|
112
|
+
<button
|
113
|
+
className="text-sm text-gray-500 bg-gray-200 rounded hover:bg-gray-300 items-center justify-center cursor-pointer "
|
114
|
+
onClick={() => {
|
115
|
+
setAuth({
|
116
|
+
rigoToken: "",
|
117
|
+
bcToken: "",
|
118
|
+
userId: "",
|
119
|
+
user: null,
|
120
|
+
})
|
121
|
+
openLogin()
|
122
|
+
}}
|
123
|
+
>
|
124
|
+
<strong>login as someone else</strong>
|
125
|
+
</button>
|
126
|
+
</span>
|
127
|
+
</div>
|
128
|
+
)}
|
98
129
|
<button
|
99
130
|
onClick={handleSubmit}
|
100
131
|
className="w-full sm:w-auto bg-blue-600 text-white rounded px-4 py-2 hover:bg-blue-700 flex items-center justify-center gap-2 cursor-pointer"
|
@@ -110,10 +141,12 @@ export const ContentIndex = ({
|
|
110
141
|
handleSubmit,
|
111
142
|
messages,
|
112
143
|
isThinking,
|
144
|
+
openLogin,
|
113
145
|
}: {
|
114
146
|
handleSubmit: () => void
|
115
147
|
messages: TMessage[]
|
116
148
|
isThinking: boolean
|
149
|
+
openLogin: () => void
|
117
150
|
}) => {
|
118
151
|
const history = useStore((state) => state.history)
|
119
152
|
const push = useStore((state) => state.push)
|
@@ -235,7 +268,10 @@ export const ContentIndex = ({
|
|
235
268
|
</div>
|
236
269
|
))}
|
237
270
|
{syllabus.lessons.length > 0 && (
|
238
|
-
<GenerateButton
|
271
|
+
<GenerateButton
|
272
|
+
handleSubmit={handleSubmit}
|
273
|
+
openLogin={openLogin}
|
274
|
+
/>
|
239
275
|
)}
|
240
276
|
</>
|
241
277
|
)}
|
@@ -127,14 +127,7 @@ export const Sidebar = ({
|
|
127
127
|
}}
|
128
128
|
/>
|
129
129
|
<div className="absolute bottom-2 right-2 flex gap-1 items-center">
|
130
|
-
<
|
131
|
-
<FileUploader
|
132
|
-
onResult={(res) => {
|
133
|
-
setUploadedFiles([...(uploadedFiles || []), ...res])
|
134
|
-
}}
|
135
|
-
/>
|
136
|
-
</div>
|
137
|
-
|
130
|
+
<FileUploader />
|
138
131
|
<button
|
139
132
|
className="cursor-pointer blue-on-hover flex items-center justify-center w-6 h-6"
|
140
133
|
onClick={() => {
|
@@ -20,7 +20,6 @@ import { ContentIndex } from "./ContentIndex"
|
|
20
20
|
import { Sidebar } from "./Sidebar"
|
21
21
|
import Login from "../Login"
|
22
22
|
import { useNavigate } from "react-router"
|
23
|
-
import PreviewGenerator from "../PreviewGenerator"
|
24
23
|
import { ParamsChecker } from "../ParamsChecker"
|
25
24
|
import { slugify } from "../../utils/creatorUtils"
|
26
25
|
import { RIGO_FLOAT_GIT } from "../../utils/constants"
|
@@ -177,7 +176,6 @@ const SyllabusEditor: React.FC = () => {
|
|
177
176
|
text="Learnpack is setting up your tutorial.
|
178
177
|
It may take a moment..."
|
179
178
|
/>
|
180
|
-
<PreviewGenerator />
|
181
179
|
</>
|
182
180
|
) : (
|
183
181
|
<div className="flex w-full bg-white rounded-md shadow-md overflow-hidden h-screen ">
|
@@ -202,6 +200,9 @@ It may take a moment..."
|
|
202
200
|
handleSubmit={handleSubmit}
|
203
201
|
messages={messages}
|
204
202
|
isThinking={isThinking}
|
203
|
+
openLogin={() => {
|
204
|
+
setShowLoginModal(true)
|
205
|
+
}}
|
205
206
|
/>
|
206
207
|
</div>
|
207
208
|
)
|
package/src/creator/src/main.tsx
CHANGED
@@ -5,7 +5,6 @@ import "./index.css"
|
|
5
5
|
import App from "./App.tsx"
|
6
6
|
import SyllabusEditor from "./components/syllabus/SyllabusEditor.tsx"
|
7
7
|
import { Toaster } from "react-hot-toast"
|
8
|
-
import PreviewGenerator from "./components/PreviewGenerator.tsx"
|
9
8
|
createRoot(document.getElementById("root")!).render(
|
10
9
|
<StrictMode>
|
11
10
|
<Toaster />
|
@@ -13,7 +12,6 @@ createRoot(document.getElementById("root")!).render(
|
|
13
12
|
<Routes>
|
14
13
|
<Route path="/creator" element={<App />} />
|
15
14
|
<Route path="/creator/syllabus" element={<SyllabusEditor />} />
|
16
|
-
<Route path="/creator/image" element={<PreviewGenerator />} />
|
17
15
|
</Routes>
|
18
16
|
</BrowserRouter>
|
19
17
|
</StrictMode>
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { create } from "zustand"
|
2
2
|
import { persist } from "zustand/middleware"
|
3
3
|
import { Lesson } from "../components/LessonItem"
|
4
|
-
import {
|
4
|
+
import { ParsedFile } from "../components/FileUploader"
|
5
|
+
// import { ParsedLink } from "../components/LinkUploader"
|
5
6
|
|
6
7
|
export type FormState = {
|
7
8
|
description: string
|
@@ -9,7 +10,7 @@ export type FormState = {
|
|
9
10
|
targetAudience: string
|
10
11
|
hasContentIndex: boolean
|
11
12
|
contentIndex: string
|
12
|
-
sources: ParsedLink[]
|
13
|
+
// sources: ParsedLink[]
|
13
14
|
isCompleted: boolean
|
14
15
|
variables: string[]
|
15
16
|
currentStep: string
|
@@ -43,8 +44,8 @@ type Store = {
|
|
43
44
|
// syllabus: Syllabus
|
44
45
|
planToRedirect: string
|
45
46
|
setPlanToRedirect: (planToRedirect: string) => void
|
46
|
-
uploadedFiles:
|
47
|
-
setUploadedFiles: (uploadedFiles:
|
47
|
+
uploadedFiles: ParsedFile[]
|
48
|
+
setUploadedFiles: (uploadedFiles: ParsedFile[]) => void
|
48
49
|
|
49
50
|
cleanHistory: () => void
|
50
51
|
history: Syllabus[]
|
@@ -75,14 +76,14 @@ const useStore = create<Store>()(
|
|
75
76
|
targetAudience: "",
|
76
77
|
hasContentIndex: false,
|
77
78
|
contentIndex: "",
|
78
|
-
sources: [],
|
79
|
+
// sources: [],
|
79
80
|
isCompleted: false,
|
80
81
|
currentStep: "description",
|
81
82
|
variables: [
|
82
83
|
"description",
|
83
84
|
"duration",
|
84
|
-
// "targetAudience",
|
85
85
|
"hasContentIndex",
|
86
|
+
"verifyHuman",
|
86
87
|
],
|
87
88
|
},
|
88
89
|
setFormState: (formState: Partial<FormState>) =>
|