Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Dec 20, 2024
1 parent 1c3e8ac commit b08096d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frontend/src/lib/components/DebugNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { navigation3000Logic } from '~/layout/navigation-3000/navigationLogic'
export function DebugNotice(): JSX.Element | null {
const [debugInfo, setDebugInfo] = useState<{ branch: string; revision: string } | undefined>()
const [noticeHidden, setNoticeHidden] = useState(false)
const [isPort8000, setIsPort8000] = useState(false)
const [isLocalPort8000, setIsLocalPort8000] = useState(false)

const { isNavCollapsed } = useValues(navigation3000Logic)

Expand All @@ -19,20 +19,20 @@ export function DebugNotice(): JSX.Element | null {
const port = window.location.port

if (isLocal && port === '8000') {
setIsPort8000(true)
setIsLocalPort8000(true)
}
}, [])

const redirectOrHideOnClick = useMemo(
() =>
isPort8000
isLocalPort8000
? () => {
window.location.assign(
`${window.location.protocol}//${window.location.hostname}:8010${window.location.pathname}${window.location.search}${window.location.hash}`
)
}
: () => setNoticeHidden(true),
[isPort8000]
[isLocalPort8000]
)

useEffect(() => {
Expand All @@ -56,7 +56,7 @@ export function DebugNotice(): JSX.Element | null {
return null
}

if (!isPort8000 && noticeHidden) {
if (!isLocalPort8000 && noticeHidden) {
return null
}

Expand All @@ -77,7 +77,7 @@ export function DebugNotice(): JSX.Element | null {
Revision: <b>{debugInfo.revision}</b>
</div>
<div className="italic">
{isPort8000 ? (
{isLocalPort8000 ? (
<>Development should run on port 8010 now! Click to redirect</>
) : (
<>Click to hide</>
Expand All @@ -101,7 +101,7 @@ export function DebugNotice(): JSX.Element | null {
onClick={() => setNoticeHidden(true)}
/>
</div>
{isPort8000 && (
{isLocalPort8000 && (
<div className="flex items-center gap-2 px-2 border-l-4 border-brand-blue justify-between">
<LemonButton
type="secondary"
Expand Down

0 comments on commit b08096d

Please sign in to comment.