@@ -4,13 +4,12 @@ import { useState, useEffect } from "react"
44import HomeScreen from "./components/homescreen"
55import ChatView from "./components/chatview"
66import Header from "./components/header"
7- import LogView from "./components/logview"
87import Sidebar from "./components/sidebar"
98import { ThemeProvider } from "next-themes"
10- import { InvitePopup } from "./components/invitepopup"
119import { API , initApi , type ChannelInfo } from "./lib/api"
1210import { generate as generateName } from 'yet-another-name-generator'
1311import { log } from "./lib/log"
12+ import { useIsDesktop } from "./hooks/use-media-query"
1413
1514export default function AppWrapper ( ) {
1615 const [ api , setApi ] = useState < API | null > ( null )
@@ -45,13 +44,9 @@ function Spinner() {
4544}
4645
4746function SplashScreen ( { children } : React . PropsWithChildren ) {
48- const [ showLogView , setShowLogView ] = useState ( false )
4947 return (
5048 < div className = "flex flex-col flex-grow" >
51- < Header
52- onLogsClick = { ( ) => setShowLogView ( ! showLogView ) }
53- />
54- { showLogView && < LogView onClose = { ( ) => setShowLogView ( false ) } /> }
49+ < Header />
5550 < div className = "flex items-center justify-center" >
5651 { children }
5752 </ div >
@@ -68,9 +63,7 @@ function App({ api }: AppProps) {
6863 const [ currentView , setCurrentView ] = useState < "home" | "chat" > ( "home" )
6964 const [ channels , setChannels ] = useState < ChannelInfo [ ] > ( [ ] )
7065 const [ activeChannel , setActiveChannel ] = useState < string | null > ( null )
71- const [ showLogView , setShowLogView ] = useState ( false )
7266 const [ nickname , setNickname ] = useState ( generateName ( ) )
73- const [ showInvitePopup , setShowInvitePopup ] = useState ( false )
7467 const [ showSidebar , setShowSidebar ] = useState ( false )
7568
7669 const joinChannel = async ( ticket : string ) => {
@@ -115,14 +108,16 @@ function App({ api }: AppProps) {
115108 setShowSidebar ( true )
116109 }
117110
111+ const isDesktop = useIsDesktop ( )
112+
118113 let title
119114 if ( activeChannel ) {
120115 title = '#' + channels . find ( ( c ) => c . id === activeChannel ) ?. name
121116 }
122117
123118 return (
124119 < >
125- { ( currentView === "chat" || showSidebar ) && (
120+ { isDesktop && ( currentView === "chat" || showSidebar ) && (
126121 < Sidebar
127122 channels = { channels }
128123 activeChannel = { activeChannel }
@@ -135,9 +130,7 @@ function App({ api }: AppProps) {
135130 ) }
136131 < div className = "flex flex-col flex-grow" >
137132 < Header
138- onLogsClick = { ( ) => setShowLogView ( ! showLogView ) }
139133 title = { title }
140- onInviteClick = { activeChannel ? ( ( ) => setShowInvitePopup ( true ) ) : undefined }
141134 />
142135 { currentView === "home" && (
143136 < HomeScreen
@@ -156,8 +149,7 @@ function App({ api }: AppProps) {
156149 { currentView === "chat" && activeChannel && (
157150 < ChatView api = { api } channel = { activeChannel } onClose = { ( ) => closeChannel ( activeChannel ) } />
158151 ) }
159- { showLogView && < LogView onClose = { ( ) => setShowLogView ( false ) } /> }
160- { showInvitePopup && activeChannel && (
152+ { /* {showInvitePopup && activeChannel && (
161153 <InvitePopup
162154 open={showInvitePopup}
163155 onOpenChange={(x) => {
@@ -167,7 +159,7 @@ function App({ api }: AppProps) {
167159 channel={channels.find((c) => c.id === activeChannel)?.name || ""}
168160 getTicket={(opts) => api.getTicket(activeChannel!, opts)}
169161 />
170- ) }
162+ )} */ }
171163 </ div >
172164 </ >
173165 )
0 commit comments