Skip to content

Commit

Permalink
chore: icon url
Browse files Browse the repository at this point in the history
  • Loading branch information
Bin-Huang committed May 7, 2023
1 parent 26e4489 commit 0c58c3c
Showing 1 changed file with 54 additions and 50 deletions.
104 changes: 54 additions & 50 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ function Main() {

const sortedSessions = sortSessions(store.chatSessions)
function handleDragEnd(event: DragEndEvent) {
const {active, over} = event;
const { active, over } = event;
if (!over) {
return
}
if (active.id !== over.id) {
const oldIndex = sortedSessions.findIndex(({id}) => id === active.id);
const newIndex = sortedSessions.findIndex(({id}) => id === over.id);
const oldIndex = sortedSessions.findIndex(({ id }) => id === active.id);
const newIndex = sortedSessions.findIndex(({ id }) => id === over.id);
const newReversed = arrayMove(sortedSessions, oldIndex, newIndex);
store.setSessions(sortSessions(newReversed))
}
}


// 是否展示设置窗口
const [openSettingWindow, setOpenSettingWindow] = React.useState(false);
Expand Down Expand Up @@ -210,14 +210,14 @@ function Main() {
}
)
}
const saveSession = async (session:Session) => {
const saveSession = async (session: Session) => {
const filePath = await save({
filters: [{
name: 'Export',
extensions: ['md']
name: 'Export',
extensions: ['md']
}]
});
if(filePath){
});
if (filePath) {
const content = session.messages
.map(msg => `**${msg.role}**:\n${msg.content}`)
.join('\n\n--------------------\n\n')
Expand Down Expand Up @@ -320,19 +320,23 @@ function Main() {
}}
spacing={2}
>
<Toolbar variant="dense" sx={{
display: "flex",
alignItems: "flex-end",
}} >
<img src={icon} style={{
width: '35px',
height: '35px',
marginRight: '5px',
}} />
<Typography variant="h5" color="inherit" component="div">
Chatbox
</Typography>
</Toolbar>
<a href='https://chatboxapp.xyz/redirect_app/homepage'
target='_blank' style={{ textDecoration: 'none' }}
>
<Toolbar variant="dense" sx={{
display: "flex",
alignItems: "flex-end",
}} >
<img src={icon} style={{
width: '35px',
height: '35px',
marginRight: '5px',
}} />
<Typography variant="h5" color="inherit" component="div">
Chatbox
</Typography>
</Toolbar>
</a>

<MenuList
sx={{
Expand All @@ -358,33 +362,33 @@ function Main() {
onDragEnd={handleDragEnd}
>
<SortableContext items={sortedSessions} strategy={verticalListSortingStrategy}>
{
sortedSessions.map((session, ix) => (
<SortableItem key={session.id} id={session.id}>
<SessionItem key={session.id}
selected={store.currentSession.id === session.id}
session={session}
switchMe={() => {
store.switchCurrentSession(session)
document.getElementById('message-input')?.focus() // better way?
}}
deleteMe={() => store.deleteChatSession(session)}
copyMe={() => {
const newSession = createSession(session.name + ' copied')
newSession.messages = session.messages
store.createChatSession(newSession, ix)
}}
switchStarred={() => {
store.updateChatSession({
...session,
starred: !session.starred
})
}}
editMe={() => setConfigureChatConfig(session)}
/>
</SortableItem>
))
}
{
sortedSessions.map((session, ix) => (
<SortableItem key={session.id} id={session.id}>
<SessionItem key={session.id}
selected={store.currentSession.id === session.id}
session={session}
switchMe={() => {
store.switchCurrentSession(session)
document.getElementById('message-input')?.focus() // better way?
}}
deleteMe={() => store.deleteChatSession(session)}
copyMe={() => {
const newSession = createSession(session.name + ' copied')
newSession.messages = session.messages
store.createChatSession(newSession, ix)
}}
switchStarred={() => {
store.updateChatSession({
...session,
starred: !session.starred
})
}}
editMe={() => setConfigureChatConfig(session)}
/>
</SortableItem>
))
}
</SortableContext>
</DndContext>
</MenuList>
Expand Down Expand Up @@ -426,7 +430,7 @@ function Main() {
</ListItemIcon>
<ListItemText>
<Badge color="primary" variant="dot" invisible={!store.needCheckUpdate}
sx={{ paddingRight: '8px' }} >
sx={{ paddingRight: '8px' }} >
<Typography sx={{ opacity: 0.5 }}>
{t('About')} ({store.version})
</Typography>
Expand Down

0 comments on commit 0c58c3c

Please sign in to comment.