File tree 4 files changed +20
-11
lines changed
4 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export interface BookmarkPopoverProps {
24
24
totalCollectionPages : number ;
25
25
setLoginModal : Setter < boolean > ;
26
26
bookmarks : CardBookmarksDTO [ ] ;
27
+ setCardCollections : Setter < CardCollectionDTO [ ] > ;
27
28
}
28
29
29
30
const BookmarkPopover = ( props : BookmarkPopoverProps ) => {
@@ -138,17 +139,17 @@ const BookmarkPopover = (props: BookmarkPopoverProps) => {
138
139
} ) ;
139
140
} ) ;
140
141
141
- setLocalCardCollections ( ( ) => {
142
- const deDupedPrev = data . collections . filter ( ( collection ) => {
143
- return (
144
- collectionsToAdd . find (
145
- ( collectionToAdd ) => collectionToAdd . id == collection . id ,
146
- ) == undefined
147
- ) ;
148
- } ) ;
149
-
150
- return [ ...collectionsToAdd , ...deDupedPrev ] ;
142
+ const deDupedPrev = data . collections . filter ( ( collection ) => {
143
+ return (
144
+ collectionsToAdd . find (
145
+ ( collectionToAdd ) => collectionToAdd . id == collection . id ,
146
+ ) == undefined
147
+ ) ;
151
148
} ) ;
149
+
150
+ const updatedCollections = [ ...collectionsToAdd , ...deDupedPrev ] ;
151
+ setLocalCardCollections ( updatedCollections ) ;
152
+ props . setCardCollections ( updatedCollections ) ;
152
153
}
153
154
} ) ;
154
155
}
Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ const ResultsPage = (props: ResultsPageProps) => {
175
175
setOnDelete = { setOnDelete }
176
176
setShowConfirmModal = { setShowConfirmDeleteModal }
177
177
showExpand = { clientSideRequestFinished ( ) }
178
+ setCardCollections = { setCardCollections }
178
179
/>
179
180
</ div >
180
181
) }
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export interface ScoreCardProps {
41
41
initialExpanded ?: boolean ;
42
42
bookmarks : CardBookmarksDTO [ ] ;
43
43
showExpand ?: boolean ;
44
+ setCardCollections : Setter < CardCollectionDTO [ ] > ;
44
45
}
45
46
46
47
const ScoreCard = ( props : ScoreCardProps ) => {
@@ -236,6 +237,7 @@ const ScoreCard = (props: ScoreCardProps) => {
236
237
bookmarks = { props . bookmarks . filter (
237
238
( bookmark ) => bookmark . card_uuid === props . card . id ,
238
239
) }
240
+ setCardCollections = { props . setCardCollections }
239
241
/>
240
242
</ div >
241
243
< div class = "flex w-full items-start" >
Original file line number Diff line number Diff line change
1
+ import type { Setter } from "solid-js" ;
1
2
import { Show , createSignal } from "solid-js" ;
2
- import type { CardMetadataWithVotes } from "../../utils/apiTypes" ;
3
+ import type {
4
+ CardMetadataWithVotes ,
5
+ CardCollectionDTO ,
6
+ } from "../../utils/apiTypes" ;
3
7
import type { ScoreCardProps } from "./ScoreCard" ;
4
8
import { FiChevronLeft , FiChevronRight } from "solid-icons/fi" ;
5
9
import ScoreCard from "./ScoreCard" ;
6
10
7
11
export type ScoreCardAraryProps = Omit < ScoreCardProps , "card" > & {
8
12
cards : CardMetadataWithVotes [ ] ;
13
+ setCardCollections : Setter < CardCollectionDTO [ ] > ;
9
14
} ;
10
15
11
16
export const ScoreCardArray = ( props : ScoreCardAraryProps ) => {
You can’t perform that action at this time.
0 commit comments