Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Pocket/web-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.156.4
Choose a base ref
...
head repository: Pocket/web-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jan 22, 2025

  1. Copy the full SHA
    5d12ec9 View commit details
  2. Copy the full SHA
    7f7a49a View commit details
  3. Copy the full SHA
    18cbf4b View commit details
  4. Copy the full SHA
    8912829 View commit details
  5. Copy the full SHA
    fa7fc87 View commit details
  6. Copy the full SHA
    abc144f View commit details
  7. Copy the full SHA
    31e433c View commit details
  8. Copy the full SHA
    b102bd7 View commit details

Commits on Jan 23, 2025

  1. Copy the full SHA
    cbdb38a View commit details

Commits on Jan 29, 2025

  1. Copy the full SHA
    407fabe View commit details
  2. Copy the full SHA
    88f5f39 View commit details
  3. Copy the full SHA
    134a432 View commit details
  4. Copy the full SHA
    afd4c9c View commit details
  5. Copy the full SHA
    887dcb7 View commit details

Commits on Feb 4, 2025

  1. Copy the full SHA
    d529953 View commit details
  2. Copy the full SHA
    d581d06 View commit details
  3. Copy the full SHA
    b367110 View commit details
  4. Copy the full SHA
    05bf685 View commit details
  5. Copy the full SHA
    d0a2c1a View commit details
  6. Copy the full SHA
    d017764 View commit details
  7. Copy the full SHA
    eb40d34 View commit details
  8. Copy the full SHA
    c8d8ade View commit details
  9. Copy the full SHA
    fafb24f View commit details
  10. Copy the full SHA
    a39dd8c View commit details

Commits on Feb 5, 2025

  1. Copy the full SHA
    1e933ba View commit details

Commits on Mar 11, 2025

  1. Copy the full SHA
    3fa7824 View commit details

Commits on Mar 13, 2025

  1. Copy the full SHA
    bca92f6 View commit details
