mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-24 08:47:55 +00:00
Comment out
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
// THIS IS DEPRECATED AND IS NO LONGER SHOWED TO THE USER WITH THE DISCONTINUATION
|
// THIS IS DEPRECATED AND IS NO LONGER SHOWED TO THE USER WITH THE DISCONTINUATION
|
||||||
// OF THE SUPPORTER PROGRAM. IT MAY BE REMOVED IN A FUTURE UPDATE.
|
// OF THE SUPPORTER PROGRAM. IT MAY BE REMOVED IN A FUTURE UPDATE.
|
||||||
|
|
||||||
import { useSupporterStatusContext } from "@app/hooks/useSupporterStatusContext";
|
// import { useSupporterStatusContext } from "@app/hooks/useSupporterStatusContext";
|
||||||
import { useState, useTransition } from "react";
|
import { useState, useTransition } from "react";
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@@ -58,134 +58,134 @@ interface SupporterStatusProps {
|
|||||||
export default function SupporterStatus({
|
export default function SupporterStatus({
|
||||||
isCollapsed = false
|
isCollapsed = false
|
||||||
}: SupporterStatusProps) {
|
}: SupporterStatusProps) {
|
||||||
const { supporterStatus, updateSupporterStatus } =
|
// const { supporterStatus, updateSupporterStatus } =
|
||||||
useSupporterStatusContext();
|
// useSupporterStatusContext();
|
||||||
const [supportOpen, setSupportOpen] = useState(false);
|
// const [supportOpen, setSupportOpen] = useState(false);
|
||||||
const [keyOpen, setKeyOpen] = useState(false);
|
// const [keyOpen, setKeyOpen] = useState(false);
|
||||||
const [purchaseOptionsOpen, setPurchaseOptionsOpen] = useState(false);
|
// const [purchaseOptionsOpen, setPurchaseOptionsOpen] = useState(false);
|
||||||
|
|
||||||
const { env } = useEnvContext();
|
// const { env } = useEnvContext();
|
||||||
const api = createApiClient({ env });
|
// const api = createApiClient({ env });
|
||||||
const t = useTranslations();
|
// const t = useTranslations();
|
||||||
|
|
||||||
const formSchema = z.object({
|
// const formSchema = z.object({
|
||||||
githubUsername: z.string().nonempty({
|
// githubUsername: z.string().nonempty({
|
||||||
error: "GitHub username is required"
|
// error: "GitHub username is required"
|
||||||
}),
|
// }),
|
||||||
key: z.string().nonempty({
|
// key: z.string().nonempty({
|
||||||
error: "Supporter key is required"
|
// error: "Supporter key is required"
|
||||||
})
|
// })
|
||||||
});
|
// });
|
||||||
|
|
||||||
const form = useForm({
|
// const form = useForm({
|
||||||
resolver: zodResolver(formSchema),
|
// resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
// defaultValues: {
|
||||||
githubUsername: "",
|
// githubUsername: "",
|
||||||
key: ""
|
// key: ""
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
async function hide() {
|
// async function hide() {
|
||||||
await api.post("/supporter-key/hide");
|
// await api.post("/supporter-key/hide");
|
||||||
|
|
||||||
updateSupporterStatus({
|
// updateSupporterStatus({
|
||||||
visible: false
|
// visible: false
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
async function onSubmit(values: z.infer<typeof formSchema>) {
|
// async function onSubmit(values: z.infer<typeof formSchema>) {
|
||||||
try {
|
// try {
|
||||||
const res = await api.post<
|
// const res = await api.post<
|
||||||
AxiosResponse<ValidateSupporterKeyResponse>
|
// AxiosResponse<ValidateSupporterKeyResponse>
|
||||||
>("/supporter-key/validate", {
|
// >("/supporter-key/validate", {
|
||||||
githubUsername: values.githubUsername,
|
// githubUsername: values.githubUsername,
|
||||||
key: values.key
|
// key: values.key
|
||||||
});
|
// });
|
||||||
|
|
||||||
const data = res.data.data;
|
// const data = res.data.data;
|
||||||
|
|
||||||
if (!data || !data.valid) {
|
// if (!data || !data.valid) {
|
||||||
toast({
|
// toast({
|
||||||
variant: "destructive",
|
// variant: "destructive",
|
||||||
title: t("supportKeyInvalid"),
|
// title: t("supportKeyInvalid"),
|
||||||
description: t("supportKeyInvalidDescription")
|
// description: t("supportKeyInvalidDescription")
|
||||||
});
|
// });
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Trigger the toast
|
// // Trigger the toast
|
||||||
toast({
|
// toast({
|
||||||
variant: "default",
|
// variant: "default",
|
||||||
title: t("supportKeyValid"),
|
// title: t("supportKeyValid"),
|
||||||
description: t("supportKeyValidDescription")
|
// description: t("supportKeyValidDescription")
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Fireworks-style confetti
|
// // Fireworks-style confetti
|
||||||
const duration = 5 * 1000; // 5 seconds
|
// const duration = 5 * 1000; // 5 seconds
|
||||||
const animationEnd = Date.now() + duration;
|
// const animationEnd = Date.now() + duration;
|
||||||
const defaults = {
|
// const defaults = {
|
||||||
startVelocity: 30,
|
// startVelocity: 30,
|
||||||
spread: 360,
|
// spread: 360,
|
||||||
ticks: 60,
|
// ticks: 60,
|
||||||
zIndex: 0,
|
// zIndex: 0,
|
||||||
colors: ["#FFA500", "#FF4500", "#FFD700"] // Orange hues
|
// colors: ["#FFA500", "#FF4500", "#FFD700"] // Orange hues
|
||||||
};
|
// };
|
||||||
|
|
||||||
function randomInRange(min: number, max: number) {
|
// function randomInRange(min: number, max: number) {
|
||||||
return Math.random() * (max - min) + min;
|
// return Math.random() * (max - min) + min;
|
||||||
}
|
// }
|
||||||
|
|
||||||
const interval = setInterval(() => {
|
// const interval = setInterval(() => {
|
||||||
const timeLeft = animationEnd - Date.now();
|
// const timeLeft = animationEnd - Date.now();
|
||||||
|
|
||||||
if (timeLeft <= 0) {
|
// if (timeLeft <= 0) {
|
||||||
clearInterval(interval);
|
// clearInterval(interval);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
const particleCount = 50 * (timeLeft / duration);
|
// const particleCount = 50 * (timeLeft / duration);
|
||||||
|
|
||||||
// Launch confetti from two random horizontal positions
|
// // Launch confetti from two random horizontal positions
|
||||||
confetti({
|
// confetti({
|
||||||
...defaults,
|
// ...defaults,
|
||||||
particleCount,
|
// particleCount,
|
||||||
origin: {
|
// origin: {
|
||||||
x: randomInRange(0.1, 0.3),
|
// x: randomInRange(0.1, 0.3),
|
||||||
y: Math.random() - 0.2
|
// y: Math.random() - 0.2
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
confetti({
|
// confetti({
|
||||||
...defaults,
|
// ...defaults,
|
||||||
particleCount,
|
// particleCount,
|
||||||
origin: {
|
// origin: {
|
||||||
x: randomInRange(0.7, 0.9),
|
// x: randomInRange(0.7, 0.9),
|
||||||
y: Math.random() - 0.2
|
// y: Math.random() - 0.2
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}, 250);
|
// }, 250);
|
||||||
|
|
||||||
setPurchaseOptionsOpen(false);
|
// setPurchaseOptionsOpen(false);
|
||||||
setKeyOpen(false);
|
// setKeyOpen(false);
|
||||||
|
|
||||||
updateSupporterStatus({
|
// updateSupporterStatus({
|
||||||
visible: false
|
// visible: false
|
||||||
});
|
// });
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
toast({
|
// toast({
|
||||||
variant: "destructive",
|
// variant: "destructive",
|
||||||
title: t("error"),
|
// title: t("error"),
|
||||||
description: formatAxiosError(
|
// description: formatAxiosError(
|
||||||
error,
|
// error,
|
||||||
t("supportKeyErrorValidationDescription")
|
// t("supportKeyErrorValidationDescription")
|
||||||
)
|
// )
|
||||||
});
|
// });
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Credenza
|
{/* <Credenza
|
||||||
open={purchaseOptionsOpen}
|
open={purchaseOptionsOpen}
|
||||||
onOpenChange={(val) => {
|
onOpenChange={(val) => {
|
||||||
setPurchaseOptionsOpen(val);
|
setPurchaseOptionsOpen(val);
|
||||||
@@ -469,7 +469,7 @@ export default function SupporterStatus({
|
|||||||
{t("supportKeyBuy")}
|
{t("supportKeyBuy")}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
) : null}
|
) : null} */}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user