Skip to content

Commit

Permalink
Added size attr for <VodsFollowUnfollowBtn> and added VodsFollowUnfol…
Browse files Browse the repository at this point in the history
…lowBtn and AddUpdateNotificationsButton to Twitch Player and channel pages.
  • Loading branch information
mambans committed Apr 18, 2021
1 parent 1482fd0 commit a25ef6b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ export const VodAddRemoveButton = styled(Button).attrs({ variant: 'link' })`
padding: 0px;
opacity: ${({ loweropacity }) => loweropacity || 1};
margin-right: ${({ marginright }) => marginright || 'unset'};
opacity: 0;
/* opacity: 0; */
transition: opacity 250ms, transform 250ms;
&:hover {
Expand Down
17 changes: 12 additions & 5 deletions frontend/src/components/twitch/channelPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import useEventListenerMemo from '../../../hooks/useEventListenerMemo';
import useQuery from '../../../hooks/useQuery';
import loginNameFormat from '../loginNameFormat';
import useToken from '../useToken';
import VodsFollowUnfollowBtn from '../vods/VodsFollowUnfollowBtn';
import AddUpdateNotificationsButton from '../AddUpdateNotificationsButton';

export default () => {
const { passedChannelData } = useLocation().state || {};
Expand Down Expand Up @@ -439,17 +441,22 @@ export default () => {
src={`${process.env.PUBLIC_URL}/partnered.png`}
/>
)}

<FollowUnfollowBtn
show={channelInfo}
channelName={channelName}
id={channelInfo._id}
/>
{/* <AddUpdateNotificationsButton
<VodsFollowUnfollowBtn
size={28}
channel={channelInfo.name || channelName}
channelId={channelInfo._id}
/>

<AddUpdateNotificationsButton
show={channelInfo}
channel={channelName}
size={30}
/> */}
channel={channelInfo.name || channelName}
size={26}
/>
</div>
<Link
to={{
Expand Down
18 changes: 17 additions & 1 deletion frontend/src/components/twitch/player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import toggleFullscreenFunc from './toggleFullscreenFunc';
import useToken from '../useToken';
import useFullscreen from '../../../hooks/useFullscreen';
import ToolTip from '../../sharedComponents/ToolTip';
import VodsFollowUnfollowBtn from '../vods/VodsFollowUnfollowBtn';
import AddUpdateNotificationsButton from '../AddUpdateNotificationsButton';

const DEFAULT_CHAT_WIDTH = Math.max(window.innerWidth * 0.1, 175);

Expand Down Expand Up @@ -416,13 +418,27 @@ export default () => {
ref={link1}
href={`https://www.twitch.tv/${streamInfo?.user_name || channelName}`}
>
<FaTwitch size={30} color='purple' />
<FaTwitch size={26} color='purple' />
</a>

<FollowUnfollowBtn
channelName={streamInfo?.user_name || channelName}
id={streamInfo.user_id || twitchVideoPlayer.current.getChannelId()}
/>

<VodsFollowUnfollowBtn
size={28}
channel={streamInfo?.user_name || channelName}
channelId={streamInfo.user_id}
marginright='5px;'
/>

<AddUpdateNotificationsButton
channel={streamInfo?.user_name || channelName}
marginright='5px;'
size={26}
/>

<ToolTip
placement={'right'}
delay={{ show: 500, hide: 0 }}
Expand Down
16 changes: 12 additions & 4 deletions frontend/src/components/twitch/vods/VodsFollowUnfollowBtn.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ import ToolTip from '../../sharedComponents/ToolTip';
* @param {Boolean} [show = true] - mount/show button.
*/

export default ({ channel, channelId, loweropacity, marginright, className, show = true }) => {
export default ({
channel,
channelId,
loweropacity,
marginright,
className,
show = true,
size,
}) => {
const { vods, setVods, channels, setChannels } = useContext(VodsContext) || {};
const { authKey, username } = useContext(AccountContext);
const [isHovered, setIsHovered] = useState();
Expand Down Expand Up @@ -102,12 +110,12 @@ export default ({ channel, channelId, loweropacity, marginright, className, show
>
{vodEnabled ? (
isHovered ? (
<MdVideocamOff size='1.4em' color='red' />
<MdVideocamOff size={size || '1.4em'} color='red' />
) : (
<MdVideocam size='1.4em' color='green' />
<MdVideocam size={size || '1.4em'} color='green' />
)
) : (
<MdVideoCall size='1.4em' />
<MdVideoCall size={size || '1.4em'} />
)}
</VodAddRemoveButton>
</ToolTip>
Expand Down

0 comments on commit a25ef6b

Please sign in to comment.