Skip to content

Commit c92d30a

Browse files
committed
User don't have to join discord
1 parent 442d05f commit c92d30a

File tree

3 files changed

+23
-40
lines changed

3 files changed

+23
-40
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ COPY ./app/requirements.txt /tmp/requirements.txt
88

99
RUN pip install -r /tmp/requirements.txt
1010

11-
ENV CAPTURE_TELEMETRY=1
12-
1311
COPY ./app/models.py /tmp/models.py
1412

1513
# cache the models

app/telemetry.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class Posthog:
2121
BACKEND_ADDED = "backend_added"
2222
BACKEND_REMOVED = "backend_removed"
2323
BACKEND_LISTED_LOCATIONS = "backend_listed_locations"
24-
_should_capture = False
2524
_identified_uuid: Optional[str] = None
2625

2726
@classmethod
@@ -40,11 +39,6 @@ def _create_uuid_file(cls, user_uuid: str):
4039

4140
@classmethod
4241
def _identify(cls):
43-
if not os.environ.get('CAPTURE_TELEMETRY'):
44-
return
45-
46-
cls._should_capture = True
47-
4842
user_uuid = cls._read_uuid_file()
4943
if user_uuid is None:
5044
new_uuid = str(uuid4())
@@ -64,9 +58,6 @@ def _capture(cls, event: str, uuid=None, properties=None):
6458
if cls._identified_uuid is None:
6559
cls._identify()
6660

67-
if not cls._should_capture:
68-
return
69-
7061
try:
7162
posthog.capture(uuid or cls._identified_uuid, event, properties)
7263
except Exception as e:

ui/src/App.tsx

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { ClipLoader } from "react-spinners";
2323
import { FiSettings } from "react-icons/fi";
2424
import {AiFillWarning} from "react-icons/ai";
2525
import { ConnectedDataSource, DataSourceType } from "./data-source";
26-
import { IoMdArrowDropdown } from "react-icons/io";
26+
import { IoMdArrowDropdown, IoMdClose } from "react-icons/io";
2727

2828
export 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">-&gt;</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">-&gt;</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

Comments
 (0)