edfghjkl;

cordova
Valerie 2022-07-22 04:00:09 -04:00
parent 830e689840
commit 7d3c72eb81
4 changed files with 45 additions and 24 deletions

View File

@ -1,26 +1,8 @@
import React from 'react';
import React, { createContext } from 'react';
import ReactDOM from 'react-dom';
import Channels from './pages/Channels';
import Chat from './pages/Chat';
import App from './pages/App';
ReactDOM.render(
(
<div style={{
display: 'grid',
gridTemplateColumns: '200px 1fr',
gridTemplateRows: '1fr',
height: '100%',
}}>
<div style={{
background: 'rgba(25, 26, 33)',
borderRight: '1px solid #bd93f9',
}}>
<Channels></Channels>
</div>
<div>
<Chat></Chat>
</div>
</div>
),
<App></App>,
document.getElementById('app'),
);

View File

@ -0,0 +1,39 @@
import { createContext, useState } from 'react';
import Channels from './Channels';
import Chat from './Chat';
export const channelContext = createContext<{
channel: string | null,
setChannel: (uid: string) => void
}>({
channel: null,
setChannel: () => {},
});
export default function App() {
const [channel, setChannel] = useState<string>(null);
const channelContextValue = { channel, setChannel };
return (
<channelContext.Provider value={channelContextValue}>
<div style={{
display: 'grid',
gridTemplateColumns: '200px 1fr',
gridTemplateRows: '1fr',
height: '100%',
}}>
<div style={{
background: 'rgba(25, 26, 33)',
borderRight: '1px solid #bd93f9',
}}>
<Channels></Channels>
</div>
<div>
<Chat></Chat>
</div>
</div>
</channelContext.Provider>
);
}

View File

@ -19,7 +19,7 @@ export function expose(router: Function, port: number) {
try {
console.log('[IN]', action, data);
const _return = await (router(action, data) as unknown as Promise<any>);
console.log(_return);
// console.log(_return);
if(_return) {
try {
switch(_return.type) {

View File

@ -13,10 +13,10 @@ export default router({
async add(channel: any) {
const name = channel.name;
const uid = v4();
console.log(channel);
// console.log(channel);
const res = await query(add, name, uid);
if(res === null) return;
console.log(res);
// console.log(res);
return broadcast({
uid,
name,