File tree Expand file tree Collapse file tree 7 files changed +45
-6
lines changed
Expand file tree Collapse file tree 7 files changed +45
-6
lines changed Original file line number Diff line number Diff line change 1313 "test" : " jest"
1414 },
1515 "dependencies" : {
16+ "@channel.io/channel-web-sdk-loader" : " ^2.0.0" ,
1617 "@sentry/nextjs" : " ^8.47.0" ,
1718 "@tanstack/react-query" : " ^5.61.3" ,
1819 "@tanstack/react-query-devtools" : " ^5.62.11" ,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import * as sentry from '@sentry/nextjs';
55import type { Metadata } from 'next' ;
66import { ReactNode } from 'react' ;
77import './globals.css' ;
8- import { QueryProvider } from '@/components' ;
8+ import { ChannelTalkProvider , QueryProvider } from '@/components' ;
99
1010export const metadata : Metadata = {
1111 title : 'Velog Dashboard' ,
@@ -23,8 +23,10 @@ export default function RootLayout({
2323 < body className = { `${ NotoSansKr . className } w-full bg-BG-MAIN` } >
2424 < sentry . ErrorBoundary >
2525 < QueryProvider >
26- < ToastContainer autoClose = { 2000 } />
27- { children }
26+ < ChannelTalkProvider >
27+ < ToastContainer autoClose = { 2000 } />
28+ { children }
29+ </ ChannelTalkProvider >
2830 </ QueryProvider >
2931 </ sentry . ErrorBoundary >
3032 </ body >
Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ type PropType<T extends clickType> = T extends 'link'
2424 ? Partial < BaseType > & {
2525 clickType : 'function' ;
2626 action : ( ) => void ;
27- children : React . ReactNode | React . ReactNode [ ] ;
27+ children : React . ReactNode ;
2828 }
2929 : T extends 'none'
3030 ? Partial < BaseType > & {
3131 clickType : 'none' ;
3232 action ?: undefined ;
33- children : React . ReactNode | React . ReactNode [ ] ;
33+ children : React . ReactNode ;
3434 }
3535 : never ;
3636
Original file line number Diff line number Diff line change @@ -62,7 +62,10 @@ export const Header = () => {
6262 return (
6363 < nav className = "w-full max-MBI:flex max-MBI:justify-center" >
6464 < div className = "flex w-fit" >
65- < Section clickType = "none" >
65+ < Section
66+ clickType = "function"
67+ action = { ( ) => router . replace ( `/main${ PARAMS . MAIN } ` ) }
68+ >
6669 < Image
6770 width = { 35 }
6871 height = { 35 }
Original file line number Diff line number Diff line change 1+ 'use client' ;
2+
3+ import * as ChannelService from '@channel.io/channel-web-sdk-loader' ;
4+ import { useEffect } from 'react' ;
5+
6+ const ChannelTalkServiceLoader = ( ) => {
7+ const CHANNELTALK_PLUGIN_KEY = process . env . NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY ;
8+ if ( ! CHANNELTALK_PLUGIN_KEY ) {
9+ throw new Error ( 'ABORT_MS가 ENV에서 설정되지 않았습니다' ) ;
10+ }
11+ console . log ( CHANNELTALK_PLUGIN_KEY ) ;
12+
13+ ChannelService . loadScript ( ) ;
14+ ChannelService . boot ( { pluginKey : CHANNELTALK_PLUGIN_KEY } ) ;
15+ } ;
16+
17+ export const ChannelTalkProvider = ( {
18+ children,
19+ } : {
20+ children : React . ReactNode ;
21+ } ) => {
22+ useEffect ( ( ) => ChannelTalkServiceLoader ( ) , [ ] ) ;
23+ return < > { children } </ > ;
24+ } ;
Original file line number Diff line number Diff line change 1+ export * from './ChannelTalkProvider' ;
12export * from './QueryProvider' ;
23export * from './ArriveSoon' ;
34export * from './Dropdown' ;
You can’t perform that action at this time.
0 commit comments