Spaces:
Runtime error
Runtime error
Esteves Enzo
commited on
Commit
·
4a320f9
1
Parent(s):
0a9f2fc
hide header after generating first image
Browse files
components/header.tsx
CHANGED
@@ -1,40 +1,50 @@
|
|
|
|
1 |
import Image from "next/image";
|
2 |
|
3 |
import HeaderImage from "@/assets/images/header.svg";
|
4 |
-
|
|
|
|
|
5 |
|
6 |
export const Header = () => {
|
|
|
|
|
7 |
return (
|
8 |
<header
|
9 |
-
className=
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
13 |
>
|
14 |
-
<div className="
|
15 |
-
<div className="
|
16 |
-
<
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
</div>
|
31 |
-
<
|
32 |
-
src={HeaderImage}
|
33 |
-
alt="Hugging Face header"
|
34 |
-
className="absolute w-full -right-10 bottom-0 max-w-lg lg:max-w-4xl z-[-1]"
|
35 |
-
/>
|
36 |
</div>
|
37 |
-
<div className="absolute bottom-0 w-full h-full left-0 bg-gradient-to-b from-transparent to-black z-[1]" />
|
38 |
</header>
|
39 |
);
|
40 |
};
|
|
|
1 |
+
"use client";
|
2 |
import Image from "next/image";
|
3 |
|
4 |
import HeaderImage from "@/assets/images/header.svg";
|
5 |
+
|
6 |
+
import { useInputGeneration } from "@/components/main/hooks/useInputGeneration";
|
7 |
+
import classNames from "classnames";
|
8 |
|
9 |
export const Header = () => {
|
10 |
+
const { hasMadeFirstGeneration } = useInputGeneration();
|
11 |
+
console.log(hasMadeFirstGeneration);
|
12 |
return (
|
13 |
<header
|
14 |
+
className={classNames(
|
15 |
+
"bg-black z-[1] transition-all duration-1000 overflow-hidden",
|
16 |
+
{
|
17 |
+
"!max-h-[0px]": hasMadeFirstGeneration,
|
18 |
+
"max-h-[450px]": !hasMadeFirstGeneration,
|
19 |
+
}
|
20 |
+
)}
|
21 |
>
|
22 |
+
<div className="relative bg-cover bg-fixed bg-black z-[1]">
|
23 |
+
<div className="flex items-start px-6 mx-auto max-w-[1722px] relative pt-24 pb-20">
|
24 |
+
<div className="w-full lg:w-1/2 relative z-10">
|
25 |
+
<h1 className="font-bold text-5xl lg:text-7xl text-white text-center lg:text-left">
|
26 |
+
Fast Stable <br />
|
27 |
+
Diffusion XL <br className="hidden lg:block" />
|
28 |
+
on TPU v5e ⚡
|
29 |
+
</h1>
|
30 |
+
<p className="text-sm text-white mt-3 text-center lg:text-left">
|
31 |
+
Powered by{" "}
|
32 |
+
<a
|
33 |
+
href="https://huggingface.co"
|
34 |
+
className="text-transparent bg-clip-text bg-gradient-to-r from-[#EFA596] to-[#ED94EB]"
|
35 |
+
>
|
36 |
+
HuggingFace.co
|
37 |
+
</a>
|
38 |
+
</p>
|
39 |
+
</div>
|
40 |
+
<Image
|
41 |
+
src={HeaderImage}
|
42 |
+
alt="Hugging Face header"
|
43 |
+
className="absolute w-full -right-10 bottom-0 max-w-lg lg:max-w-4xl z-[-1]"
|
44 |
+
/>
|
45 |
</div>
|
46 |
+
<div className="absolute bottom-0 w-full h-full left-0 bg-gradient-to-b from-transparent to-black z-[1]" />
|
|
|
|
|
|
|
|
|
47 |
</div>
|
|
|
48 |
</header>
|
49 |
);
|
50 |
};
|
components/main/collections/collection.tsx
CHANGED
@@ -33,9 +33,9 @@ export const Collection: React.FC<Props> = ({
|
|
33 |
initial={{ y: 100, opacity: 0 }}
|
34 |
animate={{ y: 0, opacity: 1 }}
|
35 |
transition={{ duration: 0.35, delay: index * 0.1 }}
|
36 |
-
className="rounded-
|
37 |
>
|
38 |
-
<div className="absolute top-0 left-0 w-full h-full translate-y-full opacity-0 transition-all duration-
|
39 |
<div className="bg-[#292424] backdrop-blur-sm bg-opacity-60 rounded-xl p-3 border-white/20 border w-full">
|
40 |
<p className="text-xs font-semibold text-white/60 mb-0.5">
|
41 |
27 October
|
@@ -52,7 +52,7 @@ export const Collection: React.FC<Props> = ({
|
|
52 |
style={{
|
53 |
backgroundImage: `url(${bufferToBase64})`,
|
54 |
}}
|
55 |
-
className="rounded-
|
56 |
/>
|
57 |
</motion.div>
|
58 |
</div>
|
|
|
33 |
initial={{ y: 100, opacity: 0 }}
|
34 |
animate={{ y: 0, opacity: 1 }}
|
35 |
transition={{ duration: 0.35, delay: index * 0.1 }}
|
36 |
+
className="rounded-[33px] h-[377px] cursor-pointer group overflow-hidden relative z-[1] group"
|
37 |
>
|
38 |
+
<div className="absolute top-0 left-0 w-full h-full translate-y-full opacity-0 transition-all duration-300 group-hover:translate-y-0 group-hover:opacity-100 flex items-end p-3">
|
39 |
<div className="bg-[#292424] backdrop-blur-sm bg-opacity-60 rounded-xl p-3 border-white/20 border w-full">
|
40 |
<p className="text-xs font-semibold text-white/60 mb-0.5">
|
41 |
27 October
|
|
|
52 |
style={{
|
53 |
backgroundImage: `url(${bufferToBase64})`,
|
54 |
}}
|
55 |
+
className="rounded-[33px] bg-red-400 bg-cover absolute top-0 left-0 w-full h-full z-[-1] transition-all duration-200 group-hover:scale-125 bg-center"
|
56 |
/>
|
57 |
</motion.div>
|
58 |
</div>
|
components/main/collections/index.tsx
CHANGED
@@ -15,13 +15,11 @@ export const Collections = () => {
|
|
15 |
|
16 |
if (loading) return;
|
17 |
|
18 |
-
console.log(collections);
|
19 |
-
|
20 |
return (
|
21 |
<div className="mx-auto grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-5 mt-8 lg:mt-14">
|
22 |
{collections?.map((collection: CollectionType, i: number) =>
|
23 |
collection?.id === -1 ? (
|
24 |
-
<CollectionLoading prompt={collection.prompt} />
|
25 |
) : (
|
26 |
<Collection
|
27 |
key={i}
|
|
|
15 |
|
16 |
if (loading) return;
|
17 |
|
|
|
|
|
18 |
return (
|
19 |
<div className="mx-auto grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-5 mt-8 lg:mt-14">
|
20 |
{collections?.map((collection: CollectionType, i: number) =>
|
21 |
collection?.id === -1 ? (
|
22 |
+
<CollectionLoading key={i} prompt={collection.prompt} />
|
23 |
) : (
|
24 |
<Collection
|
25 |
key={i}
|
components/main/hooks/useInputGeneration.ts
CHANGED
@@ -9,6 +9,7 @@ export const useInputGeneration = () => {
|
|
9 |
const { mutate: submit, isLoading: loading } = useMutation(
|
10 |
["generation"],
|
11 |
async () => {
|
|
|
12 |
client.setQueryData(["collections"], (old) => {
|
13 |
return [{
|
14 |
id: -1,
|
@@ -45,11 +46,15 @@ export const useInputGeneration = () => {
|
|
45 |
},
|
46 |
)
|
47 |
|
|
|
|
|
|
|
48 |
return {
|
49 |
prompt,
|
50 |
setPrompt,
|
51 |
loading,
|
52 |
submit,
|
|
|
53 |
}
|
54 |
|
55 |
}
|
|
|
9 |
const { mutate: submit, isLoading: loading } = useMutation(
|
10 |
["generation"],
|
11 |
async () => {
|
12 |
+
if (!hasMadeFirstGeneration) setFirstGenerationDone()
|
13 |
client.setQueryData(["collections"], (old) => {
|
14 |
return [{
|
15 |
id: -1,
|
|
|
46 |
},
|
47 |
)
|
48 |
|
49 |
+
const { data: hasMadeFirstGeneration } = useQuery(["firstGenerationDone"], () => false)
|
50 |
+
const setFirstGenerationDone = () => client.setQueryData(["firstGenerationDone"], true)
|
51 |
+
|
52 |
return {
|
53 |
prompt,
|
54 |
setPrompt,
|
55 |
loading,
|
56 |
submit,
|
57 |
+
hasMadeFirstGeneration
|
58 |
}
|
59 |
|
60 |
}
|