fix: 提交sentry
This commit is contained in:
@@ -55,6 +55,25 @@ export function TutorialButton({ items }: { items: Item[] }) {
|
||||
|
||||
useOutsideClick(ref as RefObject<HTMLDivElement>, () => setActive(null));
|
||||
|
||||
function openPopupWindow(item) {
|
||||
// features 字符串用于控制窗口的特性
|
||||
const pageWidth = 600; // 弹出窗口的宽度
|
||||
const pageHeight = 550; // 弹出窗口的高度
|
||||
const {
|
||||
availLeft, // 返回浏览器可用空间左边距离屏幕(系统桌面)左边界的距离。
|
||||
availHeight, // 浏览器在显示屏上的可用高度,即当前屏幕高度
|
||||
availWidth, // 浏览器在显示屏上的可用宽度,即当前屏幕宽度
|
||||
} = window.screen;
|
||||
const pageTop = (availHeight - pageHeight) / 2; // 窗口的垂直位置
|
||||
let pageLeft = (availWidth - pageWidth) / 2; // 窗口的水平位置;
|
||||
|
||||
pageLeft += availLeft; // 加上屏幕偏移值
|
||||
|
||||
const features = `width=${pageWidth},height=${pageHeight},left=${pageLeft},top=${pageTop},toolbar=no,location=no,menubar=no`;
|
||||
console.log(features);
|
||||
window.open(item.download, item.title, features);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<AnimatePresence>
|
||||
@@ -151,18 +170,17 @@ export function TutorialButton({ items }: { items: Item[] }) {
|
||||
</div>
|
||||
<div>
|
||||
{item.download ? (
|
||||
<a
|
||||
<button
|
||||
className={cn(
|
||||
buttonVariants({
|
||||
variant: 'default',
|
||||
}),
|
||||
'mr-2 min-w-0 bg-[#EAEAEA] px-3 text-[#225BA9] hover:text-white sm:min-w-[80px]',
|
||||
)}
|
||||
href={item.download}
|
||||
target='_blank'
|
||||
onClick={() => openPopupWindow(item)}
|
||||
>
|
||||
官方下载
|
||||
</a>
|
||||
</button>
|
||||
) : null}
|
||||
<motion.button
|
||||
layoutId={`button-${item.title}-${id}`}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
'use client';
|
||||
|
||||
import * as Sentry from '@sentry/nextjs';
|
||||
import NextError from 'next/error';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export default function GlobalError({ error }: { error: Error & { digest?: string } }) {
|
||||
useEffect(() => {
|
||||
Sentry.captureException(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<html>
|
||||
<body>
|
||||
{/* `NextError` is the default Next.js error page component. Its type
|
||||
definition requires a `statusCode` prop. However, since the App Router
|
||||
does not expose status codes for errors, we simply pass 0 to render a
|
||||
generic error message. */}
|
||||
<NextError statusCode={0} />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user