11import { createLink } from "@tanstack/react-router" ;
22import { useTranslation } from "react-i18next" ;
33
4+ import type { Locale } from "../lib/locale" ;
5+
46import { Footer } from "../design-system/footer" ;
57import { Link } from "../design-system/link" ;
6- import type { Locale } from "../lib/locale" ;
78import { useLocale } from "../lib/LocaleContext" ;
89import { AtStoreLogo } from "./AtStoreLogo" ;
910
@@ -22,39 +23,80 @@ type SearchLink = {
2223} ;
2324type PlainLink = {
2425 kind : "plain" ;
25- to : "/developers/atproto" | "/products/manage" | "/apps/tags" | "/apps/lexicons" ;
26+ to :
27+ | "/developers/atproto"
28+ | "/products/manage"
29+ | "/apps/tags"
30+ | "/apps/lexicons" ;
2631 tKey : string ;
2732} ;
2833type FooterLinkDef = LocaleLink | SearchLink | PlainLink ;
2934
30- const LINK_GROUPS : Array < { titleKey ?: string ; links : FooterLinkDef [ ] } > = [
35+ const LINK_GROUPS : Array < { titleKey ?: string ; links : Array < FooterLinkDef > } > = [
3136 {
3237 links : [
3338 { kind : "locale" , to : "/$locale/about" , tKey : "siteFooter.nav.about" } ,
3439 { kind : "locale" , to : "/$locale" , tKey : "siteFooter.nav.home" } ,
35- { kind : "search" , to : "/search" , search : { sort : "popular" } , tKey : "siteFooter.nav.search" } ,
36- { kind : "plain" , to : "/developers/atproto" , tKey : "siteFooter.nav.developerApi" } ,
37- { kind : "plain" , to : "/products/manage" , tKey : "siteFooter.nav.manageListings" } ,
40+ {
41+ kind : "search" ,
42+ to : "/search" ,
43+ search : { sort : "popular" } ,
44+ tKey : "siteFooter.nav.search" ,
45+ } ,
46+ {
47+ kind : "plain" ,
48+ to : "/developers/atproto" ,
49+ tKey : "siteFooter.nav.developerApi" ,
50+ } ,
51+ {
52+ kind : "plain" ,
53+ to : "/products/manage" ,
54+ tKey : "siteFooter.nav.manageListings" ,
55+ } ,
3856 ] ,
3957 } ,
4058 {
4159 titleKey : "siteFooter.apps.groupTitle" ,
4260 links : [
43- { kind : "search" , to : "/apps/all" , search : { sort : "popular" } , tKey : "siteFooter.apps.allApps" } ,
61+ {
62+ kind : "search" ,
63+ to : "/apps/all" ,
64+ search : { sort : "popular" } ,
65+ tKey : "siteFooter.apps.allApps" ,
66+ } ,
4467 { kind : "plain" , to : "/apps/tags" , tKey : "siteFooter.apps.categories" } ,
45- { kind : "plain" , to : "/apps/lexicons" , tKey : "siteFooter.apps.sharedData" } ,
68+ {
69+ kind : "plain" ,
70+ to : "/apps/lexicons" ,
71+ tKey : "siteFooter.apps.sharedData" ,
72+ } ,
4673 ] ,
4774 } ,
4875] ;
4976
5077function renderLink ( link : FooterLinkDef , locale : Locale , label : string ) {
5178 switch ( link . kind ) {
52- case "locale" :
53- return < FooterLink key = { link . to } to = { link . to } params = { { locale } } > { label } </ FooterLink > ;
54- case "search" :
55- return < FooterLink key = { link . to } to = { link . to } search = { link . search } > { label } </ FooterLink > ;
56- case "plain" :
57- return < FooterLink key = { link . to } to = { link . to } > { label } </ FooterLink > ;
79+ case "locale" : {
80+ return (
81+ < FooterLink key = { link . to } to = { link . to } params = { { locale } } >
82+ { label }
83+ </ FooterLink >
84+ ) ;
85+ }
86+ case "search" : {
87+ return (
88+ < FooterLink key = { link . to } to = { link . to } search = { link . search } >
89+ { label }
90+ </ FooterLink >
91+ ) ;
92+ }
93+ case "plain" : {
94+ return (
95+ < FooterLink key = { link . to } to = { link . to } >
96+ { label }
97+ </ FooterLink >
98+ ) ;
99+ }
58100 }
59101}
60102
@@ -74,7 +116,9 @@ export function SiteFooter() {
74116 key = { i }
75117 title = { group . titleKey ? t ( group . titleKey as never ) : undefined }
76118 >
77- { group . links . map ( ( link ) => renderLink ( link , locale , t ( link . tKey as never ) ) ) }
119+ { group . links . map ( ( link ) =>
120+ renderLink ( link , locale , t ( link . tKey as never ) ) ,
121+ ) }
78122 </ Footer . NavGroup >
79123 ) ) }
80124 </ Footer . NavSection >
0 commit comments