import * as React from "react"; import {ChannelNameAlignment} from "tc-shared/ui/tree/Definitions"; import {ClientIcon} from "svg-sprites/client-icons"; import {IconRenderer, RemoteIconRenderer} from "tc-shared/ui/react-elements/Icon"; import {ClientIconRenderer} from "tc-shared/ui/react-elements/Icons"; import {getIconManager} from "tc-shared/file/Icons"; import {Settings, settings} from "tc-shared/settings"; import {RDPChannel} from "tc-shared/ui/tree/RendererDataProvider"; import {UnreadMarkerRenderer} from "tc-shared/ui/tree/RendererTreeEntry"; const channelStyle = require("./Channel.scss"); const viewStyle = require("./View.scss"); export class ChannelIconClass extends React.Component<{ channel: RDPChannel }, {}> { render() { return } } export class ChannelIconsRenderer extends React.Component<{ channel: RDPChannel }, {}> { render() { const iconInfo = this.props.channel.icons; const icons = []; if (iconInfo?.default) { icons.push(); } if (iconInfo?.passwordProtected) { icons.push(); } if (iconInfo?.musicQuality) { icons.push(); } if (iconInfo?.moderated) { icons.push(); } if (iconInfo && iconInfo.channelIcon.iconId !== 0) { icons.push( ); } if (iconInfo?.codecUnsupported) { icons.push(
); } return ( {icons} ); } } const ChannelName = React.memo((props: { channelName: string | undefined, alignment: ChannelNameAlignment }) => { let name: string; if(typeof props.channelName === "string") { name = props.channelName; if(props.alignment === "repetitive") { if (name.length) { while (name.length < 8000) { name += name; } } } } else { name = ""; } return ( ); }); const ChannelCollapsedIndicator = (props: { collapsed: boolean, onToggle: () => void }) => { return
{ event.preventDefault(); props.onToggle(); }}/>
}; export class RendererChannel extends React.Component<{ channel: RDPChannel }, {}> { render() { const channel = this.props.channel; const info = this.props.channel.info; const events = this.props.channel.getEvents(); const entryId = this.props.channel.entryId; let channelIcon, channelIcons, collapsedIndicator; if(!info || info.nameStyle === "normal") { channelIcon = ; channelIcons = ; } if(info && info.collapsedState !== "unset") { collapsedIndicator = ( events.fire("action_set_collapsed_state", { state: info.collapsedState === "expended" ? "collapsed" : "expended", treeEntryId: entryId })} collapsed={info.collapsedState === "collapsed"} /> ); } return (
{ if (event.button !== 0) { return; /* only left mouse clicks */ } events.fire("action_select", { entryIds: [ entryId ], mode: "auto", ignoreClientMove: false }); }} onDoubleClick={() => events.fire("action_channel_join", { ignoreMultiSelect: false, treeEntryId: entryId })} onContextMenu={event => { if (settings.static(Settings.KEY_DISABLE_CONTEXT_MENU)) { return; } event.preventDefault(); events.fire("action_show_context_menu", { treeEntryId: entryId, pageX: event.pageX, pageY: event.pageY }); }} onMouseDown={event => { if (event.buttons !== 4) { return; } event.preventDefault(); events.fire("action_channel_open_file_browser", { treeEntryId: entryId }); }} >
{collapsedIndicator} {channelIcon} {channelIcons}
); } }