@@ -9,13 +9,20 @@ import Design from './pages/Design';
99import SplashScreen from './components/SplashScreen' ;
1010import { applyTheme , getStoredTheme } from './theme' ;
1111import Explore from './pages/Explore' ;
12+ import PolicyModal from './components/PolicyModal' ;
13+ import { privacyPolicyContent , termsOfServiceContent , cookiePolicyContent } from './data/policies' ;
1214
1315export default function App ( ) {
1416 // Detect GitHub Pages subdirectory
1517 const isGitHubPages = window . location . hostname . includes ( 'github.io' ) ;
1618 const routerBase = isGitHubPages ? '/myAIchatbotProject' : '/' ;
1719 const [ showSplash , setShowSplash ] = useState ( ( ) => localStorage . getItem ( 'showSplash' ) !== 'false' ) ;
1820 const [ splashVisible , setSplashVisible ] = useState ( showSplash ) ;
21+
22+ // Policy modal state
23+ const [ policyModalOpen , setPolicyModalOpen ] = useState ( false ) ;
24+ const [ policyTitle , setPolicyTitle ] = useState ( '' ) ;
25+ const [ policyContent , setPolicyContent ] = useState ( null ) ;
1926
2027 useEffect ( ( ) => {
2128 const { theme, mode } = getStoredTheme ( ) ;
@@ -28,6 +35,33 @@ export default function App() {
2835 return ( ) => clearTimeout ( timer ) ;
2936 } , [ showSplash ] ) ;
3037
38+ // Functions to open policy modals
39+ const openPrivacyPolicy = ( e ) => {
40+ e . preventDefault ( ) ;
41+ setPolicyTitle ( 'Chính sách Quyền riêng tư' ) ;
42+ setPolicyContent ( privacyPolicyContent ) ;
43+ setPolicyModalOpen ( true ) ;
44+ } ;
45+
46+ const openTermsOfService = ( e ) => {
47+ e . preventDefault ( ) ;
48+ setPolicyTitle ( 'Điều khoản Dịch vụ' ) ;
49+ setPolicyContent ( termsOfServiceContent ) ;
50+ setPolicyModalOpen ( true ) ;
51+ } ;
52+
53+ const openCookiePolicy = ( e ) => {
54+ e . preventDefault ( ) ;
55+ setPolicyTitle ( 'Chính sách Cookie' ) ;
56+ setPolicyContent ( cookiePolicyContent ) ;
57+ setPolicyModalOpen ( true ) ;
58+ } ;
59+
60+ const closePolicyModal = ( ) => {
61+ setPolicyModalOpen ( false ) ;
62+ setPolicyContent ( null ) ;
63+ } ;
64+
3165 return (
3266 < BrowserRouter basename = { routerBase } >
3367 < div className = "min-h-screen app-shell text-[var(--c-text)]" >
@@ -69,7 +103,7 @@ export default function App() {
69103 < div className = "space-y-3" >
70104 < div className = "text-sm font-semibold text-[var(--c-text)]" > Resources</ div >
71105 < div className = "flex flex-col gap-2 text-sm" >
72- < a className = "text-[#5B5B57] hover:text-[var(--c-text)] hover:underline" href = "/ " > Chat</ a >
106+ < a className = "text-[#5B5B57] hover:text-[var(--c-text)] hover:underline" href = "https://thisisanvariableofacoder.github.io/myAIchatbotProject " > Chat</ a >
73107 < a className = "text-[#5B5B57] hover:text-[var(--c-text)] hover:underline" href = "/explore" > Explore</ a >
74108 < a
75109 className = "text-[#5B5B57] hover:text-[var(--c-text)] hover:underline"
@@ -85,9 +119,9 @@ export default function App() {
85119 < div className = "space-y-3" >
86120 < div className = "text-sm font-semibold text-[var(--c-text)]" > Legal</ div >
87121 < div className = "flex flex-col gap-2 text-sm" >
88- < a className = "text-[#5B5B57] hover:text-[var(--c-text)] hover:underline" href = "#" > Privacy policy</ a >
89- < a className = "text-[#5B5B57] hover:text-[var(--c-text)] hover:underline" href = "#" > Terms of service</ a >
90- < a className = "text-[#5B5B57] hover:text-[var(--c-text)] hover:underline" href = "#" > Cookie policy</ a >
122+ < button onClick = { openPrivacyPolicy } className = "text-left text- [#5B5B57] hover:text-[var(--c-text)] hover:underline" > Privacy policy</ button >
123+ < button onClick = { openTermsOfService } className = "text-left text- [#5B5B57] hover:text-[var(--c-text)] hover:underline" > Terms of service</ button >
124+ < button onClick = { openCookiePolicy } className = "text-left text- [#5B5B57] hover:text-[var(--c-text)] hover:underline" > Cookie policy</ button >
91125 </ div >
92126 </ div >
93127 </ div >
@@ -108,6 +142,12 @@ export default function App() {
108142 </ div >
109143 </ footer >
110144 { splashVisible && < SplashScreen onClose = { ( ) => setSplashVisible ( false ) } /> }
145+ < PolicyModal
146+ isOpen = { policyModalOpen }
147+ onClose = { closePolicyModal }
148+ title = { policyTitle }
149+ content = { policyContent }
150+ />
111151 </ div >
112152 </ BrowserRouter >
113153 ) ;
0 commit comments