@@ -216,6 +216,7 @@ interface SynergismUserAPIResponse<T extends keyof AccountMetadata> {
216216 bonus : BonusTypes
217217 error ?: unknown
218218 subscription : SubscriptionMetadata
219+ linkedAccounts : string [ ]
219220}
220221
221222const isDiscordAccount = (
@@ -251,15 +252,16 @@ export async function handleLogin () {
251252 personalBonus : 0 ,
252253 accountType : 'none' ,
253254 bonus : { quarks : 0 } ,
254- subscription : null
255+ subscription : null ,
256+ linkedAccounts : [ ]
255257 } satisfies SynergismUserAPIResponse < 'none' >
256258 ) ,
257259 { status : 401 }
258260 )
259261 )
260262
261263 const account = await response . json ( ) as SynergismUserAPIResponse < keyof AccountMetadata >
262- const { globalBonus, personalBonus, subscription : sub } = account
264+ const { globalBonus, personalBonus, subscription : sub , linkedAccounts } = account
263265
264266 setQuarkBonus ( personalBonus , globalBonus )
265267 setInterval ( ( ) => refreshQuarkBonus ( ) , 1000 * 60 * 15 )
@@ -327,37 +329,42 @@ export async function handleLogin () {
327329 <span style="color: lightgoldenrodyellow">OMEGA Baller</span> [+5%] - ${ hasTier4 ? checkMark ( 5 ) : exMark }
328330 <span style="color: #f47fff">Discord Server Booster</span> [+1%] - ${ boosted ? checkMark ( 1 ) : exMark }
329331
330- Event Bonuses:
331- <span style="color: #ffcc00">Thanksgiving 2023</span> [+0.2%] - ${
332+ <div class="event-bonuses-header" id="eventBonusesHeader">
333+ <span class="chevron" id="eventBonusesChevron">▼</span>
334+ <span>${ i18next . t ( 'account.eventBonuses' ) } :</span>
335+ </div>
336+ <div class="event-bonuses-content" id="eventBonusesContent">
337+ <span style="color: #ffcc00">Thanksgiving 2023</span> [+0.2%] - ${
332338 discord && account . member . roles ?. includes ( THANKSGIVING_2023 ) ? checkMark ( 0.2 ) : exMark
333339 }
334- <span style="color: #ffcc00">Thanksgiving 2024</span> [+0.3%] - ${
340+ <span style="color: #ffcc00">Thanksgiving 2024</span> [+0.3%] - ${
335341 discord && account . member . roles ?. includes ( THANKSGIVING_2024 ) ? checkMark ( 0.3 ) : exMark
336342 }
337- <span style="color: #ffcc00">Conductor 2023</span> [+0.3%] - ${
343+ <span style="color: #ffcc00">Conductor 2023</span> [+0.3%] - ${
338344 discord && account . member . roles ?. includes ( CONDUCTOR_2023 ) ? checkMark ( 0.3 ) : exMark
339345 }
340- <span style="color: #ffcc00">Conductor 2024</span> [+0.4%] - ${
346+ <span style="color: #ffcc00">Conductor 2024</span> [+0.4%] - ${
341347 discord && account . member . roles ?. includes ( CONDUCTOR_2024 ) ? checkMark ( 0.4 ) : exMark
342348 }
343- <span style="color: #ffcc00">Eight Leaf</span> [+0.3%] - ${
349+ <span style="color: #ffcc00">Eight Leaf</span> [+0.3%] - ${
344350 discord && account . member . roles ?. includes ( EIGHT_LEAF ) ? checkMark ( 0.3 ) : exMark
345351 }
346- <span style="color: #ffcc00">Ten Leaf</span> [+0.4%] - ${
352+ <span style="color: #ffcc00">Ten Leaf</span> [+0.4%] - ${
347353 discord && account . member . roles ?. includes ( TEN_LEAF ) ? checkMark ( 0.4 ) : exMark
348354 }
349- <span style="color: #ffcc00">Smith Incarnate</span> [+0.6%] - ${
355+ <span style="color: #ffcc00">Smith Incarnate</span> [+0.6%] - ${
350356 discord && account . member . roles ?. includes ( SMITH_INCARNATE ) ? checkMark ( 0.6 ) : exMark
351357 }
352- <span style="color: #ffcc00">Smith God</span> [+0.7%] - ${
358+ <span style="color: #ffcc00">Smith God</span> [+0.7%] - ${
353359 discord && account . member . roles ?. includes ( SMITH_GOD ) ? checkMark ( 0.7 ) : exMark
354360 }
355- <span style="color: #ffcc00">Golden Smith God</span> [+0.8%] - ${
361+ <span style="color: #ffcc00">Golden Smith God</span> [+0.8%] - ${
356362 discord && account . member . roles ?. includes ( GOLDEN_SMITH_GOD ) ? checkMark ( 0.8 ) : exMark
357363 }
358- <span style="color: #ffcc00">Diamond Smith Messiah</span> [+1%] - ${
364+ <span style="color: #ffcc00">Diamond Smith Messiah</span> [+1%] - ${
359365 discord && account . member . roles ?. includes ( DIAMOND_SMITH_MESSIAH ) ? checkMark ( 1.2 ) : exMark
360366 }
367+ </div>
361368
362369 And Finally...
363370 <span style="color: lime"> Being <span style="color: lightgoldenrodyellow"> YOURSELF! </span></span> [+1%] - ${
@@ -369,10 +376,85 @@ export async function handleLogin () {
369376 More will be incorporated both for general accounts and supporters of the game shortly.
370377 Become a supporter of development via the link below, and get special bonuses,
371378 while also improving the Global Bonus for all to enjoy!
372- <a href="https://www.patreon.com/synergism" target="_blank" rel="noopener noreferrer nofollow">
373- <span style="color: lightgoldenrodyellow">--> PATREON <--</span>
374- </a>
375379 ` . trim ( )
380+
381+ const allPlatforms = [ 'discord' , 'patreon' ]
382+ const unlinkedPlatforms = allPlatforms . filter ( ( platform ) => ! linkedAccounts . includes ( platform ) )
383+
384+ if ( unlinkedPlatforms . length > 0 ) {
385+ const linkAccountsSection = document . createElement ( 'div' )
386+
387+ const buttonContainer = document . createElement ( 'div' )
388+ buttonContainer . style . display = 'flex'
389+ buttonContainer . style . flexWrap = 'wrap'
390+ buttonContainer . style . gap = '10px'
391+ buttonContainer . style . marginTop = '10px'
392+ buttonContainer . style . justifyContent = 'center'
393+
394+ const platformConfig = {
395+ discord : {
396+ label : 'Link Discord' ,
397+ color : '#5865F2' ,
398+ logo :
399+ `<svg width="20" height="20" viewBox="0 0 71 55" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: middle; margin-right: 8px;">
400+ <path d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z" fill="white"/>
401+ </svg>`
402+ } ,
403+ patreon : {
404+ label : 'Link Patreon' ,
405+ color : '#FF424D' ,
406+ logo :
407+ `<svg width="20" height="20" viewBox="0 0 436 476" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align: middle; margin-right: 8px;">
408+ <path d="M436 143.371C436 64.203 373.797 2 294.629 2C215.461 2 153.258 64.203 153.258 143.371C153.258 222.539 215.461 284.742 294.629 284.742C373.797 284.742 436 222.539 436 143.371ZM0 474H74.8139V2H0V474Z" fill="white"/>
409+ </svg>`
410+ }
411+ }
412+
413+ unlinkedPlatforms . forEach ( ( platform ) => {
414+ const config = platformConfig [ platform as keyof typeof platformConfig ]
415+ const button = document . createElement ( 'button' )
416+ button . innerHTML = `${ config . logo } ${ config . label } `
417+ button . style . padding = '10px 20px'
418+ button . style . cursor = 'pointer'
419+ button . style . backgroundColor = config . color
420+ button . style . color = 'white'
421+ button . style . border = 'none'
422+ button . style . borderRadius = '5px'
423+ button . style . fontSize = '14px'
424+ button . style . fontWeight = 'bold'
425+ button . style . display = 'flex'
426+ button . style . alignItems = 'center'
427+ button . style . transition = 'opacity 0.2s'
428+ button . addEventListener ( 'mouseenter' , ( ) => {
429+ button . style . opacity = '0.85'
430+ } )
431+ button . addEventListener ( 'mouseleave' , ( ) => {
432+ button . style . opacity = '1'
433+ } )
434+ button . addEventListener ( 'click' , ( ) => {
435+ window . open ( `https://synergism.cc/login?with=${ platform } &link=true` , '_blank' )
436+ } )
437+ buttonContainer . appendChild ( button )
438+ } )
439+
440+ linkAccountsSection . appendChild ( buttonContainer )
441+ subtabElement . appendChild ( linkAccountsSection )
442+ }
443+
444+ // Add event listener for event bonuses dropdown toggle
445+ const eventBonusesHeader = DOMCacheGetOrSet ( 'eventBonusesHeader' )
446+ const eventBonusesContent = DOMCacheGetOrSet ( 'eventBonusesContent' )
447+ const eventBonusesChevron = DOMCacheGetOrSet ( 'eventBonusesChevron' )
448+
449+ eventBonusesContent . style . display = 'none'
450+ eventBonusesChevron . style . transform = 'rotate(-90deg)'
451+
452+ eventBonusesHeader . style . cursor = 'pointer'
453+ eventBonusesHeader . addEventListener ( 'click' , ( ) => {
454+ const isCollapsed = eventBonusesContent . style . display === 'none'
455+ eventBonusesContent . style . display = isCollapsed ? 'block' : 'none'
456+ eventBonusesChevron . style . transform = isCollapsed ? 'rotate(0deg)' : 'rotate(-90deg)'
457+ } )
376458 } else if ( ! hasAccount ( account ) ) {
377459 // User is not logged in
378460 subtabElement . querySelector ( '#open-register' ) ?. addEventListener ( 'click' , ( ) => {
0 commit comments