Skip to content

Commit

Permalink
fix: header and ActionsContext
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTeida committed Jan 31, 2024
1 parent 5f74c1b commit 56f9b42
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
6 changes: 4 additions & 2 deletions src/components/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ function Chat() {
}, IncreaseAvailableActions).then(async (response) => {
IncreaseAvailableActions()
setOutput(response)
}).catch(() => {
}).catch((error) => {
console.log(error)
IncreaseImmediatelyAvailableActions()
})
}
Expand All @@ -91,7 +92,8 @@ function Chat() {
}, DecreaseAvailableActions).then(async (response) => {
IncreaseAvailableActions()
setOutput(response)
}).catch(() => {
}).catch((error) => {
console.log(error)
IncreaseImmediatelyAvailableActions()
})
}
Expand Down
37 changes: 28 additions & 9 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,17 @@ const Header = ({setOpenSettings}) => {
/>
</Stack>
<ModeToggle/>
<Dropdown >
<MenuButton sx={{borderRadius: 20, p: 0, ml: {xs: 0, md: 2}}} slots={{ root: IconButton }} slotProps={{ root: { variant: 'outlined', color: 'neutral'} }}
><Avatar variant="plain"/></MenuButton>
<Menu>
<MenuItem disabled>Profile</MenuItem>
<MenuItem disabled>My account</MenuItem>
<MenuItem disabled>Logout</MenuItem>
</Menu>
</Dropdown>
<Dropdown>
<MenuButton slots={{root: IconButton}} slotProps={{root: {variant: 'outlined', color: 'neutral'}}}
sx={{borderRadius: 20, p: 0, ml: {xs: 0, md: 2}, display: {xs: "none", md: "initial"}}}>
<Avatar variant="plain"/>
</MenuButton>
<Menu>
<MenuItem disabled>Profile</MenuItem>
<MenuItem disabled>My account</MenuItem>
<MenuItem disabled>Logout</MenuItem>
</Menu>
</Dropdown>
</Stack>

{location.pathname === '/NeuraChatAi/' &&
Expand Down Expand Up @@ -221,6 +223,23 @@ const Header = ({setOpenSettings}) => {
</ListItemButton>
</RouterLink>
</List>

<Box
sx={{
display: 'flex',
gap: 1,
p: 1.5,
pb: 2,
borderTop: '1px solid',
borderColor: 'divider',
}}
>
<Avatar size="lg"/>
<div>
<Typography level="title-md">Username</Typography>
<Typography level="body-sm">joined 20 Jun 2023</Typography>
</div>
</Box>
</Drawer>
</Sheet>
)
Expand Down
3 changes: 1 addition & 2 deletions src/contexts/ActionsContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ const ActionsProvider = ({children}) => {
setAvailableActions((prevActions) => prevActions + 1)
}, 20000)
}
console.log(timeRemaining)
}

const IncreaseImmediatelyAvailableActions = () => {
if (availableActions <= 3) {
if (availableActions < 3) {
setAvailableActions((prevActions) => prevActions + 1);
}
}
Expand Down

0 comments on commit 56f9b42

Please sign in to comment.