gab-social/app/javascript/gabsocial/components/link_footer.js

139 lines
4.3 KiB
JavaScript
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
2020-02-04 15:50:18 +00:00
import {
2020-02-05 22:45:48 +00:00
FormattedMessage,
2020-02-04 15:50:18 +00:00
defineMessages,
injectIntl,
} from 'react-intl'
import {
2020-12-16 00:31:30 +00:00
me,
2020-02-04 15:50:18 +00:00
repository,
source_url,
} from '../initial_state'
2020-12-16 00:31:30 +00:00
import { DEFAULT_REL } from '../constants'
2020-02-21 00:57:29 +00:00
import Text from './text'
import Button from './button'
2020-12-16 00:31:30 +00:00
import DotTextSeperator from './dot_text_seperator'
2020-02-04 15:50:18 +00:00
class LinkFooter extends React.PureComponent {
2020-02-04 15:50:18 +00:00
render() {
2020-12-16 00:31:30 +00:00
const { intl } = this.props
2020-02-21 00:57:29 +00:00
2020-04-08 02:06:59 +01:00
const currentYear = new Date().getFullYear()
2020-02-04 15:50:18 +00:00
const linkFooterItems = [
{
href: 'https://help.gab.com',
2020-02-21 00:57:29 +00:00
text: intl.formatMessage(messages.help),
},
2020-02-04 15:50:18 +00:00
{
href: '/auth/edit',
2020-02-04 15:50:18 +00:00
text: intl.formatMessage(messages.security),
requiresUser: true,
},
{
to: '/about',
text: intl.formatMessage(messages.about),
},
{
to: '/about/investors',
text: intl.formatMessage(messages.investors),
},
2020-02-04 15:50:18 +00:00
{
2020-12-16 00:31:30 +00:00
to: '/about/sales',
text: intl.formatMessage(messages.salesTerms),
2020-02-04 15:50:18 +00:00
},
{
to: '/about/dmca',
text: intl.formatMessage(messages.dmca),
},
{
2020-12-16 00:31:30 +00:00
to: '/about/tos',
text: intl.formatMessage(messages.terms),
2020-02-04 15:50:18 +00:00
},
{
to: '/about/privacy',
text: intl.formatMessage(messages.privacy),
},
{
href: '/auth/sign_out',
2020-02-04 15:50:18 +00:00
text: intl.formatMessage(messages.logout),
requiresUser: true,
logout: true,
},
]
return (
2020-12-16 00:31:30 +00:00
<div className={[_s.d, _s.mb15].join(' ')}>
<nav aria-label='Footer' role='navigation' className={[_s.d, _s.flexWrap, _s.flexRow].join(' ')}>
2020-02-04 15:50:18 +00:00
{
linkFooterItems.map((linkFooterItem, i) => {
if (linkFooterItem.requiresUser && !me) return null
2020-02-05 22:45:48 +00:00
2020-02-04 15:50:18 +00:00
return (
2020-12-16 00:31:30 +00:00
<div className={[_s.d, _s.flexRow, _s.aiCenter, _s.jcCenter].join(' ')}>
<Button
isText
underlineOnHover
color='none'
backgroundColor='none'
key={`link-footer-item-${i}`}
to={linkFooterItem.to}
href={linkFooterItem.href}
data-method={linkFooterItem.logout ? 'delete' : null}
onClick={linkFooterItem.onClick || null}
className={[_s.mt5].join(' ')}
>
<Text size='small' color='tertiary'>
{linkFooterItem.text}
</Text>
</Button>
{ !linkFooterItem.logout && <Text size='small' color='secondary' className={[_s.pt2, _s.mr5, _s.ml5].join(' ')}>·</Text> }
</div>
2020-02-04 15:50:18 +00:00
)
})
}
</nav>
2020-04-24 04:17:27 +01:00
<Text size='small' color='tertiary' className={_s.mt10}>
2020-02-21 00:57:29 +00:00
© {currentYear} Gab AI, Inc.
</Text>
2020-04-24 04:17:27 +01:00
<Text size='small' color='tertiary' tagName='p' className={_s.mt10}>
2020-02-05 22:45:48 +00:00
<FormattedMessage
id='getting_started.open_source_notice'
defaultMessage='Gab Social is open source software. You can contribute or report issues on our self-hosted GitLab at {gitlab}.'
2020-02-21 00:57:29 +00:00
values={{
gitlab: (
2020-12-16 00:31:30 +00:00
<a href={source_url} className={[_s.displayInlineBlock, _s.inherit].join(' ')} rel={DEFAULT_REL} target='_blank'>
2020-02-21 00:57:29 +00:00
{repository}
</a>
)
}}
2020-02-05 22:45:48 +00:00
/>
2020-02-21 00:57:29 +00:00
</Text>
2020-02-04 15:50:18 +00:00
</div>
)
}
}
const messages = defineMessages({
investors: { id: 'getting_started.investors', defaultMessage: 'Investors' },
help: { id: 'getting_started.help', defaultMessage: 'Help' },
security: { id: 'getting_started.security', defaultMessage: 'Security' },
about: { id: 'navigation_bar.info', defaultMessage: 'About' },
developers: { id: 'getting_started.developers', defaultMessage: 'Developers' },
terms: { id: 'getting_started.terms', defaultMessage: 'Terms of Service' },
dmca: { id: 'getting_started.dmca', defaultMessage: 'DMCA' },
salesTerms: { id: 'getting_started.terms_of_sale', defaultMessage: 'Terms of Sale' },
privacy: { id: 'getting_started.privacy', defaultMessage: 'Privacy Policy' },
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
})
LinkFooter.propTypes = {
intl: PropTypes.object.isRequired,
}
2020-12-16 00:31:30 +00:00
export default injectIntl(LinkFooter)