Commit 812b271f authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Migrate HypothesisApp to TypeScript

parent 719d80e8
...@@ -2,10 +2,15 @@ import classnames from 'classnames'; ...@@ -2,10 +2,15 @@ import classnames from 'classnames';
import { useEffect, useMemo } from 'preact/hooks'; import { useEffect, useMemo } from 'preact/hooks';
import { confirm } from '../../shared/prompts'; import { confirm } from '../../shared/prompts';
import type { SidebarSettings } from '../../types/config';
import { serviceConfig } from '../config/service-config'; import { serviceConfig } from '../config/service-config';
import { shouldAutoDisplayTutorial } from '../helpers/session'; import { shouldAutoDisplayTutorial } from '../helpers/session';
import { applyTheme } from '../helpers/theme'; import { applyTheme } from '../helpers/theme';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import type { AuthService } from '../services/auth';
import type { FrameSyncService } from '../services/frame-sync';
import type { SessionService } from '../services/session';
import type { ToastMessengerService } from '../services/toast-messenger';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import AnnotationView from './AnnotationView'; import AnnotationView from './AnnotationView';
import HelpPanel from './HelpPanel'; import HelpPanel from './HelpPanel';
...@@ -17,28 +22,27 @@ import StreamView from './StreamView'; ...@@ -17,28 +22,27 @@ import StreamView from './StreamView';
import ToastMessages from './ToastMessages'; import ToastMessages from './ToastMessages';
import TopBar from './TopBar'; import TopBar from './TopBar';
/** export type HypothesisAppProps = {
* @typedef {import('../../types/config').SidebarSettings} SidebarSettings auth: AuthService;
*/ frameSync: FrameSyncService;
settings: SidebarSettings;
/** session: SessionService;
* @typedef HypothesisAppProps toastMessenger: ToastMessengerService;
* @prop {import('../services/auth').AuthService} auth };
* @prop {import('../services/frame-sync').FrameSyncService} frameSync
* @prop {SidebarSettings} settings
* @prop {import('../services/session').SessionService} session
* @prop {import('../services/toast-messenger').ToastMessengerService} toastMessenger
*/
/** /**
* The root component for the Hypothesis client. * The root component for the Hypothesis client.
* *
* This handles login/logout actions and renders the top navigation bar * This handles login/logout actions and renders the top navigation bar
* and content appropriate for the current route. * and content appropriate for the current route.
*
* @param {HypothesisAppProps} props
*/ */
function HypothesisApp({ auth, frameSync, settings, session, toastMessenger }) { function HypothesisApp({
auth,
frameSync,
settings,
session,
toastMessenger,
}: HypothesisAppProps) {
const store = useSidebarStore(); const store = useSidebarStore();
const profile = store.profile(); const profile = store.profile();
const route = store.route(); const route = store.route();
......
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