编写更新日志
This commit is contained in:
@@ -12,15 +12,26 @@ export const UpdateNotification: React.FC = () => {
|
||||
const { updateStatus, isChecking } = useVersionCheck();
|
||||
const [isOwner, setIsOwner] = useState(false);
|
||||
const [isVersionPanelOpen, setIsVersionPanelOpen] = useState(false);
|
||||
const [isMobile, setIsMobile] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// 检查认证信息
|
||||
const authInfo = getAuthInfoFromBrowserCookie();
|
||||
setIsOwner(authInfo?.role === 'owner');
|
||||
|
||||
// 检查是否是移动设备
|
||||
const checkMobile = () => {
|
||||
setIsMobile(window.innerWidth < 768);
|
||||
};
|
||||
|
||||
checkMobile();
|
||||
window.addEventListener('resize', checkMobile);
|
||||
|
||||
return () => window.removeEventListener('resize', checkMobile);
|
||||
}, []);
|
||||
|
||||
// 检查中、不是站长或没有更新时不渲染任何内容
|
||||
if (isChecking || !isOwner || updateStatus !== UpdateStatus.HAS_UPDATE) {
|
||||
// 检查中、不是站长、是移动设备或没有更新时不渲染任何内容
|
||||
if (isChecking || !isOwner || isMobile || updateStatus !== UpdateStatus.HAS_UPDATE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user