Commit 4babd7f1 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Migrate session to TypeScript

parent 93b51390
import type { Profile } from '../../types/api';
import type { SidebarSettings } from '../../types/config';
import { serviceConfig } from '../config/service-config'; import { serviceConfig } from '../config/service-config';
/**
* @typedef {import('../../types/config').SidebarSettings} SidebarSettings
* @typedef {import('../../types/api').Profile} Profile
*/
/** /**
* The following things must all be true for the tutorial component to auto-display * The following things must all be true for the tutorial component to auto-display
* on app launch: * on app launch:
...@@ -18,12 +15,15 @@ import { serviceConfig } from '../config/service-config'; ...@@ -18,12 +15,15 @@ import { serviceConfig } from '../config/service-config';
* dismissed by this user yet). This implies the presence of a profile, which * dismissed by this user yet). This implies the presence of a profile, which
* in turn implies that there is an authenticated user. * in turn implies that there is an authenticated user.
* *
* @param {boolean} isSidebar - is the app currently displayed in a sidebar? * @param isSidebar - is the app currently displayed in a sidebar?
* @param {Profile} profile - User profile returned from the API * @param profile - User profile returned from the API
* @param {SidebarSettings} settings * @return Tutorial panel should be displayed automatically
* @return {boolean} - Tutorial panel should be displayed automatically
*/ */
export function shouldAutoDisplayTutorial(isSidebar, profile, settings) { export function shouldAutoDisplayTutorial(
isSidebar: boolean,
profile: Profile,
settings: SidebarSettings
): boolean {
const shouldShowBasedOnProfile = const shouldShowBasedOnProfile =
typeof profile.preferences === 'object' && typeof profile.preferences === 'object' &&
!!profile.preferences.show_sidebar_tutorial; !!profile.preferences.show_sidebar_tutorial;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment