@inherits LayoutComponentBase
@layout AccountLayout
@inject NavigationManager NavigationManager

<AuthorizeView Roles="Teacher">
	<Authorized>
		<MudPaper Class="d-flex flex-row flex-grow-1 overflow-hidden" Height="100%">
			<MudPaper Width="200px">
				<MudDivider Class="flex-grow-0" />
				<ExamNavMenu />
			</MudPaper>
			<MudPaper Class="d-flex flex-grow-1 overflow-auto">
				@Body
			</MudPaper>
		</MudPaper>
	</Authorized>
</AuthorizeView>

<AuthorizeView Roles="Student">
	<Authorized>
		<MudPaper Class="d-flex flex-row flex-grow-1 overflow-hidden" Height="100%">
			<MudPaper Width="200px">
				<MudDivider Class="flex-grow-0" />
				<ExamNavMenu />
			</MudPaper>
			<MudPaper Class="d-flex h-100 w-100 flex-grow-1 overflow-auto">
				@Body
			</MudPaper>
		</MudPaper>
	</Authorized>
</AuthorizeView>

@code {
	[CascadingParameter]
	private Task<AuthenticationState> authenticationStateTask { get; set; }

	protected override void OnParametersSet()
	{
		if (authenticationStateTask is null)
		{
			NavigationManager.Refresh(forceReload: true);
		}
	}
}
