diff --git a/src/components/rooms.js b/src/components/rooms.js index fb30fa7..4a8a4c9 100644 --- a/src/components/rooms.js +++ b/src/components/rooms.js @@ -1,7 +1,9 @@ import React from "react"; +import { connect } from "react-redux"; import { BooleanField, Datagrid, + Filter, List, Pagination, SelectField, @@ -12,7 +14,7 @@ import { useTranslate, } from "react-admin"; import get from "lodash/get"; -import { Tooltip, Typography } from "@material-ui/core"; +import { Tooltip, Typography, Chip } from "@material-ui/core"; import HttpsIcon from "@material-ui/icons/Https"; import NoEncryptionIcon from "@material-ui/icons/NoEncryption"; import PageviewIcon from "@material-ui/icons/Pageview"; @@ -49,36 +51,11 @@ const EncryptionField = ({ source, record = {}, emptyText }) => { ); }; -export const RoomList = props => ( - } - sort={{ field: "name", order: "ASC" }} - > - - } - /> - - - - - - - - - - - -); - const RoomTitle = ({ record }) => { const translate = useTranslate(); - var name = "" + var name = ""; if (record) { - name = record.name !== "" ? record.name : record.id + name = record.name !== "" ? record.name : record.id; } return ( @@ -173,3 +150,75 @@ export const RoomShow = props => { ); }; +const RoomFilter = ({ ...props }) => { + const translate = useTranslate(); + return ( + + + + + + + ); +}; + +const FilterableRoomList = ({ ...props }) => { + const filter = props.roomFilters; + const localMembersFilter = + filter && filter.joined_local_members ? true : false; + const stateEventsFilter = filter && filter.state_events ? true : false; + const versionFilter = filter && filter.version ? true : false; + const federateableFilter = filter && filter.federatable ? true : false; + + return ( + } + sort={{ field: "name", order: "ASC" }} + filters={} + > + + } + /> + + + {localMembersFilter && } + {stateEventsFilter && } + {versionFilter && } + {federateableFilter && } + + + + ); +}; + +function mapStateToProps(state) { + return { + roomFilters: state.admin.resources.rooms.list.params.displayedFilters, + }; +} + +export const RoomList = connect(mapStateToProps)(FilterableRoomList);