Browse Source

Fix /users, display links.

main
Titouan Rigoudy 4 years ago
parent
commit
8d7a7045c4
4 changed files with 10 additions and 6 deletions
  1. +3
    -3
      src/modules/user/UserList.tsx
  2. +2
    -2
      src/modules/user/UserListEntry.tsx
  3. +1
    -0
      src/modules/user/UsersPane.tsx
  4. +4
    -1
      src/modules/user/slice.ts

+ 3
- 3
src/modules/user/UserList.tsx View File

@ -2,16 +2,16 @@ import { FC } from "react";
import SearchableList from "components/SearchableList";
import { UserMap } from "modules/user/slice";
import User from "modules/user/User";
import UserListEntry from "modules/user/UserListEntry";
const SearchableUserList = SearchableList(User);
const SearchableUserList = SearchableList(UserListEntry);
interface Props {
users: UserMap;
}
const UserList: FC<Props> = ({ users }) => (
<SearchableUserList id="user-list" itemMap={users} refresh={() => {}} />
<SearchableUserList id="user-list" map={users} refresh={() => {}} />
);
export default UserList;

src/modules/user/User.tsx → src/modules/user/UserListEntry.tsx View File

@ -7,7 +7,7 @@ interface Props {
name: string;
}
const User: FC<Props> = ({ name }) => {
const UserListEntry: FC<Props> = ({ name }) => {
const path = `/users/${encode(name)}`;
return (
@ -17,4 +17,4 @@ const User: FC<Props> = ({ name }) => {
);
};
export default User;
export default UserListEntry;

+ 1
- 0
src/modules/user/UsersPane.tsx View File

@ -6,6 +6,7 @@ import UserList from "modules/user/UserList";
const UsersPane: FC<{}> = () => {
const users = useSelector(selectAllUsers);
console.log("Users:", users);
return (
<div id="users-pane">


+ 4
- 1
src/modules/user/slice.ts View File

@ -10,6 +10,7 @@ export enum UserStatus {
export interface UserState {
name: string;
status: UserStatus;
averageSpeed: number;
numDownloads: number;
numFiles: number;
@ -29,9 +30,10 @@ export interface RoomSliceState {
const initialState: UserSliceState = {
// TODO: Set to {} once UserListResponse actually comes. Until then, it helps
// to have some state that we can observe in the UI.
rooms: {
users: {
alice: {
name: "alice",
status: UserStatus.Online,
averageSpeed: 1,
numDownloads: 2,
numFiles: 3,
@ -41,6 +43,7 @@ const initialState: UserSliceState = {
},
bob: {
name: "bob",
status: UserStatus.Offline,
averageSpeed: 1,
numDownloads: 2,
numFiles: 3,


Loading…
Cancel
Save