diff --git a/packages/web/pages/settings/emails.tsx b/packages/web/pages/settings/emails.tsx
deleted file mode 100644
index ab432fdb4..000000000
--- a/packages/web/pages/settings/emails.tsx
+++ /dev/null
@@ -1,233 +0,0 @@
-import { Button } from '../../components/elements/Button'
-import { useGetNewsletterEmailsQuery } from '../../lib/networking/queries/useGetNewsletterEmailsQuery'
-import { createNewsletterEmailMutation } from '../../lib/networking/mutations/createNewsletterEmailMutation'
-import { deleteNewsletterEmailMutation } from '../../lib/networking/mutations/deleteNewsletterEmailMutation'
-import { MoreOptionsIcon } from '../../components/elements/images/MoreOptionsIcon'
-import { Trash, Copy } from 'phosphor-react'
-import {
- Dropdown,
- DropdownOption,
-} from '../../components/elements/DropdownElements'
-import { theme, styled } from '../../components/tokens/stitches.config'
-import { Box, HStack } from '../../components/elements/LayoutPrimitives'
-import { useCopyLink } from '../../lib/hooks/useCopyLink'
-import { useCallback, useMemo, useState } from 'react'
-import { StyledText } from '../../components/elements/StyledText'
-import { applyStoredTheme } from '../../lib/themeUpdater'
-import { showErrorToast, showSuccessToast } from '../../lib/toastHelpers'
-import { formattedShortDate } from '../../lib/dateFormatting'
-import Link from 'next/link'
-import {
- EmptySettingsRow,
- SettingsTable,
- SettingsTableRow,
-} from '../../components/templates/settings/SettingsTable'
-import { ConfirmationModal } from '../../components/patterns/ConfirmationModal'
-
-enum TextType {
- EmailAddress,
- ConfirmationCode,
-}
-
-type CopyTextButtonProps = {
- text: string
- type: TextType
-}
-
-const CopyTextBtnWrapper = styled(Box, {
- background: '$grayBgActive',
- borderRadius: '6px',
- border: '1px solid rgba(0, 0, 0, 0.06)',
- width: '32px',
- height: '32px',
-
- display: 'flex',
-
- color: '#3D3D3D',
-
- alignItems: 'center',
- justifyContent: 'center',
-})
-
-function CopyTextButton(props: CopyTextButtonProps): JSX.Element {
- const { copyLink, isLinkCopied } = useCopyLink(
- props.text,
- 'newsletter_' +
- (props.type == TextType.EmailAddress
- ? 'email_address'
- : 'confirmation_code')
- )
-
- const copy = useCallback(() => {
- copyLink()
- showSuccessToast(
- props.type == TextType.EmailAddress
- ? 'Email Address Copied'
- : 'Confirmation Code Copied'
- )
- }, [])
-
- return (
-
- )
-}
-
-export default function EmailsPage(): JSX.Element {
- const { emailAddresses, revalidate, isValidating } =
- useGetNewsletterEmailsQuery()
- const [confirmDeleteEmailId, setConfirmDeleteEmailId] =
- useState(undefined)
-
- applyStoredTheme(false)
-
- async function createEmail(): Promise {
- const email = await createNewsletterEmailMutation()
- if (!email) {
- showErrorToast('Error Creating Email')
- return
- }
- showSuccessToast('Email Created')
- revalidate()
- }
-
- async function deleteEmail(id: string): Promise {
- const result = await deleteNewsletterEmailMutation(id)
- if (!result) {
- showErrorToast('Error Deleting Email')
- return
- }
- revalidate()
- showSuccessToast('Email Deleted')
- }
-
- const sortedEmailAddresses = useMemo(() => {
- if (!emailAddresses) {
- return []
- }
- return emailAddresses.sort((a, b) => a.createdAt.localeCompare(b.createdAt))
- }, [emailAddresses])
-
- return (
- <>
-
- {sortedEmailAddresses.length > 0 ? (
- sortedEmailAddresses.map((email, i) => {
- return (
- setConfirmDeleteEmailId(email.id)}
- deleteTitle="Delete"
- sublineElement={
-
- {`created ${formattedShortDate(email.createdAt)}, `}
- {`${email.subscriptionCount} subscriptions`}
-
- }
- titleElement={
-
-
-
- }
- extraElement={
- email.confirmationCode ? (
-
- <>
-
- {`Gmail: ${email.confirmationCode}`}
-
-
-
-
-
-
- >
-
- ) : (
- <>>
- )
- }
- />
- )
- })
- ) : (
-
- )}
-
-
- {confirmDeleteEmailId ? (
- {
- await deleteEmail(confirmDeleteEmailId)
- setConfirmDeleteEmailId(undefined)
- }}
- onOpenChange={() => setConfirmDeleteEmailId(undefined)}
- />
- ) : null}
- >
- )
-}
diff --git a/packages/web/pages/settings/emails/recent.tsx b/packages/web/pages/settings/emails/recent.tsx
index d5eec181c..eb7641077 100644
--- a/packages/web/pages/settings/emails/recent.tsx
+++ b/packages/web/pages/settings/emails/recent.tsx
@@ -120,10 +120,11 @@ export default function RecentEmails(): JSX.Element {
>
{sortedRecentEmails.length > 0 ? (
sortedRecentEmails.map((recentEmail: RecentEmail, i) => {
+ console.log('recent email: ', recentEmail)
return (
{
console.log('onDelete triggered: ', recentEmail.id)
@@ -140,8 +141,10 @@ export default function RecentEmails(): JSX.Element {
},
}}
>
- {`From ${formattedShortDate(recentEmail.from)},`}
- {`Received ${formattedShortDate(recentEmail.createdAt)} at `}
+ {recentEmail.subject}
+ {`, Received ${formattedShortDate(
+ recentEmail.createdAt
+ )} at `}
{recentEmail.to}