@@ -4,6 +4,7 @@ import ReactModal from 'react-modal'
44import Select , { ActionMeta , MultiValue , SingleValue } from 'react-select'
55import Toggle from 'react-toggle'
66import 'react-toggle/style.css'
7+ import { ChipsSet } from 'src/components/Elements'
78import { Footer } from 'src/components/Layout'
89import { SUPPORTED_CARDS , SUPPORTED_SEARCH_ENGINES , supportLink } from 'src/config'
910import { Tag , useRemoteConfigStore } from 'src/features/remoteConfig'
@@ -24,7 +25,7 @@ import {
2425 trackThemeSelect ,
2526} from 'src/lib/analytics'
2627import { useUserPreferences } from 'src/stores/preferences'
27- import { SearchEngineType , SelectedCard } from 'src/types'
28+ import { Option , SearchEngineType , SelectedCard } from 'src/types'
2829import { RssSetting } from './RssSetting'
2930import './settings.css'
3031
@@ -48,8 +49,10 @@ export const SettingsModal = ({ showSettings, setShowSettings }: SettingsModalPr
4849 listingMode,
4950 theme,
5051 searchEngine,
52+ maxVisibleCards,
5153 setTheme,
5254 setListingMode,
55+ setMaxVisibleCards,
5356 setSearchEngine,
5457 setOpenLinksNewTab,
5558 setCards,
@@ -144,6 +147,12 @@ export const SettingsModal = ({ showSettings, setShowSettings }: SettingsModalPr
144147 identifyUserTheme ( newTheme )
145148 }
146149
150+ const onCardsCountChange = ( selectedChips : Option [ ] ) => {
151+ if ( selectedChips . length ) {
152+ setMaxVisibleCards ( parseInt ( selectedChips [ 0 ] . value ) )
153+ }
154+ }
155+
147156 return (
148157 < ReactModal
149158 isOpen = { showSettings }
@@ -215,6 +224,43 @@ export const SettingsModal = ({ showSettings, setShowSettings }: SettingsModalPr
215224
216225 < RssSetting setSelectedCards = { setSelectedCards } />
217226
227+ < div className = "settingRow" >
228+ < p className = "settingTitle" > Max number of cards to display</ p >
229+ < div className = "settingContent" >
230+ < ChipsSet
231+ className = { 'noMargin' }
232+ canSelectMultiple = { false }
233+ options = { [
234+ {
235+ label : '3 cards' ,
236+ value : '3' ,
237+ } ,
238+ {
239+ label : '4 cards' ,
240+ value : '4' ,
241+ } ,
242+ {
243+ label : '5 cards' ,
244+ value : '5' ,
245+ } ,
246+ {
247+ label : '6 cards' ,
248+ value : '6' ,
249+ } ,
250+ ] }
251+ defaultValues = { [ maxVisibleCards . toString ( ) ] }
252+ onChange = { ( _ , selectedChips ) => {
253+ onCardsCountChange ( selectedChips )
254+ } }
255+ />
256+
257+ < p className = "settingHint" >
258+ To ensure a seamless experience, we may adjust the selected number to align with the
259+ resolution of your screen.
260+ </ p >
261+ </ div >
262+ </ div >
263+
218264 < div className = "settingRow" >
219265 < p className = "settingTitle" > Dark Mode</ p >
220266 < div className = "settingContent" >
0 commit comments