Showing with 7,986 additions and 6,001 deletions.
  1. +35 −18 clients/extension/action/app.tsx
  2. +22 −15 clients/extension/actions.ts
  3. +75 −0 clients/extension/background/api/add-note.ts
  4. +30 −0 clients/extension/background/api/fragments/preview.ts
  5. +30 −0 clients/extension/background/api/fragments/saved-item.ts
  6. +23 −0 clients/extension/background/api/remove-note.ts
  7. +9 −31 clients/extension/background/api/upsert.ts
  8. +2 −1 clients/extension/background/icon-updates/index.ts
  9. +55 −14 clients/extension/background/index.ts
  10. +14 −8 clients/extension/components/action-container/component.story.tsx
  11. +42 −16 clients/extension/components/action-container/index.tsx
  12. +22 −0 clients/extension/components/action-error/component.story.tsx
  13. +5 −0 clients/extension/components/action-error/index.tsx
  14. +7 −0 clients/extension/components/action-error/style.module.css
  15. +0 −5 clients/extension/components/action-footer/index.tsx
  16. +7 −58 clients/extension/components/action-header/index.tsx
  17. +11 −3 clients/extension/components/action-header/style.module.css
  18. +10 −3 clients/extension/components/{saved-notes → action-loader}/component.story.tsx
  19. +1 −1 clients/extension/components/{saved-loader → action-loader}/index.tsx
  20. +1 −1 clients/extension/components/{saved-loader → action-loader}/style.module.css
  21. +63 −0 clients/extension/components/icons/Pocket.tsx
  22. +0 −46 clients/extension/components/icons/icon-notes.tsx
  23. +0 −20 clients/extension/components/icons/icon-save.tsx
  24. +22 −0 clients/extension/components/notes-add/component.story.tsx
  25. +38 −0 clients/extension/components/notes-add/index.tsx
  26. +10 −0 clients/extension/components/notes-add/style.module.css
  27. +28 −0 clients/extension/components/notes-footer/component.story.tsx
  28. +31 −0 clients/extension/components/notes-footer/index.tsx
  29. +15 −0 clients/extension/components/notes-footer/style.module.css
  30. +36 −0 clients/extension/components/notes-list/component.story.tsx
  31. +104 −0 clients/extension/components/notes-list/index.tsx
  32. +89 −0 clients/extension/components/notes-list/style.module.css
  33. +28 −0 clients/extension/components/notes/component.story.tsx
  34. +78 −0 clients/extension/components/notes/index.tsx
  35. +4 −0 clients/extension/components/notes/style.module.css
  36. +5 −4 clients/extension/components/{action-footer → saved-footer}/component.story.tsx
  37. +22 −0 clients/extension/components/saved-footer/index.tsx
  38. +2 −1 clients/extension/components/{action-footer → saved-footer}/style.module.css
  39. +0 −20 clients/extension/components/saved-loader/component.story.tsx
  40. +0 −20 clients/extension/components/saved-notes/index.tsx
  41. +0 −3 clients/extension/components/saved-notes/style.module.css
  42. +25 −5 clients/extension/components/saved-preview/component.story.tsx
  43. +2 −2 clients/extension/components/saved-preview/index.tsx
  44. +17 −16 clients/extension/components/saved-preview/style.module.css
  45. +17 −3 clients/extension/components/saved-tags/component.story.tsx
  46. +126 −5 clients/extension/components/saved-tags/index.tsx
  47. +69 −1 clients/extension/components/saved-tags/style.module.css
  48. +18 −5 clients/extension/components/saved/component.story.tsx
  49. +14 −14 clients/extension/components/saved/index.tsx
  50. +5 −0 clients/extension/components/saved/style.module.css
  51. +4 −4 clients/extension/components/waypoint/index.tsx
  52. +14 −0 clients/extension/extension.config.js
  53. +10 −6 clients/extension/package.json
  54. +37 −4 clients/extension/public/styles/global.css
  55. +13 −9 clients/extension/types/item.ts
  56. +4 −0 clients/extension/types/message.ts
  57. +4 −0 clients/extension/types/note.ts
  58. +11 −11 clients/pocket/package.json
  59. +3 −3 clients/scraper/package.json
  60. +25 −25 clients/web/package.json
  61. +15 −0 clients/web/src/common/api/fragments/fragment.savedItem.js
  62. +0 −15 clients/web/src/common/api/queries/get-saved-item-by-id.js
  63. +14 −0 clients/web/src/common/api/queries/get-syndicated-article.js
  64. +1,279 −0 clients/web/src/common/iab.js
  65. +10 −2 clients/web/src/components/annotations/annotations.list.js
  66. +1 −1 clients/web/src/components/annotations/annotations.menu.js
  67. +26 −27 clients/web/src/components/annotations/annotations.tics.js
  68. +315 −217 clients/web/src/components/annotations/utilities.js
  69. +2 −0 clients/web/src/components/popover/popover-selection.js
  70. +38 −50 clients/web/src/components/reader/content.js
  71. +16 −12 clients/web/src/components/reader/sidebar.js
  72. +2 −1 clients/web/src/connectors/placards/placards.js
  73. +10 −4 clients/web/src/connectors/reader/content.js
  74. +22 −32 clients/web/src/connectors/reader/highlights.js
  75. +4 −4 clients/web/src/connectors/reader/sidebar.js
  76. +23 −9 clients/web/src/containers/read/reader.js
  77. +1 −8 clients/web/src/containers/read/reader.state.js
  78. +4 −1 clients/web/src/containers/syndicated-article/syndicated-article.js
  79. +1 −1 common/constants/package.json
  80. +6 −6 common/localization/package.json
  81. +116 −0 common/mock-data/graph-response/note-response.json
  82. +223 −23 common/mock-data/graph-response/upsert-response.json
  83. +8 −8 common/state/package.json
  84. +4 −4 common/types/package.json
  85. +5 −90 common/types/pocket/index.d.ts
  86. +5 −88 common/types/schema.graphql
  87. +1 −1 common/utilities/package.json
  88. +1 −1 config/document-config/package.json
  89. +10 −10 config/eslint-config/package.json
  90. +6 −6 config/jest-config/package.json
  91. +0 −1 config/storybook-config/.storybook-ext/preview.tsx
  92. +13 −13 config/storybook-config/package.json
  93. +6 −6 infrastructure/pocket/package.json
  94. +6 −6 infrastructure/web/package.json
  95. +11 −11 package.json
  96. +4,367 −4,920 pnpm-lock.yaml
  97. +9 −9 ui/components/package.json
  98. +4 −0 ui/icons/.gitignore
  99. +2 −2 ui/icons/package.json
  100. +1 −3 ui/icons/svgs/add-note.svg
  101. +1 −0 ui/icons/svgs/notes.svg
  102. +2 −6 clients/extension/components/icons/icon-snippets.tsx → ui/icons/svgs/snippets.svg
  103. +2 −2 ui/styles/package.json
53 changes: 35 additions & 18 deletions clients/extension/action/app.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { useEffect, useState } from 'react'
import { EXT_ACTIONS } from '../actions'
import { ActionContainer } from '../components/action-container'
import { sendMessage } from '../utilities/send-message'

