diff --git a/README.md b/README.md
index dceb217..58119ac 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,7 @@
-# Western9Hackathon
\ No newline at end of file
+# Western9Hackathon
+
+Krish from the future here, wanted to add a couple of notes for this project:
+
+- client is hosted on firebase
+- server is hosted on railway. Our trial runs out on about May 25th. We can't use vercel because this is repo lives in a team for which we need to pay for vercel.
+- to save time, I added all env variables to the repo, but I know that's not a good practice. Consequently I have made this repo private for now.
diff --git a/client/package.json b/client/package.json
index 15b6f70..7e8d16c 100644
--- a/client/package.json
+++ b/client/package.json
@@ -21,7 +21,7 @@
},
"scripts": {
"start": "react-scripts start",
- "build": "react-scripts build",
+ "build": "CI=false react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
diff --git a/client/src/components/Project.js b/client/src/components/Project.js
index 2f1c5bd..c2af226 100644
--- a/client/src/components/Project.js
+++ b/client/src/components/Project.js
@@ -54,7 +54,7 @@ const downsampleBuffer = (buffer, sampleRate, outSampleRate) => {
const sendAudioFile = async (file, lyrics) => {
const formData = new URLSearchParams({ recording: file, lyrics: lyrics });
- return fetch("https://prod-ghostwriter.herokuapp.com/api/recordings", {
+ return fetch("http://ghostwriter-production.up.railway.app/api/recordings", {
method: "POST",
body: formData,
headers: {
@@ -76,8 +76,7 @@ function Project() {
const [curBeat, setCurBeat] = useState(beat1);
const [play, { stop: stopBeat }] = useSound(curBeat);
const [transcripts, setTranscripts] = useState(null);
- const [outputData, setOutputData] = useState([]);
-
+ const [rhymes, setRhymes] = useState(null);
useEffect(() => {
setupSocket();
@@ -125,47 +124,37 @@ function Project() {
}
}, [newTranscript]);
-
- async function getRhymes(lastWord) {
- // const lastWord = transcript.split(" ").at(-1);
- // //if the transcript has ever read in the current word
- // console.log(rhymeSuggestions);
- // console.log('im straight', transcript.split(" ").slice(0, -1), lastWord);
-
- //totalTranscript but as an array but i want to remove the element
- if (totalTranscript.slice(0, -1).includes(lastWord)) {
- console.log("IM GAY.")
- rhymeSuggestions[lastWord] += 5;
- } else {
- rhymeSuggestions[lastWord] = 0;
+ useEffect(() => {
+ async function getRhymes(lastWord) {
+ // const lastWord = transcript.split(" ").at(-1);
+ // //if the transcript has ever read in the current word
+ // console.log(rhymeSuggestions);
+ // console.log('im straight', transcript.split(" ").slice(0, -1), lastWord);
+
+ //totalTranscript but as an array but i want to remove the element
+ if (totalTranscript.slice(0, -1).includes(lastWord)) {
+ rhymeSuggestions[lastWord] += 5;
+ } else {
+ rhymeSuggestions[lastWord] = 0;
+ }
+ await fetch("https://api.datamuse.com/words?rel_rhy=" + lastWord)
+ .then((response) => response.json())
+ .then((data) =>
+ setRhymes(
+ data.slice(
+ rhymeSuggestions[lastWord],
+ rhymeSuggestions[lastWord] + 5
+ )
+ )
+ );
}
- fetch("https://api.datamuse.com/words?rel_rhy=" + lastWord)
- .then((response) => response.json())
- .then((data) =>
- data
- .slice(rhymeSuggestions[lastWord], rhymeSuggestions[lastWord] + 5)
- .map((word, index) => {
- // console.log(word.word);
- /*
- setOutputData([...outputData, {
- word: lastWord,
- suggestions: [...outputData[index].suggestions, word.word]
- }])
- */
- })
- );
- }
- /*
- useEffect(() => {
- getRhymes();
- console.log('outputData', outputData);
+ getRhymes(transcript.split(" ").at(-1));
}, [transcript]);
- */
const fetchRecordings = async () => {
const response = await fetch(
- "https://prod-ghostwriter.herokuapp.com/api/get/recordings"
+ "http://ghostwriter-production.up.railway.app/api/get/recordings"
);
const data = await response.json();
setTranscripts(data);
@@ -173,7 +162,7 @@ function Project() {
};
const setupSocket = () => {
- socket.current = io("https://prod-ghostwriter.herokuapp.com/", {
+ socket.current = io("http://ghostwriter-production.up.railway.app/", {
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax: 5000,
@@ -287,9 +276,7 @@ function Project() {
{singleTranscript}
))} - {/*{rhyme.word}
; + })} +