import React, { useState } from 'react'; import { __ } from '@wordpress/i18n'; import { LocationWithRole } from '../../../types/location.entity'; import { App } from '../../../app'; import { apiService } from '../../../services/api.service'; export interface LocationHeaderProps { locationWithRole: LocationWithRole; } export function LocationHeader({ locationWithRole }: LocationHeaderProps): JSX.Element { const [isLoading, setIsLoading] = useState(false); const { location } = locationWithRole; const handleSalonDashboardClick = async (): Promise => { setIsLoading(true); try { const result = await apiService.getLocationAuthLink(location.id); if (result?.authLink) { window.open(result.authLink, '_blank'); } } catch (err) { alert(__('Failed to get dashboard link. Please try again.', 'timetailor-salon-booking')); } finally { setIsLoading(false); } }; return (

{location.businessName}

{__('Booking Page', 'timetailor-salon-booking')}
); }