Full-screen chat as default for collaboration setup

I’m working on a targeted collaboration setup that positions Chat as the primary space for member communication, similar to other collaboration platforms. The goal is for members to land directly in their channels or latest threads, making chat the central hub when they visit the site.

So rather than landing on a view like this:

I’d land right on chat full-screen:

It seems there’s currently no way to have chat open in full-screen mode by default. Could this be added as an option?

It could be exposed as a site setting, a theme modifier, or a value transformer. A way to give theme authors or site admins the flexibility to integrate Chat as the default interaction view.

2 Likes

You can write an initializer like this:

export default {
  name: "default-full-page-chat",

  initialize() {
    if (!window.localStorage.getItem("discourse_chat_preferred_mode")) {
      window.localStorage.setItem("discourse_chat_preferred_mode", '\"FULL_PAGE_CHAT\"');
    }
  },
};

That should do what you want I think.

7 Likes

Indeed, works like a charm! Thank you :blush:

7 Likes

I know it’s already solved, but instead of accessing localstorage directly like this, if you are able to access the plugin services from a theme, you can do:

export default {
  name: "default-full-page-chat",

  initialize(container) {
    const chat = container.lookup("service:chat");
    if (!chat.userCanChat) {
      return;
    }

    const chatStateManager = container.lookup("service:chat-state-manager");
    chatStateManager.prefersFullPage();
  },
};

Which calls this:

This would be more reliable long term, if it works (I haven’t tested this :sweat_smile: ).

3 Likes

Yes using service is nicer, but I don’t think we have any way to check if any preference has been set through the service atm. Do we?

And if understood the request here, we don’t want to override any decision of the user, we just want to promote full screen on first load, if we just want to force it yes your solution will work.

1 Like