auto update templates

This commit is contained in:
matan
2024-01-19 11:27:51 +02:00
parent 3e291f779f
commit c8fe148473
3 changed files with 230 additions and 18 deletions
+17
View File
@@ -194,3 +194,20 @@ export const modules = [
}))
]
fetch("https://openart.ai/api/public/templates/list").then(res=>res.json()).then(res=>{
res.map(template => {
const t = ({
id: template.id,
title: template.name,
description: template.description,
type: 'template',
thumbnail: template.thumbnails[0].url,
categories: [categories[1]],
})
if(!modules.find(m=>m.id===t.id)){
modules.push(t)
}
}
)})
+210 -2
View File
File diff suppressed because one or more lines are too long
+3 -16
View File
@@ -1,23 +1,10 @@
import React, {useState} from 'react';
import React, {useEffect, useState} from 'react';
import {Dialog} from "@headlessui/react";
import logo from "./logo.png";
import Draggable from "react-draggable";
import {Loader} from "react-feather";
// moduleItem.querySelector('button').addEventListener('click', () => {
// LearnModal.get().close()
// if(module.initialWorkflow){
// app.loadGraphData(JSON.parse(module.initialWorkflow))
// }
// if(module.type === 'lesson') {
// const keyframesFunctions = {}
// if(module.keyframesWorkflows){
// for (let keyframe in module.keyframesWorkflows) {
// const parsedWorkflow = JSON.parse(module.keyframesWorkflows[keyframe])
// keyframesFunctions[keyframe] = ()=> app.loadGraphData(parsedWorkflow);
// }
// }
// startVideo(module.title,module.videoId,keyframesFunctions)
// }
import {categories} from "../../javascript/data";
function LearnDialog({close, startVideo}) {
const [selectedCategory,setSelectedCategory] = useState(window.data.categories[0])
const [loading,setLoading] = useState(false)