mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-20 00:05:26 +02:00
32 lines
621 B
TypeScript
32 lines
621 B
TypeScript
import {IoMdMailOpen} from "react-icons/io"
|
|
import React, {ReactElement} from "react"
|
|
import UAParser from "ua-parser-js"
|
|
|
|
import {Button} from "@mui/material"
|
|
|
|
import {APP_LINK_MAP} from "~/utils"
|
|
|
|
export interface OpenMailButtonProps {
|
|
domain: string
|
|
}
|
|
|
|
export default function OpenMailButton({
|
|
domain,
|
|
}: OpenMailButtonProps): ReactElement {
|
|
const userAgent = new UAParser()
|
|
|
|
if (userAgent.getOS().name === "Android" && APP_LINK_MAP[domain]) {
|
|
return (
|
|
<Button
|
|
startIcon={<IoMdMailOpen />}
|
|
variant="text"
|
|
href={APP_LINK_MAP[domain].android}
|
|
>
|
|
Open Mail
|
|
</Button>
|
|
)
|
|
}
|
|
|
|
return <></>
|
|
}
|