Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display OSS sponsors #1644

Merged
merged 5 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/baseComponents/useOSSSponsors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useEffect, useState } from 'react'
import { OpenSponsorsUrl } from '../env.ts'

export const useOSSSponsors = () => {
const [sponsors, setSponsors] = useState<
{ name: string; website: string; logo: string; logoDark: string }[]
>([])

useEffect(() => {
const fetchData = async () => {
const response = await fetch(OpenSponsorsUrl)
const data = await response.json()
setSponsors(data.sponsors || [])
}
fetchData()
}, [])

return sponsors
}
5 changes: 2 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import 'vite/client'

export const ViteAuthDomain = import.meta.env.VITE_AUTH_DOMAIN
// @ts-ignore
export const OpenSponsorsUrl = import.meta.env.VITE_OPEN_SPONSORS
63 changes: 48 additions & 15 deletions src/feedback/layout/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import React from 'react'
import { useTranslation } from 'react-i18next'
import { Box, useTheme } from '@mui/material'
import Link from '@mui/material/Link'
import { useOSSSponsors } from '../../baseComponents/useOSSSponsors.ts'

export const Footer = () => {
const { t } = useTranslation()
const theme = useTheme()
const logoColor = theme.palette.mode === 'dark' ? 'white' : 'black'
const isDarkMode = theme.palette.mode === 'dark'
const logoColor = isDarkMode ? 'white' : 'black'

const sponsors = useOSSSponsors()

return (
<Box
Expand All @@ -16,33 +20,62 @@ export const Footer = () => {
padding={1}
marginTop={2}
color={theme.palette.textDimmed}
component="footer"
>
component="footer">
<span style={{ marginRight: 6, marginTop: -2 }}>
{t('footer.madeBy')}
</span>
<a
href="https://github.com/HugoGresse/open-feedback"
target="_blank"
rel="noopener noreferrer"
>
rel="noopener noreferrer">
<img
height="25"
src={`/static/logos/openfeedback-${logoColor}-orange.svg`}
alt="open feedback"
/>
</a>

<Link
href="https://github.com/sponsors/HugoGresse"
target="_blank"
rel="noopener noreferrer"
style={{ color: theme.palette.primary.contrastText }}
>
<span style={{ left: 16, top: -2, position: 'relative' }}>
{t('common.donate')}
</span>
</Link>
<Box
display="flex"
flexDirection="row"
paddingRight={1.8}
paddingTop={0.5}
gap={2}
borderRadius={10}
border="1px solid #888"
alignItems="center"
marginTop={-2}
marginLeft={2}
justifyContent="center">
<Box marginInlineEnd={2}>
<Link
href="https://github.com/sponsors/HugoGresse"
target="_blank"
rel="noopener noreferrer"
style={{ color: theme.palette.textDimmed }}>
<span
style={{ left: 16, top: -2, position: 'relative' }}>
Devenir sponsor
</span>
</Link>
</Box>
{sponsors.map((sponsor) => (
<Box
component="a"
href={sponsor.website}
target="_blank"
key={sponsor.name}
sx={{ ':hover': { opacity: 0.4 } }}>
<img
src={
(isDarkMode && sponsor.logoDark) || sponsor.logo
}
alt={sponsor.name}
style={{ height: 30, borderRadius: 5 }}
/>
</Box>
))}
</Box>
</Box>
)
}