diff options
Diffstat (limited to 'src/components/shared')
| -rw-r--r-- | src/components/shared/Head.tsx | 35 |
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); |
