Удален файл 404.html и изменен компонент AppProvider для использования HashRouter вместо BrowserRouter, что улучшает совместимость с GitHub Pages.

This commit is contained in:
Alex Ant
2025-05-24 13:09:17 +05:00
parent be9b4f5957
commit e06645cc5e
2 changed files with 3 additions and 24 deletions
-21
View File
@@ -1,21 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Перенаправление</title>
<script type="text/javascript">
// Перенаправление на index.html с сохранением вложенного пути после /calculator/
var l = window.location;
var base = '/calculator';
// Если уже на index.html — не редиректим!
if (!l.pathname.startsWith(base + '/index.html')) {
var path = l.pathname.startsWith(base) ? l.pathname.slice(base.length) : l.pathname;
var redirectUrl = l.protocol + '//' + l.host + base + '/index.html' + path + l.search + l.hash;
window.location.replace(redirectUrl);
}
</script>
</head>
<body>
<p>Перенаправление на главную страницу...</p>
</body>
</html>
+3 -3
View File
@@ -1,5 +1,5 @@
import { FC, ReactNode } from 'react';
import { BrowserRouter } from 'react-router-dom';
import { HashRouter } from 'react-router-dom';
import { Layout, Row, Col } from 'antd';
import { AppRouter } from './AppRouter';
@@ -11,7 +11,7 @@ interface AppProviderProps {
export const AppProvider: FC<AppProviderProps> = () => {
return (
<BrowserRouter basename="/calculator/">
<HashRouter>
<Layout style={{ minHeight: '100vh', background: 'transparent' }}>
<Content style={{ padding: 0, width: '100%', margin: 0 }}>
<Row justify="center" gutter={[0, 0]} style={{ margin: 0, width: '100%' }}>
@@ -21,6 +21,6 @@ export const AppProvider: FC<AppProviderProps> = () => {
</Row>
</Content>
</Layout>
</BrowserRouter>
</HashRouter>
);
};