2022-01-10 14:17:52 -08:00
|
|
|
import React from 'react';
|
2022-03-21 11:09:01 -07:00
|
|
|
import { FormattedMessage, defineMessages, useIntl } from 'react-intl';
|
|
|
|
import { useDispatch } from 'react-redux';
|
2022-03-22 05:42:26 -07:00
|
|
|
import { Link, useHistory } from 'react-router-dom';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2022-01-10 19:25:30 -08:00
|
|
|
import { changeSettingImmediate } from 'soapbox/actions/settings';
|
2022-01-07 17:48:14 -08:00
|
|
|
import snackbar from 'soapbox/actions/snackbar';
|
2022-03-21 11:09:01 -07:00
|
|
|
import { Text } from 'soapbox/components/ui';
|
2022-04-07 11:47:06 -07:00
|
|
|
import SvgIcon from 'soapbox/components/ui/icon/svg-icon';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2022-01-10 14:01:24 -08:00
|
|
|
import Column from '../ui/components/column';
|
2022-01-07 17:27:18 -08:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
heading: { id: 'column.developers', defaultMessage: 'Developers' },
|
2022-01-07 17:48:14 -08:00
|
|
|
leave: { id: 'developers.leave', defaultMessage: 'You have left developers' },
|
2022-01-07 17:27:18 -08:00
|
|
|
});
|
|
|
|
|
2022-03-22 05:42:26 -07:00
|
|
|
const Developers = () => {
|
2022-03-21 11:09:01 -07:00
|
|
|
const dispatch = useDispatch();
|
2022-03-22 05:42:26 -07:00
|
|
|
const history = useHistory();
|
|
|
|
const intl = useIntl();
|
2022-01-07 17:27:18 -08:00
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
const leaveDevelopers = (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
dispatch(changeSettingImmediate(['isDeveloper'], false));
|
|
|
|
dispatch(snackbar.success(intl.formatMessage(messages.leave)));
|
|
|
|
history.push('/');
|
2022-01-07 17:48:14 -08:00
|
|
|
};
|
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
return (
|
|
|
|
<Column label={intl.formatMessage(messages.heading)}>
|
|
|
|
<div className='grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2'>
|
2022-03-30 06:07:17 -07:00
|
|
|
<Link to='/developers/apps/create' className='bg-gray-200 dark:bg-gray-600 p-4 rounded flex flex-col items-center justify-center space-y-2 hover:-translate-y-1 transition-transform'>
|
2022-04-07 11:47:06 -07:00
|
|
|
<SvgIcon src={require('@tabler/icons/icons/apps.svg')} className='dark:text-gray-100' />
|
2022-01-07 17:48:14 -08:00
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
<Text>
|
|
|
|
<FormattedMessage id='developers.navigation.app_create_label' defaultMessage='Create an app' />
|
|
|
|
</Text>
|
|
|
|
</Link>
|
2022-01-07 17:48:14 -08:00
|
|
|
|
2022-03-30 06:07:17 -07:00
|
|
|
<Link to='/developers/settings_store' className='bg-gray-200 dark:bg-gray-600 p-4 rounded flex flex-col items-center justify-center space-y-2 hover:-translate-y-1 transition-transform'>
|
2022-04-07 11:47:06 -07:00
|
|
|
<SvgIcon src={require('@tabler/icons/icons/code-plus.svg')} className='dark:text-gray-100' />
|
2022-01-07 17:48:14 -08:00
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
<Text>
|
|
|
|
<FormattedMessage id='developers.navigation.settings_store_label' defaultMessage='Settings store' />
|
|
|
|
</Text>
|
|
|
|
</Link>
|
|
|
|
|
2022-03-30 06:07:17 -07:00
|
|
|
<Link to='/error' className='bg-gray-200 dark:bg-gray-600 p-4 rounded flex flex-col items-center justify-center space-y-2 hover:-translate-y-1 transition-transform'>
|
2022-04-07 11:47:06 -07:00
|
|
|
<SvgIcon src={require('@tabler/icons/icons/mood-sad.svg')} className='dark:text-gray-100' />
|
2022-03-21 11:09:01 -07:00
|
|
|
|
|
|
|
<Text>
|
|
|
|
<FormattedMessage id='developers.navigation.intentional_error_label' defaultMessage='Trigger an error' />
|
|
|
|
</Text>
|
|
|
|
</Link>
|
|
|
|
|
2022-03-30 06:07:17 -07:00
|
|
|
<button onClick={leaveDevelopers} className='bg-gray-200 dark:bg-gray-600 p-4 rounded flex flex-col items-center justify-center space-y-2 hover:-translate-y-1 transition-transform'>
|
2022-04-07 11:47:06 -07:00
|
|
|
<SvgIcon src={require('@tabler/icons/icons/logout.svg')} className='dark:text-gray-100' />
|
2022-03-21 11:09:01 -07:00
|
|
|
|
|
|
|
<Text>
|
|
|
|
<FormattedMessage id='developers.navigation.leave_developers_label' defaultMessage='Leave developers' />
|
|
|
|
</Text>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</Column>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-03-22 05:42:26 -07:00
|
|
|
export default Developers;
|