import type { ExtItem, ExtMessage, ExtPreview } from '../types'
import type { ExtItem, ExtMessage } from '../types'
import type { NoteEdge } from '@common/types/pocket'

export function App() {
const [isOpen, setIsOpen] = useState(false)
const [saveStatus, setSaveStatus] = useState('unsaved')
const [saveStatus, setSaveStatus] = useState('saving')
const [noteStatus, setNoteStatus] = useState<string | undefined>(undefined)
const [errorMessage, setErrorMessage] = useState<string | undefined>(undefined)
const [preview, setPreview] = useState<ExtPreview | undefined>(undefined)
const [tags, setTags] = useState<string[]>([])
const [notes, setNotes] = useState<NoteEdge[] | undefined>()
const [item, setItem] = useState<ExtItem | undefined>(undefined)
const [notes, setNotes] = useState<NoteEdge[] | []>([])

/* Setup Listeners and show popup
–––––––––––––––––––––––––––––––––––––––––––––––––– */
@@ -27,24 +28,21 @@ export function App() {
/* Send a message on action activating
–––––––––––––––––––––––––––––––––––––––––––––––––– */
useEffect(() => {
if (isOpen) void chrome.runtime.sendMessage({ action: EXT_ACTIONS.BROWSER_ACTION })
if (isOpen) void sendMessage({ action: EXT_ACTIONS.BROWSER_ACTION })
}, [isOpen])

/* Handle incoming messages
–––––––––––––––––––––––––––––––––––––––––––––––––– */
function handleMessages(message: ExtMessage) {
const { action = 'Unknown Action' } = message || {}
console.log('ACTION:', { message })

switch (action) {
case EXT_ACTIONS.ADD_NOTE_SUCCESS:
case EXT_ACTIONS.SAVE_TO_POCKET_SUCCESS: {
const item = message?.item as ExtItem
const preview = item?.preview
const suggestedTags = item?.savedItem?.suggestedTags.map((tag) => tag.name) ?? []
const itemNotes = item?.savedItem?.notes

setPreview(preview)
setTags(suggestedTags)
setNotes(itemNotes)
setItem(item)
setNotes(item.savedItem.notes.edges)
setNoteStatus(undefined)
setSaveStatus('saved')
return
}
@@ -56,6 +54,24 @@ export function App() {
return
}

case EXT_ACTIONS.ADD_NOTE_FAILURE: {
const { error } = message ?? 'Unknown error'
setNoteStatus(undefined)
setErrorMessage(error)
return
}

case EXT_ACTIONS.DELETE_NOTE_SUCCESS: {
const { noteId } = message
if (noteId) {
setNoteStatus(undefined)
setNotes((notes) => {
return notes.filter((note) => note?.node?.id !== noteId)
})
}
return
}

case EXT_ACTIONS.REMOVE_ITEM_REQUEST: {
setSaveStatus('removing')
return
@@ -108,17 +124,18 @@ export function App() {
const actionUnSave = () => {}

const actionLogOut = () => {
void chrome.runtime.sendMessage({ action: EXT_ACTIONS.LOGGED_OUT_OF_POCKET })
void sendMessage({ action: EXT_ACTIONS.LOGGED_OUT_OF_POCKET })
}

return (
<ActionContainer
errorMessage={errorMessage}
saveStatus={saveStatus}
isOpen={isOpen}
preview={preview}
tags={tags}
noteStatus={noteStatus}
notes={notes}
setNoteStatus={setNoteStatus}
isOpen={isOpen}
item={item}
actionUnSave={actionUnSave}
actionLogOut={actionLogOut}
/>
37 changes: 22 additions & 15 deletions clients/extension/actions.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
export enum EXT_ACTIONS {
BROWSER_ACTION = 'BROWSER_ACTION',
LOGGED_OUT_OF_POCKET = 'LOGGED_OUT_OF_POCKET',
OPEN_POCKET = 'OPEN_POCKET',
AUTH_CODE_RECEIVED = 'AUTH_CODE_RECEIVED',
AUTH_ERROR = 'AUTH_ERROR',
BROWSER_ACTION = 'BROWSER_ACTION',
COLOR_MODE_CHANGE = 'COLOR_MODE_CHANGE',
LOGGED_OUT_OF_POCKET = 'LOGGED_OUT_OF_POCKET',
OPEN_OPTIONS = 'OPEN_OPTIONS',
SAVE_TO_POCKET_REQUEST = 'SAVE_TO_POCKET_REQUEST',
SAVE_TO_POCKET_SUCCESS = 'SAVE_TO_POCKET_SUCCESS',
SAVE_TO_POCKET_FAILURE = 'SAVE_TO_POCKET_FAILURE',
RESAVE_ITEM = 'RESAVE_ITEM',
UPDATE_ITEM_PREVIEW = 'UPDATE_ITEM_PREVIEW',
OPEN_POCKET = 'OPEN_POCKET',
POPUP_CLOSED = 'POPUP_CLOSED',
REMOVE_ITEM = 'REMOVE_ITEM',
REMOVE_ITEM_FAILURE = 'REMOVE_ITEM_FAILURE',
REMOVE_ITEM_REQUEST = 'REMOVE_ITEM_REQUEST',
REMOVE_ITEM_SUCCESS = 'REMOVE_ITEM_SUCCESS',
REMOVE_ITEM_FAILURE = 'REMOVE_ITEM_FAILURE',
SUGGESTED_TAGS_SUCCESS = 'SUGGESTED_TAGS_SUCCESS',
RESAVE_ITEM = 'RESAVE_ITEM',
SAVE_TO_POCKET_FAILURE = 'SAVE_TO_POCKET_FAILURE',
SAVE_TO_POCKET_REQUEST = 'SAVE_TO_POCKET_REQUEST',
SAVE_TO_POCKET_SUCCESS = 'SAVE_TO_POCKET_SUCCESS',
SELECTION_ADD = 'SELECTION_ADD',
SEND_TAG_ERROR = 'SEND_TAG_ERROR',
SUGGESTED_TAGS_FAILURE = 'SUGGESTED_TAGS_FAILURE',
TAGS_SYNC = 'TAGS_SYNC',
SUGGESTED_TAGS_SUCCESS = 'SUGGESTED_TAGS_SUCCESS',
TAG_SYNC_FAILURE = 'TAG_SYNC_FAILURE',
TAG_SYNC_REQUEST = 'TAG_SYNC_REQUEST',
TAG_SYNC_SUCCESS = 'TAG_SYNC_SUCCESS',
TAG_SYNC_FAILURE = 'TAG_SYNC_FAILURE',
TAGS_SYNC = 'TAGS_SYNC',
UNKNOWN_ACTION = 'UNKNOWN_ACTION',
UPDATE_ITEM_PREVIEW = 'UPDATE_ITEM_PREVIEW',
UPDATE_STORED_TAGS = 'UPDATE_STORED_TAGS',
SEND_TAG_ERROR = 'SEND_TAG_ERROR',
UPDATE_TAG_ERROR = 'UPDATE_TAG_ERROR',
USER_LOG_IN = 'USER_LOG_IN',
SELECTION_ADD = 'SELECTION_ADD',
UNKNOWN_ACTION = 'UNKNOWN_ACTION'
ADD_NOTE_REQUEST = 'ADD_NOTE_REQUEST',
ADD_NOTE_SUCCESS = 'ADD_NOTE_SUCCESS',
ADD_NOTE_FAILURE = 'ADD_NOTE_FAILURE',
DELETE_NOTE_REQUEST = 'DELETE_NOTE_REQUEST',
DELETE_NOTE_SUCCESS = 'DELETE_NOTE_SUCCESS',
DELETE_NOTE_FAILURE = 'DELETE_NOTE_FAILURE'
}
75 changes: 75 additions & 0 deletions clients/extension/background/api/add-note.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { extensionRequest } from '../../utilities/request'
import { verifySession } from '../auth'
import { FRAGMENT_ITEM_PREVIEW } from './fragments/preview'
import { FRAGMENT_SAVED_ITEM } from './fragments/saved-item'

import type { ExtItem, ExtSavedItem } from '../../types'
import type { CreateNoteMarkdownInput } from '@common/types/pocket'

interface ExtCreateNoteMarkdown {
archived: boolean
contentPreview: string
createdAt: string
deleted: boolean
docMarkdown: boolean
id: string
source: string | undefined
title: string | undefined
updatedAt: string
savedItem: ExtSavedItem
}

const gql = String.raw
const query = gql`
mutation CreateNoteMarkdown($input: CreateNoteMarkdownInput!) {
createNoteMarkdown(input: $input) {
archived
contentPreview
createdAt
deleted
docMarkdown
id
source
title
updatedAt
savedItem {
...ItemSaved
item {
... on Item {
preview {
...ItemPreview
}
}
}
}
}
}
${FRAGMENT_SAVED_ITEM}
${FRAGMENT_ITEM_PREVIEW}
`

export async function addNote(input: CreateNoteMarkdownInput) {
// We need a token to save. This will create a session if need be
// be requesting a new bearer if the current one is expired
const token = await verifySession()

// Set up the variables we need for this request
const data = { variables: { input }, query }

// Make the request and return it
const response = await extensionRequest<{ createNoteMarkdown: ExtCreateNoteMarkdown }>(
data,
token
)

const responseItem = response?.createNoteMarkdown?.savedItem
const { item, ...savedItem } = responseItem
const preview = item?.preview

// We have got a pending item back from the server ... we should handle it
if (!item || !preview) throw new Error(`Trouble creating note`)

const validItem: ExtItem = { savedItem, preview }
return validItem
}
30 changes: 30 additions & 0 deletions clients/extension/background/api/fragments/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const gql = String.raw

export const FRAGMENT_ITEM_PREVIEW = gql`
fragment ItemPreview on PocketMetadata {
... on ItemSummary {
previewId: id
id
image {
caption
credit
url
cachedImages(imageOptions: [{ width: 80, id: "ext", height: 80, fileType: PNG }]) {
url
id
}
}
excerpt
title
authors {
name
}
domain {
name
}
datePublished
url
source
}
}
`
30 changes: 30 additions & 0 deletions clients/extension/background/api/fragments/saved-item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const gql = String.raw

export const FRAGMENT_SAVED_ITEM = gql`
fragment ItemSaved on SavedItem {
savedId: id
id
suggestedTags {
id
name
}
tags {
id
name
}
notes {
edges {
cursor
node {
archived
createdAt
deleted
id
updatedAt
title
contentPreview
}
}
}
}
`
23 changes: 23 additions & 0 deletions clients/extension/background/api/remove-note.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { extensionRequest } from '../../utilities/request'
import { verifySession } from '../auth'

const gql = String.raw
const query = gql`
mutation DeleteNote($input: DeleteNoteInput!) {
deleteNote(input: $input)
}
`

export async function removeNote(noteId: string) {
// We need a token to save. This will create a session if need be
// be requesting a new bearer if the current one is expired
const token = await verifySession()

// Set up the variables we need for this request
const data = { variables: { input: { id: noteId } }, query }

// Make the request and return it
const response = await extensionRequest<{ deleteNote: boolean }>(data, token)

return response
}
40 changes: 9 additions & 31 deletions clients/extension/background/api/upsert.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { extensionRequest } from '../../utilities/request'
import { verifySession } from '../auth'

import { FRAGMENT_ITEM_PREVIEW } from './fragments/preview'
import { FRAGMENT_SAVED_ITEM } from './fragments/saved-item'
import type { ExtSave, ExtItemResponse, ExtItem } from '../../types'

interface upsertSavedItem {
@@ -9,46 +11,23 @@ interface upsertSavedItem {

const gql = String.raw
const query = gql`
mutation ItemUpsert($input: SavedItemUpsertInput!, $imageOptions: [CachedImageInput!]!) {
mutation ItemUpsert($input: SavedItemUpsertInput!) {
upsertSavedItem(input: $input) {
item {
... on Item {
preview {
image {
cachedImages(imageOptions: $imageOptions) {
url
id
}
}
title
excerpt
domain {
name
}
url
id
source
authors {
id
name
}
...ItemPreview
}
savedItem {
suggestedTags {
name
}
notes {
edges {
node {
contentPreview
}
}
}
...ItemSaved
}
}
}
}
}
${FRAGMENT_SAVED_ITEM}
${FRAGMENT_ITEM_PREVIEW}
`

export async function upsertItem(saveData: ExtSave) {
@@ -59,8 +38,7 @@ export async function upsertItem(saveData: ExtSave) {
const token = await verifySession()

// Set up the variables we need for this request
const imageOptions = [{ width: 80, id: 'ext', height: 80, fileType: 'PNG' }]
const data = { variables: { input: { url }, imageOptions }, query }
const data = { variables: { input: { url } }, query }

// Make the request and return it
const response = await extensionRequest<{ upsertSavedItem: upsertSavedItem }>(data, token)
3 changes: 2 additions & 1 deletion clients/extension/background/icon-updates/index.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@ export async function setDefaultIcon() {
}

export async function setToolbarIcon(tabId: number, isSaved: boolean) {
const imageData = isSaved ? savedIcon() : inactiveIcon()
// const imageData = isSaved ? savedIcon() : inactiveIcon()
const imageData = inactiveIcon()
await chrome.action.setIcon({ tabId, imageData })
}

Loading