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
f8dd14fb
Commit
f8dd14fb
authored
Mar 23, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Mar 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move type to shared module to avoid dependency from shared to sidebar store module
parent
184ff1ab
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
16 deletions
+14
-16
ToastMessages.tsx
src/annotator/components/ToastMessages.tsx
+1
-1
BaseToastMessages.tsx
src/shared/components/BaseToastMessages.tsx
+10
-6
ToastMessages.tsx
src/sidebar/components/ToastMessages.tsx
+1
-1
frame-sync.ts
src/sidebar/services/frame-sync.ts
+1
-1
toast-messages.js
src/sidebar/store/modules/toast-messages.js
+1
-7
No files found.
src/annotator/components/ToastMessages.tsx
View file @
f8dd14fb
import
{
useCallback
,
useEffect
,
useState
}
from
'preact/hooks'
;
import
BaseToastMessages
from
'../../shared/components/BaseToastMessages'
;
import
type
{
ToastMessage
}
from
'../../shared/components/BaseToastMessages'
;
import
type
{
PortRPC
}
from
'../../shared/messaging'
;
import
type
{
ToastMessage
}
from
'../../sidebar/store/modules/toast-messages'
;
import
type
{
HostToSidebarEvent
,
SidebarToHostEvent
,
...
...
src/shared/components/BaseToastMessages.tsx
View file @
f8dd14fb
...
...
@@ -7,7 +7,14 @@ import {
}
from
'@hypothesis/frontend-shared/lib/next'
;
import
classnames
from
'classnames'
;
import
type
{
ToastMessage
}
from
'../../sidebar/store/modules/toast-messages'
;
export
type
ToastMessage
=
{
type
:
'error'
|
'success'
|
'notice'
;
id
:
string
;
message
:
string
;
moreInfoURL
:
string
;
isDismissed
:
boolean
;
visuallyHidden
:
boolean
;
};
type
ToastMessageItemProps
=
{
message
:
ToastMessage
;
...
...
@@ -18,9 +25,6 @@ type ToastMessageItemProps = {
* An individual toast message: a brief and transient success or error message.
* The message may be dismissed by clicking on it. `visuallyHidden` toast
* messages will not be visible but are still available to screen readers.
*
* Otherwise, the `toastMessenger` service handles removing messages after a
* certain amount of time.
*/
function
ToastMessageItem
({
message
,
onDismiss
}:
ToastMessageItemProps
)
{
// Capitalize the message type for prepending; Don't prepend a message
...
...
@@ -98,7 +102,7 @@ function ToastMessageItem({ message, onDismiss }: ToastMessageItemProps) {
);
}
export
type
ToastMessageProps
=
{
export
type
Base
ToastMessageProps
=
{
messages
:
ToastMessage
[];
onMessageDismiss
:
(
messageId
:
string
)
=>
void
;
};
...
...
@@ -110,7 +114,7 @@ export type ToastMessageProps = {
export
default
function
BaseToastMessages
({
messages
,
onMessageDismiss
,
}:
ToastMessageProps
)
{
}:
Base
ToastMessageProps
)
{
// The `ul` containing any toast messages is absolute-positioned and the full
// width of the viewport. Each toast message `li` has its position and width
// constrained by `container` configuration in tailwind.
...
...
src/sidebar/components/ToastMessages.tsx
View file @
f8dd14fb
...
...
@@ -9,7 +9,7 @@ export type ToastMessageProps = {
};
/**
*
A component designed to render toast messages handled by the sidebar store.
*
Component that renders the active toast messages from the sidebar store
*/
function
ToastMessages
({
toastMessenger
}:
ToastMessageProps
)
{
const
store
=
useSidebarStore
();
...
...
src/sidebar/services/frame-sync.ts
View file @
f8dd14fb
...
...
@@ -2,6 +2,7 @@ import debounce from 'lodash.debounce';
import
type
{
DebouncedFunction
}
from
'lodash.debounce'
;
import
shallowEqual
from
'shallowequal'
;
import
type
{
ToastMessage
}
from
'../../shared/components/BaseToastMessages'
;
import
{
ListenerCollection
}
from
'../../shared/listener-collection'
;
import
{
PortFinder
,
...
...
@@ -22,7 +23,6 @@ import { isReply, isPublic } from '../helpers/annotation-metadata';
import
{
annotationMatchesSegment
}
from
'../helpers/annotation-segment'
;
import
type
{
SidebarStore
}
from
'../store'
;
import
type
{
Frame
}
from
'../store/modules/frames'
;
import
type
{
ToastMessage
}
from
'../store/modules/toast-messages'
;
import
{
watch
}
from
'../util/watch'
;
import
type
{
AnnotationsService
}
from
'./annotations'
;
import
type
{
ToastMessengerService
}
from
'./toast-messenger'
;
...
...
src/sidebar/store/modules/toast-messages.js
View file @
f8dd14fb
import
{
createStoreModule
,
makeAction
}
from
'../create-store'
;
/**
* @typedef ToastMessage
* @prop {('error'|'success'|'notice')} type
* @prop {string} id
* @prop {string} message
* @prop {string} moreInfoURL
* @prop {boolean} isDismissed
* @prop {boolean} visuallyHidden
* @typedef {import('../../../shared/components/BaseToastMessages').ToastMessage} ToastMessage
*/
/**
...
...
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