-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
5 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,14 @@ | ||
import React from 'react'; | ||
import type { IRoom } from '../../shared/api/models'; | ||
import Header from '../../widgets/layout/Header'; | ||
import Navbar from '../../widgets/layout/Navbar'; | ||
import RoomsList from '../../widgets/RoomsList'; | ||
|
||
const LobbyAccess: React.FC = () => { | ||
const rooms: IRoom[] = [ | ||
{ | ||
id: 1, | ||
title: 'Информатика 5 класс', | ||
owner: 'Иванов Иван Иванович', | ||
isActive: true, | ||
}, | ||
{ | ||
id: 2, | ||
title: 'Математика 7 класс', | ||
owner: 'Морозов Антон Дмитри...', | ||
isActive: true, | ||
}, | ||
{ | ||
id: 3, | ||
title: 'Английский и язык 7 кла... ', | ||
owner: 'Иванова Мария Ивановна', | ||
isActive: false, | ||
}, | ||
{ | ||
id: 4, | ||
title: 'Математика 8 класс', | ||
owner: 'Иванова Мария Ивановна', | ||
isActive: false, | ||
}, | ||
{ | ||
id: 5, | ||
title: 'Математика 8 класс', | ||
owner: 'Иванова Мария Ивановна', | ||
isActive: false, | ||
}, | ||
{ | ||
id: 6, | ||
title: 'Математика 8 класс', | ||
owner: 'Иванова Мария Ивановна', | ||
isActive: false, | ||
}, | ||
{ | ||
id: 7, | ||
title: 'Информатика 5 класс', | ||
owner: 'Иванов Иван Иванович', | ||
isActive: true, | ||
}, | ||
{ | ||
id: 8, | ||
title: 'Математика 7 класс', | ||
owner: 'Морозов Антон Дмитри...', | ||
isActive: true, | ||
}, | ||
{ | ||
id: 9, | ||
title: 'Английский и язык 7 кла... ', | ||
owner: 'Иванова Мария Ивановна', | ||
isActive: false, | ||
}, | ||
{ | ||
id: 10, | ||
title: 'Математика 8 класс', | ||
owner: 'Иванова Мария Ивановна', | ||
isActive: false, | ||
}, | ||
{ | ||
id: 11, | ||
title: 'Математика 8 класс', | ||
owner: 'Иванова Мария Ивановна', | ||
isActive: false, | ||
}, | ||
{ | ||
id: 12, | ||
title: 'Математика 8 класс', | ||
owner: 'Иванова Мария Ивановна', | ||
isActive: false, | ||
}, | ||
{ | ||
id: 13, | ||
title: 'Математика 8 класс', | ||
owner: '[email protected]', | ||
isActive: false, | ||
}, | ||
]; | ||
|
||
const LobbyAccess: React.FC = () => { | ||
return ( | ||
<> | ||
<Header/> | ||
<Navbar activeLink='access' accessLength={5}/> | ||
<RoomsList rooms={rooms}/> | ||
<RoomsList/> | ||
</> | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,13 @@ | ||
import React, { useEffect } from "react"; | ||
import type { IRoom } from "../../shared/api/models"; | ||
import Header from "../../widgets/layout/Header"; | ||
import Navbar from "../../widgets/layout/Navbar"; | ||
import { CreateRoomForm } from "../../features/createRoom/index.ts"; | ||
import RoomsList from "../../widgets/RoomsList"; | ||
import { observer } from "mobx-react-lite"; | ||
import roomsFormState from "./store/roomsFormState.ts"; | ||
import { useAuth0 } from "@auth0/auth0-react"; | ||
// import { useAuth0 } from "@auth0/auth0-react"; | ||
|
||
const LobbyMy: React.FC = observer(() => { | ||
const rooms: IRoom[] = [ | ||
{ | ||
id: 1, | ||
title: "Информатика 5 класс", | ||
owner: "Иванов Иван Иванович", | ||
isActive: true, | ||
}, | ||
{ | ||
id: 2, | ||
title: "Математика 7 класс", | ||
owner: "Морозов Антон Дмитри...", | ||
isActive: true, | ||
}, | ||
{ | ||
id: 3, | ||
title: "Английский и язык 7 кла... ", | ||
owner: "Иванова Мария Ивановна", | ||
isActive: false, | ||
}, | ||
{ | ||
id: 4, | ||
title: "Математика 8 класс", | ||
owner: "Иванова Мария Ивановна", | ||
isActive: false, | ||
}, | ||
{ | ||
id: 5, | ||
title: "Математика 8 класс", | ||
owner: "Иванова Мария Ивановна", | ||
isActive: false, | ||
}, | ||
{ | ||
id: 6, | ||
title: "Математика 8 класс", | ||
owner: "Иванова Мария Ивановна", | ||
isActive: false, | ||
}, | ||
{ | ||
id: 7, | ||
title: "Информатика 5 класс", | ||
owner: "Иванов Иван Иванович", | ||
isActive: true, | ||
}, | ||
{ | ||
id: 8, | ||
title: "Математика 7 класс", | ||
owner: "Морозов Антон Дмитри...", | ||
isActive: true, | ||
}, | ||
{ | ||
id: 9, | ||
title: "Английский и язык 7 кла... ", | ||
owner: "Иванова Мария Ивановна", | ||
isActive: false, | ||
}, | ||
{ | ||
id: 10, | ||
title: "Математика 8 класс", | ||
owner: "Иванова Мария Ивановна", | ||
isActive: false, | ||
}, | ||
{ | ||
id: 11, | ||
title: "Математика 8 класс", | ||
owner: "Иванова Мария Ивановна", | ||
isActive: false, | ||
}, | ||
{ | ||
id: 12, | ||
title: "Математика 8 класс", | ||
owner: "Иванова Мария Ивановна", | ||
isActive: false, | ||
}, | ||
{ | ||
id: 13, | ||
title: "Математика 8 класс", | ||
owner: "[email protected]", | ||
isActive: false, | ||
}, | ||
]; | ||
|
||
const { user, isAuthenticated } = useAuth0(); | ||
|
||
function filterRooms() { | ||
if (isAuthenticated) { | ||
const myRooms: IRoom[] = rooms.filter((room) => { | ||
return room.owner == user?.name; | ||
}); | ||
return myRooms; | ||
} | ||
} | ||
|
||
const myRooms: any = filterRooms(); | ||
|
||
useEffect(() => { | ||
if (localStorage.getItem("trigger") === "create") { | ||
|
@@ -113,9 +19,9 @@ const LobbyMy: React.FC = observer(() => { | |
return ( | ||
<> | ||
<Header /> | ||
<Navbar activeLink="my" myLength={myRooms?.length} /> | ||
<Navbar activeLink="my" /> | ||
{roomsFormState.state === "create" ? <CreateRoomForm /> : <></>} | ||
{myRooms ? <RoomsList rooms={myRooms} /> : <>Loading...</>} | ||
<RoomsList /> | ||
</> | ||
); | ||
}); | ||
|