@@ -5,6 +5,7 @@ import clsx from "clsx";
5
5
import AuthButtons , { LogOutButton } from "../components/authButtons" ;
6
6
import { useState } from "react" ;
7
7
import { trpc } from "../utils/trpc" ;
8
+ import Head from "next/head" ;
8
9
9
10
/// component to get all messages using react-query
10
11
const Messages = ( ) => {
@@ -31,7 +32,7 @@ const Messages = () => {
31
32
< span className = "text-gray-500" >
32
33
- < span className = "text-gray-300" > { msg . name } </ span > /
33
34
{ msg . createdAt . toString ( ) . split ( " " ) . slice ( 0 , 5 ) . join ( " " ) } { " " }
34
- { /** .split... remove the GMT ... from the outputted string */ }
35
+ { /** .split... removes the GMT ... from the outputted string */ }
35
36
</ span >
36
37
</ div >
37
38
) ;
@@ -58,7 +59,7 @@ const Home = () => {
58
59
onMutate : ( ) => {
59
60
ctx . cancelQuery ( [ "guestbook.getAllMessagesAndNames" ] ) ;
60
61
61
- let optimisticUpdate = ctx . getQueryData ( [
62
+ const optimisticUpdate = ctx . getQueryData ( [
62
63
"guestbook.getAllMessagesAndNames" ,
63
64
] ) ;
64
65
if ( optimisticUpdate ) {
@@ -88,11 +89,13 @@ const Home = () => {
88
89
return ;
89
90
}
90
91
92
+ /// when the message is < 100 && > 0 characters, we can post it and clear the error messages
91
93
postMessage . mutate ( {
92
94
name : session ?. user ?. name as string ,
93
95
message,
94
96
} ) ;
95
97
98
+ setError ( "" ) ;
96
99
setMessage ( "" ) ;
97
100
setLoading ( false ) ;
98
101
console . log ( "refetched!" ) ;
@@ -108,6 +111,11 @@ const Home = () => {
108
111
109
112
return (
110
113
< >
114
+ < Head >
115
+ < title > A.Pappas - Guestbook</ title >
116
+ < meta name = "description" content = "Sign the andreaspappas.xyz guestbook and leave a message for a future visitor of my site!" />
117
+ </ Head >
118
+
111
119
< header >
112
120
< h1 className = "text-3xl pt-4 pb-2 flex flex-col items-center" >
113
121
🦁 andreaspappas.xyz - Guestbook
0 commit comments