Fixed admin panel mobile view.

This commit is contained in:
SamTv12345 2024-09-13 15:36:31 +02:00
parent 3de6c7caef
commit 178fe7c24d
3 changed files with 577 additions and 513 deletions

View file

@ -1,4 +1,4 @@
import {useEffect} from 'react' import {useEffect, useState} from 'react'
import './App.css' import './App.css'
import {connect} from 'socket.io-client' import {connect} from 'socket.io-client'
import {isJSONClean} from './utils/utils.ts' import {isJSONClean} from './utils/utils.ts'
@ -6,13 +6,14 @@ import {NavLink, Outlet, useNavigate} from "react-router-dom";
import {useStore} from "./store/store.ts"; import {useStore} from "./store/store.ts";
import {LoadingScreen} from "./utils/LoadingScreen.tsx"; import {LoadingScreen} from "./utils/LoadingScreen.tsx";
import {Trans, useTranslation} from "react-i18next"; import {Trans, useTranslation} from "react-i18next";
import {Cable, Construction, Crown, NotepadText, Wrench, PhoneCall} from "lucide-react"; import {Cable, Construction, Crown, NotepadText, Wrench, PhoneCall, LucideMenu} from "lucide-react";
const WS_URL = import.meta.env.DEV ? 'http://localhost:9001' : '' const WS_URL = import.meta.env.DEV ? 'http://localhost:9001' : ''
export const App = () => { export const App = () => {
const setSettings = useStore(state => state.setSettings); const setSettings = useStore(state => state.setSettings);
const {t} = useTranslation() const {t} = useTranslation()
const navigate = useNavigate() const navigate = useNavigate()
const [sidebarOpen, setSidebarOpen] = useState<boolean>(true)
useEffect(() => { useEffect(() => {
fetch('/admin-auth/', { fetch('/admin-auth/', {
@ -85,7 +86,7 @@ export const App = ()=> {
} }
}, []); }, []);
return <div id="wrapper"> return <div id="wrapper" className={`${sidebarOpen ? '': 'closed' }`}>
<LoadingScreen/> <LoadingScreen/>
<div className="menu"> <div className="menu">
<div className="inner-menu"> <div className="inner-menu">
@ -103,6 +104,9 @@ export const App = ()=> {
</ul> </ul>
</div> </div>
</div> </div>
<button id="icon-button" onClick={() => {
setSidebarOpen(!sidebarOpen)
}}><LucideMenu/></button>
<div className="innerwrapper"> <div className="innerwrapper">
<Outlet/> <Outlet/>
</div> </div>

View file

@ -2,6 +2,7 @@
--etherpad-color: #0f775b; --etherpad-color: #0f775b;
--etherpad-comp: #9C8840; --etherpad-comp: #9C8840;
--etherpad-light: #99FF99; --etherpad-light: #99FF99;
--sidebar-width: 20em;
} }
@font-face { @font-face {
@ -28,16 +29,20 @@ body {
} }
div.menu { div.menu {
left: 0;
transition: left .3s;
height: 100vh; height: 100vh;
font-size: 16px; font-size: 16px;
font-weight: bolder; font-weight: bolder;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
max-width: 20%; width: var(--sidebar-width);
min-width: 20%; z-index: 99;
position: fixed;
} }
.icon-button { .icon-button {
display: flex; display: flex;
gap: 10px; gap: 10px;
@ -116,12 +121,14 @@ div.menu li a {
} }
div.innerwrapper { div.innerwrapper {
transition: margin-left .3s;
isolation: isolate;
background-color: #F0F0F0; background-color: #F0F0F0;
overflow: auto; overflow: auto;
height: 100vh; height: 100vh;
flex-grow: 100; flex-grow: 100;
margin-left: var(--sidebar-width);
padding: 20px; padding: 20px;
} }
@ -130,11 +137,9 @@ div.innerwrapper-err {
} }
#wrapper { #wrapper {
display: flex;
background: none repeat scroll 0px 0px #FFFFFF; background: none repeat scroll 0px 0px #FFFFFF;
box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.2); box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.2);
min-height: 100%; /*always display a scrollbar*/ min-height: 100%; /*always display a scrollbar*/
} }
h1 { h1 {
@ -173,12 +178,15 @@ input {
.sort { .sort {
cursor: pointer; cursor: pointer;
} }
.sort:after { .sort:after {
content: '▲▼' content: '▲▼'
} }
.sort.up:after { .sort.up:after {
content: '▲' content: '▲'
} }
.sort.down:after { .sort.down:after {
content: '▼' content: '▼'
} }
@ -196,8 +204,11 @@ table {
margin: 20px 0; margin: 20px 0;
} }
.table-container {
width: 100%;
overflow: auto;
max-height: 90vh;
}
#available-plugins th:first-child, #available-plugins th:nth-child(2) { #available-plugins th:first-child, #available-plugins th:nth-child(2) {
@ -221,17 +232,22 @@ td, th {
.messages { .messages {
height: 5em; height: 5em;
} }
.messages * { .messages * {
display: none; display: none;
text-align: center; text-align: center;
} }
.messages .fetching { .messages .fetching {
display: block; display: block;
} }
.progress { .progress {
position: absolute; position: absolute;
top: 0; left: 0; bottom:0; right:0; top: 0;
left: 0;
bottom: 0;
right: 0;
padding: auto; padding: auto;
background: rgb(255, 255, 255); background: rgb(255, 255, 255);
@ -302,17 +318,46 @@ pre {
word-wrap: break-word; word-wrap: break-word;
} }
#icon-button {
color: var(--etherpad-color);
top: 10px;
background-color: transparent;
border: none;
z-index: 99;
position: absolute;
left: 10px;
}
.inner-menu span:nth-child(2) {
display: flex;
margin-top: 30px;
}
#wrapper.closed .menu {
left: calc(-1 * var(--sidebar-width));
}
#wrapper.closed .innerwrapper {
margin-left: 0;
}
@media (max-width: 800px) { @media (max-width: 800px) {
div.innerwrapper { div.innerwrapper {
padding: 0 15px 15px 15px; padding: 0 15px 15px 15px;
margin-left: 0;
}
.inner-menu {
border-radius: 0;
} }
div.menu { div.menu {
padding: 1px 15px 0 15px;
position: static;
height: auto; height: auto;
border-right: none; border-right: none;
width: auto; width: 100%;
float: left; float: left;
} }
@ -376,6 +421,7 @@ pre {
.login-background { .login-background {
background-image: url("/fond.jpg"); background-image: url("/fond.jpg");
background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
display: flex; display: flex;
@ -394,7 +440,6 @@ pre {
} }
.login-textinput { .login-textinput {
width: 100%; width: 100%;
padding: 10px; padding: 10px;
@ -405,13 +450,19 @@ pre {
} }
.login-box { .login-box {
width: 20%;
padding: 20px; padding: 20px;
border-radius: 40px; border-radius: 40px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
background-color: #fff; background-color: #fff;
} }
@media (max-width: 900px) {
.login-box {
width: 90%
}
}
.login-inner-box { .login-inner-box {
position: relative; position: relative;
padding: 20px; padding: 20px;
@ -480,7 +531,6 @@ pre {
} }
.ToastViewport { .ToastViewport {
position: fixed; position: fixed;
top: 10px; top: 10px;
@ -518,19 +568,24 @@ pre {
column-gap: 15px; column-gap: 15px;
align-items: center; align-items: center;
} }
.ToastRoot[data-state='open'] { .ToastRoot[data-state='open'] {
animation: slideIn 150ms cubic-bezier(0.16, 1, 0.3, 1); animation: slideIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
} }
.ToastRoot[data-state='closed'] { .ToastRoot[data-state='closed'] {
animation: hide 100ms ease-in; animation: hide 100ms ease-in;
} }
.ToastRoot[data-swipe='move'] { .ToastRoot[data-swipe='move'] {
transform: translateX(var(--radix-toast-swipe-move-x)); transform: translateX(var(--radix-toast-swipe-move-x));
} }
.ToastRoot[data-swipe='cancel'] { .ToastRoot[data-swipe='cancel'] {
transform: translateX(0); transform: translateX(0);
transition: transform 200ms ease-out; transition: transform 200ms ease-out;
} }
.ToastRoot[data-swipe='end'] { .ToastRoot[data-swipe='end'] {
animation: swipeOut 100ms ease-out; animation: swipeOut 100ms ease-out;
} }
@ -597,7 +652,7 @@ pre {
border-color: transparent; border-color: transparent;
border-radius: 20px; border-radius: 20px;
height: 2.5rem; height: 2.5rem;
width: 100vh; width: 100%;
padding: 5px 5px 5px 30px; padding: 5px 5px 5px 30px;
} }
@ -765,9 +820,11 @@ input, button, select, optgroup, textarea {
box-shadow: 0 2px 10px var(--black-a7); box-shadow: 0 2px 10px var(--black-a7);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
} }
.SwitchRoot:focus { .SwitchRoot:focus {
box-shadow: 0 0 0 2px black; box-shadow: 0 0 0 2px black;
} }
.SwitchRoot[data-state='checked'] { .SwitchRoot[data-state='checked'] {
background-color: var(--etherpad-color); background-color: var(--etherpad-color);
} }
@ -783,6 +840,7 @@ input, button, select, optgroup, textarea {
transform: translateX(2px); transform: translateX(2px);
will-change: transform; will-change: transform;
} }
.SwitchThumb[data-state='checked'] { .SwitchThumb[data-state='checked'] {
transform: translateX(25px); transform: translateX(25px);
} }

View file

@ -193,6 +193,7 @@ export const HomePage = () => {
<h2><Trans i18nKey="admin_plugins.available"/></h2> <h2><Trans i18nKey="admin_plugins.available"/></h2>
<SearchField onChange={v=>{setSearchTerm(v.target.value)}} placeholder={t('admin_plugins.available_search.placeholder')} value={searchTerm}/> <SearchField onChange={v=>{setSearchTerm(v.target.value)}} placeholder={t('admin_plugins.available_search.placeholder')} value={searchTerm}/>
<div className="table-container">
<table id="available-plugins"> <table id="available-plugins">
<thead> <thead>
<tr> <tr>
@ -241,4 +242,5 @@ export const HomePage = () => {
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
} }