@@ -3,7 +3,7 @@ import { RDTContextProvider, RdtClientConfig } from "./context/RDTContext.js";
33import { Tab } from "./tabs/index.js" ;
44import { useTimelineHandler } from "./hooks/useTimelineHandler.js" ;
55import { useDetachedWindowControls , usePersistOpen , useSettingsContext } from "./context/useRDTContext.js" ;
6- import { useLocation } from "@remix-run/react" ;
6+ import { Link , useLocation } from "@remix-run/react" ;
77import { Trigger } from "./components/Trigger.js" ;
88import { MainPanel } from "./layout/MainPanel.js" ;
99import { Tabs } from "./layout/Tabs.js" ;
@@ -26,6 +26,7 @@ import { useDebounce } from "./hooks/useDebounce.js";
2626import { useListenToRouteChange } from "./hooks/detached/useListenToRouteChange.js" ;
2727import { RdtPlugin } from "../index.js" ;
2828import { useHotkeys } from "react-hotkeys-hook" ;
29+ import clsx from "clsx" ;
2930
3031const recursivelyChangeTabIndex = ( node : Element | HTMLElement , remove = true ) => {
3132 if ( remove ) {
@@ -38,6 +39,27 @@ const recursivelyChangeTabIndex = (node: Element | HTMLElement, remove = true) =
3839 }
3940} ;
4041
42+ const LiveUrls = ( ) => {
43+ const { settings } = useSettingsContext ( ) ;
44+ const location = useLocation ( ) ;
45+ const envsPosition = settings . liveUrlsPosition ;
46+ const envsClassName = {
47+ "rdt-bottom-0" : envsPosition === "bottom-left" || envsPosition === "bottom-right" ,
48+ "rdt-top-0" : envsPosition === "top-left" || envsPosition === "top-right" ,
49+ "rdt-right-0" : envsPosition === "bottom-right" || envsPosition === "top-right" ,
50+ "rdt-left-0" : envsPosition === "bottom-left" || envsPosition === "top-left" ,
51+ }
52+ if ( settings . liveUrls . length === 0 ) return null ;
53+ return < div className = { clsx ( "rdt-flex rdt-fixed rdt-items-center rdt-gap-2 rdt-px-2" , envsClassName ) } >
54+ { settings . liveUrls . map ( ( env ) => {
55+ return < Link key = { env . name } referrerPolicy = "no-referrer" target = "_blank" to = { env . url + location . pathname } className = "rdt-flex rdt-transition-all hover:rdt-text-black rdt-items-center rdt-gap-2 rdt-text-sm rdt-font-semibold rdt-text-gray-400" >
56+ { env . name }
57+ </ Link >
58+ } ) }
59+ </ div >
60+
61+ }
62+
4163const DevTools = ( { plugins : pluginArray } : RemixDevToolsProps ) => {
4264 useTimelineHandler ( ) ;
4365 useResetDetachmentCheck ( ) ;
@@ -85,17 +107,18 @@ const DevTools = ({ plugins: pluginArray }: RemixDevToolsProps) => {
85107 }
86108
87109 return (
88- < >
110+
89111 < div id = { REMIX_DEV_TOOLS } className = "remix-dev-tools" >
90112 < Trigger isOpen = { isOpen } setIsOpen = { setIsOpen } />
113+ < LiveUrls />
91114 < MainPanel isOpen = { isOpen } >
92115 < div className = "rdt-flex rdt-h-full" >
93116 < Tabs plugins = { plugins } setIsOpen = { setIsOpen } />
94117 < ContentPanel leftSideOriented = { leftSideOriented } plugins = { plugins } />
95118 </ div >
96119 </ MainPanel >
97120 </ div >
98- </ >
121+
99122 ) ;
100123} ;
101124
0 commit comments