From fb2a9b12055075968ba35716a8f62dfb4b39e4f3 Mon Sep 17 00:00:00 2001 From: Guy Mor Date: Tue, 9 Sep 2025 03:02:23 +0300 Subject: [PATCH 1/5] made it work --- frontend/src/components/Button.tsx | 19 ++++++-- frontend/src/components/Header.tsx | 40 +++++++-------- frontend/src/components/PadPage.tsx | 59 +++++++++++++--------- frontend/src/components/Tooltip.tsx | 70 +++++++++++++++++++++++++++ frontend/src/index.css | 16 ++++++ frontend/src/runners/go-runner.ts | 2 +- frontend/src/runners/python-runner.ts | 8 +-- 7 files changed, 162 insertions(+), 52 deletions(-) create mode 100644 frontend/src/components/Tooltip.tsx diff --git a/frontend/src/components/Button.tsx b/frontend/src/components/Button.tsx index 70f547f..e243550 100644 --- a/frontend/src/components/Button.tsx +++ b/frontend/src/components/Button.tsx @@ -1,18 +1,27 @@ -import React from 'react'; +import React, { useRef } from 'react'; +import { Tooltip } from './Tooltip'; interface ButtonProps extends Omit, 'type'> { variant?: 'default' | 'outline'; colorType?: 'default' | 'green' | 'red'; + tooltip?: { + text: string; + // Tooltip delay in milliseconds + delay?: number; + direction?: 'top' | 'bottom'; + }; children: React.ReactNode; } export const Button: React.FC = ({ variant = 'default', colorType = 'default', + tooltip, children, className = '', ...props }) => { + const buttonRef = useRef(null); const baseClasses = 'py-2.5 px-4 rounded-lg transition-all duration-200 inline-flex items-center justify-center font-medium text-sm disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-dark-950'; @@ -34,8 +43,10 @@ export const Button: React.FC = ({ const buttonClasses = `${baseClasses} ${variantClasses[variant][colorType]} ${className}`; return ( - + + + ); }; diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index 6e84174..92b70fc 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -2,6 +2,7 @@ import { useState } from 'react'; import { Select } from './Select'; import { Button } from './Button'; import { capitalize, SUPPORTED_LANGUAGES } from 'coderjam-shared'; +import { Tooltip } from './Tooltip'; export type HeaderProps = { language: string; @@ -47,26 +48,27 @@ export function Header({ language, onLanguageChange, isRunning, onRunCode }: Hea - - - + + +