diff --git a/.env b/.env index 974fe773..8b137891 100644 --- a/.env +++ b/.env @@ -1,2 +1 @@ -NEXT_PUBLIC_EMAIL = isaiahntina47@gmail.com -CHROME_EXECUTABLE_PATH = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'; + diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3a3cce57..ec236882 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,4 @@ + # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: diff --git a/.gitignore b/.gitignore index 8f322f0d..4220822d 100644 --- a/.gitignore +++ b/.gitignore @@ -26,9 +26,9 @@ yarn-error.log* # local env files .env*.local - # vercel .vercel +.env # typescript *.tsbuildinfo diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..b242572e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "githubPullRequests.ignoredPullRequestBranches": [ + "main" + ] +} \ No newline at end of file diff --git a/app/components/ChristmasIcons.tsx b/app/components/ChristmasIcons.tsx new file mode 100644 index 00000000..9c4b797c --- /dev/null +++ b/app/components/ChristmasIcons.tsx @@ -0,0 +1,70 @@ +'use client'; +import React from 'react'; +import { christmasIcons } from '../constants'; +import { useEffect, useState } from 'react'; + +const ChristmasIcons: React.FC = () => { + const [positions, setPositions] = useState>([]); + + const getRandomPosition = (): { left: number; top: number } => { + const left = Math.random() * 100; + const top = Math.random() * 100; + return { left, top }; + }; + + const checkCollision = (newPosition: { left: number; top: number }): boolean => { + const collisionThreshold = 10; + + for (const position of positions) { + if ( + Math.abs(position.left - newPosition.left) < collisionThreshold && + Math.abs(position.top - newPosition.top) < collisionThreshold + ) { + return true; // Collision detected + } + } + + return false; // No collision + }; + + useEffect(() => { + const newPositions: Array<{ left: number; top: number }> = []; + + christmasIcons.forEach(() => { + let newPosition = getRandomPosition(); + + // Check for collisions and adjust position if needed + while (checkCollision(newPosition)) { + newPosition = getRandomPosition(); + } + + newPositions.push(newPosition); + }); + + setPositions(newPositions); + }, []); // Run once on component mount + + return ( + <> + {christmasIcons.map((icon, index) => ( +
+ {icon.type === 'emoji' ? ( + {icon.name} + ) : ( + {icon.description} + )} +
+ ))} + + ); +}; + +export default ChristmasIcons; diff --git a/app/components/InspirationCards.tsx b/app/components/InspirationCards.tsx new file mode 100644 index 00000000..aff7ed7c --- /dev/null +++ b/app/components/InspirationCards.tsx @@ -0,0 +1,40 @@ +import React from 'react'; +import Inspocard from './inspoComponent'; + +interface Quote { + quote: string; + source: string; + sourceUrl?: string; + } + +const InspirationCards = () => { + const [quotes, setQuotes] = React.useState([]); + React.useEffect(() => { + fetch('/api/get_quotes') + .then((res) => res.json()) + .then((data) => { + setQuotes(data); + }); + }, []); + + return ( +
+ {quotes.length > 0 ? ( + quotes.map((quote, index) => ( + + )) + ) : ( +
+ No quotes available at the moment. Check back later! +
+ )} +
+ ); +}; + +export default InspirationCards; diff --git a/app/components/PromptConfiguration.tsx b/app/components/PromptConfiguration.tsx new file mode 100644 index 00000000..a3dc0f4e --- /dev/null +++ b/app/components/PromptConfiguration.tsx @@ -0,0 +1,23 @@ +import React from 'react'; +import { promt } from '../constants'; + +interface PromptConfigurationProps { + uniqueKey: string; + sanitizedInput: string; +} + +const PromptConfiguration: React.FC = ({ uniqueKey, sanitizedInput }) => { + return ( +
+

+ {promt[0].privilage} + {promt[0].connector} + {promt[0].username} + ~ {promt[0].endofline} + {sanitizedInput} +

+
+ ); +}; + +export default PromptConfiguration; \ No newline at end of file diff --git a/app/components/admin/QuoteForm.tsx b/app/components/admin/QuoteForm.tsx new file mode 100644 index 00000000..93be38e8 --- /dev/null +++ b/app/components/admin/QuoteForm.tsx @@ -0,0 +1,111 @@ +// path: app/components/admin/QuoteForm.tsx +import React, { useState } from 'react'; +import { useForm } from 'react-hook-form'; +import { CheckCircleIcon, ExclamationCircleIcon } from '@heroicons/react/20/solid'; + +interface FormData { + quote: string; + source?: string; + sourceUrl?: string; + } + +interface QuoteFormProps { + onSubmit: (data: FormData) => Promise; + } + +const QuoteForm = ({ onSubmit }: QuoteFormProps) => { + const { register, handleSubmit, formState: { errors }, reset } = useForm(); + const [submitting, setSubmitting] = useState(false); + const [submitStatus, setSubmitStatus] = useState<'idle' | 'success' | 'error'>('idle'); + + const handleFormSubmit = async (data: FormData) => { + setSubmitting(true); + try { + console.log('Submitting form data:', data); // Debugging + await onSubmit(data); + console.log('Form submission successful'); // Debugging + setSubmitStatus('success'); + setTimeout(() => { + setSubmitStatus('success'); + setSubmitting(false); + reset(); + }, 5000); + } catch (error) { + console.error('Error submitting form:', error); // Debugging + setSubmitStatus('error'); + setTimeout(() => { + setSubmitStatus('error'); + setSubmitting(false); + }, 5000); + } + }; + + return ( +
+
+
+ +