File tree Expand file tree Collapse file tree
app/(with-contexts)/(with-layout)
packages/components-library/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import { BaseLayout } from "@components/public/base-layout";
1212import { Profile } from "@courselit/common-models" ;
1313import { getFullSiteSetup } from "@ui-lib/utils" ;
1414import { useContext } from "react" ;
15- import { CodeInjectorWrapper } from "@components/public/code-injector" ;
15+ import { CodeInjector } from "@components/public/code-injector" ;
1616
1717export default function HomepageLayout ( {
1818 children,
@@ -61,7 +61,10 @@ export default function HomepageLayout({
6161 } }
6262 >
6363 { children }
64- < CodeInjectorWrapper />
64+ < CodeInjector
65+ head = { siteinfo ?. codeInjectionHead }
66+ body = { siteinfo ?. codeInjectionBody }
67+ />
6568 </ BaseLayout >
6669 ) ;
6770}
Original file line number Diff line number Diff line change 11"use client" ;
22
3- import React , { useContext } from "react" ;
3+ import React from "react" ;
44import { connect } from "react-redux" ;
55import { AppState } from "@courselit/state-management" ;
6- import { usePathname } from "next/navigation" ;
7- import { SiteInfoContext } from "@components/contexts" ;
86
97type InjectionSection = "head" | "body" ;
108
119interface CodeInjectorProps {
12- isAdminPage ?: boolean ;
1310 head ?: string ;
1411 body ?: string ;
1512}
1613
17- export const CodeInjectorWrapper = ( ) => {
18- const siteInfo = useContext ( SiteInfoContext ) ;
19- const pathname = usePathname ( ) ;
20-
21- return (
22- < CodeInjector
23- isAdminPage = { pathname ?. startsWith ( "/dashboard" ) }
24- head = { siteInfo ?. codeInjectionHead }
25- body = { siteInfo ?. codeInjectionBody }
26- />
27- ) ;
28- } ;
29-
3014export class CodeInjector extends React . Component < CodeInjectorProps > {
3115 componentDidMount ( ) {
32- if ( ! this . props . isAdminPage ) {
33- const targetTagsForInjection : InjectionSection [ ] = [ "head" , "body" ] ;
34- for ( const target of targetTagsForInjection ) {
35- this . injectCodeIn ( target ) ;
36- }
16+ const targetTagsForInjection : InjectionSection [ ] = [ "head" , "body" ] ;
17+ for ( const target of targetTagsForInjection ) {
18+ this . injectCodeIn ( target ) ;
3719 }
3820 }
3921
Original file line number Diff line number Diff line change @@ -49,9 +49,7 @@ function MyApp({
4949 >
5050 < Component { ...pageProps } />
5151 </ div >
52- < CodeInjector
53- isAdminPage = { router . pathname . startsWith ( "/dashboard" ) }
54- />
52+ < CodeInjector />
5553 </ ThemeProvider >
5654 </ Provider >
5755 </ SessionProvider >
Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ export default function Link({
1919 className = "" ,
2020 onClick,
2121} : LinkProps ) {
22- const isInternal = href && href . startsWith ( "/" ) ;
22+ const isInternal =
23+ href && href . startsWith ( "/" ) && ! href . startsWith ( "/dashboard" ) ;
2324 const isInPageNavigation = href && href . startsWith ( "#" ) ;
2425 const router = useRouter ( ) ;
2526
You can’t perform that action at this time.
0 commit comments