Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(404): fix empty email when the field is empty #6095

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 18 additions & 23 deletions utopia-remix/app/components/projectNotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import cx from 'classnames'
import type { UserDetails } from 'prisma-client'
import React, { useMemo } from 'react'
import { colors } from '../styles/sprinkles.css'
import { when } from '../util/react-conditionals'
import { Status } from '../util/statusCodes'
import * as styles from './projectNotFound.css'
import { useCDNLink } from '../util/cdnLink'
Expand Down Expand Up @@ -82,15 +81,7 @@ function UnauthorizedPage({ projectId, user }: { projectId: string; user: UserDe
<div style={{ fontSize: '100px', fontWeight: 600, fontStyle: 'italic' }}>Hmmm…</div>
<div className={styles.runningText}>
<span>Looks like you need permission to access this project. </span>
<span>You're signed in as </span>
<a
href='/projects'
rel='noopener noreferrer'
style={{ textDecoration: 'none', color: isDarkMode ? '#80CAFF' : '#0075F9' }}
>
{user?.email}
</a>
<span>.</span>
<SignedInAs user={user} isDarkMode={isDarkMode} />
</div>
<div style={{ display: 'flex', gap: '20px' }}>
{accessRequested ? (
Expand Down Expand Up @@ -146,19 +137,7 @@ function NotFoundPage({ user, projectId }: { user: UserDetails | null; projectId
<div style={{ fontSize: '42px' }}>Project not found.</div>
<div className={styles.runningText}>
<span>Either this project does not exist, or you need to be granted access to it. </span>
{when(user?.user_id != null, () => (
<>
<span>You're signed in as </span>{' '}
<a
href='/projects'
rel='noopener noreferrer'
style={{ textDecoration: 'none', color: isDarkMode ? '#80CAFF' : '#0075F9' }}
>
{user?.email}
</a>
<span>.</span>
</>
))}
<SignedInAs user={user} isDarkMode={isDarkMode} />
</div>
<div style={{ display: 'flex', gap: '20px' }}>
{user?.user_id != null ? (
Expand Down Expand Up @@ -246,3 +225,19 @@ function ActionButton({
</Button>
)
}

function SignedInAs({ user, isDarkMode }: { user: UserDetails | null; isDarkMode: boolean }) {
return user?.user_id != null && user?.email != null ? (
<>
<span>You're signed in as </span>
<a
href='/projects'
rel='noopener noreferrer'
style={{ textDecoration: 'none', color: isDarkMode ? '#80CAFF' : '#0075F9' }}
>
{user?.email}
</a>
<span>.</span>
</>
) : null
}
Loading