Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Commit

Permalink
Add title to channel tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
freaktechnik committed Sep 10, 2017
1 parent da967de commit 80edc6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/list/components/channels.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ class Channel extends NavigateableItem {
onRedirectorClick: PropTypes.func.isRequired,
onContextMenu: PropTypes.func.isRequired,
onCopy: PropTypes.func.isRequired,
onFocusChange: PropTypes.func.isRequired
onFocusChange: PropTypes.func.isRequired,
tooltip: PropTypes.string.isRequired
};
}

Expand All @@ -167,7 +168,7 @@ class Channel extends NavigateableItem {
this.props.children.push(<InnerChannel image={ this.props.image } uname={ this.props.uname } title={ this.props.title } extras={ this.props.extras } liveState={ this.props.liveState } redirectors={ this.props.redirectors } imageSize={ this.props.imageSize } onRedirectorClick={ this.props.onRedirectorClick } key="inner"/>);
const element = super.render();
return React.cloneElement(element, {
title: this.props.uname,
title: this.props.tooltip,
className,
onClick: this.props.onClick,
onContextMenu: this.props.onContextMenu,
Expand Down Expand Up @@ -223,6 +224,7 @@ const channelsShape = PropTypes.arrayOf(PropTypes.shape({
imageSize: PropTypes.number,
external: PropTypes.bool,
url: PropTypes.string,
tooltip: PropTypes.string.isRequired
})),
ChannelList = (props) => {
const channels = props.channels.map((ch) => {
Expand Down
6 changes: 5 additions & 1 deletion src/list/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const formatChannel = (channel, providers, type, extras = false, style =
liveState: channel.live.state,
imageSize: 30,
hasChat: false,
providerEnabled: providers[channel.type].enabled
providerEnabled: providers[channel.type].enabled,
tooltip: channel.uname
};
if(style === "compact") {
formattedChannel.imageSize = 12;
Expand All @@ -34,6 +35,9 @@ export const formatChannel = (channel, providers, type, extras = false, style =
delete formattedChannel.extras.viewers;
delete formattedChannel.extras.category;
}
if(channel.live.state !== LiveState.OFFLINE && channel.title) {
formattedChannel.tooltip += ` - "${channel.title}"`;
}

if("id" in channel) {
formattedChannel.id = channel.id;
Expand Down

0 comments on commit 80edc6f

Please sign in to comment.