From 6a43db7187b27d4363df177359d47777d8094e9e Mon Sep 17 00:00:00 2001 From: Daniel O'Connell Date: Sat, 23 Mar 2024 21:45:43 +0100 Subject: [PATCH] typos + title --- app/components/ContentBox/index.tsx | 2 +- app/components/Footer/index.tsx | 4 ++-- app/components/Grid/grid.css | 1 - app/root.tsx | 14 +++++++------- app/routes/_index.tsx | 24 ++---------------------- app/routes/questions.$questionId.$.tsx | 7 +++++++ app/routes/questions.toc.ts | 5 ++++- app/server-utils/stampy.ts | 1 + 8 files changed, 24 insertions(+), 34 deletions(-) diff --git a/app/components/ContentBox/index.tsx b/app/components/ContentBox/index.tsx index a83a2f6a..a6c317c8 100644 --- a/app/components/ContentBox/index.tsx +++ b/app/components/ContentBox/index.tsx @@ -51,7 +51,7 @@ export const ContentBoxMain = () => ( action={questionUrl({pageid: '9OGZ'})} actionTitle={ <> - Start reading + Start here } diff --git a/app/components/Footer/index.tsx b/app/components/Footer/index.tsx index e5cc4911..b33c1db9 100644 --- a/app/components/Footer/index.tsx +++ b/app/components/Footer/index.tsx @@ -21,8 +21,8 @@ export const FooterBar: FunctionComponent = () => { AISafety.info

- We’re a global team of specialists supported by volunteers from various backgrounds who - are concerned about the possibility of human extinction from future AI. + We’re a global team of specialists and volunteers from various backgrounds who want to + ensure that the effects of future AI are beneficial rather than catastrophic.
diff --git a/app/components/Grid/grid.css b/app/components/Grid/grid.css index 1e88050d..76343524 100644 --- a/app/components/Grid/grid.css +++ b/app/components/Grid/grid.css @@ -9,7 +9,6 @@ text-align: left; padding: var(--spacing-40); width: 21.46vw; - height: 21.46vw; min-width: var(--spacing-288); min-height: var(--spacing-288); text-decoration: none; diff --git a/app/root.tsx b/app/root.tsx index 36655a91..ab04df2f 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -16,7 +16,6 @@ import newStyles from '~/newRoot.css' import Error from '~/components/Error' import Page from '~/components/Page' import {CachedObjectsProvider} from '~/hooks/useCachedObjects' -import {questionsOnPage} from '~/hooks/stateModifiers' import {useTheme} from '~/hooks/theme' import {loadQuestionDetail} from '~/server-utils/stampy' @@ -47,15 +46,16 @@ const makeSocialPreviewText = ( */ const fetchQuestion = async (request: Request) => { const url = new URL(request.url) - const questions = questionsOnPage(url.searchParams.get('state') || '') - if (questions.length != 1) return null - - const {data} = await loadQuestionDetail(request, questions[0][0]) - return data + const [path, pageid] = url.pathname.slice(1).split('/') || [] + if (path === 'questions') { + const {data} = await loadQuestionDetail(request, pageid) + return data + } + return null } -const TITLE = 'Stampy' +const TITLE = 'AISafety.info' const DESCRIPTION = 'AI Safety FAQ' const twitterCreator = '@stampyai' export const meta: MetaFunction = ({data = {} as any}) => { diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index a43172df..817df3d0 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,28 +1,8 @@ -import type {LoaderFunction} from '@remix-run/cloudflare' -import {ShouldRevalidateFunction, redirect} from '@remix-run/react' -import {QuestionState} from '~/server-utils/stampy' +import {ShouldRevalidateFunction} from '@remix-run/react' import {ContentBoxMain, ContentBoxSecond, ContentBoxThird} from '~/components/ContentBox' import useToC from '~/hooks/useToC' import Grid from '~/components/Grid' import Page from '~/components/Page' -import {getStateEntries} from '~/hooks/stateModifiers' -import {questionUrl} from '~/routesMapper' - -export const loader = async ({request}: Parameters[0]) => { - const url = new URL(request.url) - const stateFromUrl = url.searchParams.get('state') - if (stateFromUrl) { - const firstOpenId = getStateEntries(stateFromUrl).filter( - ([_, state]) => state === QuestionState.OPEN - )[0]?.[0] - if (firstOpenId) { - url.searchParams.delete('state') - url.pathname = questionUrl({pageid: firstOpenId}) - throw redirect(url.toString()) - } - } - return null -} export const shouldRevalidate: ShouldRevalidateFunction = () => false @@ -31,7 +11,7 @@ export default function App() { return (
-

Answers on all things AI safety

+

Your guide to AI safety

diff --git a/app/routes/questions.$questionId.$.tsx b/app/routes/questions.$questionId.$.tsx index 6b8fe542..754657d8 100644 --- a/app/routes/questions.$questionId.$.tsx +++ b/app/routes/questions.$questionId.$.tsx @@ -96,6 +96,13 @@ export default function RenderArticle() { setShowNav(false) }, [location.key]) + useEffect(() => { + data.then((val) => { + const question = val as Question + if (question.title) document.title = question.title + }) + }, [data]) + return (
diff --git a/app/routes/questions.toc.ts b/app/routes/questions.toc.ts index bf10cbc7..79c79f56 100644 --- a/app/routes/questions.toc.ts +++ b/app/routes/questions.toc.ts @@ -60,7 +60,10 @@ export const loadToC = async (request: any): Promise => { [k: string]: Question } const canBeShown = ({status}: Question) => - status && [QuestionStatus.LIVE_ON_SITE, QuestionStatus.NOT_STARTED].includes(status) + status && + [QuestionStatus.LIVE_ON_SITE, QuestionStatus.NOT_STARTED, QuestionStatus.SUBSECTION].includes( + status + ) data .filter(canBeShown) diff --git a/app/server-utils/stampy.ts b/app/server-utils/stampy.ts index a3d8834e..437fa45b 100644 --- a/app/server-utils/stampy.ts +++ b/app/server-utils/stampy.ts @@ -36,6 +36,7 @@ export enum QuestionStatus { IN_PROGRESS = 'In progress', IN_REVIEW = 'In review', LIVE_ON_SITE = 'Live on site', + SUBSECTION = 'Subsection', UNKNOWN = 'Unknown', } export type Banner = {