Skip to content

Commit

Permalink
Added clickable link to user room list
Browse files Browse the repository at this point in the history
  • Loading branch information
MangoCubes committed Sep 11, 2022
1 parent 8b05732 commit 1ef964b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/root/users/userId/UserDetailsEdit.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PersonOff, AdminPanelSettings, Badge, Password } from "@mui/icons-material";
import { CardContent, List, ListItem, ListItemIcon, ListItemText, Switch, Button, CardActions, FormControl, TextField, DialogActions, Dialog, DialogContent, DialogTitle, Stack, MenuItem, Select } from "@mui/material";
import { CardContent, List, ListItem, ListItemIcon, ListItemText, Switch, Button, CardActions, TextField, DialogActions, Dialog, DialogContent, DialogTitle, Stack, MenuItem, Select } from "@mui/material";
import { useContext, useState } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "react-toastify";
Expand Down
13 changes: 9 additions & 4 deletions src/root/users/userId/UserRooms.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Button, CardActions, CardContent } from "@mui/material";
import { GridColumns, DataGrid } from "@mui/x-data-grid";
import { Button, CardActions, CardContent, Link } from "@mui/material";
import { GridColumns, DataGrid, GridRenderCellParams } from "@mui/x-data-grid";
import { useState, useRef, useContext, useMemo, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { toast } from "react-toastify";
import handleCommonErrors from "../../../functions/handleCommonErrors";
import { GetUserMembershipQuery } from "../../../query/GetUserMembershipQuery";
Expand All @@ -14,15 +15,19 @@ export default function UserRooms(props: {user: User, rooms: Room[] | null}) {
const {t} = useTranslation();

const [rooms, setRooms] = useState<RoomID[] | null>(null);
const [rows, setRows] = useState<{id: string, name: string}[] | null>(null);
const [rows, setRows] = useState<{id: RoomID, name: string}[] | null>(null);

const con = useRef<AbortController | null>(null);

const nav = useNavigate();

const {homeserver, token} = useContext(LoginContext);

const columns = useMemo<GridColumns>(
() => [
{field: 'id', headerName: t('user.rooms.id'), flex: 2},
{field: 'id', headerName: t('user.rooms.id'), flex: 2, renderCell: (params: GridRenderCellParams<RoomID>) => (
<Link href='#' onClick={() => nav(`/rooms/${params.value}`)}>{params.value}</Link>
)},
{field: 'name', headerName: t('user.rooms.name'), flex: 2}
],
[]
Expand Down

0 comments on commit 1ef964b

Please sign in to comment.