2022-04-19 19:42:03 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
2023-01-09 15:11:39 -08:00
|
|
|
import ForkAwesomeIcon from 'soapbox/components/fork-awesome-icon';
|
2022-04-19 19:42:03 -07:00
|
|
|
import { Widget, Stack, Text } from 'soapbox/components/ui';
|
2022-11-26 08:38:16 -08:00
|
|
|
import { useInstance, useSettings, useSoapboxConfig } from 'soapbox/hooks';
|
2022-04-19 19:42:03 -07:00
|
|
|
|
|
|
|
const PromoPanel: React.FC = () => {
|
2022-11-26 08:38:16 -08:00
|
|
|
const instance = useInstance();
|
2022-04-19 19:42:03 -07:00
|
|
|
const { promoPanel } = useSoapboxConfig();
|
|
|
|
const settings = useSettings();
|
|
|
|
|
|
|
|
const promoItems = promoPanel.get('items');
|
|
|
|
const locale = settings.get('locale');
|
|
|
|
|
|
|
|
if (!promoItems || promoItems.isEmpty()) return null;
|
|
|
|
|
|
|
|
return (
|
2022-11-26 08:38:16 -08:00
|
|
|
<Widget title={instance.title}>
|
2022-04-19 19:42:03 -07:00
|
|
|
<Stack space={2}>
|
|
|
|
{promoItems.map((item, i) => (
|
2022-04-21 15:52:48 -07:00
|
|
|
<Text key={i}>
|
|
|
|
<a className='flex items-center' href={item.url} target='_blank'>
|
2023-02-01 14:13:42 -08:00
|
|
|
<ForkAwesomeIcon id={item.icon} className='mr-2 flex-none text-lg rtl:mr-0 rtl:ml-2' fixedWidth />
|
2022-04-19 19:42:03 -07:00
|
|
|
{item.textLocales.get(locale) || item.text}
|
|
|
|
</a>
|
|
|
|
</Text>
|
|
|
|
))}
|
|
|
|
</Stack>
|
|
|
|
</Widget>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default PromoPanel;
|