Skip to content

Commit 72b817b

Browse files
authored
Merge pull request #76 from element-hq/langley/use-sc-room-list
Use the shared components room list
2 parents 83627f6 + cd31513 commit 72b817b

24 files changed

Lines changed: 1054 additions & 1098 deletions

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"biome:format": "yarn biome format --write ."
2121
},
2222
"dependencies": {
23-
"@element-hq/web-shared-components": "0.0.1",
23+
"@element-hq/web-shared-components": "0.0.2",
2424
"@tauri-apps/api": "^1.5.2",
2525
"@vector-im/compound-design-tokens": "^6.0.0",
26-
"@vector-im/compound-web": "^8.2.1",
26+
"@vector-im/compound-web": "^8.3.6",
2727
"async-mutex": "^0.4.1",
2828
"classnames": "^2.5.1",
2929
"lodash-es": "^4.17.21",

src/App.css

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -68,60 +68,11 @@ body {
6868
display: flex;
6969
/* this is important, to stop roomlist pushing the composer off the bottom */
7070
flex-direction: column;
71-
flex: 0 0 auto;
71+
flex: 0 0 320px;
72+
width: 320px;
7273
border-right: 1px solid #262628;
7374
}
7475

75-
.mx_RoomList ol {
76-
overflow: scroll;
77-
/* this is important, to stop roomlist pushing the composer off the bottom */
78-
flex: 1 1 0;
79-
margin: 0px;
80-
padding: 0px;
81-
}
82-
83-
.mx_RoomList li {
84-
list-style-type: none;
85-
}
86-
87-
.mx_RoomTile {
88-
position: relative;
89-
max-width: 300px;
90-
cursor: pointer;
91-
background-color: #0f0f12bf;
92-
padding-top: var(--cpd-space-2x);
93-
padding-bottom: var(--cpd-space-2x);
94-
border-bottom: 1px solid #262628;
95-
}
96-
97-
.mx_RoomTile_selected {
98-
background-color: #a0a0a088;
99-
}
100-
101-
.mx_RoomTile_avatar {
102-
top: var(--cpd-space-2x);
103-
left: var(--cpd-space-4x);
104-
position: absolute;
105-
}
106-
107-
.mx_RoomTile_name {
108-
margin-left: var(--cpd-space-14x);
109-
overflow: hidden;
110-
text-overflow: ellipsis;
111-
font-size: var(--cpd-font-size-body-sm);
112-
font-weight: var(--cpd-font-weight-semibold);
113-
white-space: nowrap;
114-
}
115-
116-
.mx_RoomTile_preview {
117-
margin-left: var(--cpd-space-14x);
118-
overflow: hidden;
119-
text-overflow: ellipsis;
120-
font-size: var(--cpd-font-size-body-xs);
121-
font-weight: var(--cpd-font-weight-normal);
122-
white-space: nowrap;
123-
}
124-
12576
.mx_MainPanel {
12677
flex: 1 1 auto;
12778
display: flex;

src/Client.tsx

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import type React from "react";
22
import "./App.css";
33
import { useViewModel } from "@element-hq/web-shared-components";
44
import { useClientStoreContext } from "./context/ClientStoreContext";
5-
import { RoomListHeader, RoomListSearch } from "./RoomList";
6-
import { RoomListFiltersView } from "./RoomListFiltersView";
7-
import { RoomListView } from "./RoomListView";
5+
import { RoomListHeader, RoomListSearch, RoomListView } from "./RoomList";
86
import { RoomView } from "./RoomView";
97
import { SidePanelView } from "./SidePanelView.tsx";
108
import { SplashView } from "./SplashView.tsx";
@@ -19,17 +17,9 @@ export const Client: React.FC<ClientProps> = ({ onAddAccount }) => {
1917
const [clientViewModel] = useClientStoreContext();
2018
const { roomListViewModel, roomViewModel } = useViewModel(clientViewModel);
2119

22-
// Handle room changes
23-
const handleRoomSelected = (roomId: string) => {
24-
clientViewModel.setCurrentRoom(roomId);
25-
};
26-
20+
// Room list view model must be available to render
2721
if (!roomListViewModel) return null;
2822

29-
console.log(
30-
`roomListViewModel: ${roomListViewModel}, roomViewModel: ${roomViewModel}`,
31-
);
32-
3323
return (
3424
<>
3525
<header className="mx_Header"> </header>
@@ -42,16 +32,8 @@ export const Client: React.FC<ClientProps> = ({ onAddAccount }) => {
4232
</nav>
4333
<nav className="mx_RoomList">
4434
<RoomListSearch />
45-
{
46-
<>
47-
<RoomListHeader />
48-
<RoomListFiltersView vm={roomListViewModel} />
49-
<RoomListView
50-
vm={roomListViewModel}
51-
onRoomSelected={handleRoomSelected}
52-
/>
53-
</>
54-
}
35+
<RoomListHeader />
36+
<RoomListView vm={roomListViewModel} />
5537
</nav>
5638
{roomViewModel ? (
5739
<RoomView roomViewModel={roomViewModel} />

src/Filter.ts

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/RoomHeaderView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import "./RoomHeaderView.css";
99
import "./viewmodel/TimelineViewModel";
1010
import { Avatar } from "@vector-im/compound-web";
1111
import type React from "react";
12-
import type { RoomSummary } from "./viewmodel/RoomSummary";
12+
import type { RoomSummary } from "./RoomList/RoomSummary";
1313

1414
type RoomHeaderViewProps = {
1515
roomHeaderViewModel?: RoomSummary;

0 commit comments

Comments
 (0)