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-05 11:40:43 +02:00
|
|
|
import Button from '../shared/Button';
|
2022-05-28 11:03:36 +02:00
|
|
|
import { BoxTitleText, SmallMutedText } from '../shared/CustomTexts';
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
followed: boolean;
|
|
|
|
|
submitFollow(): void;
|
|
|
|
|
|
|
|
|
|
isLoggedIn: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ActionBox = ({followed, submitFollow, isLoggedIn}: Props) => (
|
|
|
|
|
<div className="actionBoxContainer">
|
|
|
|
|
<div className="actionBoxFollow">
|
2022-06-05 11:40:43 +02:00
|
|
|
<BoxTitleText>{I18n.t('post.action_box.title')}</BoxTitleText>
|
2022-05-28 11:03:36 +02:00
|
|
|
<br />
|
|
|
|
|
<Button onClick={isLoggedIn ? submitFollow : () => location.href = '/users/sign_in'} outline>
|
2022-06-05 11:40:43 +02:00
|
|
|
{ followed ? I18n.t('post.action_box.unfollow_button') : I18n.t('post.action_box.follow_button') }
|
2022-05-28 11:03:36 +02:00
|
|
|
</Button>
|
|
|
|
|
<br />
|
|
|
|
|
<SmallMutedText>
|
|
|
|
|
{ followed ?
|
2022-06-05 11:40:43 +02:00
|
|
|
I18n.t('post.action_box.following_description')
|
2022-05-28 11:03:36 +02:00
|
|
|
:
|
2022-06-05 11:40:43 +02:00
|
|
|
I18n.t('post.action_box.not_following_description')
|
2022-05-28 11:03:36 +02:00
|
|
|
}
|
|
|
|
|
</SmallMutedText>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default ActionBox;
|