Skip to content

Commit

Permalink
refactor: show empty info, fix teacher avatar on refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Feb 2, 2023
1 parent 7dd1b59 commit 6ec5941
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/flat-components/src/components/UsersPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export const UsersPanel = /* @__PURE__ */ observer<UsersPanelProps>(function Use
))}
</tbody>
</table>
{users.length === 0 && (
<div className="users-panel-list-empty">{t("no-students")}</div>
)}
</div>
</div>
);
Expand Down
8 changes: 8 additions & 0 deletions packages/flat-components/src/components/UsersPanel/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@
}
}

.users-panel-list-empty {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-weaker);
}

.users-panel-list-item {
font-size: 0;
position: relative;
Expand Down
1 change: 1 addition & 0 deletions packages/flat-i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"raised-hand": "(Hand raised)",
"has-left": "(Has left)",
"offline": "offline",
"no-students": "No students",
"say-something": "Say something...",
"send": "send",
"teacher": "Teacher",
Expand Down
1 change: 1 addition & 0 deletions packages/flat-i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"raised-hand": "(已举手)",
"has-left": "(已离开)",
"offline": "已离线",
"no-students": "暂无学生",
"agree": "通过",
"me": "(我)",
"cancel-hand-raising": "取消举手",
Expand Down
7 changes: 7 additions & 0 deletions packages/flat-stores/src/room-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
recordInfo,
RoomStatus,
RoomType,
usersInfo,
} from "@netless/flat-server-api";
import { globalStore } from "./global-store";
import { preferencesStore } from "./preferences-store";
Expand Down Expand Up @@ -132,10 +133,16 @@ export class RoomStore {

public async syncOrdinaryRoomInfo(roomUUID: string): Promise<void> {
const { roomInfo, ...restInfo } = await ordinaryRoomInfo(roomUUID);
// always include owner avatar url in full room info
const { [roomInfo.ownerUUID]: owner } = await usersInfo({
roomUUID,
usersUUID: [roomInfo.ownerUUID],
});
this.updateRoom(roomUUID, roomInfo.ownerUUID, {
...restInfo,
...roomInfo,
roomUUID,
ownerAvatarURL: owner.avatarURL,
});
}

Expand Down

0 comments on commit 6ec5941

Please sign in to comment.