diff --git a/.example.env b/.example.env index 3145c3e..c1ca9e6 100644 --- a/.example.env +++ b/.example.env @@ -1,5 +1,4 @@ -REPLICATE_API_KEY=r8_2vsTHdL2qcq6r7jJLiCbNnZTTROSwNA0iEK1H - +REPLICATE_API_KEY=r8_I3qmCVzlGI0xjAuOAU0NgQShASJbAi606AzcT #console.log('Replicate API Key:', process.env.REPLICATE_API_KEY); # #const replicate = new Replicate(process.env.REPLICATE_API_KEY); diff --git a/components/Header.tsx b/components/Header.tsx index 2b6bd37..738ccdd 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -1,4 +1,4 @@ -import {LoginLink, RegisterLink} from "@kinde-oss/kinde-auth-nextjs"; +import { LoginLink, RegisterLink } from "@kinde-oss/kinde-auth-nextjs"; import Image from "next/image"; import Link from "next/link"; import React, { useContext } from "react"; @@ -9,7 +9,7 @@ export default function Header() { const user = userContext?.user; return ( -
+
-

+

DESIGN + AI Toolkit @@ -31,18 +31,21 @@ export default function Header() { <> Profile {user.email} + Credit: {user.credit} {/* Add this line to display the user's credit */} ) : ( <> diff --git a/components/InputForm.tsx b/components/InputForm.tsx index eb3cd26..1fd695d 100644 --- a/components/InputForm.tsx +++ b/components/InputForm.tsx @@ -139,8 +139,8 @@ const InputForm: React.FC = () => { //

-
-
+
+
@@ -150,7 +150,7 @@ const InputForm: React.FC = () => { name="prompt" // Zmenené z "inputPrompt" na "prompt" value={formData.prompt} onChange={handleChange} - className="w-full border border-gray-300 rounded-lg px-4 py-2 mb-2" + className="w-full border border-gray-500 rounded-lg px-4 py-2 mb-2" />
@@ -250,9 +250,9 @@ const InputForm: React.FC = () => {
-
- {generatedPhoto && Generated} +
+ {generatedPhoto && Generated}
) ; diff --git a/context/UserContext.tsx b/context/UserContext.tsx index c12172c..f34ce50 100644 --- a/context/UserContext.tsx +++ b/context/UserContext.tsx @@ -3,6 +3,7 @@ import React from 'react'; type UserState = { email: string; password: string; + credit: number; // Add this line } | null; export type UserContextType = { @@ -10,4 +11,6 @@ export type UserContextType = { setUser: React.Dispatch>; }; -export const UserContext = React.createContext(undefined); \ No newline at end of file +export const UserContext = React.createContext(undefined); + + diff --git a/pages/_document.tsx b/pages/_document.tsx index 94449f6..abbc8d5 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -8,19 +8,19 @@ class MyDocument extends Document { - + { const [email, setEmail] = useState('') const [password, setPassword] = useState('') + const handleSubmit = async (event: React.FormEvent) => { event.preventDefault() @@ -35,7 +36,8 @@ const Home: NextPage = () => { localStorage.setItem('token', data.token) // Redirect the user to the home page or dashboard } else { - // Handle error + alert('Invalid credentials') + } } @@ -98,8 +100,8 @@ const Home: NextPage = () => {
) -} +} -export default Home; \ No newline at end of file +export default Home; diff --git a/pages/realvision.tsx b/pages/realvision.tsx index 285d63a..c46d9a8 100644 --- a/pages/realvision.tsx +++ b/pages/realvision.tsx @@ -56,7 +56,7 @@ const Home = () => { -
+
{generatedPhoto ? ( => { - // let isSafe = false; - // try { - // isSafe = await NSFWPredictor.isSafeImg(file); - // if (!isSafe) va.track("NSFW Image blocked"); - // } catch (error) { - // console.error("NSFW predictor threw an error", error); - // } - // return isSafe - // ? undefined - // : "Detected a NSFW image which is not allowed. If this was a mistake, please contact me at hassan@hey.com"; - // }, }; const Home: NextPage = () => { @@ -52,22 +40,20 @@ const Home: NextPage = () => { const [photoName, setPhotoName] = useState(null); const [isUploaded, setIsUploaded] = useState(false); - - const UploadDropZone = () => ( - { - if (file.length !== 0) { - setOriginalPhoto(file[0].fileUrl.replace("raw", "thumbnail")); - generatePhoto(file[0].fileUrl.replace("raw", "thumbnail")); - setIsUploaded(true); - } - }} - width="670px" - height="250px" - /> + { + if (file.length !== 0) { + setOriginalPhoto(file[0].fileUrl.replace("raw", "thumbnail")); + generatePhoto(file[0].fileUrl.replace("raw", "thumbnail")); + setIsUploaded(true); + } + }} + width="670px" + height="250px" + /> ); function deleteImage() { @@ -99,132 +85,127 @@ const Home: NextPage = () => { } return ( -
- - Restore Photos - - - -
-
+
+ + Restore Photos + + -

- Upravte svoje fotografie pomocou umeléj inteligencie. -

-

- Nahrajte svoje fotografie a nechajte AI obnoviť ich kvalitu. AI je trénované na obnovu starých fotografií, odstránenie šumu a zlepšenie črtov tváre. -

- {/*

*/} - {/* {" "}*/} - {/* /!* Obtained this number from Vercel: based on how many serverless invocations happened. *!/*/} - {/* {" "}*/} - {/* photos generated and counting.*/} - {/*

*/} - - - - setSideBySide(newVal)} - /> - {restoredLoaded && sideBySide && ( - +
+

+ Upravte svoje fotografie pomocou umeléj inteligencie. +

+

+ Nahrajte svoje fotografie a nechajte AI obnoviť ich kvalitu. AI je trénované na obnovu starých fotografií, odstránenie šumu a zlepšenie črtov tváre. +

+ + + + setSideBySide(newVal)} /> - )} - {!originalPhoto && } - {originalPhoto && !restoredImage && ( - original photo - )} - {restoredImage && originalPhoto && !sideBySide && ( -
- )} - {loading && ( - - )} - {error && ( -
- {error} -
- )} -
- {originalPhoto && !loading && ( - + )} - {restoredLoaded && ( - + {error && ( +
+ {error} +
)} -
- - - -
-
-
+
+ {originalPhoto && !loading && ( + + )} + + {isUploaded ? ( +
+ + {restoredImage && Download Restored Photo} +
+ ) : null} + {restoredLoaded && ( + + )} +
+ + + +
+
); }; -export default Home; +export default Home; \ No newline at end of file