Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: align chat page title center on mobile screen #2132

Merged
merged 1 commit into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/components/chat.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
.chat-input-actions {
display: flex;
flex-wrap: wrap;
margin-bottom: 10px;

.chat-input-action {
display: inline-flex;
Expand Down Expand Up @@ -328,6 +327,12 @@
flex-direction: column;
border-top: var(--border-in-light);
box-shadow: var(--card-shadow);

.chat-input-actions {
.chat-input-action {
margin-bottom: 10px;
}
}
}

@mixin single-line {
Expand Down Expand Up @@ -400,6 +405,8 @@
padding: 10px 90px 10px 14px;
resize: none;
outline: none;
box-sizing: border-box;
min-height: 68px;
}

.chat-input:focus {
Expand Down
37 changes: 22 additions & 15 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,19 @@ export function Chat() {
return (
<div className={styles.chat} key={session.id}>
<div className="window-header" data-tauri-drag-region>
{isMobileScreen && (
<div className="window-actions">
<div className={"window-action-button"}>
<IconButton
icon={<ReturnIcon />}
bordered
title={Locale.Chat.Actions.ChatList}
onClick={() => navigate(Path.Home)}
/>
</div>
</div>
)}

<div className="window-header-title">
<div
className={`window-header-main-title " ${styles["chat-body-title"]}`}
Expand All @@ -807,21 +820,15 @@ export function Chat() {
</div>
</div>
<div className="window-actions">
<div className={"window-action-button" + " " + styles.mobile}>
<IconButton
icon={<ReturnIcon />}
bordered
title={Locale.Chat.Actions.ChatList}
onClick={() => navigate(Path.Home)}
/>
</div>
<div className="window-action-button">
<IconButton
icon={<RenameIcon />}
bordered
onClick={renameSession}
/>
</div>
{!isMobileScreen && (
<div className="window-action-button">
<IconButton
icon={<RenameIcon />}
bordered
onClick={renameSession}
/>
</div>
)}
<div className="window-action-button">
<IconButton
icon={<ExportIcon />}
Expand Down
2 changes: 1 addition & 1 deletion app/locales/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const cn = {
ChatItemCount: (count: number) => `${count} 条对话`,
},
Chat: {
SubTitle: (count: number) => `与 ChatGPT 的 ${count} 条对话`,
SubTitle: (count: number) => ` ${count} 条对话`,
Actions: {
ChatList: "查看消息列表",
CompressedHistory: "查看压缩后的历史 Prompt",
Expand Down
2 changes: 1 addition & 1 deletion app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const en: LocaleType = {
ChatItemCount: (count: number) => `${count} messages`,
},
Chat: {
SubTitle: (count: number) => `${count} messages with ChatGPT`,
SubTitle: (count: number) => `${count} messages`,
Actions: {
ChatList: "Go To Chat List",
CompressedHistory: "Compressed History Memory Prompt",
Expand Down
6 changes: 5 additions & 1 deletion app/styles/window.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
font-size: 14px;
margin-top: 5px;
}

@media screen and (max-width: 600px) {
text-align: center;
}
}

.window-actions {
display: inline-flex;
}

.window-action-button {
.window-action-button:not(:first-child) {
margin-left: 10px;
}