Skip to content

Commit

Permalink
Render chat conversations as markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Nov 3, 2023
1 parent 6c4af66 commit fc9523b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions main.wasp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ app chatApp {
("node-fetch", "3.3.0"),
("react-hook-form", "^7.45.4"),
("stripe", "11.15.0"),
("react-markdown", "9.0.0"),
],
}

Expand Down
7 changes: 4 additions & 3 deletions src/client/ChatPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import logout from '@wasp/auth/logout';
import { useState, Dispatch, SetStateAction } from 'react';
// import { Chat, Conversation } from '@wasp/entities'
import { Link } from '@wasp/router'
import Markdown from 'react-markdown'

import logo from './static/captn-logo.png'
import createChat from '@wasp/actions/createChat'
Expand Down Expand Up @@ -53,9 +54,9 @@ const ConversationsList = ({ conversations }) => {
<span className="absolute inline-block" style={{"left": "-15px", "top": "6px", "height":" 45px", "width": "45px"}}>
{conversationLogo}
</span>
<span className="text-base">
{conversation.content}
</span>
<div className="chat-conversations text-base flex flex-col gap-2">
<Markdown>{conversation.content}</Markdown>
</div>
</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/client/Main.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ a {
a:hover {
color: rgb(99 102 241 / var(--tw-text-opacity));
}

.chat-conversations ol, .chat-conversations ul, .chat-conversations li{
list-style: auto;
margin:10px;
}

0 comments on commit fc9523b

Please sign in to comment.