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

Display chat title #1100

Merged
merged 1 commit into from
Mar 18, 2024
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
15 changes: 13 additions & 2 deletions packages/host/app/components/ai-assistant/panel.gts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export default class AiAssistantPanel extends Component<Signature> {
width='20'
height='20'
/>
<h3 class='panel-title-text'>Assistant</h3>
<h3 class='panel-title-text' data-test-chat-title>
{{if this.currentRoom.name this.currentRoom.name 'Assistant'}}
</h3>
</div>
{{/if}}
<IconButton
Expand Down Expand Up @@ -193,27 +195,36 @@ export default class AiAssistantPanel extends Component<Signature> {
z-index: 1;
}
.panel-header {
--panel-title-height: 44px;
position: relative;
padding: var(--boxel-sp) calc(var(--boxel-sp) / 2) var(--boxel-sp)
var(--boxel-sp-lg);
}
.panel-title-group {
height: var(--panel-title-height);
align-items: center;
display: flex;
gap: var(--boxel-sp-xs);
margin-bottom: var(--boxel-sp);
}
.panel-title-text {
margin: 0;
padding-right: var(--boxel-sp-xl);
color: var(--boxel-light);
font: 700 var(--boxel-font);
letter-spacing: var(--boxel-lsp);
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.close-ai-panel {
--icon-color: var(--boxel-highlight);
position: absolute;
right: var(--boxel-sp-xs);
top: var(--boxel-sp-sm);
top: var(--boxel-sp);
height: var(--panel-title-height);
z-index: 1;
}
.header-buttons {
Expand Down
8 changes: 8 additions & 0 deletions packages/matrix/tests/room-creation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,13 @@ test.describe('Room creation', () => {

let room1 = await getRoomName(page);
await assertRooms(page, [room1]);
await expect(page.locator(`[data-test-chat-title]`)).toHaveCount(0);
await sendMessage(page, room1, 'Hello');
await expect(page.locator(`[data-test-chat-title]`)).toHaveText(room1);

let room2 = await createRoomWithMessage(page);
await expect(page.locator(`[data-test-chat-title]`)).toHaveText(room2);

let room3 = await createRoom(page);
await assertRooms(page, [room1, room2, room3]);

Expand Down Expand Up @@ -136,6 +140,7 @@ test.describe('Room creation', () => {

await openRoom(page, newRoom1);
await expect(page.locator(`[data-test-room="${newRoom1}"]`)).toHaveCount(1);
await expect(page.locator(`[data-test-chat-title]`)).toHaveText(newRoom1);

await reloadAndOpenAiAssistant(page);
await assertRooms(page, [newRoom1, room2, room3]);
Expand Down Expand Up @@ -273,10 +278,12 @@ test.describe('Room creation', () => {
await assertRooms(page, [room1, room2, room3]);

await isInRoom(page, room3);
await expect(page.locator(`[data-test-chat-title]`)).toHaveText(room3);
await deleteRoom(page, room3); // current room is deleted
await page.locator(`[data-test-close-past-sessions]`).click();
await assertRooms(page, [room1, room2]);
await isInRoom(page, room2); // is in latest available room
await expect(page.locator(`[data-test-chat-title]`)).toHaveText(room2);

await deleteRoom(page, room1); // a different room is deleted
await page.locator(`[data-test-close-past-sessions]`).click();
Expand All @@ -289,6 +296,7 @@ test.describe('Room creation', () => {
let newRoom = await getRoomName(page);
await isInRoom(page, newRoom);
await assertRooms(page, [newRoom]);
await expect(page.locator(`[data-test-chat-title]`)).toHaveCount(0);
});

test('it orders past-sessions list items based on last activity in reverse chronological order', async ({
Expand Down
Loading