@@ -23,7 +23,7 @@ import { ClipLoader } from "react-spinners";
2323import { FiSettings } from "react-icons/fi" ;
2424import { AiFillWarning } from "react-icons/ai" ;
2525import { ConnectedDataSource , DataSourceType } from "./data-source" ;
26- import { IoMdArrowDropdown } from "react-icons/io" ;
26+ import { IoMdArrowDropdown , IoMdClose } from "react-icons/io" ;
2727
2828export interface AppState {
2929 query : string
@@ -107,7 +107,7 @@ export default class App extends React.Component <{}, AppState>{
107107 isStartedFetching : false ,
108108 isPreparingIndexing : false ,
109109 discordCodeInput : "" ,
110- didPassDiscord : true ,
110+ didPassDiscord : false ,
111111 docsLeftToIndex : 0 ,
112112 docsInIndexing : 0 ,
113113 docsIndexed : 0 ,
@@ -263,7 +263,6 @@ export default class App extends React.Component <{}, AppState>{
263263 if ( this . state . didPassDiscord ) {
264264 this . setState ( { isModalOpen : true } ) ;
265265 } else {
266- toast . error ( "You must pass the discord verification first." , { autoClose : 3000 } ) ;
267266 }
268267 }
269268
@@ -291,27 +290,20 @@ export default class App extends React.Component <{}, AppState>{
291290 return " text-[#A78BF6]"
292291 }
293292
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 } ) ;
308295 }
309296
310- saveDiscordPassed = ( ) => {
297+ saveDiscordPassed = ( joined : boolean ) => {
311298 localStorage . setItem ( 'discord_key' , 'true' ) ;
312299 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+ }
315307 }
316308
317309 dataSourcesAdded = ( newlyConnected : ConnectedDataSource ) => {
@@ -403,32 +395,34 @@ export default class App extends React.Component <{}, AppState>{
403395 {
404396 ! this . state . didPassDiscord &&
405397 < 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" >
407399 < 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 >
408403 < span className = "flex flex-row text-white text-3xl font-bold m-5 mt-5 mb-6 font-sans items-center" >
409404 < span > Are you on Discord?</ span >
410405 < img src = { DiscordImage } alt = "discord" className = "relative inline h-10 ml-4 opacity-80 animate-pulse" > </ img >
411406 </ span >
412407 < div className = "flex flex-row w-[97%] bg-[#faa61a1a] p-3 ml-1 border-[2px] border-[#FAA61A] rounded-[5px]" >
413408 < img className = "ml-2 h-10" src = { WarningImage } alt = "warning" > </ img >
414409 < 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
417413 < span className = "font-inter tracking-normal font-semibold group-hover:translate-x-0.5 transition-transform duration-150 ease-in-out ml-1" > -></ span >
418414 </ a >
419415 </ span >
420416 </ button >
421417 </ 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 >
426418 </ div >
427419 < 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
429424 < span className = "font-inter tracking-normal font-semibold group-hover:translate-x-0.5 transition-transform duration-150 ease-in-out ml-1" > -></ span >
430425 </ 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 >
432426 </ div >
433427 </ div >
434428
0 commit comments