update msgboard UX
This commit is contained in:
parent
702eaa1f94
commit
a0cfd23825
|
|
@ -12,6 +12,7 @@ import { ChatBoxTool } from '@/tools/ChatBoxTool'
|
||||||
import { IChatBoxShape, ChatBoxShape } from '@/shapes/ChatBoxShape'
|
import { IChatBoxShape, ChatBoxShape } from '@/shapes/ChatBoxShape'
|
||||||
import { multiplayerAssetStore } from '../client/multiplayerAssetStore' // Adjusted path if necessary
|
import { multiplayerAssetStore } from '../client/multiplayerAssetStore' // Adjusted path if necessary
|
||||||
import { customSchema } from '../../worker/TldrawDurableObject'
|
import { customSchema } from '../../worker/TldrawDurableObject'
|
||||||
|
import './ChatBoxStyles.css' // Add a CSS file for styles
|
||||||
|
|
||||||
const WORKER_URL = `https://jeffemmett-canvas.jeffemmett.workers.dev`
|
const WORKER_URL = `https://jeffemmett-canvas.jeffemmett.workers.dev`
|
||||||
|
|
||||||
|
|
@ -62,6 +63,22 @@ export function Board() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assuming you have a message structure like this
|
||||||
|
interface ChatMessage {
|
||||||
|
id: string;
|
||||||
|
text: string;
|
||||||
|
isUser: boolean; // New property to identify the sender
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example rendering function for messages
|
||||||
|
function renderMessage(message: ChatMessage) {
|
||||||
|
return (
|
||||||
|
<div className={message.isUser ? 'user-message' : 'other-message'}>
|
||||||
|
{message.text}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// How does our server handle bookmark unfurling?
|
// How does our server handle bookmark unfurling?
|
||||||
async function unfurlBookmarkUrl({ url }: { url: string }): Promise<TLBookmarkAsset> {
|
async function unfurlBookmarkUrl({ url }: { url: string }): Promise<TLBookmarkAsset> {
|
||||||
const asset: TLBookmarkAsset = {
|
const asset: TLBookmarkAsset = {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/* General chatbox styles */
|
||||||
|
.chatbox {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 8px;
|
||||||
|
max-width: 400px; /* Adjust as needed */
|
||||||
|
margin: auto; /* Center on the page */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Message styles */
|
||||||
|
.message {
|
||||||
|
padding: 8px;
|
||||||
|
margin: 5px 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
word-wrap: break-word; /* Ensure long words break */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* User message styles */
|
||||||
|
.user-message {
|
||||||
|
background-color: #d1e7dd; /* Light green */
|
||||||
|
color: #0c5460; /* Darker text color for contrast */
|
||||||
|
align-self: flex-end; /* Align to the right */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Other message styles */
|
||||||
|
.other-message {
|
||||||
|
background-color: #f8d7da; /* Light red */
|
||||||
|
color: #721c24; /* Darker text color for contrast */
|
||||||
|
align-self: flex-start; /* Align to the left */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Input area styles */
|
||||||
|
.input-area {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-area input {
|
||||||
|
flex: 1;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-area button {
|
||||||
|
padding: 10px;
|
||||||
|
margin-left: 5px;
|
||||||
|
border: none;
|
||||||
|
background-color: #007bff; /* Bootstrap primary color */
|
||||||
|
color: white;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-area button:hover {
|
||||||
|
background-color: #0056b3; /* Darker shade on hover */
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue