Feature/sas mypages * feat: Add SAS partner page under my pages * fix: feature toggle SAS Partner page in my pages * add translations for SAS account page * use 'flex-start' instead of 'start' * fix: flatten css * fix: don't use <SectionContainer /> on linkedAccounts page
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { trpc } from "@/lib/trpc/client"
|
|
|
|
import Refresh from "@/components/Icons/Refresh"
|
|
import { Loading } from "@/components/Loading"
|
|
import Button from "@/components/TempDesignSystem/Button"
|
|
import { toast } from "@/components/TempDesignSystem/Toasts"
|
|
|
|
import styles from "./levelupgradebutton.module.css"
|
|
|
|
export function LevelUpgradeButton() {
|
|
const intl = useIntl()
|
|
|
|
const { mutate, isPending } =
|
|
trpc.partner.sas.performLevelUpgrade.useMutation({
|
|
onSuccess() {
|
|
toast.success(intl.formatMessage({ id: "Level upgraded" }))
|
|
},
|
|
onError() {
|
|
toast.error(intl.formatMessage({ id: "Failed to upgrade level" }))
|
|
},
|
|
})
|
|
|
|
const handleClick = () => {
|
|
mutate()
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Button
|
|
intent="primary"
|
|
theme="primaryLight"
|
|
onClick={handleClick}
|
|
className={styles.button}
|
|
>
|
|
<div
|
|
className={styles.textContainer}
|
|
style={{ visibility: isPending ? "hidden" : "visible" }}
|
|
>
|
|
<Refresh color="currentColor" />
|
|
{intl.formatMessage({ id: "Check for level upgrade" })}
|
|
</div>
|
|
{isPending && <Loading color="white" className={styles.loading} />}
|
|
</Button>
|
|
</>
|
|
)
|
|
}
|