Skip to content

Commit 007e3be

Browse files
feat: shortener domain env, react-compiler, biome ci (#5)
* feat: env for shortener domain * feat: enable react compiler * chore: biome * ci: better biome usage
1 parent 6c4ddbd commit 007e3be

File tree

12 files changed

+83
-34
lines changed

12 files changed

+83
-34
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
- name: Install dependencies
3838
run: pnpm install --frozen-lockfile
3939

40-
- name: Run linter
41-
run: pnpm run lint
40+
- name: Run Biome
41+
run: pnpm exec biome ci .
4242

4343
- name: Check TypeScript types
4444
run: pnpm run build

next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const withBundleAnalyzer = bundleAnalyzer({ enabled: ANALYZE_AND_PROFILE })
77
const nextConfig: NextConfig = {
88
output: "standalone",
99
transpilePackages: ["@t3-oss/env-nextjs", "@t3-oss/env-core"],
10-
experimental: { swcTraceProfiling: ANALYZE_AND_PROFILE },
10+
experimental: { reactCompiler: true, swcTraceProfiling: ANALYZE_AND_PROFILE },
1111
}
1212

1313
export default withBundleAnalyzer(nextConfig)

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"build": "next build --turbopack",
88
"build:analyze": "ANALYZE=true SKIP_ENV_VALIDATION=true next build",
99
"start": "next start",
10-
"lint": "biome check",
11-
"format": "biome format --write",
10+
"check": "biome check",
11+
"check:fix": "biome check --write",
1212
"docker:build": "docker build -t tmsu-cc .",
1313
"docker:run": "docker run -p 6111:6111 tmsu-cc",
1414
"docker:dev": "docker-compose up --build",
@@ -61,6 +61,7 @@
6161
"@types/node": "^24.3.1",
6262
"@types/react": "^19",
6363
"@types/react-dom": "^19",
64+
"babel-plugin-react-compiler": "^1.0.0",
6465
"tailwindcss": "^4",
6566
"tw-animate-css": "^1.3.8",
6667
"typescript": "^5"

pnpm-lock.yaml

Lines changed: 43 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/openapi.json/route.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// import convert from "@openapi-contrib/json-schema-to-openapi-schema"
22
import { generateOpenApi } from "@ts-rest/open-api"
3+
import { env } from "@/env"
34
// import z from "zod"
45
import { contract } from "@/lib/contract"
56

@@ -16,11 +17,11 @@ import { contract } from "@/lib/contract"
1617

1718
const openapiDocument = generateOpenApi(contract, {
1819
info: {
19-
title: "polinet.cc API",
20+
title: `${env.DOMAIN} API`,
2021
version: "1.0.0",
2122
description: "PoliNetwork's Short URLs - Service API",
2223
},
23-
servers: [{ url: "https://polinet.cc/api" }],
24+
servers: [{ url: `https://${env.DOMAIN}/api` }],
2425
components: {
2526
securitySchemes: {
2627
CloudflareID: {

src/components/create-url-dialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from "@/components/ui/dialog"
1717
import { Input } from "@/components/ui/input"
1818
import { Label } from "@/components/ui/label"
19+
import { env } from "@/env"
1920
import { createUrl } from "@/lib/actions"
2021
import { createUrlSchema } from "@/lib/validations"
2122
import { RandomText } from "./random-text"
@@ -111,7 +112,7 @@ export function CreateUrlDialog({
111112
<p className="text-xs">Preview: </p>
112113
<div className="text-sm p-4 border rounded-md border-border mb-4 mt-1 flex flex-col gap-1 bg-muted/50 text-muted-foreground">
113114
<p className="font-mono mx-auto">
114-
https://polinet.cc/
115+
https://${env.DOMAIN}/
115116
{isRandom ? (
116117
<RandomText generate={randomCode} />
117118
) : (

src/components/dashboard.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ import {
3131
TableHeader,
3232
TableRow,
3333
} from "@/components/ui/table"
34+
import { env } from "@/env"
3435
import { useUrls } from "@/hooks/urls"
3536
import type { UrlRecord, UrlsQueryParams } from "@/lib/schemas"
36-
import { copyToClipboard } from "@/lib/utils"
37+
import { copyToClipboard, makeShortUrl } from "@/lib/utils"
3738
import { CreateUrlDialog } from "./create-url-dialog"
3839
import { type EditDialogState, EditUrlDialog } from "./edit-url-dialog"
3940
import { PaginationControls } from "./pagination"
@@ -120,7 +121,7 @@ export function Dashboard() {
120121
<div className="flex items-center gap-4">
121122
<Image src={logo} alt="PoliNetwork Logo" className="h-16 w-16" />
122123
<div className="gap-2">
123-
<h1 className="text-3xl font-bold">polinet.cc</h1>
124+
<h1 className="text-3xl font-bold">${env.DOMAIN}</h1>
124125
<p className="text-muted-foreground max-md:text-sm">
125126
PoliNetwork's URL shortener dashboard
126127
</p>
@@ -221,9 +222,7 @@ export function Dashboard() {
221222
<MobileRow
222223
key={url.id}
223224
url={url}
224-
onCopy={(url) =>
225-
copyToClipboard(`https://polinet.cc/${url.short_code}`)
226-
}
225+
onCopy={(url) => copyToClipboard(makeShortUrl(url))}
227226
onDelete={(url) => handleDelete(url.short_code)}
228227
onEdit={(url) => setEditDialog({ open: true, url })}
229228
onQrCode={(url) => setQrDialog({ open: true, url })}
@@ -248,9 +247,7 @@ export function Dashboard() {
248247
<UrlRecordRow
249248
key={url.id}
250249
url={url}
251-
onCopy={(url) =>
252-
copyToClipboard(`https://polinet.cc/${url.short_code}`)
253-
}
250+
onCopy={(url) => copyToClipboard(makeShortUrl(url))}
254251
onDelete={(url) => handleDelete(url.short_code)}
255252
onEdit={(url) => setEditDialog({ open: true, url })}
256253
onQrCode={(url) => setQrDialog({ open: true, url })}

src/components/edit-url-dialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { Input } from "@/components/ui/input"
1717
import { Label } from "@/components/ui/label"
1818
import { editUrl } from "@/lib/actions"
1919
import type { UrlRecord } from "@/lib/schemas"
20+
import { makeShortUrl } from "@/lib/utils"
2021
import { editUrlSchema } from "@/lib/validations"
2122

2223
export type EditDialogState =
@@ -67,7 +68,7 @@ export function EditUrlDialog({
6768
<DialogHeader>
6869
<DialogTitle>Edit Short URL</DialogTitle>
6970
<DialogDescription>
70-
Update the destination URL for polinet.cc/{state.url.short_code}.
71+
Update the destination URL for {makeShortUrl(state.url)}.
7172
</DialogDescription>
7273
</DialogHeader>
7374
<form {...getFormProps(form, {})} action={action}>

src/components/qr-code-dialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
type QrOptions,
1010
} from "@/lib/qr-config"
1111
import type { UrlRecord } from "@/lib/schemas"
12+
import { makeShortUrl } from "@/lib/utils"
1213
import { QrCode } from "./qr-code"
1314
import { Button } from "./ui/button"
1415
import {
@@ -48,7 +49,7 @@ export function QrCodeDialog({ open, url, onOpenChange }: QrCodeDialogProps) {
4849
}
4950

5051
if (!url) return null
51-
const shortUrl = `https://polinet.cc/${url.short_code}`
52+
const shortUrl = makeShortUrl(url)
5253

5354
return (
5455
<Dialog open={open} onOpenChange={onOpenChange}>

src/components/url-record-row.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Trash2,
1010
} from "lucide-react"
1111
import type { UrlRecord } from "@/lib/schemas"
12-
import { copyToClipboard } from "@/lib/utils"
12+
import { copyToClipboard, makeShortUrl } from "@/lib/utils"
1313
import { Button } from "./ui/button"
1414
import { TableCell, TableRow } from "./ui/table"
1515

@@ -28,6 +28,7 @@ export function MobileRow({
2828
onEdit,
2929
onQrCode,
3030
}: UrlRecordRowProps) {
31+
const shortUrl = makeShortUrl(url)
3132
return (
3233
<div className="flex flex-col gap-1 border rounded-md py-2 px-4">
3334
<div className="flex justify-start gap-2 items-center">
@@ -38,12 +39,12 @@ export function MobileRow({
3839
)}
3940

4041
<a
41-
href={`https://polinet.cc/${url.short_code}`}
42+
href={shortUrl}
4243
target="_blank"
4344
rel="noopener noreferrer"
4445
className="text-blue-400 hover:underline font-mono"
4546
>
46-
polinet.cc/{url.short_code}
47+
{shortUrl}
4748
</a>
4849
<Button variant="ghost" size="icon" onClick={() => onCopy(url)}>
4950
<Copy />
@@ -92,6 +93,7 @@ export function MobileRow({
9293
}
9394

9495
export function UrlRecordRow({ url, ...props }: UrlRecordRowProps) {
96+
const shortUrl = makeShortUrl(url)
9597
return (
9698
<TableRow key={url.id} className="max-sm:hidden">
9799
<TableCell>
@@ -104,12 +106,12 @@ export function UrlRecordRow({ url, ...props }: UrlRecordRowProps) {
104106
<TableCell>
105107
<div className="flex items-center gap-2">
106108
<a
107-
href={`https://polinet.cc/${url.short_code}`}
109+
href={shortUrl}
108110
target="_blank"
109111
rel="noopener noreferrer"
110112
className="text-blue-400 hover:underline font-mono"
111113
>
112-
polinet.cc/{url.short_code}
114+
{shortUrl}
113115
</a>
114116
<Button variant="ghost" size="icon" onClick={() => props.onCopy(url)}>
115117
<Copy />

0 commit comments

Comments
 (0)