mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-29 06:00:52 +02:00
Improve conversation preview layout
This commit is contained in:
@@ -858,7 +858,7 @@ html[data-theme="dark"] .vulnerability-alert-switch input:disabled + .vulnerabil
|
|||||||
}
|
}
|
||||||
|
|
||||||
.conversation-sidebar {
|
.conversation-sidebar {
|
||||||
width: 280px;
|
width: 320px;
|
||||||
background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
|
background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
|
||||||
border-right: 1px solid var(--border-color);
|
border-right: 1px solid var(--border-color);
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -44995,7 +44995,7 @@ html[data-theme="dark"] .project-folder-preview-edit:focus-visible {
|
|||||||
.project-conversation-preview {
|
.project-conversation-preview {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 1200;
|
z-index: 1200;
|
||||||
width: min(300px, calc(100vw - 32px));
|
width: min(340px, calc(100vw - 32px));
|
||||||
padding: 12px 14px 11px;
|
padding: 12px 14px 11px;
|
||||||
border: 1px solid rgba(30, 41, 59, 0.15);
|
border: 1px solid rgba(30, 41, 59, 0.15);
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
@@ -45011,11 +45011,12 @@ html[data-theme="dark"] .project-folder-preview-edit:focus-visible {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.project-conversation-preview-header {
|
.project-conversation-preview-header {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: minmax(0, 1fr) auto;
|
flex-direction: column;
|
||||||
align-items: baseline;
|
align-items: flex-start;
|
||||||
gap: 10px;
|
gap: 3px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.project-conversation-preview-title {
|
.project-conversation-preview-title {
|
||||||
@@ -45025,8 +45026,11 @@ html[data-theme="dark"] .project-folder-preview-edit:focus-visible {
|
|||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
line-height: 1.35;
|
line-height: 1.35;
|
||||||
text-overflow: ellipsis;
|
display: -webkit-box;
|
||||||
white-space: nowrap;
|
-webkit-line-clamp: 2;
|
||||||
|
line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
.project-conversation-preview-age {
|
.project-conversation-preview-age {
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ function functionSource(source, name, nextName) {
|
|||||||
return source.slice(start, end);
|
return source.slice(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cssBlock(source, selector) {
|
||||||
|
const match = source.match(new RegExp(`${selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*\\{[^}]*\\}`));
|
||||||
|
assert.ok(match, `${selector} style block should exist`);
|
||||||
|
return match[0];
|
||||||
|
}
|
||||||
|
|
||||||
test('无项目文件夹与普通项目共用悬浮和键盘聚焦预览', () => {
|
test('无项目文件夹与普通项目共用悬浮和键盘聚焦预览', () => {
|
||||||
const source = functionSource(projects, 'appendChatProjectFolderItem', 'appendChatProjectConversationItem');
|
const source = functionSource(projects, 'appendChatProjectFolderItem', 'appendChatProjectConversationItem');
|
||||||
|
|
||||||
@@ -122,3 +128,13 @@ test('对话悬浮预览显示本地年月日时分', () => {
|
|||||||
assert.match(zh, /"conversationPreviewDateTime": "\{\{year\}\}年\{\{month\}\}月\{\{day\}\}日 \{\{hour\}\}:\{\{minute\}\}"/);
|
assert.match(zh, /"conversationPreviewDateTime": "\{\{year\}\}年\{\{month\}\}月\{\{day\}\}日 \{\{hour\}\}:\{\{minute\}\}"/);
|
||||||
assert.match(en, /"conversationPreviewDateTime": "\{\{year\}\}-\{\{month\}\}-\{\{day\}\} \{\{hour\}\}:\{\{minute\}\}"/);
|
assert.match(en, /"conversationPreviewDateTime": "\{\{year\}\}-\{\{month\}\}-\{\{day\}\} \{\{hour\}\}:\{\{minute\}\}"/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('对话悬浮预览标题与时间分行显示并保留更多标题内容', () => {
|
||||||
|
const titleStyles = cssBlock(styles, '.project-conversation-preview-title');
|
||||||
|
|
||||||
|
assert.match(styles, /\.conversation-sidebar\s*\{[\s\S]*?width: 320px;/);
|
||||||
|
assert.match(styles, /\.project-conversation-preview\s*\{[\s\S]*?width: min\(340px, calc\(100vw - 32px\)\);/);
|
||||||
|
assert.match(styles, /\.project-conversation-preview-header\s*\{[\s\S]*?flex-direction: column;[\s\S]*?align-items: flex-start;/);
|
||||||
|
assert.match(titleStyles, /-webkit-line-clamp: 2;/);
|
||||||
|
assert.doesNotMatch(titleStyles, /white-space: nowrap;/);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user