Tv Mode in custom Nerdlet

Add Tv Mode option in nerdlet

Description
Does anybody know if it is possible to add a tv mode option in a custom nerdlet? I would like to see my nerdlet in full screen as the dashboards do in tv mode but I don’t know how can I achieve that.

@jsius or @dgolden any thoughts on this TV mode questions?

Update: I already find out how to open tv mode from a header button.

What I did is to create a link that appends to the url
&platform[tvMode]=true
And it works.

But, to achieve that I have a hidden link that triggers on click on a header action button

componentDidMount() {
  nerdlet.setConfig({
      actionControls: true,
      actionControlButtons: [
        {
          label: 'Tv Mode',
          type: Button.TYPE.PRIMARY,
          hint: 'Tv Mode',
          iconType: Icon.TYPE.INTERFACE__OPERATIONS__TV_MODE,
          onClick: () => this.openTvMode(),
        }
      ],
    });
}

openTvMode() {
  this.tvModeLink.click(); // Emulate click on ref
}

// In render a hidden link
 <a
  href={`${nerdletUrl.pathname}&platform[tvMode]=true`}
  ref={e => this.tvModeLink = e}> // ref
  Tv Mode
 </a>

To get the nerdlet Url you can do something like:

navigation.getOpenNerdletLocation({id: 'your-nerdlet-id'});

If someone has a better approach please add it in the comments.

1 Like

@dpena Super star :star_struck: Thanks for sharing how you were able to figure out the TV mode situation. Curious to hear other members approaches as well…

1 Like