diff --git a/client/package-lock.json b/client/package-lock.json index 75280788..fecb4d4d 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -18,6 +18,7 @@ "graphology": "^0.25.4", "graphology-layout": "^0.6.1", "graphology-layout-force": "^0.2.4", + "highlight.js": "^11.10.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-hook-form": "^7.53.0", @@ -2507,6 +2508,14 @@ "node": ">= 0.4" } }, + "node_modules/highlight.js": { + "version": "11.10.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz", + "integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", diff --git a/client/package.json b/client/package.json index d845f2f9..ca4a0694 100644 --- a/client/package.json +++ b/client/package.json @@ -13,6 +13,7 @@ "graphology": "^0.25.4", "graphology-layout": "^0.6.1", "graphology-layout-force": "^0.2.4", + "highlight.js": "^11.10.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-hook-form": "^7.53.0", diff --git a/client/src/apiTools.jsx b/client/src/apiTools.jsx index b12beeb3..4cec4b57 100644 --- a/client/src/apiTools.jsx +++ b/client/src/apiTools.jsx @@ -50,10 +50,10 @@ export async function fetchPageAtEdit(number, id) { return shoofetch(`${apiUrl}/page/${number}/${id}`, {method: 'GET'}); } -export async function postPage({id, title, description}) { +export async function postPage({id, title, description, type}) { return shoofetch(`${apiUrl}/page/${id}`, { method: 'POST', - body: JSON.stringify({id: id, title: title, description: description}), + body: JSON.stringify({id: id, title: title, description: description, type: type}), }) } @@ -98,4 +98,8 @@ export async function postLogOut() { export async function fetchProfile() { return shoofetch(`${apiUrl}/user`, {method: 'GET'}); +} + +export async function fetchCurrentVerbs() { + return shoofetch(`${apiUrl}/embody/verbs`, {method: 'GET'}); } \ No newline at end of file diff --git a/client/src/embodied/Live.jsx b/client/src/embodied/Live.jsx index 6c83bfda..5c89726c 100644 --- a/client/src/embodied/Live.jsx +++ b/client/src/embodied/Live.jsx @@ -64,7 +64,7 @@ function Live({editing, ...props}) { - + { console.log(w); sendMessage(w); } }/> ); } diff --git a/client/src/embodied/MessageFeed.css b/client/src/embodied/MessageFeed.css index 013e2fba..23847ab8 100644 --- a/client/src/embodied/MessageFeed.css +++ b/client/src/embodied/MessageFeed.css @@ -22,4 +22,7 @@ } .messages-tray li { list-style: none; +} +.messages-tray li:nth-child(even) { + background: lightgray; } \ No newline at end of file diff --git a/client/src/embodied/Sidebar.jsx b/client/src/embodied/Sidebar.jsx index 88352d09..c9e64aff 100644 --- a/client/src/embodied/Sidebar.jsx +++ b/client/src/embodied/Sidebar.jsx @@ -1,5 +1,7 @@ import { useState } from 'react'; +import { useQuery } from '@tanstack/react-query'; import { useLoggedIn } from '../AuthProvider.jsx'; +import { fetchCurrentVerbs } from '../apiTools.jsx'; import './Sidebar.css'; @@ -7,13 +9,18 @@ function Sidebar({children, pagenumber, hidden=false, sendWord=(()=>null)}) { const [open, setOpen] = useState(!hidden); const loggedIn = useLoggedIn(); - const verbs = ["go", "take"]; + const { isPending, isError, error, data } = useQuery({ // fetch the currrent values + queryKey: ['my verbs'], + queryFn: fetchCurrentVerbs, + }); + + const verbs = data; return (
    - {verbs.map( (name) => ( + {(verbs || []).map( (name) => (