Skip to content

Commit

Permalink
chore(deps): update dependency @biomejs/biome to v1.9.3 (#987)
Browse files Browse the repository at this point in the history
Signed-off-by: Giovanni Ravalico <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Giovanni Ravalico <[email protected]>
  • Loading branch information
renovate[bot] and suddenlyGiovanni authored Oct 8, 2024
1 parent c0017e6 commit acc2bc6
Show file tree
Hide file tree
Showing 50 changed files with 1,238 additions and 351 deletions.
3 changes: 2 additions & 1 deletion .idea/biome.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/tailwindcss.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
40 changes: 29 additions & 11 deletions apps/web/app/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { clsx } from '@suddenlygiovanni/ui/lib/utils.ts'
import { Button } from '@suddenlygiovanni/ui/ui/button.js'

import type { action } from '~/root.tsx'
import { useOptimisticThemeMode } from '~/utils/theme.tsx'
import { type Theme, useOptimisticThemeMode } from '~/utils/theme.tsx'
import avatarAssetUrl from './assets/giovanni_ravalico-profile_bw.webp'

import { routesRecord } from './routes-record.ts'
Expand Down Expand Up @@ -90,6 +90,17 @@ const routes = (

const PRIMARY_NAVIGATION = 'primary-navigation'

function computeNextThemeMode(mode: Theme): Theme {
const nextMode =
mode === 'system' //
? 'light'
: // biome-ignore lint/nursery/noNestedTernary: FIXME: convert it to a State Machine obj
mode === 'light'
? 'dark'
: 'system'
return nextMode
}

function ThemeSwitch({
userPreference,
className,
Expand All @@ -101,12 +112,6 @@ function ThemeSwitch({

const optimisticMode = useOptimisticThemeMode()
const mode = optimisticMode ?? userPreference ?? 'system'
const nextMode =
mode === 'system' //
? 'light'
: mode === 'light'
? 'dark'
: 'system'
const modeLabel = {
light: (
<Icons.sun className={clsx('h-[1.2rem]', 'w-[1.2rem]')}>
Expand All @@ -119,15 +124,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={computeNextThemeMode(mode)}
/>
<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 +291,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
25 changes: 19 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 Down Expand Up @@ -105,13 +105,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 +152,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
19 changes: 15 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 Down Expand Up @@ -169,15 +168,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
59 changes: 45 additions & 14 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 @@ -117,12 +128,17 @@ interface ContactsProps {
readonly url: Model.Basics['url']
}

const httpsUrlPattern: RegExp = /(?:https:\/\/www\.)|(?:https:\/\/)/i

function Contacts({ email, location, phone, profiles, url }: ContactsProps): ReactElement {
return (
<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,38 +148,53 @@ 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}>
{profile.url.replace(
/* biome-ignore lint/nursery/useTopLevelRegex: <explanation> */
/(?:https:\/\/www\.)|(?:https:\/\/)/i,
'',
)}
<T.a
aria-label={`link to ${profile.network}`}
href={profile.url}
>
{profile.url.replace(httpsUrlPattern, '')}
</T.a>
</li>
))}
Expand Down
Loading

0 comments on commit acc2bc6

Please sign in to comment.