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 {
...
@@ -7,10 +7,14 @@ import {
}
from
'@hypothesis/frontend-shared/lib/next'
;
}
from
'@hypothesis/frontend-shared/lib/next'
;
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
import
type
{
SidebarSettings
}
from
'../../types/config'
;
import
{
serviceConfig
}
from
'../config/service-config'
;
import
{
serviceConfig
}
from
'../config/service-config'
;
import
{
isThirdPartyService
}
from
'../helpers/is-third-party-service'
;
import
{
isThirdPartyService
}
from
'../helpers/is-third-party-service'
;
import
{
applyTheme
}
from
'../helpers/theme'
;
import
{
applyTheme
}
from
'../helpers/theme'
;
import
{
withServices
}
from
'../service-context'
;
import
{
withServices
}
from
'../service-context'
;
import
type
{
FrameSyncService
}
from
'../services/frame-sync'
;
import
type
{
StreamerService
}
from
'../services/streamer'
;
import
{
useSidebarStore
}
from
'../store'
;
import
{
useSidebarStore
}
from
'../store'
;
import
GroupList
from
'./GroupList'
;
import
GroupList
from
'./GroupList'
;
...
@@ -19,39 +23,38 @@ import SortMenu from './SortMenu';
...
@@ -19,39 +23,38 @@ import SortMenu from './SortMenu';
import
StreamSearchInput
from
'./StreamSearchInput'
;
import
StreamSearchInput
from
'./StreamSearchInput'
;
import
UserMenu
from
'./UserMenu'
;
import
UserMenu
from
'./UserMenu'
;
/**
export
type
TopBarProps
=
{
* @typedef {import('preact').ComponentChildren} Children
/** Flag indicating whether the app is in a sidebar context */
* @typedef {import('../services/frame-sync').FrameSyncService} FrameSyncService
isSidebar
:
boolean
;
* @typedef {import('../../types/config').SidebarSettings} SidebarSettings
* @typedef {import('../services/streamer').StreamerService} StreamerService
*/
/**
/** Callback invoked when user clicks "Login" button */
* @typedef TopBarProps
onLogin
:
()
=>
void
;
* @prop {FrameSyncService} frameSync - injected
* @prop {boolean} isSidebar - Flag indicating whether the app is the sidebar or a top-level page.
/** Callback invoked when user clicks "Logout" action in account menu */
* @prop {() => void} onLogin - Callback invoked when user clicks "Login" button.
onLogout
:
()
=>
void
;
* @prop {() => void} onLogout - Callback invoked when user clicks "Logout" action in account menu.
* @prop {() => void} onSignUp - Callback invoked when user clicks "Sign up" button.
/** Callback invoked when user clicks "Sign up" button */
* @prop {SidebarSettings} settings - injected
onSignUp
:
()
=>
void
;
* @prop {StreamerService} streamer - injected
*/
// injected
frameSync
:
FrameSyncService
;
settings
:
SidebarSettings
;
streamer
:
StreamerService
;
};
/**
/**
* 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
({
frameSync
,
isSidebar
,
isSidebar
,
onLogin
,
onLogin
,
onLogout
,
onLogout
,
onSignUp
,
onSignUp
,
frameSync
,
settings
,
settings
,
streamer
,
streamer
,
})
{
}
:
TopBarProps
)
{
const
showSharePageButton
=
!
isThirdPartyService
(
settings
);
const
showSharePageButton
=
!
isThirdPartyService
(
settings
);
const
loginLinkStyle
=
applyTheme
([
'accentColor'
],
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