Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Giovanni Ravalico <[email protected]>
  • Loading branch information
suddenlyGiovanni committed Oct 8, 2024
1 parent d6b39c4 commit 1aed1ec
Show file tree
Hide file tree
Showing 39 changed files with 1,098 additions and 228 deletions.
32 changes: 22 additions & 10 deletions apps/web/app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ function handleBotRequest(
return new Promise((resolve, reject) => {
let shellRendered = false
const { pipe, abort } = renderToPipeableStream(
<RemixServer context={remixContext} url={request.url} abortDelay={ABORT_DELAY} />,
<RemixServer
context={remixContext}
url={request.url}
abortDelay={ABORT_DELAY}
/>,
{
onAllReady() {
shellRendered = true
Expand All @@ -58,11 +62,13 @@ function handleBotRequest(
onError(error: unknown) {
// biome-ignore lint/style/noParameterAssign: this is how Remix defined the default entry.server
responseStatusCode = 500
// Log streaming rendering errors from inside the shell. Don't log
// errors encountered during initial shell rendering since they'll
// reject and get logged in handleDocumentRequest.
/*
Log streaming rendering errors from inside the shell. Don't log
errors encountered during initial shell rendering since they'll
reject and get logged in handleDocumentRequest.
*/
if (shellRendered) {
// biome-ignore lint/nursery/noConsole: <explanation>
// biome-ignore lint/suspicious/noConsole: legit console error statement.
console.error(error)
}
},
Expand All @@ -82,7 +88,11 @@ function handleBrowserRequest(
return new Promise((resolve, reject) => {
let shellRendered = false
const { pipe, abort } = renderToPipeableStream(
<RemixServer context={remixContext} url={request.url} abortDelay={ABORT_DELAY} />,
<RemixServer
context={remixContext}
url={request.url}
abortDelay={ABORT_DELAY}
/>,
{
onShellReady() {
shellRendered = true
Expand All @@ -106,11 +116,13 @@ function handleBrowserRequest(
onError(error: unknown) {
// biome-ignore lint/style/noParameterAssign: this is how Remix defined the default entry.server
responseStatusCode = 500
// Log streaming rendering errors from inside the shell. Don't log
// errors encountered during initial shell rendering since they'll
// reject and get logged in handleDocumentRequest.
/*
Log streaming rendering errors from inside the shell. Don't log
errors encountered during initial shell rendering since they'll
reject and get logged in handleDocumentRequest.
*/
if (shellRendered) {
// biome-ignore lint/nursery/noConsole: <explanation>
// biome-ignore lint/suspicious/noConsole: legit console error statement.
console.error(error)
}
},
Expand Down
21 changes: 17 additions & 4 deletions apps/web/app/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,25 @@ function ThemeSwitch({
</Icons.moon>
),
system: (
<Icons.laptop name="laptop" className={clsx('h-[1.2rem]', 'w-[1.2rem]')}>
<Icons.laptop
name="laptop"
className={clsx('h-[1.2rem]', 'w-[1.2rem]')}
>
<span className="sr-only">System</span>
</Icons.laptop>
),
}

return (
<fetcher.Form method="POST" className={className}>
<input type="hidden" name="theme" value={nextMode} />
<fetcher.Form
method="POST"
className={className}
>
<input
type="hidden"
name="theme"
value={nextMode}
/>
<div className="flex gap-2">
<Button
className={clsx('flex h-8 w-8 cursor-pointer items-center justify-center')}
Expand Down Expand Up @@ -276,7 +286,10 @@ export const Header = memo(function Header({
role="menu"
>
{renderLi}
<ThemeSwitch userPreference={theme} className="ml-16 aspect-square" />
<ThemeSwitch
userPreference={theme}
className="ml-16 aspect-square"
/>
</menu>
</nav>
</div>
Expand Down
29 changes: 23 additions & 6 deletions apps/web/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
import { Links, Meta, Scripts, ScrollRestoration, json, useLoaderData } from '@remix-run/react'
import { Types, makeOpenGraphWebsite } from '@suddenlygiovanni/open-graph-protocol'
import * as Either from 'effect/Either'
import type { ReactElement, ReactNode } from 'react'
import type { JSX, ReactElement, ReactNode } from 'react'

import { Layout } from '@suddenlygiovanni/ui/components/layout/layout.tsx'
import { clsx } from '@suddenlygiovanni/ui/lib/utils.ts'
Expand All @@ -29,6 +29,7 @@ import { Main } from './main.tsx'
import fontsStyleSheetUrl from './styles/fonts.css?url'
import tailwindStyleSheetUrl from './styles/tailwind.css?url'

// biome-ignore lint/nursery/useComponentExportOnlyModules: Remix convention
export const links: LinksFunction = () => {
return [
{
Expand All @@ -41,6 +42,7 @@ export const links: LinksFunction = () => {
]
}

// biome-ignore lint/nursery/useComponentExportOnlyModules: Remix convention
export function meta({ location }: Parameters<MetaFunction>[number]) {
const description = "@suddenlyGiovanni's personal website"
const title = config.siteName
Expand All @@ -62,6 +64,7 @@ export function meta({ location }: Parameters<MetaFunction>[number]) {
]
}

// biome-ignore lint/nursery/useComponentExportOnlyModules: Remix convention
export function loader({ request }: LoaderFunctionArgs) {
return {
requestInfo: {
Expand All @@ -75,6 +78,7 @@ export function loader({ request }: LoaderFunctionArgs) {
}
}

// biome-ignore lint/nursery/useComponentExportOnlyModules: Remix convention
export async function action({ request }: ActionFunctionArgs) {
const formData = await request.formData()
const payload = Object.fromEntries(formData)
Expand Down Expand Up @@ -105,13 +109,23 @@ function Document({
theme?: 'light' | 'dark' | null // TODO: address this prop
// biome-ignore lint/correctness/noUndeclaredVariables: <explanation>
env?: typeof ENV
}): ReactElement {
}): JSX.Element {
return (
<html className={clsx(theme, 'min-h-screen')} data-theme={clsx(theme)} lang="en">
<html
className={clsx(theme, 'min-h-screen')}
data-theme={clsx(theme)}
lang="en"
>
<head>
<meta charSet="utf-8" />
<meta httpEquiv="Content-Type" content="text/html;charset=utf-8" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta
httpEquiv="Content-Type"
content="text/html;charset=utf-8"
/>
<meta
content="width=device-width, initial-scale=1"
name="viewport"
/>
<Meta />
<Links />
</head>
Expand Down Expand Up @@ -142,7 +156,10 @@ export default function App(): ReactElement {
const data = useLoaderData<typeof loader>()
const theme = useTheme()
return (
<Document env={data.ENV} theme={theme}>
<Document
env={data.ENV}
theme={theme}
>
<Header theme={data.requestInfo.userPrefs.theme} />
<Main />
<Footer />
Expand Down
20 changes: 16 additions & 4 deletions apps/web/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/no-unescaped-entities -- TODO: need to validate the rule */
import type { MetaFunction } from '@remix-run/node'
import { Link as RemixLink } from '@remix-run/react'
import { Types, makeOpenGraphWebsite } from '@suddenlygiovanni/open-graph-protocol'
Expand All @@ -21,6 +20,7 @@ import hero2800wAssetUrl from '~/assets/hero/giovanni_ravalico-profile_color_e4c
import { config } from '~/config.ts'
import { routesRecord } from '~/routes-record.ts'

// biome-ignore lint/nursery/useComponentExportOnlyModules: Remix convention
export function meta({ location }: Parameters<MetaFunction>[number]) {
const description = 'All about Giovanni Ravalico'
const title = `${config.siteName} | About me`
Expand Down Expand Up @@ -169,15 +169,27 @@ export default function Index(): JSX.Element {

<T.p>
You can <strong>find me on</strong>{' '}
<T.a href={config.socials.Twitter.url} target="_blank" rel="noreferrer">
<T.a
href={config.socials.Twitter.url}
target="_blank"
rel="noreferrer"
>
🐦 Twitter
</T.a>
,{' '}
<T.a href={config.socials.GitHub.url} target="_blank" rel="noreferrer">
<T.a
href={config.socials.GitHub.url}
target="_blank"
rel="noreferrer"
>
🐙 GitHub
</T.a>
, and{' '}
<T.a href={config.socials.LinkedIn.url} target="_blank" rel="noreferrer">
<T.a
href={config.socials.LinkedIn.url}
target="_blank"
rel="noreferrer"
>
🦵 LinkedIn
</T.a>
.
Expand Down
1 change: 1 addition & 0 deletions apps/web/app/routes/brain-dump/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { clsx } from '@suddenlygiovanni/ui/lib/utils.ts'
import type { JSX } from 'react'
import { routesRecord } from '~/routes-record.ts'

// biome-ignore lint/nursery/useComponentExportOnlyModules: Remix convention
export const meta: MetaFunction = () => {
return [
{ title: routesRecord['brain-dump'].title },
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/routes/reading-journal/route.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MetaFunction } from '@remix-run/node'
import { T } from '@suddenlygiovanni/ui/components/typography/typography.tsx'
import type { JSX } from 'react'

// biome-ignore lint/nursery/useComponentExportOnlyModules: Remix convention
export const meta: MetaFunction = () => {
return [
{ title: 'Reading Journal' },
Expand Down
51 changes: 42 additions & 9 deletions apps/web/app/routes/resume/basics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import resumePdfAssetUrl from '/giovanni-ravalico-resume-2021.pdf?url'

export function Basics({ basics }: { basics: Model.Basics }): ReactElement {
return (
<Header label={basics.label} name={basics.name} summary={basics.summary}>
<Header
label={basics.label}
name={basics.name}
summary={basics.summary}
>
<Contacts
email={basics.email}
location={basics.location}
Expand Down Expand Up @@ -63,10 +67,17 @@ function Header({
{children}
<T.muted>
click on this link to download the pdf version of my resume{' '}
<span aria-label="pdf" role="img">
<span
aria-label="pdf"
role="img"
>
📜
</span>{' '}
<T.a download={true} href={resumePdfAssetUrl} rel="noopener">
<T.a
download={true}
href={resumePdfAssetUrl}
rel="noopener"
>
giovanni-ravalico-resume.pdf
</T.a>
</T.muted>
Expand Down Expand Up @@ -122,7 +133,10 @@ function Contacts({ email, location, phone, profiles, url }: ContactsProps): Rea
<address className={addressClasses.address}>
<T.ul className={addressClasses.ul}>
<li className={addressClasses.li}>
<Icons.globe aria-label="location icon" className="size-4" />
<Icons.globe
aria-label="location icon"
className="size-4"
/>
<T.a
href="https://www.openstreetmap.org/search?query=berlin#map=11/52.5072/13.4249"
target="_blank"
Expand All @@ -132,33 +146,52 @@ function Contacts({ email, location, phone, profiles, url }: ContactsProps): Rea

<li className={addressClasses.li}>
<Icons.envelope aria-label="mail icon" />
<T.a aria-label="email" href={`mailto:${email}`} rel="noreferrer" target="_blank">
<T.a
aria-label="email"
href={`mailto:${email}`}
rel="noreferrer"
target="_blank"
>
{email}
</T.a>
</li>

<li className={addressClasses.li}>
<Icons.desktop aria-label="mail icon" />
<T.a aria-label="link to my website" href={url} rel="noreferrer" target="_blank">
<T.a
aria-label="link to my website"
href={url}
rel="noreferrer"
target="_blank"
>
{url}
</T.a>
</li>

<li className={addressClasses.li}>
<Icons.mobile aria-label="phone icon" />
<T.a aria-label="phone number" href={`tel:${phone ?? ''}`}>
<T.a
aria-label="phone number"
href={`tel:${phone ?? ''}`}
>
{phone}
</T.a>
</li>
{profiles.map(profile => (
<li className={addressClasses.li} key={profile.network}>
<li
className={addressClasses.li}
key={profile.network}
>
<SocialIcon
className={clsx('size-5 fill-foreground')}
aria-label={`${profile.network} icon`}
network={profile.network.toLowerCase()}
/>

<T.a aria-label={`link to ${profile.network}`} href={profile.url}>
<T.a
aria-label={`link to ${profile.network}`}
href={profile.url}
>
{profile.url.replace(
/* biome-ignore lint/nursery/useTopLevelRegex: <explanation> */
/(?:https:\/\/www\.)|(?:https:\/\/)/i,
Expand Down
Loading

0 comments on commit 1aed1ec

Please sign in to comment.