feat: widget link

This commit is contained in:
Tristan Yang
2023-02-20 10:07:56 +08:00
parent 12ae089c6b
commit 7e4833594f
13 changed files with 261 additions and 101 deletions
+12 -4
View File
@@ -1,16 +1,24 @@
import ReactDOM from "react-dom/client";
import { Provider } from "react-redux";
import { WidgetProvider } from './widget/WidgetContext';
import Widget from "./widget/index";
import './assets/index.css';
import store from "./app/store";
import './i18n';
import { isDarkMode } from "./common/utils";
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
const hostId = new URLSearchParams(location.search).get("host");
const themeColor = new URLSearchParams(location.search).get("themeColor") || "#1fe1f9";
const hostId = new URLSearchParams(location.search).get("host") || 1;
// dark mode
if (isDarkMode()) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
root.render(
hostId ? <Provider store={store}>
<Widget hostId={Number(hostId)} themeColor={themeColor} />
<WidgetProvider>
<Widget hostId={Number(hostId)} />
</WidgetProvider>
</Provider> : null
);