-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
174 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import * as React from 'react'; | ||
import TimeAgo from 'react-timeago'; | ||
|
||
import { Box, ListDivider, ListItem, ListItemDecorator, MenuItem, Typography } from '@mui/joy'; | ||
import ArrowBackIcon from '@mui/icons-material/ArrowBack'; | ||
|
||
import { useChatLinkItems } from '../chat/trade/trade-store'; | ||
|
||
import { Brand } from '~/common/brand'; | ||
import { Link } from '~/common/components/Link'; | ||
import { closeLayoutDrawerMenu } from '~/common/layout/store-applayout'; | ||
import { getChatLinkRelativePath, getHomeLink } from '~/common/routes'; | ||
|
||
|
||
/** | ||
* Drawer Items are all the links already shared, for quick access. | ||
* This is stores in the Trade Store (local storage). | ||
*/ | ||
export function AppChatLinkDrawerItems() { | ||
|
||
// external state | ||
const chatLinkItems = useChatLinkItems() | ||
.slice() | ||
.sort((a, b) => b.createdAt.localeCompare(a.createdAt)); | ||
const notEmpty = chatLinkItems.length > 0; | ||
|
||
return <> | ||
|
||
<MenuItem | ||
onClick={closeLayoutDrawerMenu} | ||
component={Link} href={getHomeLink()} noLinkStyle | ||
> | ||
<ListItemDecorator><ArrowBackIcon /></ListItemDecorator> | ||
{Brand.Title.Base} | ||
</MenuItem> | ||
|
||
{notEmpty && <ListDivider />} | ||
|
||
{notEmpty && <ListItem> | ||
<Typography level='body-sm'> | ||
Links shared by you | ||
</Typography> | ||
</ListItem>} | ||
|
||
{notEmpty && <Box sx={{ overflowY: 'auto' }}> | ||
{chatLinkItems.map(item => ( | ||
|
||
<MenuItem | ||
key={'chat-link-' + item.objectId} | ||
component={Link} href={getChatLinkRelativePath(item.objectId)} noLinkStyle | ||
sx={{ | ||
display: 'flex', flexDirection: 'column', | ||
alignItems: 'flex-start', | ||
}} | ||
> | ||
<Typography level='title-sm'> | ||
{item.chatTitle || 'Untitled Chat'} | ||
</Typography> | ||
<Typography level='body-xs'> | ||
<TimeAgo date={item.createdAt} /> | ||
</Typography> | ||
</MenuItem> | ||
|
||
))} | ||
</Box>} | ||
</>; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import * as React from 'react'; | ||
import { shallow } from 'zustand/shallow'; | ||
|
||
import { MenuItem, Switch, Typography } from '@mui/joy'; | ||
|
||
import { useUIPreferencesStore } from '~/common/state/store-ui'; | ||
|
||
|
||
/** | ||
* Menu Items are the settings for the chat. | ||
*/ | ||
export function AppChatLinkMenuItems() { | ||
|
||
// external state | ||
const { | ||
showSystemMessages, setShowSystemMessages, | ||
renderMarkdown, setRenderMarkdown, | ||
zenMode, setZenMode, | ||
} = useUIPreferencesStore(state => ({ | ||
showSystemMessages: state.showSystemMessages, setShowSystemMessages: state.setShowSystemMessages, | ||
renderMarkdown: state.renderMarkdown, setRenderMarkdown: state.setRenderMarkdown, | ||
zenMode: state.zenMode, setZenMode: state.setZenMode, | ||
}), shallow); | ||
|
||
|
||
const handleRenderSystemMessageChange = (event: React.ChangeEvent<HTMLInputElement>) => setShowSystemMessages(event.target.checked); | ||
const handleRenderMarkdownChange = (event: React.ChangeEvent<HTMLInputElement>) => setRenderMarkdown(event.target.checked); | ||
const handleZenModeChange = (event: React.ChangeEvent<HTMLInputElement>) => setZenMode(event.target.checked ? 'cleaner' : 'clean'); | ||
|
||
const zenOn = zenMode === 'cleaner'; | ||
|
||
|
||
return <> | ||
|
||
<MenuItem onClick={() => setShowSystemMessages(!showSystemMessages)} sx={{ justifyContent: 'space-between' }}> | ||
<Typography> | ||
System message | ||
</Typography> | ||
<Switch | ||
checked={showSystemMessages} onChange={handleRenderSystemMessageChange} | ||
// endDecorator={showSystemMessages ? 'On' : 'Off'} | ||
slotProps={{ endDecorator: { sx: { minWidth: 26 } } }} | ||
/> | ||
</MenuItem> | ||
|
||
<MenuItem onClick={() => setRenderMarkdown(!renderMarkdown)} sx={{ justifyContent: 'space-between' }}> | ||
<Typography> | ||
Markdown | ||
</Typography> | ||
<Switch | ||
checked={renderMarkdown} onChange={handleRenderMarkdownChange} | ||
// endDecorator={renderMarkdown ? 'On' : 'Off'} | ||
slotProps={{ endDecorator: { sx: { minWidth: 26 } } }} | ||
/> | ||
</MenuItem> | ||
|
||
<MenuItem onClick={() => setZenMode(zenOn ? 'clean' : 'cleaner')} sx={{ justifyContent: 'space-between' }}> | ||
<Typography> | ||
Zen | ||
</Typography> | ||
<Switch | ||
checked={zenOn} onChange={handleZenModeChange} | ||
// endDecorator={zenOn ? 'On' : 'Off'} | ||
slotProps={{ endDecorator: { sx: { minWidth: 26 } } }} | ||
/> | ||
</MenuItem> | ||
|
||
</>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
188a18d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
big-agi – ./
get.big-agi.com
big-agi-enricoros.vercel.app
big-agi-git-main-enricoros.vercel.app