File tree 9 files changed +1917
-2550
lines changed
9 files changed +1917
-2550
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import type { NoteEdge } from '@common/types/pocket'
7
7
8
8
export function App ( ) {
9
9
const [ isOpen , setIsOpen ] = useState ( false )
10
- const [ saveStatus , setSaveStatus ] = useState ( 'unsaved ' )
10
+ const [ saveStatus , setSaveStatus ] = useState ( 'saving ' )
11
11
const [ errorMessage , setErrorMessage ] = useState < string | undefined > ( undefined )
12
12
const [ preview , setPreview ] = useState < ExtPreview | undefined > ( undefined )
13
13
const [ tags , setTags ] = useState < string [ ] > ( [ ] )
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ export async function setDefaultIcon() {
6
6
}
7
7
8
8
export async function setToolbarIcon ( tabId : number , isSaved : boolean ) {
9
- const imageData = isSaved ? savedIcon ( ) : inactiveIcon ( )
9
+ // const imageData = isSaved ? savedIcon() : inactiveIcon()
10
+ const imageData = inactiveIcon ( )
10
11
await chrome . action . setIcon ( { tabId, imageData } )
11
12
}
12
13
Original file line number Diff line number Diff line change @@ -18,19 +18,18 @@ let saveQueue: ExtSave | null = null
18
18
chrome . runtime . onInstalled . addListener ( function ( ) {
19
19
// Use SVG icons over the png for more control
20
20
void setDefaultIcon ( )
21
-
22
21
// handle.setContextMenus()
23
22
} )
24
23
25
24
/* Tab Changes
26
25
–––––––––––––––––––––––––––––––––––––––––––––––––– */
27
- chrome . tabs . onUpdated . addListener ( tabUpdated )
28
- function tabUpdated ( tabId : number , changeInfo : chrome . tabs . TabChangeInfo ) {
29
- // if actively loading a new page, unset save state on icon
30
- if ( changeInfo . status === 'loading' && changeInfo . url ) {
31
- void setToolbarIcon ( tabId , false )
32
- }
33
- }
26
+ // chrome.tabs.onUpdated.addListener(tabUpdated)
27
+ // function tabUpdated(tabId: number, changeInfo: chrome.tabs.TabChangeInfo) {
28
+ // // if actively loading a new page, unset save state on icon
29
+ // // if (changeInfo.status === 'loading' && changeInfo.url) {
30
+ // // void setToolbarIcon(tabId, false)
31
+ // / / }
32
+ // }
34
33
35
34
/* Message handling
36
35
–––––––––––––––––––––––––––––––––––––––––––––––––– */
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export function ActionContainer({
10
10
isOpen = false ,
11
11
errorMessage,
12
12
preview,
13
+ saveStatus,
13
14
notes,
14
15
tags
15
16
} : {
@@ -23,7 +24,7 @@ export function ActionContainer({
23
24
} ) {
24
25
return isOpen ? (
25
26
< div className = "extension" >
26
- < ExtensionHeader />
27
+ < ExtensionHeader saveStatus = { saveStatus } />
27
28
{ preview ? (
28
29
< >
29
30
< SavedScreen preview = { preview } notes = { notes } tags = { tags } />
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export function ExtensionFooter({ errorMessage }: { errorMessage?: string }) {
7
7
return (
8
8
< footer className = { style . footer } >
9
9
< button >
10
- < NotesIcon /> Attach Notes
10
+ < NotesIcon /> Notes
11
11
</ button >
12
12
< button >
13
13
< DeleteIcon />
Original file line number Diff line number Diff line change 1
1
import style from './style.module.css'
2
2
import { OverflowMenuIcon } from '../icons/OverflowMenuIcon'
3
+ import { SaveFilledIcon } from '../icons/SaveFilledIcon'
3
4
import { SaveIcon } from '../icons/SaveIcon'
4
5
import { SavedLoader } from '../saved-loader'
5
6
6
- export function ExtensionHeader ( ) {
7
+ export function ExtensionHeader ( { saveStatus } : { saveStatus ?: string } ) {
8
+ const loaded = saveStatus !== 'saving'
7
9
return (
8
10
< header className = { style . header } >
9
- < SaveIcon />
10
- < SavedLoader />
11
+ { loaded ? < SaveFilledIcon className = { style . icon } /> : < SaveIcon className = { style . icon } /> }
12
+ { loaded ? < div /> : < SavedLoader /> }
11
13
< OverflowMenuIcon />
12
14
</ header >
13
15
)
Original file line number Diff line number Diff line change 1
1
.header {
2
- display : flex ;
3
- justify-content : space-between ;
2
+ display : grid ;
3
+ grid-template-columns : 32 px auto 32 px ;
4
4
align-items : center;
5
5
padding : 0.5rem 1rem ;
6
6
font-size : 1rem ;
7
7
font-weight : 600 ;
8
8
line-height : 19.09px ;
9
9
letter-spacing : -0.03em ;
10
10
border-bottom : 1px solid var (--color-divider );
11
+ min-height : 2.5rem ;
12
+ }
13
+
14
+ .icon {
15
+ color : var (--color-brandPocket );
16
+ width : 24px ;
17
+ height : 24px ;
11
18
}
Original file line number Diff line number Diff line change 1
- import type { SVGProps } from " react"
1
+ import type { SVGProps } from ' react'
2
2
3
- export const SaveFilledIcon = ( { className, ...rest } : SVGProps < SVGSVGElement > ) => {
3
+ export const SaveFilledIcon = ( { className, ...rest } : SVGProps < SVGSVGElement > ) => {
4
4
const iconClass = [ 'icon' , className && className ] . join ( ' ' )
5
5
return (
6
- < svg fill = "currentColor" xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" aria-hidden = "true" className = { iconClass } { ...rest } > < path fillRule = "evenodd" d = "M12 21c5.523 0 10-4.477 10-10V5a2 2 0 0 0-2-2H4c-1.105 0-2 .893-2 1.998V11c0 5.523 4.477 10 10 10M8.707 9.293a1 1 0 0 0-1.414 1.414l4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L12 12.586z" clipRule = "evenodd" /> </ svg >
7
- ) }
8
-
6
+ < svg
7
+ fill = "currentColor"
8
+ xmlns = "http://www.w3.org/2000/svg"
9
+ viewBox = "0 0 24 24"
10
+ aria-hidden = "true"
11
+ className = { iconClass }
12
+ { ...rest } >
13
+ < path
14
+ fillRule = "evenodd"
15
+ d = "M12 21c5.523 0 10-4.477 10-10V5a2 2 0 0 0-2-2H4c-1.105 0-2 .893-2 1.998V11c0 5.523 4.477 10 10 10M8.707 9.293a1 1 0 0 0-1.414 1.414l4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L12 12.586z"
16
+ clipRule = "evenodd"
17
+ />
18
+ </ svg >
19
+ )
20
+ }
You can’t perform that action at this time.
0 commit comments