Skip to main content

MaestroKit: PanelControl Component Documentation

The PanelControl is a configurable view component responsible for setting up the interactive navigation bar and panels for a specific channel. Additionally, it permits the passage of a customized admin profile view, which renders through selecting the AdminProfile icon.

Usage​

import SwiftUI
import MaestroKit

struct ContentView: View {
@EnvironmentObject var sdk: Maestro
let channelId: String
let siteId: String
let userJwt: String

var body: some View {
sdk.panelControl(
channelId: channelId,
siteId: siteId,
userJwt: userJwt,
panelItems: [.chat],
hasProfile: true
) {
HStack {
Text("Custom Admin Profile View")
}
}
}
}

struct ContentView_Previews: PreviewProvider {
@EnvironmentObject static var maestroSDK: Maestro
static var previews: some View {
ContentView(
channelId: "YOUR_CHANNEL_ID",
siteId: "YOUR_SITE_ID",
userJwt: "YOUR_USER_JWT"
)
.environmentObject(maestroSDK)
}
}

Parameters​

The PanelControl view accepts the following parameters:

  • channelId (required): The unique ID of the Maestro channel for which you want to display the live stream.
  • siteId (required): The unique ID of Maestro's site.
  • userJwt (required): User Token
  • panelItems (required): An array consisting of the desired panels. Do not pass in duplicate panel. As of now, the only available panel is the chat panel.
    Example:
    panelItems: [.chat]
  • hasProfile (required): The boolean which determines if the AdminProfile icon is rendered on the navigation bar.
  • startingPanel (optional): Determines what panel is rendered first when component is mounted.
    Example:
    startingPanel: .chat
  • profileView (required): The custom profile view that will be displayed when the AdminProfile icon is selected. If the hasProfile is set to false, then pass in an empty view.
    SwiftUI Example:
    hasProfile: false, profileView: EmptyView()
    UIKit Example:
    let emptyView = UIView()
    emptyView.backgroundColor = UIColor.clear

    hasProfile: false, profileView: emptyView

Behavior​

The PanelControl's children components behave in a particular manner based on the channel's state, live or offline. Also, if an admin does not have a profile image, the AdminProfile icon will render a default profile image.

The Different AdminProfile Icon States​

AdminProfileStates

Example channel is live​

When the channel is live, the desired panels will render when selected.

Channel is live

Example channel is offline​

When the channel is offline, the panels are hidden. Also, the AdminProfile icon will contain an offline badge overlay.

Channel is offline