Spaces:
Running
Running
Download frontend/src/main.jsx from tntgroup/website_content: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/spaces/tntgroup/website_content/resolve/main/frontend/src/main.jsx
- Command line
-
hf download hf://spaces/tntgroup/website_content/frontend/src/main.jsx
-
curl -L -o main.jsx https://huggingface.co/spaces/tntgroup/website_content/resolve/main/frontend/src/main.jsx
1.65 kB
| import React, { Component } from "react"; | |
| import ReactDOM from "react-dom/client"; | |
| import App from "./App.jsx"; | |
| import { StoreProvider } from "./store"; | |
| import { VideoGenProvider } from "./stores/videoGenStore"; | |
| import { DirtyProvider } from "./stores/dirtyStore"; | |
| import { AuthProvider } from "./stores/authStore"; | |
| import "./theme.css"; | |
| class ErrorBoundary extends Component { | |
| state = { err: null }; | |
| static getDerivedStateFromError(err) { return { err }; } | |
| componentDidCatch(err, info) { console.error("Lỗi render:", err, info); } | |
| render() { | |
| if (this.state.err) { | |
| return ( | |
| <div style={{ padding: 32, fontFamily: "system-ui, sans-serif" }}> | |
| <h2 style={{ color: "#b3541e", margin: "0 0 8px" }}>Có lỗi xảy ra khi hiển thị</h2> | |
| <p style={{ color: "#555", margin: "0 0 16px" }}> | |
| {String(this.state.err.message || this.state.err)} | |
| </p> | |
| <button | |
| onClick={() => window.location.reload()} | |
| style={{ | |
| padding: "8px 16px", border: "1px solid #ddd", borderRadius: 8, | |
| background: "#fff", cursor: "pointer", fontWeight: 600, | |
| }}> | |
| Tải lại trang | |
| </button> | |
| </div> | |
| ); | |
| } | |
| return this.props.children; | |
| } | |
| } | |
| ReactDOM.createRoot(document.getElementById("root")).render( | |
| <React.StrictMode> | |
| <StoreProvider> | |
| <AuthProvider> | |
| <VideoGenProvider> | |
| <DirtyProvider> | |
| <ErrorBoundary> | |
| <App /> | |
| </ErrorBoundary> | |
| </DirtyProvider> | |
| </VideoGenProvider> | |
| </AuthProvider> | |
| </StoreProvider> | |
| </React.StrictMode> | |
| ); | |