Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions app/api/session/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,25 @@ async function createSession(timezone?: string) {
apiKey: process.env.BROWSERBASE_API_KEY!,
});

const config = await getAll<EdgeConfig>();
let config: EdgeConfig | undefined;
try {
// Attempt to get the Edge Config
config = await getAll<EdgeConfig>();
} catch (error) {
// If Edge Config is not available, fall back to default values
console.error("Could not get Edge Config, falling back to defaults", error);
config = {
advancedStealth: undefined,
proxies: undefined,
regionDistribution: undefined,
};
}

const {
advancedStealth: advancedStealthConfig,
proxies: proxiesConfig,
regionDistribution: distributionsConfig,
} = config;
} = config || {};

const advancedStealth: boolean = advancedStealthConfig ?? true;
const proxies: boolean = proxiesConfig ?? true;
Expand Down
21 changes: 19 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,34 @@ const Tooltip = ({
text: string;
}) => {
const [isHovered, setIsHovered] = useState(false);
const timeoutRef = useRef<NodeJS.Timeout | null>(null);

const showTooltip = useCallback(() => {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
timeoutRef.current = null;
}
setIsHovered(true);
}, []);

const hideTooltip = useCallback(() => {
timeoutRef.current = setTimeout(() => {
setIsHovered(false);
}, 200);
}, []);

return (
<div
className="relative"
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
onMouseEnter={showTooltip}
onMouseLeave={hideTooltip}
>
{children}
<AnimatePresence>
{isHovered && (
<motion.span
onMouseEnter={showTooltip}
onMouseLeave={hideTooltip}
initial={{ opacity: 0, y: 10, scale: 0.9 }}
animate={{ opacity: 1, y: 3, scale: 1 }}
exit={{ opacity: 0, y: 10, scale: 0.9 }}
Expand Down