-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3047d54
commit b9c5237
Showing
4 changed files
with
67 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Button, Spacer, Table, Text, Textarea } from "@geist-ui/react"; | ||
import { Button, Page, Spacer, Table, Text, Textarea } from "@geist-ui/react"; | ||
import { CheckEmailOutput } from "@reacherhq/api/lib"; | ||
import React, { useEffect, useState } from "react"; | ||
|
||
|
@@ -7,6 +7,7 @@ import { sentryException } from "@/util/sentry"; | |
import { useUser } from "@/util/useUser"; | ||
import { Tables } from "@/supabase/database.types"; | ||
import { supabase } from "@/util/supabaseClient"; | ||
import { Nav } from "@/components"; | ||
|
||
function alertError(email: string, e: string) { | ||
alert( | ||
|
@@ -21,33 +22,25 @@ interface BulkProps { | |
onVerified?(result: CheckEmailOutput): Promise<void>; | ||
} | ||
|
||
const emailsToTest = [ | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
]; | ||
|
||
interface BulkJobWithEmails extends Tables<"bulk_jobs"> { | ||
bulk_emails: Tables<"bulk_emails">[]; | ||
} | ||
|
||
export function Bulk({ onVerified }: BulkProps): React.ReactElement { | ||
export default function Bulk({ onVerified }: BulkProps): React.ReactElement { | ||
const { user, userDetails } = useUser(); | ||
const [emails, setEmails] = useState(emailsToTest.join("\n")); | ||
const [emails, setEmails] = useState(""); | ||
const [loading, setLoading] = useState(false); | ||
|
||
const [bulkJobs, setBulkJobs] = useState<BulkJobWithEmails[]>([]); | ||
|
||
useEffect(() => { | ||
// This is a temporary redirect to the dashboard while I still work | ||
// on the bulk page. | ||
if (window.location.hostname == "app.reacher.email") { | ||
window.location.href = "https://app.reacher.email/dashboard"; | ||
} | ||
}, []); | ||
|
||
useEffect(() => { | ||
setInterval(async () => { | ||
console.log("FETCHING BULK JOBS..."); | ||
|
@@ -99,50 +92,54 @@ export function Bulk({ onVerified }: BulkProps): React.ReactElement { | |
|
||
return ( | ||
<> | ||
<Text h3>BULK</Text> | ||
|
||
<div className="text-center"> | ||
<Textarea | ||
autoFocus | ||
disabled={loading} | ||
onChange={(e) => { | ||
setEmails(e.target.value); | ||
}} | ||
placeholder="[email protected]" | ||
value={emails} | ||
></Textarea> | ||
<Nav /> | ||
<Page> | ||
<Text h3>BULK Work in Progress Page</Text> | ||
|
||
<div className="text-center"> | ||
<Textarea | ||
autoFocus | ||
disabled={loading} | ||
onChange={(e) => { | ||
setEmails(e.target.value); | ||
}} | ||
placeholder="[email protected]" | ||
value={emails} | ||
></Textarea> | ||
|
||
<Spacer /> | ||
|
||
<Button | ||
disabled={loading} | ||
loading={loading} | ||
onClick={handleVerify} | ||
type="success" | ||
> | ||
Bulk Verify | ||
</Button> | ||
</div> | ||
|
||
<Spacer /> | ||
|
||
<Button | ||
disabled={loading} | ||
loading={loading} | ||
onClick={handleVerify} | ||
type="success" | ||
> | ||
Bulk Verify | ||
</Button> | ||
</div> | ||
|
||
<Spacer /> | ||
|
||
<Table data={bulkJobs}> | ||
<Table.Column prop="id" label="ID" /> | ||
</Table> | ||
|
||
<div> | ||
ALLJOBS: | ||
{bulkJobs.map((job) => ( | ||
<div key={job.id}> | ||
{job.id} -{" "} | ||
{ | ||
job.bulk_emails.filter(({ call_id }) => !!call_id) | ||
.length | ||
} | ||
/{job.bulk_emails.length} | ||
</div> | ||
))} | ||
</div> | ||
<Table data={bulkJobs}> | ||
<Table.Column prop="id" label="ID" /> | ||
</Table> | ||
|
||
<div> | ||
ALLJOBS: | ||
{bulkJobs.map((job) => ( | ||
<div key={job.id}> | ||
{job.id} -{" "} | ||
{ | ||
job.bulk_emails.filter( | ||
({ call_id }) => !!call_id | ||
).length | ||
} | ||
/{job.bulk_emails.length} | ||
</div> | ||
))} | ||
</div> | ||
</Page> | ||
</> | ||
); | ||
} |