mirror of
https://github.com/meshtastic/web.git
synced 2026-05-19 03:35:06 -04:00
Fix mobile layout
This commit is contained in:
@@ -29,7 +29,7 @@ const Main = (props: MainProps) => {
|
||||
const [messages, setMessages] = React.useState<
|
||||
{ message: Types.TextPacket; ack: boolean }[]
|
||||
>([]);
|
||||
const [settingsModalOpen, setSettingsModalOpen] = useState<boolean>(false);
|
||||
const [sidebarOpen, setSidebarOpen] = useState<boolean>(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
const textPacketEvent = props.connection.onTextPacketEvent.subscribe(
|
||||
@@ -86,7 +86,8 @@ const Main = (props: MainProps) => {
|
||||
<MessageBox
|
||||
connection={props.connection}
|
||||
isReady={props.isReady}
|
||||
setSettingsModalOpen={setSettingsModalOpen}
|
||||
sidebarOpen={sidebarOpen}
|
||||
setSidebarOpen={setSidebarOpen}
|
||||
translations={props.translations}
|
||||
/>
|
||||
</div>
|
||||
@@ -100,6 +101,7 @@ const Main = (props: MainProps) => {
|
||||
setLanguage={props.setLanguage}
|
||||
translations={props.translations}
|
||||
myId={props.myNodeInfo.myNodeNum}
|
||||
sidebarOpen={sidebarOpen}
|
||||
darkmode={props.darkmode}
|
||||
setDarkmode={props.setDarkmode}
|
||||
/>
|
||||
|
||||
@@ -7,7 +7,8 @@ import type { languageTemplate } from '../App';
|
||||
|
||||
export interface MessageBoxProps {
|
||||
translations: languageTemplate;
|
||||
setSettingsModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
sidebarOpen: boolean;
|
||||
setSidebarOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
connection: IHTTPConnection;
|
||||
isReady: boolean;
|
||||
}
|
||||
@@ -21,11 +22,11 @@ const MessageBox = (props: MessageBoxProps) => {
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className="flex text-lg font-medium border rounded-md space-x-2 md:space-x-0 w-full">
|
||||
<div className="flex text-lg font-medium space-x-2 md:space-x-0 w-full">
|
||||
<div
|
||||
className="flex p-3 text-xl hover:text-gray-500 text-gray-400 rounded-md shadow-md focus:outline-none cursor-pointer md:hidden"
|
||||
className="flex p-3 text-xl hover:text-gray-500 text-gray-400 rounded-md border shadow-md focus:outline-none cursor-pointer md:hidden"
|
||||
onClick={() => {
|
||||
props.setSettingsModalOpen(true);
|
||||
props.setSidebarOpen(!props.sidebarOpen);
|
||||
}}
|
||||
>
|
||||
<MenuIcon className="m-auto h-6 2-6" />
|
||||
@@ -46,7 +47,7 @@ const MessageBox = (props: MessageBoxProps) => {
|
||||
onChange={(e) => {
|
||||
setCurrentMessage(e.target.value);
|
||||
}}
|
||||
className={`p-3 placeholder-gray-400 text-gray-700 relative rounded-md shadow-md focus:outline-none w-full pr-10 ${
|
||||
className={`p-3 placeholder-gray-400 text-gray-700 relative rounded-md border shadow-md focus:outline-none w-full pr-10 ${
|
||||
props.isReady ? 'cursor-text' : 'cursor-not-allowed'
|
||||
}`}
|
||||
/>
|
||||
|
||||
@@ -22,13 +22,18 @@ interface SidebarProps {
|
||||
setLanguage: React.Dispatch<React.SetStateAction<LanguageEnum>>;
|
||||
translations: languageTemplate;
|
||||
myId: number;
|
||||
sidebarOpen: boolean;
|
||||
darkmode: boolean;
|
||||
setDarkmode: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
}
|
||||
|
||||
const Sidebar = (props: SidebarProps) => {
|
||||
return (
|
||||
<div className="flex flex-col rounded-md md:ml-0 shadow-md border w-full max-w-sm">
|
||||
<div
|
||||
className={`${
|
||||
props.sidebarOpen ? 'flex' : 'hidden md:flex'
|
||||
} flex-col rounded-md md:ml-0 shadow-md border w-full max-w-sm`}
|
||||
>
|
||||
<Nodes
|
||||
isReady={props.isReady}
|
||||
nodes={props.nodes}
|
||||
|
||||
Reference in New Issue
Block a user