@@ -8,10 +8,41 @@ import { LinkedInInsightTag } from 'nextjs-linkedin-insight-tag'
88import { Separator } from '@/components/ui/separator'
99import { siteConfig } from '@/lib/constant'
1010
11+ type LinkInfo = { text : string ; href : string ; target ?: string }
12+
13+ const siteLinks : LinkInfo [ ] = [
14+ { text : 'Home' , href : '/' } ,
15+ { text : 'Docs' , href : '/docs' , target : '_blank' } ,
16+ { text : 'News' , href : 'https://news.codebuff.com' , target : '_blank' } ,
17+ { text : 'Pricing' , href : '/pricing' } ,
18+ { text : 'Usage' , href : '/usage' } ,
19+ ]
20+
21+ const legalLinks : LinkInfo [ ] = [
22+ { text : 'Privacy Policy' , href : '/privacy-policy' } ,
23+ { text : 'Terms of Service' , href : '/terms-of-service' } ,
24+ ]
25+
26+ const communityLinks : LinkInfo [ ] = [
27+ { text : 'Discord' , href : 'https://discord.gg/mcWTGjgTj3' , target : '_blank' } ,
28+ ]
29+
30+ const authLinks : LinkInfo [ ] = [ { text : 'Login' , href : '/login' } ]
31+
32+ const publicPaths = [
33+ ...authLinks ,
34+ ...legalLinks ,
35+ ...siteLinks . filter ( ( link ) => link . href !== '/docs' ) ,
36+ ]
37+ . map ( ( link ) => link . href )
38+ . filter ( ( href ) => ! href . startsWith ( 'http' ) )
39+
1140export const Footer = ( ) => {
1241 const pathname = usePathname ( )
13- if ( pathname . startsWith ( '/docs' ) ) {
14- return < > </ >
42+ const isPublicPage = publicPaths . includes ( pathname )
43+
44+ if ( ! isPublicPage ) {
45+ return null
1546 }
1647
1748 return (
@@ -36,71 +67,49 @@ export const Footer = () => {
3667 < div >
3768 < h3 className = "font-semibold mb-4" > Site</ h3 >
3869 < nav className = "flex flex-col space-y-2" >
39- < Link
40- href = "/"
41- className = "text-muted-foreground hover:text-primary"
42- >
43- Home
44- </ Link >
45- < Link
46- href = "/docs"
47- target = "_blank"
48- className = "text-muted-foreground hover:text-primary"
49- >
50- Docs
51- </ Link >
52- < Link
53- href = "https://news.codebuff.com"
54- target = "_blank"
55- className = "text-muted-foreground hover:text-primary"
56- >
57- News
58- </ Link >
59- < Link
60- href = "/pricing"
61- className = "text-muted-foreground hover:text-primary"
62- >
63- Pricing
64- </ Link >
65- < Link
66- href = "/usage"
67- className = "text-muted-foreground hover:text-primary"
68- >
69- Usage
70- </ Link >
70+ { siteLinks . map ( ( link ) => (
71+ < Link
72+ key = { link . href }
73+ href = { link . href }
74+ target = { link . target }
75+ className = "text-muted-foreground hover:text-primary"
76+ >
77+ { link . text }
78+ </ Link >
79+ ) ) }
7180 </ nav >
7281 </ div >
7382
7483 { /* Legal */ }
7584 < div >
7685 < h3 className = "font-semibold mb-4" > Legal</ h3 >
7786 < nav className = "flex flex-col space-y-2" >
78- < Link
79- href = "/privacy-policy"
80- className = "text-muted-foreground hover:text-primary"
81- >
82- Privacy Policy
83- </ Link >
84- < Link
85- href = "/terms-of-service"
86- className = "text-muted-foreground hover:text-primary"
87- >
88- Terms of Service
89- </ Link >
87+ { legalLinks . map ( ( link ) => (
88+ < Link
89+ key = { link . href }
90+ href = { link . href }
91+ className = "text-muted-foreground hover:text-primary"
92+ >
93+ { link . text }
94+ </ Link >
95+ ) ) }
9096 </ nav >
9197 </ div >
9298
9399 { /* Community */ }
94100 < div >
95101 < h3 className = "font-semibold mb-4" > Community</ h3 >
96102 < nav className = "flex flex-col space-y-2" >
97- < Link
98- href = "https://discord.gg/mcWTGjgTj3"
99- target = "_blank"
100- className = "text-muted-foreground hover:text-primary"
101- >
102- Discord
103- </ Link >
103+ { communityLinks . map ( ( link ) => (
104+ < Link
105+ key = { link . href }
106+ href = { link . href }
107+ target = { link . target }
108+ className = "text-muted-foreground hover:text-primary"
109+ >
110+ { link . text }
111+ </ Link >
112+ ) ) }
104113 </ nav >
105114 </ div >
106115 </ div >
0 commit comments