File tree Expand file tree Collapse file tree 1 file changed +17
-16
lines changed
src/features/settings/components Expand file tree Collapse file tree 1 file changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -26,13 +26,6 @@ export const SourceSettings = () => {
2626 } ) ,
2727 ] . sort ( ( a , b ) => ( a . label > b . label ? 1 : - 1 ) )
2828
29- const defaultValues = [
30- ...cards
31- . map ( ( source ) => SUPPORTED_CARDS . find ( ( sc ) => sc . value === source . name ) )
32- . map ( ( v ) => v ?. value ) ,
33- ...userCustomCards . map ( ( source ) => source . value ) ,
34- ] . filter ( Boolean ) as string [ ]
35-
3629 return (
3730 < SettingsContentLayout
3831 title = "Sources"
@@ -41,20 +34,28 @@ export const SourceSettings = () => {
4134 < ChipsSet
4235 canSelectMultiple = { true }
4336 options = { mergedSources }
44- defaultValues = { defaultValues }
37+ defaultValues = { cards . map ( ( source ) => source . name ) }
4538 onChange = { ( changes , selectedChips ) => {
4639 const selectedValues = selectedChips . map ( ( chip ) => chip . value )
4740
48- const cards = ( selectedValues
49- . map ( ( source ) => SUPPORTED_CARDS . find ( ( sc ) => sc . value === source ) )
50- . filter ( Boolean )
41+ const cards = selectedValues
5142 . map ( ( source , index ) => {
52- return {
53- id : index ,
54- name : source ?. value || '' ,
55- type : 'supported' ,
43+ if ( SUPPORTED_CARDS . find ( ( sc ) => sc . value === source ) ) {
44+ return {
45+ id : index ,
46+ name : source ,
47+ type : 'supported' ,
48+ }
49+ } else if ( userCustomCards . find ( ( ucc ) => ucc . value === source ) ) {
50+ return {
51+ id : index ,
52+ name : source ,
53+ type : 'rss' ,
54+ }
5655 }
57- } ) || [ ] ) as SelectedCard [ ]
56+ return null
57+ } )
58+ . filter ( Boolean ) as SelectedCard [ ]
5859
5960 setCards ( cards )
6061
You can’t perform that action at this time.
0 commit comments