import { Button } from "@mantine/core";
import classes from './Download.module.css';
import { RosettaLogo } from "../RosettaLogo/RosettaLogo";

interface DownloadProps {
    href: string;
}

export function Download(props: DownloadProps) {
    /*const protocol = useMemo(() => {
        let protocol = new Protocol('ws://127.0.0.1:3000');
        protocol.addSupportedPacket(new PacketRequestUpdate());
        protocol.addSupportedPacket(new PacketKernelUpdate());
        return protocol;
    }, []);
    
    useEffect(() => {
        if(!protocol){
            return;
        }
        const platform = getPlatformTranslated();
        let packet = new PacketRequestUpdate();
        packet.setPlatform(platform);
        packet.setKernelVersion("0.0.0");
        packet.setArch("x64");
        protocol.sendPacket(packet);
    }, [protocol]);

    protocol.waitPacket(0x0D, (packet : PacketKernelUpdate) => {
        console.info(packet);
    });*/

    return (
        <Button.Group>
            <Button
                size="xl"
                component="a"
                className={classes.control}
                variant={'default'}
                href={props.href}
                leftSection={
                    <RosettaLogo size={25}></RosettaLogo>
                }
            >
                Get Rosetta
            </Button>
        </Button.Group>
    );

}