diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index c04615a0..cbf7281b 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -29,6 +29,7 @@ import { VideoPlayer } from '../_shared/VideoPlayer' import { AuthorBadge } from '../Author/AuthorBadge' import { CardTopic } from '../Feed/CardTopic' import { FeedArticlePopup } from '../Feed/FeedArticlePopup' +import { Modal } from '../Nav/Modal' import { TableOfContents } from '../TableOfContents' import { AudioHeader } from './AudioHeader' @@ -79,7 +80,7 @@ export const FullArticle = (props: Props) => { actions: { requireAuthentication }, } = useSession() - const formattedDate = createMemo(() => formatDate(new Date(props.article.created_at * 1000))) + const formattedDate = createMemo(() => formatDate(new Date(props.article.published_at * 1000))) const mainTopic = createMemo(() => { const main_topic_slug = props.article.topics.length > 0 ? props.article.main_topic : null @@ -308,6 +309,8 @@ export const FullArticle = (props: Props) => { const aspectRatio = width / height iframe.style.width = `${containerWidth}px` iframe.style.height = `${Math.round(containerWidth / aspectRatio) + 40}px` + } else { + iframe.style.height = `${containerWidth}px` } }) } @@ -618,7 +621,9 @@ export const FullArticle = (props: Props) => { - + + + { const mainTopicTitle = mainTopicSlug && lang() === 'en' ? mainTopicSlug.replace(/-/, ' ') : mainTopic?.title || '' - const formattedDate = createMemo(() => { - let r = '' - if (props.article.created_at) r = formatDate(new Date(props.article.created_at * 1000)) - return r - }) + const formattedDate = createMemo(() => + props.article.published_at ? formatDate(new Date(props.article.published_at * 1000)) : '', + ) const { title, subtitle } = getTitleAndSubtitle(props.article) diff --git a/src/components/Nav/AuthModal/AuthModal.module.scss b/src/components/Nav/AuthModal/AuthModal.module.scss index d9b7daaa..f589c677 100644 --- a/src/components/Nav/AuthModal/AuthModal.module.scss +++ b/src/components/Nav/AuthModal/AuthModal.module.scss @@ -188,11 +188,10 @@ line-height: 16px; margin-top: 0.3em; - /* Red/500 */ - color: #d00820; + color: var(--danger-color); a { - color: #d00820; + color: var(--danger-color); border-color: #d00820; &:hover { diff --git a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx index 4e147d92..493bd64a 100644 --- a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx +++ b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx @@ -1,11 +1,11 @@ import type { AuthModalSearchParams } from './types' +import { ApiResponse, ForgotPasswordResponse } from '@authorizerdev/authorizer-js' import { clsx } from 'clsx' import { createSignal, JSX, Show } from 'solid-js' import { useLocalize } from '../../../context/localize' import { useSession } from '../../../context/session' -// import { ApiError } from '../../../graphql/error' import { useRouter } from '../../../stores/router' import { validateEmail } from '../../../utils/validateEmail' @@ -29,16 +29,14 @@ export const ForgotPasswordForm = () => { const { actions: { forgotPassword }, } = useSession() - const [submitError, setSubmitError] = createSignal('') const [isSubmitting, setIsSubmitting] = createSignal(false) const [validationErrors, setValidationErrors] = createSignal({}) - const [isUserNotFount, setIsUserNotFound] = createSignal(false) + const [isUserNotFound, setIsUserNotFound] = createSignal(false) const authFormRef: { current: HTMLFormElement } = { current: null } const [message, setMessage] = createSignal('') const handleSubmit = async (event: Event) => { event.preventDefault() - setSubmitError('') setIsUserNotFound(false) const newValidationErrors: ValidationErrors = {} @@ -66,15 +64,8 @@ export const ForgotPasswordForm = () => { redirect_uri: window.location.origin, }) console.debug('[ForgotPasswordForm] authorizer response:', data) - setMessage(data.message) - - console.warn(errors) - if (errors.some((e) => e.cause === 'user_not_found')) { + if (errors && errors.some((error) => error.message.includes('bad user credentials'))) { setIsUserNotFound(true) - return - } else { - const errorText = errors.map((e) => e.message).join(' ') // FIXME - setSubmitError(errorText) } } catch (error) { console.error(error) @@ -111,37 +102,27 @@ export const ForgotPasswordForm = () => { /> + +
+ {t("We can't find you, check email or")}{' '} + + changeSearchParams({ + mode: 'login', + }) + } + > + {t('register')} + +
+
+ +
{validationErrors().email}
+
- -
-
    -
  • {submitError()}
  • -
-
-
- - -
- {t("We can't find you, check email or")}{' '} - { - event.preventDefault() - changeSearchParams({ - mode: 'register', - }) - }} - > - {t('register')} - - -
{validationErrors().email}
-
-
-
- -
+
handlePasswordInput(value)} /> + +
+ {validationErrors().password} +
+