Added MIT License

Added README as basis for EPQ explanation
Added PAPERWORK as basis for Project Proposal Form
This commit is contained in:
Zhongheng Liu 2024-01-03 18:19:45 +02:00
commit e7a64d07f4
No known key found for this signature in database
5 changed files with 111 additions and 48 deletions

View file

@ -33,7 +33,7 @@ const ChatWrapper = (
stompClient.subscribe(endpoints.subscription, (message) => {
console.log(`Collected new message: ${message.body}`);
const messageBody = JSON.parse(message.body) as Message
if (messageBody.type === MessageType.MESSAGE) {return;}
// if (messageBody.type !== MessageType.MESSAGE) {return;}
const messageElement = <MessageContainer {...messageBody} />
console.log(messageElement);
@ -46,6 +46,7 @@ const ChatWrapper = (
});
stompClient.publish({
body: JSON.stringify({
type: MessageType.HELLO,
fromUserId: user,
toUserId: "everyone",
content: `${user} has joined the server!`,
@ -74,7 +75,7 @@ const ChatWrapper = (
if (!entryElement.value) {alert("Message cannot be empty!"); return;}
const messageData: Message =
{
type: MessageType.HELLO,
type: MessageType.MESSAGE,
fromUserId: user,
toUserId: "everyone",
content: entryElement.value,

View file

@ -9,7 +9,16 @@ export const MessageContainer = (
content,
timeMillis,
}: Message
): React.ReactElement<{ sender: string; text: string; }> => {
): React.ReactElement<Message> => {
const dateTime: Date = new Date(timeMillis);
return (<p>[{dateTime.toLocaleString(Intl.DateTimeFormat().resolvedOptions().timeZone)}] Message from {fromUserId}: {content}</p>);
/* FIXED funny error
* DESCRIPTION
* The line below was
* return (<p>[{dateTime.toLocaleString(Intl.DateTimeFormat().resolvedOptions().timeZone)}]...</p>)
* The line incorrectly generated a value of "UTC" as the parameter to toLocaleString()
* While "UTC" is an accepted string value, in EEST, aka. "Europe/Athens" timezone string is not an acceptable parameter.
* This caused the return statement to fail, and the message fails to render, despite it being correctly committed to the db.
* Funny clown moment 🤡
*/
return (<p>[{dateTime.toLocaleString()}] Message from {fromUserId}: {content}</p>);
};