Commit 9139fa35 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Convert SidebarView to TS

parent c912f3d6
import { useEffect, useRef } from 'preact/hooks'; import { useEffect, useRef } from 'preact/hooks';
import { useRootThread } from './hooks/use-root-thread'; import { tabForAnnotation } from '../helpers/tabs';
import { withServices } from '../service-context'; import { withServices } from '../service-context';
import type { FrameSyncService } from '../services/frame-sync';
import type { LoadAnnotationsService } from '../services/load-annotations';
import type { StreamerService } from '../services/streamer';
import { useSidebarStore } from '../store'; import { useSidebarStore } from '../store';
import { tabForAnnotation } from '../helpers/tabs';
import { useRootThread } from './hooks/use-root-thread';
import FilterStatus from './FilterStatus'; import FilterStatus from './FilterStatus';
import LoggedOutMessage from './LoggedOutMessage'; import LoggedOutMessage from './LoggedOutMessage';
...@@ -12,19 +16,18 @@ import SelectionTabs from './SelectionTabs'; ...@@ -12,19 +16,18 @@ import SelectionTabs from './SelectionTabs';
import SidebarContentError from './SidebarContentError'; import SidebarContentError from './SidebarContentError';
import ThreadList from './ThreadList'; import ThreadList from './ThreadList';
/** export type SidebarViewProps = {
* @typedef SidebarViewProps onLogin: () => void;
* @prop {() => void} onLogin onSignUp: () => void;
* @prop {() => void} onSignUp
* @prop {import('../services/frame-sync').FrameSyncService} frameSync // injected
* @prop {import('../services/load-annotations').LoadAnnotationsService} loadAnnotationsService frameSync: FrameSyncService;
* @prop {import('../services/streamer').StreamerService} streamer loadAnnotationsService: LoadAnnotationsService;
*/ streamer: StreamerService;
};
/** /**
* Render the sidebar and its components * Render the content of the sidebar, including tabs and threads (annotations)
*
* @param {SidebarViewProps} props
*/ */
function SidebarView({ function SidebarView({
frameSync, frameSync,
...@@ -32,7 +35,7 @@ function SidebarView({ ...@@ -32,7 +35,7 @@ function SidebarView({
onSignUp, onSignUp,
loadAnnotationsService, loadAnnotationsService,
streamer, streamer,
}) { }: SidebarViewProps) {
const rootThread = useRootThread(); const rootThread = useRootThread();
// Store state values // Store state values
...@@ -89,7 +92,7 @@ function SidebarView({ ...@@ -89,7 +92,7 @@ function SidebarView({
// on a particular user). // on a particular user).
if (prevGroupId.current) { if (prevGroupId.current) {
// Respect applied focus-mode filtering when changing focused group // Respect applied focus-mode filtering when changing focused group
let restoreFocus = store.focusState().active; const restoreFocus = store.focusState().active;
store.clearSelection(); store.clearSelection();
if (restoreFocus) { if (restoreFocus) {
......
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