Skip to content

Commit

Permalink
added: lodash lib
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTeida committed Jan 28, 2024
1 parent a81a68a commit e8f4f3e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Description soon
* React
* React Router
* OpenAI API 4.24.7
* JS
* Sass
* Joy UI
* Lodash
* Material Icons
* Day.js
* Day.js
* JS
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@mui/joy": "^5.0.0-beta.23",
"@mui/material": "^5.15.5",
"dayjs": "^1.11.10",
"lodash": "^4.17.21",
"openai": "^4.24.7",
"prop-types": "^15.8.1",
"react": "^18.2.0",
Expand Down
35 changes: 23 additions & 12 deletions src/components/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function Chat() {
}])
const [hoveredIndex, setHoveredIndex] = useState(null);
const [formDisabled, setFormDisabled] = useState(false);
const [tooltipVisible, setTooltipVisible] = useState(true);

const messagesEndRef = useRef(null);

Expand All @@ -35,6 +36,9 @@ function Chat() {

useEffect(() => {
messagesEndRef.current.scrollIntoView({behavior: "smooth"})
if (messages.length >= 2) {
setTooltipVisible(false)
}
}, [messages])

const handleSend = () => {
Expand All @@ -54,6 +58,10 @@ function Chat() {
setMessageSnackbar(message)
}

const handleTip = (tip) => {
setInput(tip)
}

return (
<Stack flex={8} spacing={2} sx={{height: 'calc(100dvh - var(--Header-height))', py: 2}}>
<Card sx={{
Expand Down Expand Up @@ -114,26 +122,29 @@ function Chat() {
)
})}
</Stack>
<Stack direction={{xs: "column", md: "row"}} spacing={2} justifyContent="center">
<Tooltip title="Test" arrow placement="top" sx={{flex: 1}}>
<Card onClick={() => console.log("1")}>
{tooltipVisible && <Stack direction={{xs: "column", md: "row"}} spacing={2} justifyContent="center">
<Tooltip title="Test" arrow placement="top" sx={{flex: 1, "&:hover": {cursor: "pointer"}}}>
<Card
onClick={() => handleTip("Brainstorm ideas for a unique and memorable marriage proposal")}>
<Typography level="title-sm">Brainstorm ideas</Typography>
<Typography level="body-sm">for a unique and memorable marriage proposal</Typography>
</Card>
</Tooltip>
<Tooltip title="Test" arrow placement="top" sx={{flex: 1}}>
<Card onClick={() => console.log("2")}>
<Typography level="title-sm">Test</Typography>
<Typography level="body-sm">Test</Typography>
<Tooltip title="Test" arrow placement="top" sx={{flex: 1, "&:hover": {cursor: "pointer"}}}>
<Card
onClick={() => handleTip("Suggest ways to improve productivity while working from home")}>
<Typography level="title-sm">Suggest ways</Typography>
<Typography level="body-sm">to improve productivity while working from home</Typography>
</Card>
</Tooltip>
<Tooltip title="Test" arrow placement="top" sx={{flex: 1}}>
<Card onClick={() => console.log("3")}>
<Typography level="title-sm">Test</Typography>
<Typography level="body-sm">Test</Typography>
<Tooltip title="Test" arrow placement="top" sx={{flex: 1, "&:hover": {cursor: "pointer"}}}>
<Card
onClick={() => handleTip("Recommend books for a book club focused on fantasy genres")}>
<Typography level="title-sm">Recommend books</Typography>
<Typography level="body-sm">for a book club focused on fantasy genres</Typography>
</Card>
</Tooltip>
</Stack>
</Stack>}
</Stack>
<Box ref={messagesEndRef}/>
</Card>
Expand Down

0 comments on commit e8f4f3e

Please sign in to comment.