Skip to content

Commit 18f3cd2

Browse files
committed
UI and UX update
1 parent c17bf16 commit 18f3cd2

File tree

5 files changed

+85
-23
lines changed

5 files changed

+85
-23
lines changed

src/App.css

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
@tailwind components;
33
@tailwind utilities;
44

5-
.App {
6-
text-align: center;
7-
}
5+
*{
6+
margin:0;
7+
padding:0;
8+
}
89

910
.App-logo {
1011
height: 40vmin;
@@ -17,20 +18,6 @@
1718
}
1819
}
1920

20-
.App-header {
21-
background-color: #252525;
22-
height: 100vh;
23-
display: flex;
24-
flex-direction: column;
25-
align-items: center;
26-
justify-content: center;
27-
font-size: calc(10px + 2vmin);
28-
color: white;
29-
}
30-
31-
.App-link {
32-
color: #61dafb;
33-
}
3421

3522
@keyframes App-logo-spin {
3623
from {

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import SearchPage from "./pages/SearchPage.tsx";
77
import { GlobalContext } from "./context";
88

99
export default function App(){
10-
const API_URL=`http://127.0.0.1:5000`
10+
const API_URL=`https://gemmie.onrender.com`
1111
const [isSupported,setIsSupported]=useState(true)
1212
const [videoConstraints, setVideoConstraints]=useState<any>({
1313
width: screen.width-400,

src/pages/MainPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ export default function MainPage() {
8181
return (
8282
<>
8383
{isLoading&&isLoading?(
84-
<div style={{display:"flex",justifyContent:"center", background:"#252525", alignItems:"center", height:"100vh"}}>
84+
<div style={{display:"flex",justifyContent:"center", background:"#14161a", alignItems:"center", height:"100vh"}}>
8585
<p style={{fontSize:14, color:"white", textAlign:"center"}}>Loading, please wait...</p>
8686
</div>
8787
):(
88-
<div className="App h-screen">
89-
<header className="App-header">
88+
<div className="text-center h-screen">
89+
<header className="h-screen flex flex-col items-center justify-center text-white bg-[#14161a]">
9090
<Webcam
9191
ref={webcamRef}
9292
audio={false}

src/pages/NotSupported.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
export default function NotSupported(){
33
return(
4-
<div style={{display:"flex",justifyContent:"center", background:"#252525", alignItems:"center", height:"100vh"}}>
4+
<div style={{display:"flex",justifyContent:"center", background:"#14161a", alignItems:"center", height:"100vh"}}>
55
<p style={{fontSize:14, color:"white", textAlign:"center"}}>Warning, open this website on your mobile phone...</p>
66
</div>
77
)

src/pages/SearchPage.tsx

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,83 @@
1+
import { Link } from "react-router-dom";
2+
import { useContext, useEffect, useState } from "react"
3+
import { FaChevronLeft } from "react-icons/fa";
4+
import { FiMoreHorizontal } from "react-icons/fi";
5+
import { GlobalContext } from "../context";
6+
import { FaAngellist } from "react-icons/fa6";
7+
import { HiMiniSpeakerWave } from "react-icons/hi2";
18

29
export default function SearchPage(){
10+
const { videoConstraints, API_URL }=useContext(GlobalContext);
11+
const [results,setResults]=useState<any>(<></>)
12+
const [error,setError]=useState("")
13+
const [isLoading,setIsLoading]=useState(true)
14+
let capture:any=localStorage.getItem("capture")
15+
let query:any=localStorage.getItem("query")
16+
17+
async function getResults(){
18+
try{
19+
let url=`${API_URL}/api/prompt`
20+
21+
const response = await fetch(url, {
22+
method: 'POST',
23+
body: JSON.stringify({ prompt: `What is a ${query}` }),
24+
headers: {
25+
'content-type': 'application/json',
26+
},
27+
});
28+
29+
const parseRes = await response.json();
30+
if (parseRes.error) {
31+
setError(parseRes.error);
32+
setIsLoading(false)
33+
} else {
34+
let text=parseRes.text.replace(/<[^>]+>/g, '')
35+
setResults(text)
36+
setIsLoading(false)
37+
}
38+
}catch(error:any){
39+
setError(error.message)
40+
setIsLoading(false)
41+
}
42+
}
43+
44+
useEffect(()=>{
45+
getResults()
46+
},[])
347
return(
448
<>
5-
<p>Search page</p>
49+
{isLoading&&isLoading?(
50+
<div style={{display:"flex",justifyContent:"center", background:"#14161a", alignItems:"center", height:"100vh"}}>
51+
<p style={{fontSize:14, color:"white", textAlign:"center"}}>Searching, please wait...</p>
52+
</div>
53+
):(
54+
<div className="flex flex-col text-white bg-[#14161a] min-h-screen">
55+
<div className="fixed h-[0px] z-10 top-0 left-0 right-0">
56+
<div className="flex bg-none text-white items-center justify-between m-[20px]">
57+
<Link to="/">
58+
<FaChevronLeft className="w-[22px] h-[20px]"/>
59+
</Link>
60+
<p>Search</p>
61+
<button>
62+
<FiMoreHorizontal className="w-[22px] h-[22px]"/>
63+
</button>
64+
</div>
65+
</div>
66+
<div className="bg-[#2a2d33] rounded-b-[20px]">
67+
<img src={capture} width={videoConstraints.width} height={480} className="h-[380px] object-cover rounded-b-[20px]"/>
68+
<div className="flex items-center m-[15px] justify-between">
69+
<div className="flex gap-2">
70+
<FaAngellist className="w-[22px] h-[22px]"/>
71+
<p className="capitalize">{query}</p>
72+
</div>
73+
<HiMiniSpeakerWave className="w-[22px] h-[22px] ml-auto"/>
74+
</div>
75+
</div>
76+
<div className="flex flex-col m-[20px] text-sm">
77+
{results?results:(<p className="text-center">{error}</p>)}
78+
</div>
79+
</div>
80+
)}
681
</>
782
)
883
}

0 commit comments

Comments
 (0)