Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
9c550f78
Commit
9c550f78
authored
Nov 28, 2022
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Dec 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert `TopBar` to TS
parent
c8610002
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
TopBar.tsx
src/sidebar/components/TopBar.tsx
+23
-20
No files found.
src/sidebar/components/TopBar.
js
→
src/sidebar/components/TopBar.
tsx
View file @
9c550f78
...
...
@@ -7,10 +7,14 @@ import {
}
from
'@hypothesis/frontend-shared/lib/next'
;
import
classnames
from
'classnames'
;
import
type
{
SidebarSettings
}
from
'../../types/config'
;
import
{
serviceConfig
}
from
'../config/service-config'
;
import
{
isThirdPartyService
}
from
'../helpers/is-third-party-service'
;
import
{
applyTheme
}
from
'../helpers/theme'
;
import
{
withServices
}
from
'../service-context'
;
import
type
{
FrameSyncService
}
from
'../services/frame-sync'
;
import
type
{
StreamerService
}
from
'../services/streamer'
;
import
{
useSidebarStore
}
from
'../store'
;
import
GroupList
from
'./GroupList'
;
...
...
@@ -19,39 +23,38 @@ import SortMenu from './SortMenu';
import
StreamSearchInput
from
'./StreamSearchInput'
;
import
UserMenu
from
'./UserMenu'
;
/**
* @typedef {import('preact').ComponentChildren} Children
* @typedef {import('../services/frame-sync').FrameSyncService} FrameSyncService
* @typedef {import('../../types/config').SidebarSettings} SidebarSettings
* @typedef {import('../services/streamer').StreamerService} StreamerService
*/
export
type
TopBarProps
=
{
/** Flag indicating whether the app is in a sidebar context */
isSidebar
:
boolean
;
/**
* @typedef TopBarProps
* @prop {FrameSyncService} frameSync - injected
* @prop {boolean} isSidebar - Flag indicating whether the app is the sidebar or a top-level page.
* @prop {() => void} onLogin - Callback invoked when user clicks "Login" button.
* @prop {() => void} onLogout - Callback invoked when user clicks "Logout" action in account menu.
* @prop {() => void} onSignUp - Callback invoked when user clicks "Sign up" button.
* @prop {SidebarSettings} settings - injected
* @prop {StreamerService} streamer - injected
*/
/** Callback invoked when user clicks "Login" button */
onLogin
:
()
=>
void
;
/** Callback invoked when user clicks "Logout" action in account menu */
onLogout
:
()
=>
void
;
/** Callback invoked when user clicks "Sign up" button */
onSignUp
:
()
=>
void
;
// injected
frameSync
:
FrameSyncService
;
settings
:
SidebarSettings
;
streamer
:
StreamerService
;
};
/**
* The toolbar which appears at the top of the sidebar providing actions
* to switch groups, view account information, sort/filter annotations etc.
*
* @param {TopBarProps} props
*/
function
TopBar
({
frameSync
,
isSidebar
,
onLogin
,
onLogout
,
onSignUp
,
frameSync
,
settings
,
streamer
,
})
{
}
:
TopBarProps
)
{
const
showSharePageButton
=
!
isThirdPartyService
(
settings
);
const
loginLinkStyle
=
applyTheme
([
'accentColor'
],
settings
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment