File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed
Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -135,12 +135,24 @@ export default function DownloadSelector() {
135135 )
136136 </ span > ;
137137
138- const toggleModule = ( moduleId : string ) => {
139- setSelectedModules ( prev =>
140- prev . includes ( moduleId ) ?
141- prev . filter ( id => id !== moduleId )
142- : [ ...prev , moduleId ] ,
143- ) ;
138+ const toggleModule = ( moduleId : ModuleType ) => {
139+ setSelectedModules ( prev => {
140+ let next : string [ ] ;
141+ if ( prev . includes ( moduleId ) ) {
142+ next = prev . filter ( id => id !== moduleId ) ;
143+ // If discord is being toggled off, also unselect discordlink
144+ if ( moduleId === 'discord' && next . includes ( 'discordlink' ) ) {
145+ next = next . filter ( id => id !== 'discordlink' ) ;
146+ }
147+ } else {
148+ next = [ ...prev , moduleId ] ;
149+ // If discordlink is being toggled on, also select discord
150+ if ( moduleId === 'discordlink' && ! next . includes ( 'discord' ) ) {
151+ next . push ( 'discord' ) ;
152+ }
153+ }
154+ return next ;
155+ } ) ;
144156 } ;
145157
146158 return (
Original file line number Diff line number Diff line change 1+ import { ModuleType } from '@/lib/build-utils' ;
2+
13export interface Module {
2- id : string ;
4+ id : ModuleType ;
35 name : string ;
46 description : string ;
57 recommended ?: boolean ;
You can’t perform that action at this time.
0 commit comments