summaryrefslogtreecommitdiff
path: root/src/components/shared
diff options
context:
space:
mode:
authorHaishan <[email protected]>2021-05-30 16:33:27 +0800
committerHaishan <[email protected]>2021-05-30 17:11:57 +0800
commitcac64c0d2a80105db14ae04e0aeb4eacb148a771 (patch)
tree0471b5af331986b00366856ace236617bcb6c16e /src/components/shared
parentd46ce57be85dc39453cb5668a49ca76e18d6ec7c (diff)
Use vite
Diffstat (limited to 'src/components/shared')
-rw-r--r--src/components/shared/Head.tsx35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/components/shared/Head.tsx b/src/components/shared/Head.tsx
index 3f2e966..1622473 100644
--- a/src/components/shared/Head.tsx
+++ b/src/components/shared/Head.tsx
@@ -1,5 +1,4 @@
import * as React from 'react';
-import { Helmet } from 'react-helmet';
import { connect } from 'src/components/StateProvider';
import { getClashAPIConfig, getClashAPIConfigs } from 'src/store/app';
@@ -8,21 +7,27 @@ const mapState = (s) => ({
apiConfigs: getClashAPIConfigs(s),
});
-function HeadImpl({ apiConfig, apiConfigs }: { apiConfig: { baseURL: string }, apiConfigs: any[] }) {
- let title = 'yacd';
- if (apiConfigs.length > 1) {
- try {
- const host = new URL(apiConfig.baseURL).host;
- title = `${host} - yacd`;
- } catch (e) {
- // ignore
+function HeadImpl({
+ apiConfig,
+ apiConfigs,
+}: {
+ apiConfig: { baseURL: string };
+ apiConfigs: any[];
+}) {
+ React.useEffect(() => {
+ let title = 'yacd';
+ if (apiConfigs.length > 1) {
+ try {
+ const host = new URL(apiConfig.baseURL).host;
+ title = `${host} - yacd`;
+ } catch (e) {
+ // ignore
+ }
}
- }
- return (
- <Helmet>
- <title>{title}</title>
- </Helmet>
- );
+ document.title = title;
+ });
+
+ return <></>;
}
export const Head = connect(mapState)(HeadImpl);