Commit 1a447624 authored by Robert Knight's avatar Robert Knight

Fix prop typechecking for `TopBar` component

The type of the `props` argument to `TopBar` was not specified, so its
props were not type-checked. Specifying a type for `props` turned up
several mistakes in other types.

 - Specify the type of the `props` object so that the props are actually
   type-checked
 - Add missing `status` field to `AuthState` type
 - Correctly set the optionality of various props
parent 101da30c
...@@ -21,19 +21,21 @@ import UserMenu from './UserMenu'; ...@@ -21,19 +21,21 @@ import UserMenu from './UserMenu';
/** /**
* @typedef TopBarProps * @typedef TopBarProps
* @prop {AuthState} [auth] * @prop {AuthState} auth
* @prop {Bridge} bridge * @prop {Bridge} bridge
* @prop {boolean} [isSidebar] - Flag indicating whether the app is the sidebar or a top-level page. * @prop {boolean} isSidebar - Flag indicating whether the app is the sidebar or a top-level page.
* @prop {() => any} [onLogin] - Callback invoked when user clicks "Login" button. * @prop {() => any} onLogin - Callback invoked when user clicks "Login" button.
* @prop {() => any} [onLogout] - Callback invoked when user clicks "Logout" action in account menu. * @prop {() => any} onLogout - Callback invoked when user clicks "Logout" action in account menu.
* @prop {() => any} [onSignUp] - Callback invoked when user clicks "Sign up" button. * @prop {() => any} onSignUp - Callback invoked when user clicks "Sign up" button.
* @prop {MergedConfig} [settings] * @prop {MergedConfig} settings
* @prop {Object} [streamer] * @prop {import('../services/streamer').default} streamer
*/ */
/** /**
* The toolbar which appears at the top of the sidebar providing actions * The toolbar which appears at the top of the sidebar providing actions
* to switch groups, view account information, sort/filter annotations etc. * to switch groups, view account information, sort/filter annotations etc.
*
* @param {TopBarProps} props
*/ */
function TopBar({ function TopBar({
auth, auth,
......
...@@ -17,6 +17,7 @@ import MenuSection from './MenuSection'; ...@@ -17,6 +17,7 @@ import MenuSection from './MenuSection';
/** /**
* @typedef AuthState * @typedef AuthState
* @prop {'logged-in'|'logged-out'|'unknown'} status
* @prop {string} displayName * @prop {string} displayName
* @prop {string} userid * @prop {string} userid
* @prop {string} username * @prop {string} username
......
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