@@ -23,7 +23,7 @@ import { ClipLoader } from "react-spinners";
23
23
import { FiSettings } from "react-icons/fi" ;
24
24
import { AiFillWarning } from "react-icons/ai" ;
25
25
import { ConnectedDataSource , DataSourceType } from "./data-source" ;
26
- import { IoMdArrowDropdown } from "react-icons/io" ;
26
+ import { IoMdArrowDropdown , IoMdClose } from "react-icons/io" ;
27
27
28
28
export interface AppState {
29
29
query : string
@@ -107,7 +107,7 @@ export default class App extends React.Component <{}, AppState>{
107
107
isStartedFetching : false ,
108
108
isPreparingIndexing : false ,
109
109
discordCodeInput : "" ,
110
- didPassDiscord : true ,
110
+ didPassDiscord : false ,
111
111
docsLeftToIndex : 0 ,
112
112
docsInIndexing : 0 ,
113
113
docsIndexed : 0 ,
@@ -263,7 +263,6 @@ export default class App extends React.Component <{}, AppState>{
263
263
if ( this . state . didPassDiscord ) {
264
264
this . setState ( { isModalOpen : true } ) ;
265
265
} else {
266
- toast . error ( "You must pass the discord verification first." , { autoClose : 3000 } ) ;
267
266
}
268
267
}
269
268
@@ -291,27 +290,20 @@ export default class App extends React.Component <{}, AppState>{
291
290
return " text-[#A78BF6]"
292
291
}
293
292
294
- verifyDiscordCode = ( ) => {
295
- if ( this . state . discordCodeInput . trim ( ) === discordCode ) {
296
- this . saveDiscordPassed ( ) ;
297
- } else {
298
- toast . error ( "Invalid code. Join Discord!" , { autoClose : 2000 } ) ;
299
- }
300
- }
301
-
302
- onDiscordCodeChange = ( event ) => {
303
- if ( event . target . value === discordCode ) {
304
- this . saveDiscordPassed ( ) ;
305
- } else {
306
- this . setState ( { discordCodeInput : event . target . value } ) ;
307
- }
293
+ hideDiscord = ( ) => {
294
+ this . setState ( { didPassDiscord : true } ) ;
308
295
}
309
296
310
- saveDiscordPassed = ( ) => {
297
+ saveDiscordPassed = ( joined : boolean ) => {
311
298
localStorage . setItem ( 'discord_key' , 'true' ) ;
312
299
this . setState ( { didPassDiscord : true } ) ;
313
- posthog . capture ( 'passed_discord' ) ;
314
- toast . success ( "Code accepted. Welcome!" , { autoClose : 3000 } ) ;
300
+ if ( joined ) {
301
+ posthog . capture ( 'passed_discord' , { name : "joined" } ) ;
302
+ toast . success ( "Welcome to the community!" , { autoClose : 2000 } ) ;
303
+ } else {
304
+ posthog . capture ( 'passed_discord' , { name : "skipped" } ) ;
305
+ toast . success ( "Welcome! use top-left discord icon to join the community." , { autoClose : 8000 } ) ;
306
+ }
315
307
}
316
308
317
309
dataSourcesAdded = ( newlyConnected : ConnectedDataSource ) => {
@@ -403,32 +395,34 @@ export default class App extends React.Component <{}, AppState>{
403
395
{
404
396
! this . state . didPassDiscord &&
405
397
< div className = 'absolute z-30 flex flex-col items-center top-40 mx-auto w-full' >
406
- < div className = "flex flex-col items-start w-[660px] h-[440px ] bg-[#36393F] rounded-xl" >
398
+ < div className = "flex flex-col items-start w-[660px] h-[305px ] bg-[#36393F] rounded-xl" >
407
399
< div className = "flex flex-col justify-center items-start p-3" >
400
+ < div className = "ml-[614px] text-2xl text-white gap-4" >
401
+ < IoMdClose onClick = { this . hideDiscord } className = 'hover:text-[#9875d4] hover:cursor-pointer' />
402
+ </ div >
408
403
< span className = "flex flex-row text-white text-3xl font-bold m-5 mt-5 mb-6 font-sans items-center" >
409
404
< span > Are you on Discord?</ span >
410
405
< img src = { DiscordImage } alt = "discord" className = "relative inline h-10 ml-4 opacity-80 animate-pulse" > </ img >
411
406
</ span >
412
407
< div className = "flex flex-row w-[97%] bg-[#faa61a1a] p-3 ml-1 border-[2px] border-[#FAA61A] rounded-[5px]" >
413
408
< img className = "ml-2 h-10" src = { WarningImage } alt = "warning" > </ img >
414
409
< button className = "ml-4 text-white text-xl font-source-sans-pro font-semibold inline" >
415
- < span className = "block text-left" > gerev.ai is currently only available to our Discord community members.
416
- < a href = "https://discord.gg/aMRRcmhAdW" target = "_blank" rel = "noreferrer" className = "inline-flex transition duration-150 ease-in-out group ml-1 hover:cursor-pointer" > Join Discord
410
+ < span className = "block text-left" > Join Gerev's 1000+ discord community members, get early access to exclusive features.
411
+ < a href = "https://discord.gg/aMRRcmhAdW" target = "_blank" rel = "noreferrer"
412
+ className = "inline-flex transition duration-150 ease-in-out group ml-1 hover:cursor-pointer" > Join Discord
417
413
< span className = "font-inter tracking-normal font-semibold group-hover:translate-x-0.5 transition-transform duration-150 ease-in-out ml-1" > -></ span >
418
414
</ a >
419
415
</ span >
420
416
</ button >
421
417
</ div >
422
- < div className = "flex flex-col items-start justify-center ml-2 mt-9 w-[100%]" >
423
- < span className = "text-[#B9BBBE] font-source-sans-pro font-black text-[22px]" > ENTER DISCORD AUTH CODE</ span >
424
- < input onPaste = { this . onDiscordCodeChange } value = { this . state . discordCodeInput } onChange = { this . onDiscordCodeChange } className = "bg-[#18191C] h-14 font-source-sans-pro font-black text-xl text-[#DCDDDE] rounded w-[94%] px-4 mt-4" placeholder = "123456" > </ input >
425
- </ div >
426
418
</ div >
427
419
< div className = "flex flex-row justify-between p-4 w-[100%] mt-7 rounded-b-xl h-[100px] bg-[#2F3136]" >
428
- < a href = "https://discord.gg/aMRRcmhAdW" target = "_blank" rel = "noreferrer" className = "flex hover:bg-[#404ab3] justify-center items-center font-inter bg-[#5865F2] rounded h-12 p-2 text-white w-40 inline-flex transition duration-150 ease-in-out group ml-1 hover:cursor-pointer" > Join Discord
420
+ < button onClick = { ( ) => { this . saveDiscordPassed ( false ) } } className = "font-inter bg-[#4f545d] hover:bg-[#3a3e45] rounded h-12 p-2 text-white w-40" > Hide forever</ button >
421
+
422
+ < a onClick = { ( ) => { this . saveDiscordPassed ( true ) } } href = "https://discord.gg/aMRRcmhAdW" target = "_blank" rel = "noreferrer" className = "flex hover:bg-[#404ab3] justify-center items-center font-inter bg-[#5865F2] rounded h-12 p-2 text-white w-40
423
+ inline-flex transition duration-150 ease-in-out group ml-1 hover:cursor-pointer" > Join Discord
429
424
< span className = "font-inter tracking-normal font-semibold group-hover:translate-x-0.5 transition-transform duration-150 ease-in-out ml-1" > -></ span >
430
425
</ a >
431
- < button onClick = { this . verifyDiscordCode } className = "font-inter bg-[#5865F2] hover:bg-[#404ab3] rounded h-12 p-2 text-white w-40" > Verify</ button >
432
426
</ div >
433
427
</ div >
434
428
0 commit comments