Skip to content

Commit

Permalink
Fix formatting and remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sir-Thom committed Dec 14, 2023
1 parent 2ed5ef8 commit 4a82c87
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 78 deletions.
2 changes: 1 addition & 1 deletion src/components/ListBox/listView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function ListView({
{canDelete == true && (
<button
onClick={() => DeleteFunc(item.id)}
className="ml-6 text-white"
className="absolute hover:text-red-500 right-0 mr-8 text-white"
>
<FaTrashCan size={18} />
</button>
Expand Down
13 changes: 6 additions & 7 deletions src/components/videoPlayer/videoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export default function VidPlayer() {
setPlaceholderUrl(placeholderValue.toString());
} catch (error) {
throw new Error("Error parsing JSON:" + error);

//console.error("Error parsing JSON:", error);
}
});
})();
Expand All @@ -40,10 +38,11 @@ export default function VidPlayer() {
async function get_url() {
try {
const response = await fetch(url);

console.log("response:", response);
if (response.status === 200) {
setIsConnected(true);
setStreamUrl(url);
console.log("streamUrl:", url);
setError("");
} else {
throw new Error(
Expand All @@ -52,15 +51,15 @@ export default function VidPlayer() {
}
} catch (err) {
setIsConnected(false);
setError("An error occurred: " + err.message);

handleDisconnect();
handlePlayerError(err.message);
}
}

const handlePlayerError = (error: unknown) => {
setIsConnected(false);
setError("An error occurred: " + error);
setError("An error occurred: " + error.toString());
};

function handleUrlChanged(e: React.ChangeEvent<HTMLInputElement>) {
Expand All @@ -85,7 +84,7 @@ export default function VidPlayer() {
<ReactPlayer
playing={isConnected}
className="flex mx-16 mt-16"
url={streamUrl}
url={streamUrl.toString()}
width={width}
height={height - 150}
controls={false}
Expand Down Expand Up @@ -122,7 +121,7 @@ export default function VidPlayer() {
className="bg-accent-color1-700 hover:bg-accent-color1-800 mr-16 font-bold py-2 px-4 rounded"
>
Connect to Stream
</button>
</button>
</div>

{error && (
Expand Down
32 changes: 14 additions & 18 deletions src/views/Server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function ServerInfo() {
return (
<>
{createPortal(<Titlebar />, document.getElementById("titlebar")!)}
<div className="grid scrollbar scrollbar-thumb-window-light-50 relative w-full overflow-hidden grid-cols-12 ">
<div className="grid relative w-full overflow-hidden grid-cols-12 ">
<div className=" col-span-2 pt-10 ">
<SideMenu
menuItems={menuItems}
Expand All @@ -37,26 +37,22 @@ export default function ServerInfo() {
</div>
<div className="my-8 py-3.5 row-start-1 row-end-2 w-full col-start-4 col-span-9 h-full ">
<div className="mx-auto z-auto my-auto ">
<div className="mx-auto mt-24">
{currentSetting === "RTSP" && <RtspServerInfo />}
</div>
<div className="mx-auto mt-24">
{currentSetting === "RTMP" && <RtmpConnInfo />}
</div>
<div className="mx-auto mt-24">
{currentSetting === "HLS" && <HLsConnInfo />}
</div>
{currentSetting === "RTSP" && <RtspServerInfo />}

{currentSetting === "RTMP" && <RtmpConnInfo />}

{currentSetting === "HLS" && <HLsConnInfo />}
</div>
</div>
{error && (
<Notification
message={error}
timer={5000}
type={"error"}
onDismiss={handleDismissErrorNotification}
/>
)}
</div>
{error && (
<Notification
message={error}
timer={5000}
type={"error"}
onDismiss={handleDismissErrorNotification}
/>
)}
</>
);
}
26 changes: 14 additions & 12 deletions src/views/ServerInfoView/HlsServerInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,22 @@ export default function HLsConnInfo() {
}, [apiIp]);

return (
<motion.div
className="w-3/4 overscroll-contain mx-auto flex flex-co justify-center items-start"
variants={fadeIn}
initial="hidden"
animate="visible"
exit="exit"
>
<div className="mt-4 mb-2">
<h2 className=" mx-auto mb-10 text-center font-bold text-3xl">
<div className="mx-auto w-full ">
<motion.div
className="w-full rounded-md"
variants={fadeIn}
initial="hidden"
animate="visible"
exit="exit"
>
<h2 className="text-center py-2.5 mx-auto w-full bg-center bg-window-dark-900 font-bold text-3xl">
HLS Informations
</h2>

<ListView fetchData={items} canDelete={false} />
</div>
</motion.div>
<div className="divide-y w-full divide-window-dark-500">
<ListView fetchData={items} canDelete={false} />
</div>
</motion.div>
</div>
);
}
35 changes: 18 additions & 17 deletions src/views/ServerInfoView/RtmpServerInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,25 @@ export default function RtmpConnInfo() {
}

return (
<motion.div
className="w-3/4 overscroll-contain mx-auto flex flex-co justify-center items-start"
variants={fadeIn}
initial="hidden"
animate="visible"
exit="exit"
>
<div className="mt-4 mb-2">
<h2 className=" mx-auto mb-10 text-center font-bold text-3xl">
<div className="mx-auto w-full ">
<motion.div
className="w-full rounded-md"
variants={fadeIn}
initial="hidden"
animate="visible"
exit="exit"
>
<h2 className="text-center py-2.5 mx-auto w-full bg-center bg-window-dark-900 font-bold text-3xl">
RTMP Informations
</h2>

<ListView
fetchData={items}
canDelete={true}
DeleteFunc={KickRTMPession}
/>
</div>
</motion.div>
<div className="divide-y w-full divide-window-dark-500">
<ListView
fetchData={items}
canDelete={true}
DeleteFunc={KickRTMPession}
/>
</div>
</motion.div>
</div>
);
}
2 changes: 0 additions & 2 deletions src/views/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ export default function Setting() {
recordSegmentDuration: parsedResponse.recordSegmentDuration || "1h",
recordDeleteAfter: parsedResponse.recordDeleteAfter || "24h"
});


const apiIpValue = apiIp;
invoke("save_api_ip", { apiIp: apiIpValue }).then((res) => {
Expand Down Expand Up @@ -463,7 +462,6 @@ export default function Setting() {
}
}


console.log("configData: " + JSON.stringify(configData));
}

Expand Down
43 changes: 22 additions & 21 deletions src/views/serverSetting/webrtcSetting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export default function WebrtcSetting({ settings, onSave, patchSetting }) {
};
const handleWebrtcICEServers2 = (event) => {
const { name, value } = event.target;

setWebrtcICEServers2((prevICEServers2) => ({
...prevICEServers2,
[name]: value,
[name]: value
}));
};
const handleWebrtcICEHostNAT1To1IPs = (event) => {
Expand Down Expand Up @@ -238,7 +238,9 @@ export default function WebrtcSetting({ settings, onSave, patchSetting }) {
<label className="mt-24 w-full">
Webrtc ICE Host NAT 1 To 1 IPs:
</label>
<label className="mt-2 w-full">Webrtc ICE UDP Mux Address:</label>
<label className="mt-2 w-full">
Webrtc ICE UDP Mux Address:
</label>
<label className="mt-2">Webrtc ICE TCP Mux Address:</label>
</div>
<div className="col-span-2 grid grid-cols-2 grid-rows-5 gap-x-4">
Expand Down Expand Up @@ -281,24 +283,23 @@ export default function WebrtcSetting({ settings, onSave, patchSetting }) {
</div>
</div>
<textarea
name="webrtcICEHostNAT1To1IPs"
className="resize-none my-20 h-16 col-span-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500 mx-2"
value={webrtcICEHostNAT1To1IPs}
onChange={handleWebrtcICEHostNAT1To1IPs}
/>
<input
type="text"
className="my-2 h-8 border col-span-2 border-gray-300 rounded-md focus:outline-none focus:border-blue-500 mx-2"
value={webrtcICEUDPMuxAddress}
onChange={handleWebrtcICEUDPMuxAddress}
/>
<input
type="text"
className="my-2 h-8 border col-span-2 border-gray-300 rounded-md focus:outline-none focus:border-blue-500 mx-2"
value={webrtcICETCPMuxAddress}
onChange={handleWebrtcICETCPMuxAddress}
/>

name="webrtcICEHostNAT1To1IPs"
className="resize-none my-20 h-16 col-span-2 border border-gray-300 rounded-md focus:outline-none focus:border-blue-500 mx-2"
value={webrtcICEHostNAT1To1IPs}
onChange={handleWebrtcICEHostNAT1To1IPs}
/>
<input
type="text"
className="my-2 h-8 border col-span-2 border-gray-300 rounded-md focus:outline-none focus:border-blue-500 mx-2"
value={webrtcICEUDPMuxAddress}
onChange={handleWebrtcICEUDPMuxAddress}
/>
<input
type="text"
className="my-2 h-8 border col-span-2 border-gray-300 rounded-md focus:outline-none focus:border-blue-500 mx-2"
value={webrtcICETCPMuxAddress}
onChange={handleWebrtcICETCPMuxAddress}
/>
</div>
</div>
);
Expand Down

0 comments on commit 4a82c87

Please sign in to comment.