feat: added new images for generate code, deleted unused utils

This commit is contained in:
David Xu
2024-10-19 23:45:12 -07:00
parent 5b8d08a9b6
commit 2ab6b0a70f
13 changed files with 0 additions and 270 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

-61
View File
@@ -1,61 +0,0 @@
import React, { useState, useEffect } from 'react'
interface EdgeLabelModalProps {
isOpen: boolean
onClose: () => void
onSave: (label: string) => void
initialLabel: string
}
const EdgeLabelModal: React.FC<EdgeLabelModalProps> = ({ isOpen, onClose, onSave, initialLabel }) => {
const [label, setLabel] = useState(initialLabel)
const [isVisible, setIsVisible] = useState(false)
useEffect(() => {
setLabel(initialLabel)
setIsVisible(isOpen)
}, [initialLabel, isOpen])
if (!isOpen) return null
return (
<div
className={`fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 transition-opacity duration-300 ${
isVisible ? 'opacity-100' : 'opacity-0'
}`}
>
<div
className={`bg-[#131316] p-6 rounded-lg relative transition-all duration-500 ${
isVisible ? 'scale-100 opacity-100' : 'scale-95 opacity-0'
}`}
>
<h2 className='text-xl text-white font-semibold mb-4'>Add edge label</h2>
<input
type='text'
value={label}
onChange={(e) => setLabel(e.target.value)}
className='w-full p-2 border border-gray-700 ring-0 focus:ring-0 focus:outline-none rounded mb-4 bg-[#1E1E1E] text-white'
/>
<div className='flex justify-end space-x-4'>
<button onClick={onClose} className='px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700'>
Cancel
</button>
<button
onClick={() => {
onSave(label)
onClose()
}}
className='px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600'
>
Save
</button>
</div>
<button onClick={onClose} className='text-white absolute top-2 right-4 font-bold hover:text-gray-500'>
x
</button>
</div>
</div>
)
}
export default EdgeLabelModal
-45
View File
@@ -1,45 +0,0 @@
import React, { useState, useEffect } from 'react'
import Button from '@mui/joy/Button'
interface ModalProps {
onClose: () => void
onSelect: (type: 'js' | 'python') => void
}
const Modal: React.FC<ModalProps> = ({ onClose, onSelect }) => {
const [isVisible, setIsVisible] = useState(false)
useEffect(() => {
setIsVisible(true)
}, [])
return (
<div
className={`fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 transition-opacity duration-300 ${isVisible ? 'opacity-100' : 'opacity-0'}`}
>
<div
className={`bg-[#131316] p-6 rounded-lg relative transition-all duration-500 ${isVisible ? 'scale-100 opacity-100' : 'scale-95 opacity-0'}`}
>
<h2 className='text-xl text-white font-semibold mb-4'>Choose language</h2>
<div className='flex space-x-4'>
<Button
onClick={() => onSelect('js')}
className='bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded'
>
JavaScript
</Button>
<Button
onClick={() => onSelect('python')}
className='bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded'
>
Python
</Button>
</div>
<button onClick={onClose} className='text-white absolute top-2 right-4 font-bold hover:text-gray-500'>
x
</button>
</div>
</div>
)
}
export default Modal
-55
View File
@@ -1,55 +0,0 @@
export const createproject = async (project: any) => {
// user: {
// type: String,
// },
// projectname: {
// type: String,
// },
// productname: {
// type: String,
// },
// productlink: {
// type: String,
// },
// productdescription: {
// type: String,
// },
// postfilter: {
// type: String,
// },
// subreddits: {
// type: String,
// },
// keywords: {
// type: String,
// },
// postandreplyids: {
// type: Array,
// },
// updatedat: {
// type: Date,
// default: Date.now,
// },
const proj = {
user: project.user,
projectname: project.projectname,
productname: project.productname,
productlink: project.productlink,
productdescription: project.productdescription,
postfilter: project.postfilter,
subreddits: project.subreddits,
keywords: project.keywords,
postandreplyids: [],
updatedat: Date.now(),
}
const data = await fetch(`https://buzzgenius-backend.onrender.com/createproject`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(proj),
})
const res = await data.json()
return res
}
-19
View File
@@ -1,19 +0,0 @@
export const createuser = async (email: string) => {
const user = {
email: email,
projects: [],
history: [],
payment: 'free',
postsleft: 0,
}
if (email === 'srijanjain1207@gmail.com' || email === 'andrew@unitedwebworks.com') user.payment = 'individual'
const response = await fetch(`https://buzzgenius-backend.onrender.com/createuser`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(user),
})
const data = await response.json()
return data
}
-13
View File
@@ -1,13 +0,0 @@
// app.delete("/project/:id"
export const deleteproject = async (id: string) => {
const response = await fetch(`https://buzzgenius-backend.onrender.com/project/${id}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
})
console.log('response', response)
const data = await response.json()
return data
}
-10
View File
@@ -1,10 +0,0 @@
export const getuserprojects = async (userid: string) => {
const response = await fetch(`https://buzzgenius-backend.onrender.com/userprojects/${userid}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
const data = await response.json()
return data
}
-10
View File
@@ -1,10 +0,0 @@
export const postandreplies = async (projectid: any) => {
const response = await fetch(`https://buzzgenius-backend.onrender.com/postandreplies/${projectid}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
const data = await response.json()
return data
}
-20
View File
@@ -1,20 +0,0 @@
// const FeedbackSchema = new mongoose.Schema({
// // feedback
// feedback: {
// type: String,
// },
// updatedat: {
// type: Date,
// default: Date.now,
// },
// })
export const savefeedback = async (feedback: string) => {
const response = await fetch(`https://buzzgenius-backend.onrender.com/feedback`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ feedback }),
})
}
-13
View File
@@ -1,13 +0,0 @@
// send email to https://buzzgenius-backend.onrender.com/verifyemail
//api endpoint with params token and email
export const signin = async (token: string) => {
const response = await fetch(`https://buzzgenius-backend.onrender.com/signin?token=${token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
return response.json()
}
-11
View File
@@ -1,11 +0,0 @@
export const trialreplies = async (trialproject: any) => {
const response = await fetch(`https://buzzgenius-backend.onrender.com/trialreplies`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(trialproject),
})
const data = await response.json()
return data
}
-13
View File
@@ -1,13 +0,0 @@
// send email to https://buzzgenius-backend.onrender.com/verifyemail
export const verifyemail = async (email: string) => {
console.log('email', email)
const response = await fetch('https://buzzgenius-backend.onrender.com/verifyemail', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email: email }),
})
return response.text()
}