import React, { useState } from 'react'; import { Box, IconButton, Tooltip, SvgIcon, Dialog, DialogTitle, DialogContent, DialogActions, Button, TextField } from '@mui/material'; import GitHubIcon from '@mui/icons-material/GitHub'; import LinkedInIcon from '@mui/icons-material/LinkedIn'; import PersonIcon from '@mui/icons-material/Person'; import { SvgIconProps } from '@mui/material/SvgIcon'; // Custom icons for platforms without MUI icons const GiteaIcon = (props: SvgIconProps) => ( ); const DiscordIcon = (props: SvgIconProps) => ( ); const XIcon = (props: SvgIconProps) => ( ); const FilesIcon = (props: SvgIconProps) => ( ); const AIIcon = (props: SvgIconProps) => ( ); // Interface for social media links export interface SocialLink { name: string; url: string; icon: React.ElementType; isCustomerSupport?: boolean; } // Default social links const defaultSocialLinks: SocialLink[] = [ { name: 'LinkedIn', url: 'https://www.linkedin.com/in/damien-ostler-254663110/', icon: LinkedInIcon, }, { name: 'GitHub', url: 'https://github.com/d4m13n-d3v', icon: GitHubIcon, }, { name: 'Gitea', url: 'https://git.d4m13n.dev', icon: GiteaIcon, }, { name: 'Discord', url: 'https://discord.gg/8dHnaarghJ', icon: DiscordIcon, }, { name: 'X', url: 'https://x.com/d4m13n_d3v', icon: XIcon, }, { name: 'Files', url: 'https://files.d4m13n.dev', icon: FilesIcon, }, { name: 'AI', url: 'https://chat.d4m13n.dev', icon: AIIcon, }, { name: 'Customer Portal', url: 'calicoastrp.d4m13n.dev', icon: PersonIcon, isCustomerSupport: true, // Flag to identify customer support button }, ]; // Glow effects const whiteGlowEffects = { textShadow: '0 0 10px rgba(255, 255, 255, 0.25), 0 0 20px rgba(255, 255, 255, 0.15)', filter: 'drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25))' }; const blueGlowEffects = { textShadow: '0 0 10px rgba(79, 209, 255, 0.15), 0 0 20px rgba(79, 209, 255, 0.1)', filter: 'drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25))' }; interface SocialIconsProps { links?: SocialLink[]; position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; } const SocialIcons: React.FC = ({ links = defaultSocialLinks, position = 'top-right' }) => { // State for customer portal dialog const [dialogOpen, setDialogOpen] = useState(false); const [name, setName] = useState(''); const [error, setError] = useState(false); // Determine position styling const getPositionStyling = () => { switch (position) { case 'top-right': return { top: 16, right: 16 }; case 'top-left': return { top: 16, left: 16 }; case 'bottom-right': return { bottom: 16, right: 16 }; case 'bottom-left': return { bottom: 16, left: 16 }; default: return { top: 16, right: 16 }; } }; // Handle customer portal button click const handleCustomerPortalClick = (e: React.MouseEvent, linkName: string) => { if (linkName === 'Customer Portal') { e.preventDefault(); setDialogOpen(true); setName(''); setError(false); } }; // Handle name submission const handleSubmit = () => { if (name === 'cali-coast') { window.location.href = 'https://0.0.0.0/'; } else { setError(true); } }; return ( <> {links.map((link) => ( link.isCustomerSupport ? ( handleCustomerPortalClick(e, link.name)} sx={{ display: 'flex', alignItems: 'center', padding: '4px 8px', borderRadius: '4px', border: '1px solid white', color: 'white', textDecoration: 'none', ...whiteGlowEffects, transition: 'all 0.3s ease-in-out', '&:hover': { color: '#4fd1ff', borderColor: '#4fd1ff', ...blueGlowEffects } }} > Customer Portal ) : ( ) ))} {/* Customer Portal Dialog */} setDialogOpen(false)}> Customer Portal setName(e.target.value)} error={error} helperText={error ? "Invalid customer name" : ""} /> ); }; export default SocialIcons;