diff --git a/app/(main)/blog/[slug]/page.tsx b/app/(main)/blog/[slug]/page.tsx
index 3c34f9e1..9674e2f4 100644
--- a/app/(main)/blog/[slug]/page.tsx
+++ b/app/(main)/blog/[slug]/page.tsx
@@ -35,9 +35,9 @@ export default async function Page({ params }: { params: { slug: string } }) {
backHref="/blog"
backText="Go back to posts"
featuredImage={
- image ?
+ image ? (
- : undefined
+ ) : undefined
}
meta={meta}
>
diff --git a/app/(main)/blog/posts/building-figma-multiplayer-cursors/content.mdx b/app/(main)/blog/posts/building-figma-multiplayer-cursors/content.mdx
index 853f74d2..81edaac9 100644
--- a/app/(main)/blog/posts/building-figma-multiplayer-cursors/content.mdx
+++ b/app/(main)/blog/posts/building-figma-multiplayer-cursors/content.mdx
@@ -333,9 +333,9 @@ const server = Bun.serve<{ connectionId: string }>({
const connectionId = Math.random().toString(36).slice(2)
const success = server.upgrade(req, { data: { connectionId } })
- return success ? undefined : (
- new Response("WebSocket upgrade error", { status: 400 })
- )
+ return success
+ ? undefined
+ : new Response("WebSocket upgrade error", { status: 400 })
}
return new Response("Hello world")
diff --git a/app/(main)/blog/posts/efficient-prisma-pagination/content.mdx b/app/(main)/blog/posts/efficient-prisma-pagination/content.mdx
index 3c17ebd3..9f46c84e 100644
--- a/app/(main)/blog/posts/efficient-prisma-pagination/content.mdx
+++ b/app/(main)/blog/posts/efficient-prisma-pagination/content.mdx
@@ -57,10 +57,11 @@ type SearchBytesProps = {
function searchBytes({ before, after }: SearchBytesProps) {
const cursor = after ?? before
- const direction: Direction =
- after ? "forward"
- : before ? "backward"
- : "none"
+ const direction: Direction = after
+ ? "forward"
+ : before
+ ? "backward"
+ : "none"
const res = await prisma.byte.findMany({
cursor: cursor ? { id: cursor } : undefined,
@@ -137,9 +138,9 @@ array.
```typescript
const bytes =
- direction === "backward" ?
- res.slice(0, PAGE_SIZE)
- : res.slice(-PAGE_SIZE)
+ direction === "backward"
+ ? res.slice(0, PAGE_SIZE)
+ : res.slice(-PAGE_SIZE)
```
Okay, it's finally time to use that extra result that we've been talking
@@ -166,14 +167,14 @@ page links becomes fairly simple.
```typescript showLineNumbers {2,7}
const nextHref =
- direction === "backward" || hasMore ?
- `/bytes?after=${bytes.at(-1)?.id}`
- : undefined
+ direction === "backward" || hasMore
+ ? `/bytes?after=${bytes.at(-1)?.id}`
+ : undefined
const prevHref =
- direction === "forward" || (direction === "backward" && hasMore) ?
- `/bytes?before=${bytes.at(0)?.id}`
- : undefined
+ direction === "forward" || (direction === "backward" && hasMore)
+ ? `/bytes?before=${bytes.at(0)?.id}`
+ : undefined
```
## Conclusion
diff --git a/app/(main)/bytes/api.ts b/app/(main)/bytes/api.ts
index f6462491..f1c184ea 100644
--- a/app/(main)/bytes/api.ts
+++ b/app/(main)/bytes/api.ts
@@ -153,9 +153,8 @@ export const searchBytes = cache(
take: (direction === "left" ? -1 : 1) * (PAGE_SIZE + 1),
// Search by tag, or by title/description
where: {
- OR:
- query ?
- [
+ OR: query
+ ? [
{ title: { contains: query } },
{ description: { contains: query } },
]
@@ -178,15 +177,15 @@ export const searchBytes = cache(
nextHref:
// The next button is enabled when we are moving left, or there are more
// pages to the right.
- direction === "left" || hasMore ?
- `${prefix}after=${bytes.at(-1)?.id}`
- : undefined,
+ direction === "left" || hasMore
+ ? `${prefix}after=${bytes.at(-1)?.id}`
+ : undefined,
prevHref:
// The previous button is enabled when we are moving right, or there
// are more pages to the left.
- direction === "right" || (direction === "left" && hasMore) ?
- `${prefix}before=${bytes.at(0)?.id}`
- : undefined,
+ direction === "right" || (direction === "left" && hasMore)
+ ? `${prefix}before=${bytes.at(0)?.id}`
+ : undefined,
}
},
)
diff --git a/app/(main)/bytes/page.tsx b/app/(main)/bytes/page.tsx
index f480689f..4c47d954 100644
--- a/app/(main)/bytes/page.tsx
+++ b/app/(main)/bytes/page.tsx
@@ -30,10 +30,7 @@ export default async function Blog({
}
}) {
const { after, before, q: query, tag } = searchParams
- const direction: Direction =
- after ? "right"
- : before ? "left"
- : "none"
+ const direction: Direction = after ? "right" : before ? "left" : "none"
const { bytes, nextHref, prevHref } = await searchBytes({
cursor: after ?? before,
direction,
@@ -58,7 +55,7 @@ export default async function Blog({
/>
- {query || tag ?
+ {query || tag ? (
- : null}
+ ) : null}
- {bytes.length ?
+ {bytes.length ? (
{bytes.map((byte) => {
const date = toDateString(byte.createdAt)
@@ -118,7 +115,7 @@ export default async function Blog({
)
})}
- {prevHref || nextHref ?
+ {prevHref || nextHref ? (
@@ -130,9 +127,10 @@ export default async function Blog({
- : null}
+ ) : null}
- :
+ ) : (
+
We couldn’t find any bytes matching{" "}
@@ -140,7 +138,7 @@ export default async function Blog({
Try another query or reset your search to view all bytes.
- }
+ )}
)
}
diff --git a/app/(main)/uses/page.tsx b/app/(main)/uses/page.tsx
index fe4c7fc4..ff4ec871 100644
--- a/app/(main)/uses/page.tsx
+++ b/app/(main)/uses/page.tsx
@@ -35,9 +35,7 @@ function Tool({ children, href, title }: ToolProps) {
{children}
- {href ?
-
- : null}
+ {href ? : null}
)
}
diff --git a/app/components/Card.tsx b/app/components/Card.tsx
index 4dc09b74..7c3611a2 100644
--- a/app/components/Card.tsx
+++ b/app/components/Card.tsx
@@ -67,11 +67,13 @@ Card.Title = function CardTitle({
return (
- {href ?
+ {href ? (
{children}
- : {children} }
+ ) : (
+ {children}
+ )}
)
}
diff --git a/app/components/NavMenu.tsx b/app/components/NavMenu.tsx
index 2bacbe85..b872a233 100644
--- a/app/components/NavMenu.tsx
+++ b/app/components/NavMenu.tsx
@@ -21,9 +21,9 @@ export function NavMenuItem(props: NavMenuItemProps) {
className={({ isFocused, isSelected }) =>
twMerge(
"group flex w-full cursor-default items-center rounded-lg px-4 py-2 text-xs font-medium outline-none",
- isFocused ?
- "bg-zinc-100 text-zinc-900 dark:bg-zinc-900 dark:text-zinc-100"
- : "text-zinc-700 dark:text-zinc-300",
+ isFocused
+ ? "bg-zinc-100 text-zinc-900 dark:bg-zinc-900 dark:text-zinc-100"
+ : "text-zinc-700 dark:text-zinc-300",
isSelected && "text-indigo-700 dark:text-indigo-300",
)
}
diff --git a/app/components/layouts/PostLayout.tsx b/app/components/layouts/PostLayout.tsx
index 791c17ab..9ba6ba0e 100644
--- a/app/components/layouts/PostLayout.tsx
+++ b/app/components/layouts/PostLayout.tsx
@@ -42,28 +42,32 @@ export function PostLayout({
{children}
diff --git a/app/components/root/Footer.tsx b/app/components/root/Footer.tsx
index 1d437706..3fae176e 100644
--- a/app/components/root/Footer.tsx
+++ b/app/components/root/Footer.tsx
@@ -40,9 +40,9 @@ export function Footer({ variant }: FooterProps) {
return (
diff --git a/app/components/root/Header.tsx b/app/components/root/Header.tsx
index 0a2eeb7b..10fd3013 100644
--- a/app/components/root/Header.tsx
+++ b/app/components/root/Header.tsx
@@ -17,9 +17,9 @@ export function Header({ variant }: HeaderProps) {
diff --git a/app/layout.tsx b/app/layout.tsx
index 8d19b0ba..c22d5763 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -50,9 +50,9 @@ export default function RootLayout({ children }: RootLayoutProps) {
{children}