diff --git a/analyzer/app.py b/analyzer/app.py
index 48a1fd3..960d0d1 100644
--- a/analyzer/app.py
+++ b/analyzer/app.py
@@ -2,7 +2,7 @@
from flask_restful import Resource, Api
from convex import ConvexClient
from config import url as convex_url
-from treehacks2023.analyzer.boundingBoxes import computeBoundingBox
+from boundingBoxes import computeBoundingBox
app = Flask(__name__)
api = Api(app)
@@ -20,3 +20,13 @@ def get(self):
if __name__ == '__main__':
app.run(debug=True)
+
+messages = client.query("listMessages")
+print("PYTHON RPINT")
+print(messages)
+for message in messages:
+ if "format" in message and "url" in message and message["format"] == "image" and message["url"] != None:
+ print("URL", message["url"])
+ print(message["url"] == None)
+# from pprint import pprint
+# pprint(messages)
diff --git a/frontend/src/App.js b/frontend/src/App.js
index 7cfe5e6..ed4a3bd 100644
--- a/frontend/src/App.js
+++ b/frontend/src/App.js
@@ -2,11 +2,53 @@ import logo from './logo.svg';
import './App.css';
import { useQuery } from "./convex/_generated/react";
import { useMutation } from "./convex/_generated/react";
+import { useRef, useState } from "react";
+
+function Image({ message }) {
+ return ;
+}
function App() {
+ const messages = useQuery("listMessages") || [];
+
// const data = useQuery("listMessages");
- const sendMessage = useMutation("sendMessage");
- const sendHello = () => sendMessage("Hello!", "me");
+ const sendMessage = useMutation("sendMessage:sendMessage");
+ const sendHello = () => sendMessage("Hello!", "me2");
+
+
+ const [name] = useState(() => "User " + Math.floor(Math.random() * 10000));
+
+ const imageInput = useRef(null);
+ const [selectedImage, setSelectedImage] = useState(null);
+
+ const generateUploadUrl = useMutation("sendMessage:generateUploadUrl");
+ const sendImage = useMutation("sendMessage:sendImage");
+
+ // async function handleSendMessage(event) {
+ // event.preventDefault();
+ // setNewMessageText("");
+ // if (newMessageText) {
+ // await sendMessage(newMessageText, name);
+ // }
+ // }
+
+ async function handleSendImage(event) {
+ event.preventDefault();
+ setSelectedImage(null);
+ imageInput.current.value = "";
+
+ // Step 1: Get a short-lived upload URL
+ const postUrl = await generateUploadUrl();
+ // Step 2: POST the file to the URL
+ const result = await fetch(postUrl, {
+ method: "POST",
+ headers: { "Content-Type": selectedImage.type },
+ body: selectedImage,
+ });
+ const { storageId } = await result.json();
+ // Step 3: Save the newly allocated storage id to the messages table
+ await sendImage(storageId, name);
+ }
return (