Skip to content

Commit

Permalink
cleaned up stripping logic, added favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
engineerjoe440 committed Sep 1, 2024
1 parent 54e2372 commit 0395bdd
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 21 deletions.
6 changes: 4 additions & 2 deletions backend/wordwall/api/words.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ async def get_words_for_wall(
if player_id:
extra_filters["player_id"] = player_id
word_records = await WordResponse.filter(
WordResponse.gt('word', ""), # Ensure Not Empty
wall_hash=wall.hash
wall_hash=wall.hash,
**extra_filters
)
if player_id:
# Loading for a Player Page
return word_records
words = {}
for record in word_records:
if not record.word:
# Null/Empty -- Skip
continue
cleaned_word = record.word.strip()
if cleaned_word not in words:
words[cleaned_word] = 1 # Record Word
Expand Down
Binary file removed frontend/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions frontend/public/file-word-box-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions frontend/public/file-word-box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="%PUBLIC_URL%/file-word-box-outline.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Simple, Self-Hosted, Collaborative Word Cloud Generator."
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/file-word-box.svg" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>WordWall</title>
</head>
Expand Down
Binary file removed frontend/public/logo192.png
Binary file not shown.
Binary file removed frontend/public/logo512.png
Binary file not shown.
35 changes: 18 additions & 17 deletions frontend/src/FloatingCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,29 @@ export default function FloatingCloud({wall_id = "test", onClick=() => {}}) {
const [words, setWords] = React.useState([]);

React.useEffect(()=>{
// Define API Getter
const getWords = () => {
// Call the API
fetch(`/api/v1/words/${wall_id}`)
.then(response => {
if (!response.ok) {
throw new Error("HTTP error " + response.status);
}
return response.json();
})
.then(json => {
setWords(json);
})
.catch(function () {
console.error(`Failed to load words for ${wall_id}`)
})
}
// Load Requisites when page Completes
getWords();
setInterval(getWords, 1000);
},[]);
},[wall_id]);


const getWords = () => {
// Call the API
fetch(`/api/v1/words/${wall_id}`)
.then(response => {
if (!response.ok) {
throw new Error("HTTP error " + response.status);
}
return response.json();
})
.then(json => {
setWords(json);
})
.catch(function () {
console.error(`Failed to load words for ${wall_id}`)
})
}

return (
<>
Expand Down

0 comments on commit 0395bdd

Please sign in to comment.