mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Hide dev port display when not available
This commit is contained in:
parent
502963b4ab
commit
d0bc95bce4
@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { getNodeEnvironment } from "@stackframe/stack-shared/dist/utils/env";
|
||||
import { useState } from "react";
|
||||
import { getPublicEnvVar } from "../lib/env";
|
||||
|
||||
@ -7,12 +8,13 @@ import { getPublicEnvVar } from "../lib/env";
|
||||
export function DevelopmentPortDisplay() {
|
||||
const [isVisible, setIsVisible] = useState(true);
|
||||
const prefix = getPublicEnvVar("NEXT_PUBLIC_STACK_PORT_PREFIX");
|
||||
if (!prefix || !isVisible) return null;
|
||||
if (!prefix || !isVisible || !getNodeEnvironment().includes("development")) return null;
|
||||
const color = ({
|
||||
"91": "#eee",
|
||||
"92": "#fff8e0",
|
||||
"93": "#e0e0ff",
|
||||
} as any)[prefix as any] || undefined;
|
||||
if (!color) return null;
|
||||
return (
|
||||
<div onClick={() => setIsVisible(false)} className="fixed top-0 left-0 p-2 text-red-700 animate-[dev-port-slide_120s_linear_infinite] flex gap-2" style={{
|
||||
backgroundColor: color,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user