-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathApp.js
More file actions
72 lines (67 loc) · 2.51 KB
/
Copy pathApp.js
File metadata and controls
72 lines (67 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import React, { useEffect } from "react"
import routes from "./routes"
import { withRouter } from "react-router"
import { Init, AuthGuard, ThemeLoader } from "components"
import { renderRoutes } from "react-router-config"
import { LastLocationProvider } from "react-router-last-location"
import { createUseStyles } from "react-jss"
import { Helmet } from "react-helmet"
import { redirectOldLinks } from "services/helper"
import { useLocation } from "react-router-dom"
const TwitterEmbedAPI = React.lazy(
() => import("components/pages/TwitterEmbedAPI"),
)
const useStyles = createUseStyles((theme) => ({
wrapper: {
overflow: "hidden !important",
backgroundColor: theme.background.primary,
},
}))
const AppWrapper = ({ children }) => {
const classes = useStyles()
return <div className={classes.wrapper}>{children}</div>
}
const App = () => {
const { pathname } = useLocation()
const twitterEmbedRoutes = pathname.match(/^\/twitterEmbed/)
const currentSiteUrl = window.location.protocol + "//" + window.location.host
useEffect(() => {
// redirect old links to the new ones
redirectOldLinks()
}, [])
return (
<React.Fragment>
<React.Suspense fallback={<span> </span>}>
<Helmet>
<link rel="canonical" href={currentSiteUrl} />
<meta property="og:title" content="D.Buzz" />
<meta
property="og:description"
content="D.Buzz | Micro-blogging for HIVE | Connect with thought leaders and like-minded individuals on d.buzz. Explore trending topics, share your insights, and join the community today."
/>
<meta property="og:image" content="https://d.buzz/dbuzz.svg" />
<meta property="title" content="D.Buzz" />
<meta
property="description"
content="D.Buzz | Micro-blogging for HIVE | Connect with thought leaders and like-minded individuals on d.buzz. Explore trending topics, share your insights, and join the community today."
/>
<meta property="image" content="https://d.buzz/dbuzz-icon.svg" />
</Helmet>
<LastLocationProvider>
<ThemeLoader>
{!twitterEmbedRoutes ? (
<Init>
<AuthGuard>
<AppWrapper>{renderRoutes(routes)}</AppWrapper>
</AuthGuard>
</Init>
) : (
<TwitterEmbedAPI />
)}
</ThemeLoader>
</LastLocationProvider>
</React.Suspense>
</React.Fragment>
)
}
export default withRouter(App)