|
|
@ -14,7 +14,7 @@ import { getAuthenticatedUser, getChecked } from 'src/selectors/authentication' |
|
|
|
import { getUserPosts } from 'src/selectors/posts' |
|
|
|
import { getThemeName } from 'src/selectors/theme' |
|
|
|
|
|
|
|
import { useDeepCompareEffect, useConfig, useTheme } from 'src/hooks' |
|
|
|
import { useDeepCompareEffect, useConfig, useTheme, useSetting } from 'src/hooks' |
|
|
|
import { setTitle, urlForBlob } from 'src/utils' |
|
|
|
import { AppState, Theme, EntityType, User, Post, AppThunkDispatch, LevelItem } from 'src/types' |
|
|
|
|
|
|
@ -42,6 +42,7 @@ const ViewUser: FC = () => { |
|
|
|
const dispatch = useDispatch<AppThunkDispatch>() |
|
|
|
const config = useConfig() |
|
|
|
const history = useHistory() |
|
|
|
const allowThemeChange = useSetting<boolean>('allowThemeChange', true) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
const init = async () => { |
|
|
@ -59,11 +60,11 @@ const ViewUser: FC = () => { |
|
|
|
useDeepCompareEffect(() => { |
|
|
|
if (user) { |
|
|
|
setTitle(user.name) |
|
|
|
dispatch(setTheme(user.theme)) |
|
|
|
if (allowThemeChange && user.theme) dispatch(setTheme(user.theme)) |
|
|
|
} |
|
|
|
|
|
|
|
return () => { |
|
|
|
if (selectedThemeName) dispatch(setTheme(selectedThemeName)) |
|
|
|
if (allowThemeChange && selectedThemeName) dispatch(setTheme(selectedThemeName)) |
|
|
|
} |
|
|
|
}, [user]) |
|
|
|
|
|
|
@ -121,8 +122,8 @@ const ViewUser: FC = () => { |
|
|
|
|
|
|
|
<div className="buttons"> |
|
|
|
{subscribed && |
|
|
|
<button className="button is-danger" onClick={() => dispatch(unsubscribe(user.id))}> |
|
|
|
<span className="icon is-small"> |
|
|
|
<button style={{ backgroundColor: theme.red, color: 'white' }} onClick={() => dispatch(unsubscribe(user.id))}> |
|
|
|
<span className="icon"> |
|
|
|
<FontAwesomeIcon icon={faUserMinus} /> |
|
|
|
</span> |
|
|
|
<span>Unsusbcribe</span> |
|
|
@ -130,8 +131,8 @@ const ViewUser: FC = () => { |
|
|
|
} |
|
|
|
|
|
|
|
{subscriptionPending && |
|
|
|
<button className="button is-warning"> |
|
|
|
<span className="icon is-small"> |
|
|
|
<button style={{ backgroundColor: theme.blue, color: 'white' }}> |
|
|
|
<span className="icon"> |
|
|
|
<FontAwesomeIcon icon={faUserClock} /> |
|
|
|
</span> |
|
|
|
<span>Pending</span> |
|
|
@ -139,8 +140,8 @@ const ViewUser: FC = () => { |
|
|
|
} |
|
|
|
|
|
|
|
{self && !isSelf && !subscribed && !subscriptionPending && |
|
|
|
<button className="button is-success" onClick={() => dispatch(subscribe(user.id))}> |
|
|
|
<span className="icon is-small"> |
|
|
|
<button style={{ backgroundColor: theme.green, color: 'white' }} onClick={() => dispatch(subscribe(user.id))}> |
|
|
|
<span className="icon"> |
|
|
|
<FontAwesomeIcon icon={faUserPlus} /> |
|
|
|
</span> |
|
|
|
<span>Subscribe</span> |
|
|
@ -148,8 +149,8 @@ const ViewUser: FC = () => { |
|
|
|
} |
|
|
|
|
|
|
|
{!isSelf && |
|
|
|
<button className="button is-danger"> |
|
|
|
<span className="icon is-small"> |
|
|
|
<button style={{ backgroundColor: theme.red, color: 'white' }}> |
|
|
|
<span className="icon"> |
|
|
|
<FontAwesomeIcon icon={faBan} /> |
|
|
|
</span> |
|
|
|
<span>Block</span> |
|
|
@ -157,8 +158,8 @@ const ViewUser: FC = () => { |
|
|
|
} |
|
|
|
|
|
|
|
{user.group && !isGroup && |
|
|
|
<button className="button is-danger"> |
|
|
|
<span className="icon is-small"> |
|
|
|
<button style={{ backgroundColor: theme.red, color: 'white' }}> |
|
|
|
<span className="icon"> |
|
|
|
<FontAwesomeIcon icon={faBan} /> |
|
|
|
</span> |
|
|
|
<span>Block Community: {user.group.name}</span> |
|
|
|