2023-04-22 20:39:27 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
import ReactDOM from 'react-dom/client';
|
2024-03-23 21:24:39 +08:00
|
|
|
import { BrowserRouter } from 'react-router-dom';
|
2025-06-08 12:14:49 +08:00
|
|
|
import '@douyinfe/semi-ui/dist/css/semi.css';
|
2024-03-23 21:24:39 +08:00
|
|
|
import { UserProvider } from './context/User';
|
2023-04-22 20:39:27 +08:00
|
|
|
import 'react-toastify/dist/ReactToastify.css';
|
2024-03-23 21:24:39 +08:00
|
|
|
import { StatusProvider } from './context/Status';
|
2024-04-16 17:11:39 +08:00
|
|
|
import { ThemeProvider } from './context/Theme';
|
2025-06-04 00:42:06 +08:00
|
|
|
import PageLayout from './components/layout/PageLayout.js';
|
2024-12-12 23:32:55 +08:00
|
|
|
import './i18n/i18n.js';
|
2025-06-04 00:42:06 +08:00
|
|
|
import './index.css';
|
2023-04-22 20:39:27 +08:00
|
|
|
|
2024-01-07 18:31:14 +08:00
|
|
|
// initialization
|
2024-03-23 20:22:00 +08:00
|
|
|
|
2023-04-22 20:39:27 +08:00
|
|
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
|
|
|
root.render(
|
2025-06-04 01:00:48 +08:00
|
|
|
<React.StrictMode>
|
2024-03-23 21:24:39 +08:00
|
|
|
<StatusProvider>
|
|
|
|
|
<UserProvider>
|
|
|
|
|
<BrowserRouter>
|
2024-04-16 17:11:39 +08:00
|
|
|
<ThemeProvider>
|
📱 refactor(web): remove legacy isMobile util and migrate to useIsMobile hook
BREAKING CHANGE:
helpers/utils.js no longer exports `isMobile()`.
Any external code that relied on this function must switch to the `useIsMobile` React hook.
Summary
-------
1. Deleted the obsolete `isMobile()` function from helpers/utils.js.
2. Introduced `MOBILE_BREAKPOINT` constant and `matchMedia`-based detection for non-React contexts.
3. Reworked toast positioning logic in utils.js to rely on `matchMedia`.
4. Updated render.js:
• Removed isMobile import.
• Added MOBILE_BREAKPOINT detection in `truncateText`.
5. Migrated every page/component to the `useIsMobile` hook:
• Layout: HeaderBar, PageLayout, SiderBar
• Pages: Home, Detail, Playground, User (Add/Edit), Token, Channel, Redemption, Ratio Sync
• Components: ChannelsTable, ChannelSelectorModal, ConflictConfirmModal
6. Purged all remaining `isMobile()` calls and legacy imports.
7. Added missing `const isMobile = useIsMobile()` declarations where required.
Benefits
--------
• Unifies mobile detection with a React-friendly hook.
• Eliminates duplicated logic and improves maintainability.
• Keeps non-React helpers lightweight by using `matchMedia` directly.
2025-07-16 02:54:58 +08:00
|
|
|
<PageLayout />
|
2024-04-16 17:11:39 +08:00
|
|
|
</ThemeProvider>
|
2024-03-23 21:24:39 +08:00
|
|
|
</BrowserRouter>
|
|
|
|
|
</UserProvider>
|
|
|
|
|
</StatusProvider>
|
2025-06-04 01:00:48 +08:00
|
|
|
</React.StrictMode>,
|
2023-04-22 20:39:27 +08:00
|
|
|
);
|