2022-05-28 11:03:36 +02:00
|
|
|
import * as React from 'react';
|
2022-06-05 11:40:43 +02:00
|
|
|
import I18n from 'i18n-js';
|
2022-05-28 11:03:36 +02:00
|
|
|
|
2022-06-08 10:20:36 +02:00
|
|
|
import { SmallMutedText } from '../common/CustomTexts';
|
|
|
|
|
import SidebarBox from '../common/SidebarBox';
|
|
|
|
|
import Switch from '../common/Switch';
|
2022-05-28 11:03:36 +02:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
followed: boolean;
|
|
|
|
|
submitFollow(): void;
|
|
|
|
|
|
|
|
|
|
isLoggedIn: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ActionBox = ({followed, submitFollow, isLoggedIn}: Props) => (
|
2022-06-08 10:20:36 +02:00
|
|
|
<SidebarBox title={I18n.t('post.action_box.title')} customClass="actionBoxContainer">
|
|
|
|
|
<Switch
|
|
|
|
|
onClick={isLoggedIn ? submitFollow : () => location.href = '/users/sign_in'}
|
|
|
|
|
label={I18n.t('post.action_box.follow_button')}
|
|
|
|
|
checked={followed}
|
|
|
|
|
htmlId="followSwitch"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<SmallMutedText>
|
|
|
|
|
{ followed ?
|
|
|
|
|
I18n.t('post.action_box.following_description')
|
|
|
|
|
:
|
|
|
|
|
I18n.t('post.action_box.not_following_description')
|
|
|
|
|
}
|
|
|
|
|
</SmallMutedText>
|
|
|
|
|
</SidebarBox>
|
2022-05-28 11:03:36 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default ActionBox;
|