@learnpack/learnpack 5.0.70 → 5.0.72
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/init.js +1 -1
- package/lib/commands/serve.js +60 -4
- package/lib/creatorDist/assets/{index-Dqo9u2iR.css → index-BJ2JJzVC.css} +53 -26
- package/lib/creatorDist/assets/{index-Chx6V3zd.js → index-CKBeex0S.js} +35878 -29623
- package/lib/creatorDist/index.html +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/init.ts +1 -1
- package/src/commands/serve.ts +70 -6
- package/src/creator/package-lock.json +49 -0
- package/src/creator/package.json +1 -0
- package/src/creator/src/App.tsx +28 -21
- package/src/creator/src/assets/svgs.tsx +1 -1
- package/src/creator/src/components/ConsumablesManager.tsx +12 -2
- package/src/creator/src/components/LessonItem.tsx +3 -2
- package/src/creator/src/components/Loader.tsx +5 -1
- package/src/creator/src/components/Login.tsx +58 -151
- package/src/creator/src/components/Message.tsx +11 -1
- package/src/creator/src/components/Redirector.tsx +12 -0
- package/src/creator/src/components/syllabus/ContentIndex.tsx +88 -58
- package/src/creator/src/components/syllabus/Sidebar.tsx +3 -12
- package/src/creator/src/components/syllabus/SyllabusEditor.tsx +63 -7
- package/src/creator/src/index.css +15 -0
- package/src/creator/src/main.tsx +0 -1
- package/src/creator/src/utils/creatorUtils.ts +33 -3
- package/src/creator/src/utils/lib.ts +156 -2
- package/src/creator/src/utils/rigo.ts +3 -3
- package/src/creator/src/utils/store.ts +2 -1
- package/src/creatorDist/assets/{index-Dqo9u2iR.css → index-BJ2JJzVC.css} +53 -26
- package/src/creatorDist/assets/{index-Chx6V3zd.js → index-CKBeex0S.js} +35878 -29623
- package/src/creatorDist/index.html +2 -2
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +529 -529
- package/src/ui/app.tar.gz +0 -0
@@ -10,8 +10,8 @@
|
|
10
10
|
/>
|
11
11
|
|
12
12
|
<title>Learnpack Creator: Craft tutorials in seconds!</title>
|
13
|
-
<script type="module" crossorigin src="/creator/assets/index-
|
14
|
-
<link rel="stylesheet" crossorigin href="/creator/assets/index-
|
13
|
+
<script type="module" crossorigin src="/creator/assets/index-CKBeex0S.js"></script>
|
14
|
+
<link rel="stylesheet" crossorigin href="/creator/assets/index-BJ2JJzVC.css">
|
15
15
|
</head>
|
16
16
|
<body>
|
17
17
|
<div id="root"></div>
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"5.0.
|
1
|
+
{"version":"5.0.72","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false}},"args":[]},"breakToken":{"id":"breakToken","description":"Break the token","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Runs a small server to build tutorials","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]},"translate":{"id":"translate","description":"List all the lessons, the user is able of select many of them to translate to the given languages","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[]}}}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@learnpack/learnpack",
|
3
3
|
"description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
|
4
|
-
"version": "5.0.
|
4
|
+
"version": "5.0.72",
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
6
6
|
"contributors": [
|
7
7
|
{
|
package/src/commands/init.ts
CHANGED
@@ -269,7 +269,7 @@ const handleAILogic = async (tutorialDir: string, packageInfo: PackageInfo) => {
|
|
269
269
|
|
270
270
|
if (!sessionExists || !isValidBreathecodeToken || !isValidToken) {
|
271
271
|
Console.info(
|
272
|
-
"Almost there! First you need to login with 4Geeks.com to use AI Generation tool for creators. You can create a new account here: https://4geeks.com/
|
272
|
+
"Almost there! First you need to login with 4Geeks.com to use AI Generation tool for creators. You can create a new account here: https://4geeks.com/checkout?plan=4geeks-creator"
|
273
273
|
)
|
274
274
|
try {
|
275
275
|
sessionPayload = await SessionManager.login()
|
package/src/commands/serve.ts
CHANGED
@@ -49,13 +49,12 @@ export default class ServeCommand extends SessionCommand {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
const credentials = JSON.parse(crendsEnv)
|
52
|
-
|
53
52
|
const bucketStorage = new Storage({
|
54
53
|
credentials,
|
55
54
|
})
|
56
55
|
|
57
56
|
const bucket = bucketStorage.bucket(
|
58
|
-
process.env.GCP_BUCKET_NAME || "learnpack-
|
57
|
+
process.env.GCP_BUCKET_NAME || "learnpack-packages"
|
59
58
|
)
|
60
59
|
|
61
60
|
async function listFilesWithPrefix(prefix: string) {
|
@@ -126,14 +125,57 @@ export default class ServeCommand extends SessionCommand {
|
|
126
125
|
stream.end(buffer)
|
127
126
|
})
|
128
127
|
|
128
|
+
app.post("/upload-image", express.json(), async (req, res) => {
|
129
|
+
const { image_url, destination } = req.body
|
130
|
+
if (!image_url || !destination) {
|
131
|
+
return res
|
132
|
+
.status(400)
|
133
|
+
.json({ error: "image_url and destination are required" })
|
134
|
+
}
|
135
|
+
|
136
|
+
try {
|
137
|
+
const response = await fetch(image_url)
|
138
|
+
if (!response.ok) {
|
139
|
+
return res
|
140
|
+
.status(400)
|
141
|
+
.json({ error: `Failed to download image: ${response.statusText}` })
|
142
|
+
}
|
143
|
+
|
144
|
+
const contentType =
|
145
|
+
response.headers.get("content-type") || "application/octet-stream"
|
146
|
+
const buffer = await response.arrayBuffer()
|
147
|
+
|
148
|
+
const file = bucket.file(destination)
|
149
|
+
await file.save(Buffer.from(buffer), {
|
150
|
+
resumable: false,
|
151
|
+
contentType,
|
152
|
+
})
|
153
|
+
|
154
|
+
console.log(`✅ Image uploaded to ${file.name}`)
|
155
|
+
res.json({ message: "Image uploaded successfully", path: file.name })
|
156
|
+
} catch (error) {
|
157
|
+
console.error("❌ upload-image error:", error)
|
158
|
+
res.status(500).json({ error: (error as Error).message })
|
159
|
+
}
|
160
|
+
})
|
161
|
+
|
162
|
+
app.get("/create", (req, res) => {
|
163
|
+
console.log("GET /create")
|
164
|
+
res.redirect("/creator/")
|
165
|
+
})
|
166
|
+
|
129
167
|
app.get("/", async (req, res) => {
|
130
|
-
// The the ui/_app/index.html
|
131
168
|
console.log("GET /")
|
132
169
|
|
133
|
-
const
|
134
|
-
res.sendFile(file)
|
135
|
-
})
|
170
|
+
const slug = req.query.slug
|
136
171
|
|
172
|
+
if (slug) {
|
173
|
+
const file = path.resolve(__dirname, "../ui/_app/index.html")
|
174
|
+
res.sendFile(file)
|
175
|
+
} else {
|
176
|
+
res.redirect("https://learnpack.co")
|
177
|
+
}
|
178
|
+
})
|
137
179
|
app.get("/config", async (req, res) => {
|
138
180
|
const courseSlug = req.query.slug
|
139
181
|
const files = await listFilesWithPrefix(`courses/${courseSlug}`)
|
@@ -219,6 +261,28 @@ continue
|
|
219
261
|
res.send({ attributes, body })
|
220
262
|
})
|
221
263
|
|
264
|
+
app.get("/.learn/assets/:file", async (req, res) => {
|
265
|
+
console.log("GET /.learn/assets/:file", req.params.file)
|
266
|
+
const { file } = req.params
|
267
|
+
const courseSlug = req.query.slug
|
268
|
+
|
269
|
+
if (!courseSlug) {
|
270
|
+
return res.status(400).send("Course slug is required")
|
271
|
+
}
|
272
|
+
|
273
|
+
const filePath = `courses/${courseSlug}/.learn/assets/${file}`
|
274
|
+
const fileRef = bucket.file(filePath)
|
275
|
+
const [exists] = await fileRef.exists()
|
276
|
+
if (!exists) {
|
277
|
+
return res.status(404).send("File not found")
|
278
|
+
}
|
279
|
+
|
280
|
+
const fileStream = fileRef.createReadStream()
|
281
|
+
res.set("Content-Type", "application/octet-stream")
|
282
|
+
res.set("Content-Disposition", `attachment; filename="${file}"`)
|
283
|
+
fileStream.pipe(res)
|
284
|
+
})
|
285
|
+
|
222
286
|
app.put(
|
223
287
|
"/exercise/:slug/file/:fileName",
|
224
288
|
express.text(),
|
@@ -11,6 +11,7 @@
|
|
11
11
|
"@google-cloud/storage": "^7.16.0",
|
12
12
|
"@tailwindcss/vite": "^4.1.3",
|
13
13
|
"axios": "^1.8.4",
|
14
|
+
"framer-motion": "^12.9.2",
|
14
15
|
"front-matter": "^4.0.2",
|
15
16
|
"js-yaml": "^4.1.0",
|
16
17
|
"mammoth": "^1.9.0",
|
@@ -3012,6 +3013,33 @@
|
|
3012
3013
|
"url": "https://github.com/sponsors/rawify"
|
3013
3014
|
}
|
3014
3015
|
},
|
3016
|
+
"node_modules/framer-motion": {
|
3017
|
+
"version": "12.9.2",
|
3018
|
+
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.9.2.tgz",
|
3019
|
+
"integrity": "sha512-R0O3Jdqbfwywpm45obP+8sTgafmdEcUoShQTAV+rB5pi+Y1Px/FYL5qLLRe5tPtBdN1J4jos7M+xN2VV2oEAbQ==",
|
3020
|
+
"license": "MIT",
|
3021
|
+
"dependencies": {
|
3022
|
+
"motion-dom": "^12.9.1",
|
3023
|
+
"motion-utils": "^12.8.3",
|
3024
|
+
"tslib": "^2.4.0"
|
3025
|
+
},
|
3026
|
+
"peerDependencies": {
|
3027
|
+
"@emotion/is-prop-valid": "*",
|
3028
|
+
"react": "^18.0.0 || ^19.0.0",
|
3029
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
3030
|
+
},
|
3031
|
+
"peerDependenciesMeta": {
|
3032
|
+
"@emotion/is-prop-valid": {
|
3033
|
+
"optional": true
|
3034
|
+
},
|
3035
|
+
"react": {
|
3036
|
+
"optional": true
|
3037
|
+
},
|
3038
|
+
"react-dom": {
|
3039
|
+
"optional": true
|
3040
|
+
}
|
3041
|
+
}
|
3042
|
+
},
|
3015
3043
|
"node_modules/front-matter": {
|
3016
3044
|
"version": "4.0.2",
|
3017
3045
|
"resolved": "https://registry.npmjs.org/front-matter/-/front-matter-4.0.2.tgz",
|
@@ -3983,6 +4011,21 @@
|
|
3983
4011
|
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
|
3984
4012
|
"license": "MIT"
|
3985
4013
|
},
|
4014
|
+
"node_modules/motion-dom": {
|
4015
|
+
"version": "12.9.1",
|
4016
|
+
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.9.1.tgz",
|
4017
|
+
"integrity": "sha512-xqXEwRLDYDTzOgXobSoWtytRtGlf7zdkRfFbrrdP7eojaGQZ5Go4OOKtgnx7uF8sAkfr1ZjMvbCJSCIT2h6fkQ==",
|
4018
|
+
"license": "MIT",
|
4019
|
+
"dependencies": {
|
4020
|
+
"motion-utils": "^12.8.3"
|
4021
|
+
}
|
4022
|
+
},
|
4023
|
+
"node_modules/motion-utils": {
|
4024
|
+
"version": "12.8.3",
|
4025
|
+
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.8.3.tgz",
|
4026
|
+
"integrity": "sha512-GYVauZEbca8/zOhEiYOY9/uJeedYQld6co/GJFKOy//0c/4lDqk0zB549sBYqqV2iMuX+uHrY1E5zd8A2L+1Lw==",
|
4027
|
+
"license": "MIT"
|
4028
|
+
},
|
3986
4029
|
"node_modules/ms": {
|
3987
4030
|
"version": "2.1.3",
|
3988
4031
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
@@ -4756,6 +4799,12 @@
|
|
4756
4799
|
"typescript": ">=4.8.4"
|
4757
4800
|
}
|
4758
4801
|
},
|
4802
|
+
"node_modules/tslib": {
|
4803
|
+
"version": "2.8.1",
|
4804
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
4805
|
+
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
4806
|
+
"license": "0BSD"
|
4807
|
+
},
|
4759
4808
|
"node_modules/turbo-stream": {
|
4760
4809
|
"version": "2.4.0",
|
4761
4810
|
"resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz",
|
package/src/creator/package.json
CHANGED
package/src/creator/src/App.tsx
CHANGED
@@ -3,11 +3,11 @@ import StepWizard from "./components/StepWizard"
|
|
3
3
|
import SelectableCard from "./components/SelectableCard"
|
4
4
|
import Loader from "./components/Loader"
|
5
5
|
import { useNavigate } from "react-router"
|
6
|
-
import Login, { loginWithToken } from "./components/Login"
|
7
6
|
import { useShallow } from "zustand/react/shallow"
|
8
7
|
import useStore from "./utils/store"
|
8
|
+
|
9
9
|
import { interactiveCreation } from "./utils/rigo"
|
10
|
-
import { checkParams, parseLesson } from "./utils/lib"
|
10
|
+
import { checkParams, loginWithToken, parseLesson } from "./utils/lib"
|
11
11
|
import FileUploader from "./components/FileUploader"
|
12
12
|
|
13
13
|
// const exampleContentIndex = `-Introduction to AI: Explain what is AI and its applications
|
@@ -17,9 +17,9 @@ import FileUploader from "./components/FileUploader"
|
|
17
17
|
function App() {
|
18
18
|
const navigate = useNavigate()
|
19
19
|
|
20
|
-
const {
|
20
|
+
const { formState, setFormState, setSyllabus, setAuth } = useStore(
|
21
21
|
useShallow((state) => ({
|
22
|
-
auth: state.auth,
|
22
|
+
// auth: state.auth,
|
23
23
|
formState: state.formState,
|
24
24
|
setFormState: state.setFormState,
|
25
25
|
setSyllabus: state.setSyllabus,
|
@@ -45,6 +45,7 @@ function App() {
|
|
45
45
|
bcToken: token,
|
46
46
|
userId: user.id,
|
47
47
|
rigoToken: user.rigobot.key,
|
48
|
+
user: user,
|
48
49
|
})
|
49
50
|
setFormState({
|
50
51
|
variables: [
|
@@ -68,7 +69,7 @@ function App() {
|
|
68
69
|
}
|
69
70
|
|
70
71
|
const handleCreateTutorial = async () => {
|
71
|
-
const res = await interactiveCreation(
|
72
|
+
const res = await interactiveCreation({
|
72
73
|
courseInfo: JSON.stringify(formState),
|
73
74
|
prevInteractions: "",
|
74
75
|
})
|
@@ -113,21 +114,21 @@ function App() {
|
|
113
114
|
/>
|
114
115
|
),
|
115
116
|
},
|
116
|
-
{
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
},
|
117
|
+
// {
|
118
|
+
// title:
|
119
|
+
// "First you need to login with 4Geeks.com to use AI Generation tool for creators. ",
|
120
|
+
// slug: "login",
|
121
|
+
// isCompleted: false,
|
122
|
+
// content: (
|
123
|
+
// <Login
|
124
|
+
// onFinish={() => {
|
125
|
+
// setFormState({
|
126
|
+
// currentStep: "duration",
|
127
|
+
// })
|
128
|
+
// }}
|
129
|
+
// />
|
130
|
+
// ),
|
131
|
+
// },
|
131
132
|
{
|
132
133
|
title: "What is the estimated duration for this tutorial?",
|
133
134
|
slug: "duration",
|
@@ -265,7 +266,13 @@ function App() {
|
|
265
266
|
{formState.isCompleted ? (
|
266
267
|
<Loader
|
267
268
|
text="Learnpack is setting up your tutorial. It may take a moment..."
|
268
|
-
icon={
|
269
|
+
icon={
|
270
|
+
<img
|
271
|
+
src={"rigo-float.gif"}
|
272
|
+
alt="rigo"
|
273
|
+
className="w-20 h-20"
|
274
|
+
/>
|
275
|
+
}
|
269
276
|
/>
|
270
277
|
) : (
|
271
278
|
<StepWizard
|
@@ -190,7 +190,7 @@ export const SVGS = {
|
|
190
190
|
>
|
191
191
|
<path
|
192
192
|
d="M6.12812 3.64814L0.384343 0.0378137C0.213539 -0.0696296 0 0.0647108 0 0.279307V5.34833C0 5.47075 0.0733163 5.57892 0.18082 5.61498L2.90314 6.52715L5.01075 7.23331C5.25193 7.31415 5.25193 7.68577 5.01075 7.76646L2.90314 8.47262L0.18082 9.38509C0.0733163 9.42114 0 9.52931 0 9.65173V14.7206C0 14.9354 0.213539 15.0695 0.384343 14.9622L6.12812 11.3519L11.8719 7.7416C12.0427 7.6343 12.0427 7.36576 11.8719 7.25847L6.12812 3.64814Z"
|
193
|
-
fill="
|
193
|
+
fill="var(--four-geeks-blue)"
|
194
194
|
/>
|
195
195
|
</svg>
|
196
196
|
),
|
@@ -4,6 +4,7 @@ import useStore from "../utils/store"
|
|
4
4
|
|
5
5
|
export const ConsumablesManager = () => {
|
6
6
|
const auth = useStore((state) => state.auth)
|
7
|
+
const setAuth = useStore((state) => state.setAuth)
|
7
8
|
const setConsumables = useStore((state) => state.setConsumables)
|
8
9
|
|
9
10
|
useEffect(() => {
|
@@ -13,8 +14,17 @@ export const ConsumablesManager = () => {
|
|
13
14
|
}, [auth])
|
14
15
|
|
15
16
|
const fetchConsumables = async () => {
|
16
|
-
|
17
|
-
|
17
|
+
try {
|
18
|
+
const consumables = await getConsumables(auth.bcToken)
|
19
|
+
setConsumables(parseConsumables(consumables.voids))
|
20
|
+
} catch (error) {
|
21
|
+
setAuth({
|
22
|
+
bcToken: "",
|
23
|
+
rigoToken: "",
|
24
|
+
userId: "",
|
25
|
+
user: null,
|
26
|
+
})
|
27
|
+
}
|
18
28
|
}
|
19
29
|
|
20
30
|
return <></>
|
@@ -35,10 +35,11 @@ export const LessonItem: React.FC<LessonItemProps> = ({
|
|
35
35
|
|
36
36
|
return (
|
37
37
|
<div
|
38
|
-
className={`flex items-center space-x-2
|
39
|
-
isNew ? "
|
38
|
+
className={`flex items-center space-x-2 relative rounded-md p-3 ${
|
39
|
+
isNew ? "border border-learnpack-blue" : "border border-gray-200"
|
40
40
|
}`}
|
41
41
|
>
|
42
|
+
{isNew && <span className="red-ball"></span>}
|
42
43
|
<span className="index-circle">{cleanFloatString(lesson.id)}</span>
|
43
44
|
<span className="text-gray-500 text-sm">
|
44
45
|
{lesson.type[0] + lesson.type.slice(1).toLowerCase()} ●
|
@@ -6,6 +6,7 @@ interface LoaderProps {
|
|
6
6
|
icon?: React.ReactNode
|
7
7
|
listeningTo?: string
|
8
8
|
initialBuffer?: string
|
9
|
+
minheight?: string
|
9
10
|
}
|
10
11
|
|
11
12
|
const Loader: React.FC<LoaderProps> = ({
|
@@ -13,6 +14,7 @@ const Loader: React.FC<LoaderProps> = ({
|
|
13
14
|
icon,
|
14
15
|
listeningTo,
|
15
16
|
initialBuffer,
|
17
|
+
minheight = "min-h-screen",
|
16
18
|
}) => {
|
17
19
|
const [buffer, setBuffer] = useState(initialBuffer || "")
|
18
20
|
const preRef = useRef<HTMLPreElement>(null)
|
@@ -40,7 +42,9 @@ const Loader: React.FC<LoaderProps> = ({
|
|
40
42
|
}, [buffer])
|
41
43
|
|
42
44
|
return (
|
43
|
-
<div
|
45
|
+
<div
|
46
|
+
className={`flex flex-col items-center justify-center bg-gray-50 text-center space-y-6 ${minheight}`}
|
47
|
+
>
|
44
48
|
<div className="text-blue-500 text-4xl animate-pulse">{icon}</div>
|
45
49
|
<p className="text-gray-800 text-lg whitespace-pre-line">{text}</p>
|
46
50
|
{!buffer && (
|