From bf5a0ab4b5e9a9cd6064cdedc0828a3fa86c13d6 Mon Sep 17 00:00:00 2001 From: "Victor A." <52110451+cs50victor@users.noreply.github.com> Date: Thu, 18 Jan 2024 02:26:31 -0500 Subject: [PATCH] fix: ci --- demo/components/Debug.tsx | 213 -------------------------------------- package.json | 4 +- 2 files changed, 2 insertions(+), 215 deletions(-) delete mode 100644 demo/components/Debug.tsx diff --git a/demo/components/Debug.tsx b/demo/components/Debug.tsx deleted file mode 100644 index 0cf73e9..0000000 --- a/demo/components/Debug.tsx +++ /dev/null @@ -1,213 +0,0 @@ -import * as React from 'react'; -import { useRoomContext } from '@livekit/components-react'; -import { setLogLevel, LogLevel, RemoteTrackPublication } from 'livekit-client'; -import { tinykeys } from 'tinykeys'; -// import styles from '../styles/Debug.module.css'; - -export const useDebugMode = ({ logLevel }: { logLevel?: LogLevel }) => { - setLogLevel(logLevel ?? 'debug'); - const room = useRoomContext(); - - React.useEffect(() => { - // @ts-expect-error - window.__lk_room = room; - - return () => { - // @ts-expect-error - window.__lk_room = undefined; - }; - }, []); -}; - -export const DebugMode = ({ logLevel }: { logLevel?: LogLevel }) => { - const room = useRoomContext(); - const [isOpen, setIsOpen] = React.useState(false); - const [, setRender] = React.useState({}); - - useDebugMode({ logLevel }); - - React.useEffect(() => { - if (window) { - const unsubscribe = tinykeys(window, { - 'Shift+D': () => { - console.log('setting open'); - setIsOpen((open) => !open); - }, - }); - - // timer to re-render - const interval = setInterval(() => { - setRender({}); - }, 1000); - - return () => { - unsubscribe(); - clearInterval(interval); - }; - } - }, [isOpen]); - - if (typeof window === 'undefined' || !isOpen) { - return null; - } - - const handleSimulate = (event: React.ChangeEvent) => { - const { value } = event.target; - if (value == '') { - return; - } - event.target.value = ''; - let isReconnect = false; - switch (value) { - case 'signal-reconnect': - isReconnect = true; - - // fall through - default: - // @ts-expect-error - room.simulateScenario(value); - } - }; - - const lp = room.localParticipant; - - if (!isOpen) { - return <>; - } else { - return ( -
-
-

- Room Info {room.name}: {room.sid} -

-
-
- - Local Participant: {lp.identity} - -
- - Published tracks - -
- {Array.from(lp.tracks.values()).map((t) => ( - <> -
- - {t.source.toString()} -  {t.trackSid} - -
- - - - - - - - - - - -
Kind - {t.kind}  - {t.kind === 'video' && ( - - {t.track?.dimensions?.width}x{t.track?.dimensions?.height} - - )} -
Bitrate{Math.ceil(t.track!.currentBitrate / 1000)} kbps
- - ))} -
-
-
- - Permissions - -
- - - {lp.permissions && - Object.entries(lp.permissions).map(([key, val]) => ( - <> - - - {key !== 'canPublishSources' ? ( - - ) : ( - - )} - - - ))} - -
{key}{val.toString()} {val.join(', ')}
-
-
-
- -
- - Remote Participants - - {Array.from(room.participants.values()).map((p) => ( -
- - - {p.identity} - - - -
- {Array.from(p.tracks.values()).map((t) => ( - <> -
- - {t.source.toString()} -  {t.trackSid} - -
- - - - - - - - - - - {t.track && ( - - - - - )} - -
Kind - {t.kind}  - {t.kind === 'video' && ( - - {t.dimensions?.width}x{t.dimensions?.height} - - )} -
Status{trackStatus(t)}
Bitrate{Math.ceil(t.track.currentBitrate / 1000)} kbps
- - ))} -
-
- ))} -
-
- ); - } -}; - -function trackStatus(t: RemoteTrackPublication): string { - if (t.isSubscribed) { - return t.isEnabled ? 'enabled' : 'disabled'; - } else { - return 'unsubscribed'; - } -} diff --git a/package.json b/package.json index c4c5a8c..2f3edde 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "", "scripts": { "prepare": "husky install", - "build": "pnpm --dir=meet build", - "dev": "concurrently --names 'WEB,SERVER' -c 'auto' \"pnpm --dir=meet dev\" \"cargo rr --bin lkgpt\"", + "build": "pnpm --dir=demo build", + "dev": "concurrently --names 'WEB,SERVER' -c 'auto' \"pnpm --dir=demo dev\" \"cargo rr --bin new_media\"", "format": "concurrently --names 'fmt:web,fmt:rs,fmt:toml' -c 'auto' \"pnpm format:prettier\" \"pnpm format:rs\" \"pnpm format:toml\"", "format:prettier": "prettier --write \"**/*.{js,ts,tsx}\"", "format:rs": "cargo fmt --all",