-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
860 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { useState } from "react"; | ||
import { Share } from "../../types/zrok"; | ||
import { Text, Link, Tooltip } from "@radix-ui/themes"; | ||
import { OpenExternal, Request } from "../../wailsjs/go/main/App"; | ||
|
||
const FrontendEndpoint = ({ share }: { share: Share }) => { | ||
const [active, setActive] = useState(false); | ||
const openExternal = ( | ||
event: React.MouseEvent<HTMLAnchorElement, MouseEvent>, | ||
url: string | ||
) => { | ||
event.stopPropagation(); | ||
if (url == "private") { | ||
return; | ||
} | ||
OpenExternal(url); | ||
}; | ||
|
||
const getStatus = async () => { | ||
const statusCode = await Request(share.frontendEndpoint); | ||
if (statusCode == 404) { | ||
setActive(false); | ||
} else { | ||
setActive(true); | ||
} | ||
}; | ||
|
||
getStatus(); | ||
|
||
return ( | ||
<Link | ||
href="#" | ||
onClick={(event) => openExternal(event, share.frontendEndpoint)} | ||
> | ||
<span | ||
className={`inline-block mr-2 size-3 rounded-full shadow-inner ${ | ||
active ? "border-green-900 bg-green-500" : "border-red-900 bg-red-500" | ||
}`} | ||
></span> | ||
<Tooltip content={share.frontendEndpoint}> | ||
<Text>{share.frontendEndpoint.slice(0, 20)}</Text> | ||
</Tooltip> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default FrontendEndpoint; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.