|
| 1 | +import { useEffect } from 'react' |
| 2 | +import { useTranslation } from '@helpwave/hightide' |
| 3 | +import * as CookieConsent from 'vanilla-cookieconsent' |
| 4 | +import { Helpwave } from '@helpwave/hightide' |
| 5 | +import type { Languages } from '@helpwave/hightide' |
| 6 | +import { useLanguage } from '@helpwave/hightide' |
| 7 | +import { Select } from '@helpwave/hightide' |
| 8 | +import pluginConfig from '../utils/CookieConsentConfig' |
| 9 | +import FooterLinkGroup from './FooterLinkGroup' |
| 10 | +import 'vanilla-cookieconsent/dist/cookieconsent.css' |
| 11 | +import type { ThemeType, ThemeTypeTranslation } from '@helpwave/hightide' |
| 12 | +import { defaultThemeTypeTranslation } from '@helpwave/hightide' |
| 13 | +import { useTheme } from '@helpwave/hightide' |
| 14 | + |
| 15 | +type Categories = 'socials' | 'general' | 'products' | 'development' |
| 16 | +type FooterTranslation = { [key in Categories]: string } & ThemeTypeTranslation |
| 17 | + |
| 18 | +const defaultFooterTranslation: Record<Languages, FooterTranslation> = { |
| 19 | + en: { |
| 20 | + socials: 'socials', |
| 21 | + general: 'general', |
| 22 | + products: 'products', |
| 23 | + development: 'development', |
| 24 | + ...defaultThemeTypeTranslation.en, |
| 25 | + }, |
| 26 | + de: { |
| 27 | + socials: 'social', |
| 28 | + general: 'allgemein', |
| 29 | + products: 'produkte', |
| 30 | + development: 'entwicklung', |
| 31 | + ...defaultThemeTypeTranslation.de, |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +type LinkType = { name: string, link: string, openInCurrentTab?: boolean, onClick?: () => void } |
| 36 | +const linkGroups: Record<Categories, LinkType[]> = { |
| 37 | + socials: [ |
| 38 | + { name: 'GitHub', link: 'https://github.com/helpwave/' }, |
| 39 | + { name: 'LinkedIn', link: 'https://linkedin.com/company/helpwave/' }, |
| 40 | + { name: 'Instagram', link: 'https://instagram.com/helpwave_de/' }, |
| 41 | + { name: 'Twitter', link: 'https://twitter.com/helpwave_org' }, |
| 42 | + { name: 'YouTube', link: 'https://www.youtube.com/@helpwave' }, |
| 43 | + { name: 'Twitch', link: 'https://www.twitch.tv/helpwave' }, |
| 44 | + { name: 'Spotify', link: 'https://open.spotify.com/show/6hL5UMytp81gmURnfn3dS9' }, |
| 45 | + { name: 'Apple Podcasts', link: 'https://podcasts.apple.com/us/podcast/helpwave-talks/id1695217116' }, |
| 46 | + { name: 'Google Podcasts', link: 'https://podcasts.google.com/feed/aHR0cHM6Ly9hbmNob3IuZm0vcy9lNTE1NWZhMC9wb2RjYXN0L3Jzcw' }, |
| 47 | + { name: 'Slack', link: 'https://helpwave.slack.com' }, |
| 48 | + ], |
| 49 | + development: [ |
| 50 | + { name: 'Status', link: 'https://helpwave.betteruptime.com/' }, |
| 51 | + { name: 'web', link: 'https://github.com/helpwave/web' }, |
| 52 | + { name: 'mobile-app', link: 'https://github.com/helpwave/mobile-app' }, |
| 53 | + { name: 'services', link: 'https://github.com/helpwave/services' }, |
| 54 | + { name: 'helpwave tasks', link: 'https://tasks.helpwave.de' }, |
| 55 | + ], |
| 56 | + general: [ |
| 57 | + { name: 'Support', link: 'https://support.helpwave.de' }, |
| 58 | + { name: 'Imprint', link: 'https://cdn.helpwave.de/imprint.html' }, |
| 59 | + { name: 'Privacy', link: 'https://cdn.helpwave.de/privacy.html' }, |
| 60 | + { name: 'Cookies', link: '', onClick: () => CookieConsent.showPreferences() }, |
| 61 | + { name: 'Contact', link: 'mailto:[email protected]' }, |
| 62 | + { name: 'Pitchdeck', link: 'https://cdn.helpwave.de/helpwave_pitchdeck.pdf' }, |
| 63 | + { name: 'Onepager', link: 'https://cdn.helpwave.de/helpwave_onepager.pdf' }, |
| 64 | + { name: 'LOI', link: 'https://cdn.helpwave.de/helpwave_letter_of_intent.pdf' }, |
| 65 | + { name: 'Tech-Radar', link: '/tech-radar', openInCurrentTab: true }, |
| 66 | + { name: 'Credits', link: '/credits', openInCurrentTab: true }, |
| 67 | + ], |
| 68 | + products: [ |
| 69 | + { name: 'helpwave tasks', link: '/product/tasks' }, |
| 70 | + { name: 'App Zum Doc', link: 'https://app-zum-doc.de/' }, |
| 71 | + { name: 'mediQuu Netzmanager', link: 'https://mediquu.de/mediquu_netzmanager.html' }, |
| 72 | + /* { name: 'scaffold', link: '/product/scaffold' }, |
| 73 | + { name: 'cloud', link: '/product/cloud' }, |
| 74 | + { name: 'impulse', link: '/product/impulse' }, |
| 75 | + { name: 'analytics', link: '/product/analytics' }, |
| 76 | + { name: 'core', link: '/product/core' }, */ |
| 77 | + ] |
| 78 | +} |
| 79 | + |
| 80 | +const grouping: (Categories[])[] = [ |
| 81 | + ['socials'], |
| 82 | + ['general', 'products'], |
| 83 | + ['development'] |
| 84 | +] |
| 85 | + |
| 86 | +const Footer = () => { |
| 87 | + const year = new Date().getFullYear() |
| 88 | + const { language, setLanguage } = useLanguage() |
| 89 | + const { theme, setTheme } = useTheme() |
| 90 | + const translation = useTranslation(defaultFooterTranslation, {}) |
| 91 | + |
| 92 | + useEffect(() => { |
| 93 | + CookieConsent.run(pluginConfig) |
| 94 | + }, []) |
| 95 | + |
| 96 | + return ( |
| 97 | + <div className="w-screen bg-black text-white py-8 col items-center justify-center"> |
| 98 | + <div className="flex flex-wrap w-full max-w-[900px] max-tablet:px-6 tablet:px-24 desktop:px-24 mx-auto justify-between"> |
| 99 | + {grouping.map((groups, index) => ( |
| 100 | + <div key={index} className="col max-tablet:w-full w-[192px] max-tablet:text-center max-tablet:items-center"> |
| 101 | + {groups.map((category) => ( |
| 102 | + <FooterLinkGroup key={category} title={translation[category]} links={linkGroups[category]} /> |
| 103 | + ))} |
| 104 | + {index === 2 && ( |
| 105 | + <> |
| 106 | + <Select<Languages> |
| 107 | + value={language} |
| 108 | + onChange={(language) => setLanguage(language)} |
| 109 | + options={[ |
| 110 | + { value: 'de', label: 'Deutsch' }, |
| 111 | + { value: 'en', label: 'English' } |
| 112 | + ]}> |
| 113 | + </Select> |
| 114 | + <Select<ThemeType> |
| 115 | + value={theme} |
| 116 | + onChange={(theme) => setTheme(theme)} |
| 117 | + options={[ |
| 118 | + { value: 'light', label: translation.light }, |
| 119 | + { value: 'dark', label: translation.dark } |
| 120 | + ]}> |
| 121 | + </Select> |
| 122 | + </> |
| 123 | + )} |
| 124 | + </div> |
| 125 | + ))} |
| 126 | + </div> |
| 127 | + <div |
| 128 | + className="row w-full h-[128px] items-center justify-center mx-auto font-space"> |
| 129 | + <Helpwave color="white" size={128} /> |
| 130 | + <span className="textstyle-title-normal">© {year} helpwave</span> |
| 131 | + </div> |
| 132 | + </div> |
| 133 | + ) |
| 134 | +} |
| 135 | + |
| 136 | +export default Footer |
0 commit comments