Added Role Owner and new UI for Owner
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Server, Play, Square, Terminal, FolderOpen, HardDrive, Settings, Plus, Users as UsersIcon, LogOut, Menu, X, MessageSquare, UserCircle } from 'lucide-react';
|
||||
import { Server, Play, Square, Terminal, FolderOpen, HardDrive, Settings, Plus, Users as UsersIcon, LogOut, Menu, X, MessageSquare, UserCircle, Shield } from 'lucide-react';
|
||||
import Console from './components/Console';
|
||||
import FileManager from './components/FileManager';
|
||||
import Stats from './components/Stats';
|
||||
import ServerSettings from './components/ServerSettings';
|
||||
import CreateServerModal from './components/CreateServerModal';
|
||||
import Users from './components/Users';
|
||||
import UserManagement from './components/UserManagement';
|
||||
import Tickets from './components/Tickets';
|
||||
import Profile from './components/Profile';
|
||||
import Auth from './components/Auth';
|
||||
@@ -24,6 +25,7 @@ function App() {
|
||||
const [activeTab, setActiveTab] = useState('console');
|
||||
const [showCreateModal, setShowCreateModal] = useState(false);
|
||||
const [showUsers, setShowUsers] = useState(false);
|
||||
const [showUserManagement, setShowUserManagement] = useState(false);
|
||||
const [showTickets, setShowTickets] = useState(false);
|
||||
const [showProfile, setShowProfile] = useState(false);
|
||||
const [viewingUsername, setViewingUsername] = useState(null);
|
||||
@@ -393,6 +395,16 @@ function App() {
|
||||
<MessageSquare className="w-4 h-4" />
|
||||
<span className="hidden sm:inline">Тикеты</span>
|
||||
</button>
|
||||
{user?.role === 'owner' && (
|
||||
<button
|
||||
onClick={() => setShowUserManagement(true)}
|
||||
className="bg-yellow-500 hover:bg-yellow-600 px-4 py-2 rounded-lg transition flex items-center gap-2 text-white"
|
||||
title="Управление пользователями (только для владельца)"
|
||||
>
|
||||
<Shield className="w-4 h-4" />
|
||||
<span className="hidden sm:inline">Управление</span>
|
||||
</button>
|
||||
)}
|
||||
{user?.role === 'admin' && (
|
||||
<button
|
||||
onClick={() => setShowUsers(true)}
|
||||
@@ -593,6 +605,31 @@ function App() {
|
||||
onCreated={loadServers}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showUserManagement && (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
|
||||
<div className={`${currentTheme.card} rounded-2xl ${currentTheme.border} border w-full max-w-6xl max-h-[90vh] overflow-hidden flex flex-col`}>
|
||||
<div className={`${currentTheme.secondary} px-6 py-4 ${currentTheme.border} border-b flex items-center justify-between`}>
|
||||
<h2 className="text-2xl font-bold flex items-center gap-2">
|
||||
<Shield className="w-6 h-6 text-yellow-400" />
|
||||
Управление пользователями
|
||||
</h2>
|
||||
<button
|
||||
onClick={() => setShowUserManagement(false)}
|
||||
className={`${currentTheme.hover} p-2 rounded-lg transition`}
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<UserManagement
|
||||
currentUser={user}
|
||||
addNotification={notify}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user