• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zooniverse / front-end-monorepo / 16531866204

25 Jul 2025 09:23PM UTC coverage: 77.439% (-0.5%) from 77.896%
16531866204

push

github

web-flow
lib-react-components: Add FavoritesIconButton component and useUserCollections hook (#6958)

* Add initial FavoritesIconButton component

* Add usePanoptesAuthToken and useUserCollections

* Refactor SubjectTalkPage with connector and FavoritesIconButton

* Add FavoritesIconButtonContainer with useUserCollections

* Add addSubjects and removeSubjects mutations

* Add create favorite

* Refactor addSubjectsToCollection with options arg

* Add FavoritesIconButton tests

* Refactor props passed from SubjectTalkPageConnector to FavoritesIconButtonContainer

* Add comment for refactoring with subjects that include favorite boolean

* Add documentation for usePanoptesAuthToken and useUserCollections hooks

* Refactor collections updates with mutate

* Update FavoritesIconButton README

* Add FavoritesIconButton to CHANGELOG

* Remove unused SubjectTalkPageConnector export

* Refactor SubjectTalkPageConnector useStores

* Update SubjectTalkViewer with optional chaining

Co-authored-by: Delilah C. <23665803+goplayoutside3@users.noreply.github.com>

* Refactor FavoritesIconButton with useEffect per checked property

* Remove mutate from FavoritesIconButtonContainer

* use swr mutate to modify icon checked or not-checked (#6975)

---------

Co-authored-by: Delilah C. <23665803+goplayoutside3@users.noreply.github.com>

11348 of 17140 branches covered (66.21%)

Branch coverage included in aggregate %.

63 of 137 new or added lines in 13 files covered. (45.99%)

17570 of 20203 relevant lines covered (86.97%)

398.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

7.84
/packages/lib-react-components/src/helpers/collections/addSubjectsToCollection.js
1
import { collections } from '@zooniverse/panoptes-js'
1✔
2
import auth from 'panoptes-client/lib/auth'
1!
3

NEW
4
export async function addSubjectsToCollection({ collectionId, options, projectId, subjectIds }) {
×
NEW
5
  const token = await auth.checkBearerToken()
×
NEW
6
  const authorization = `Bearer ${token}`
×
7

NEW
8
  if (!collectionId) {
×
NEW
9
    const response = await collections.create({
×
10
      authorization,
11
      data: options,
12
      project: projectId,
13
      subjects: subjectIds
14
    })
15

NEW
16
    const [newCollection] = response.body.collections
×
17
    return newCollection
18
  } else {
NEW
19
    const params = {
×
20
      authorization,
21
      id: collectionId,
22
      subjects: subjectIds
NEW
23
    }
×
24

NEW
25
    const response = await collections.addSubjects(params)
×
NEW
26
    const [collection] = response?.body?.collections
×
NEW
27
    return collection
×
28
  }
NEW
29
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc