chore(lint): biome config + auto-fix sweep + translation hot-path quality fixes
- biome: enable unsafeParameterDecoratorsEnabled (NestJS @Body/@Query); ignore *.gen.ts; spec files override noExplicitAny - translations: remove dictionary fallback DB write — was producing half-translated strings (e.g. "Body frame" → "Kaporta frame") that poisoned future lookups; now misses fall through to bootstrap script - categories: add translateMany() to PCAT root/subgroup/parts insert paths (was only EMEX) - auto-fix: organize imports, type-only imports, node: protocol on stdlib imports, and template-literal cleanups across 24 files Drops lint count from 769 → 257; remaining are legacy noNonNullAssertion / noArrayIndexKey / useExhaustiveDependencies that need manual review. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { resolve } from "path";
|
||||
import { resolve } from "node:path";
|
||||
import { Module } from "@nestjs/common";
|
||||
import { ConfigModule } from "@nestjs/config";
|
||||
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from "@nestjs/core";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { randomUUID } from "crypto";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { generateReferralCode } from "@sase/shared";
|
||||
import { betterAuth } from "better-auth";
|
||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
|
||||
@@ -84,7 +84,7 @@ export class CatalogService {
|
||||
const brandServices = new Map<string, string[]>();
|
||||
for (const [serviceName, brandName] of Object.entries(SERVICE_TO_BRAND)) {
|
||||
if (!brandServices.has(brandName)) brandServices.set(brandName, []);
|
||||
brandServices.get(brandName)!.push(serviceName);
|
||||
brandServices.get(brandName)?.push(serviceName);
|
||||
}
|
||||
|
||||
for (const brandName of Array.from(brandNames).sort()) {
|
||||
@@ -1285,7 +1285,7 @@ export class CatalogService {
|
||||
for (const item of items) {
|
||||
const node = map.get(item.id)!;
|
||||
if (item.parentId && map.has(item.parentId)) {
|
||||
map.get(item.parentId)!.children.push(node);
|
||||
map.get(item.parentId)?.children.push(node);
|
||||
} else {
|
||||
roots.push(node);
|
||||
}
|
||||
@@ -1293,7 +1293,7 @@ export class CatalogService {
|
||||
|
||||
for (const node of map.values()) {
|
||||
if (node.children.length === 0) {
|
||||
delete node.children;
|
||||
node.children = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1105,7 +1105,7 @@ export class CategoriesService {
|
||||
for (const item of items) {
|
||||
const node = map.get(item.id)!;
|
||||
if (item.parentId && map.has(item.parentId)) {
|
||||
map.get(item.parentId)!.children.push(node);
|
||||
map.get(item.parentId)?.children.push(node);
|
||||
} else {
|
||||
roots.push(node);
|
||||
}
|
||||
@@ -1115,7 +1115,7 @@ export class CategoriesService {
|
||||
// leaf nodes (children: []) from unexplored nodes (children: undefined)
|
||||
for (const node of map.values()) {
|
||||
if (node.children.length === 0) {
|
||||
delete node.children;
|
||||
node.children = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,49 +35,49 @@ describe("CorgiService", () => {
|
||||
// WBA = BMW, position 10 (index 9) = 'K' = 2019
|
||||
const result = service.decodeVin("WBAPH5C55BA123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.brandName).toBe("BMW");
|
||||
expect(result!.wmi).toBe("WBA");
|
||||
expect(result!.isKnown).toBe(true);
|
||||
expect(result!.modelYear).toBe(2011); // 'B' at position 10
|
||||
expect(result?.brandName).toBe("BMW");
|
||||
expect(result?.wmi).toBe("WBA");
|
||||
expect(result?.isKnown).toBe(true);
|
||||
expect(result?.modelYear).toBe(2011); // 'B' at position 10
|
||||
});
|
||||
|
||||
it("should extract model year 'A' as 2010", () => {
|
||||
// Position 10 (index 9) = 'A' = 2010
|
||||
const result = service.decodeVin("WBAPH5C55AA123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.modelYear).toBe(2010);
|
||||
expect(result?.modelYear).toBe(2010);
|
||||
});
|
||||
|
||||
it("should extract model year 'J' as 2018", () => {
|
||||
const result = service.decodeVin("WBAPH5C55JA123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.modelYear).toBe(2018);
|
||||
expect(result?.modelYear).toBe(2018);
|
||||
});
|
||||
|
||||
it("should extract model year '1' as 2001", () => {
|
||||
const result = service.decodeVin("WBAPH5C5510123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.modelYear).toBe(2001);
|
||||
expect(result?.modelYear).toBe(2001);
|
||||
});
|
||||
|
||||
it("should extract model year '9' as 2009", () => {
|
||||
const result = service.decodeVin("WBAPH5C5590123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.modelYear).toBe(2009);
|
||||
expect(result?.modelYear).toBe(2009);
|
||||
});
|
||||
|
||||
it("should return null modelYear for unrecognized year character", () => {
|
||||
// Position 10 (index 9) = '0' is not in YEAR_MAP
|
||||
const result = service.decodeVin("WBAPH5C550A123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.modelYear).toBeNull();
|
||||
expect(result?.modelYear).toBeNull();
|
||||
});
|
||||
|
||||
it("should return isKnown=false for unknown WMI", () => {
|
||||
const result = service.decodeVin("ZZZPH5C55KA123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.brandName).toBe("Unknown");
|
||||
expect(result!.isKnown).toBe(false);
|
||||
expect(result?.brandName).toBe("Unknown");
|
||||
expect(result?.isKnown).toBe(false);
|
||||
});
|
||||
|
||||
it("should return null for VIN with wrong length", () => {
|
||||
@@ -89,33 +89,33 @@ describe("CorgiService", () => {
|
||||
it("should handle lowercase VIN input", () => {
|
||||
const result = service.decodeVin("wbaph5c55ka123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.brandName).toBe("BMW");
|
||||
expect(result!.wmi).toBe("WBA");
|
||||
expect(result?.brandName).toBe("BMW");
|
||||
expect(result?.wmi).toBe("WBA");
|
||||
});
|
||||
|
||||
it("should decode a Toyota VIN correctly", () => {
|
||||
const result = service.decodeVin("JTDKN3DU5LA123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.brandName).toBe("Toyota");
|
||||
expect(result!.wmi).toBe("JTD");
|
||||
expect(result!.isKnown).toBe(true);
|
||||
expect(result!.modelYear).toBe(2020); // 'L' at position 10
|
||||
expect(result?.brandName).toBe("Toyota");
|
||||
expect(result?.wmi).toBe("JTD");
|
||||
expect(result?.isKnown).toBe(true);
|
||||
expect(result?.modelYear).toBe(2020); // 'L' at position 10
|
||||
});
|
||||
|
||||
it("should decode a Volkswagen VIN with numeric WMI prefix", () => {
|
||||
const result = service.decodeVin("3VWFE21C55M123456");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.brandName).toBe("Volkswagen");
|
||||
expect(result!.wmi).toBe("3VW");
|
||||
expect(result!.isKnown).toBe(true);
|
||||
expect(result?.brandName).toBe("Volkswagen");
|
||||
expect(result?.wmi).toBe("3VW");
|
||||
expect(result?.isKnown).toBe(true);
|
||||
});
|
||||
|
||||
it("should decode a VW Commercial VIN correctly", () => {
|
||||
const result = service.decodeVin("WV2ZZZ2KZ5X071795");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.brandName).toBe("Volkswagen");
|
||||
expect(result!.wmi).toBe("WV2");
|
||||
expect(result!.isKnown).toBe(true);
|
||||
expect(result?.brandName).toBe("Volkswagen");
|
||||
expect(result?.wmi).toBe("WV2");
|
||||
expect(result?.isKnown).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* QuickGroups.aspx, or QuickDetails.aspx — plain HTTP GET works.
|
||||
*/
|
||||
|
||||
import * as path from "path";
|
||||
import * as path from "node:path";
|
||||
import {
|
||||
BadRequestException,
|
||||
Injectable,
|
||||
@@ -167,7 +167,7 @@ export class EmexService {
|
||||
try {
|
||||
this.logger.log(`Loading EMEX scraper module from: ${this.scraperPath}`);
|
||||
|
||||
const fs = require("fs");
|
||||
const fs = require("node:fs");
|
||||
if (!fs.existsSync(this.scraperPath)) {
|
||||
this.logger.error(`Scraper file not found at: ${this.scraperPath}`);
|
||||
this.logger.error(`Current working directory: ${process.cwd()}`);
|
||||
@@ -600,7 +600,7 @@ export class EmexService {
|
||||
|
||||
if (!response.success) {
|
||||
this.logger.warn(`EMEX browser search unsuccessful: ${response.message || response.error}`);
|
||||
if (response.vehicle && response.vehicle.brand) {
|
||||
if (response.vehicle?.brand) {
|
||||
return mapEmexResponse(response);
|
||||
}
|
||||
return createEmptyDecodedVehicle(cleanVin, response.message || response.error);
|
||||
|
||||
@@ -24,6 +24,6 @@ export abstract class BasePL24Parser {
|
||||
protected safeNumber(value: unknown): number {
|
||||
if (typeof value === "number") return value;
|
||||
const parsed = Number(value);
|
||||
return isNaN(parsed) ? 0 : parsed;
|
||||
return Number.isNaN(parsed) ? 0 : parsed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* P5 Modern architecture only (JSON API). Legacy scraping is deferred.
|
||||
*/
|
||||
|
||||
import { createHash } from "crypto";
|
||||
import { createHash } from "node:crypto";
|
||||
import {
|
||||
BadRequestException,
|
||||
Injectable,
|
||||
|
||||
@@ -76,17 +76,15 @@ describe("PaymentsService", () => {
|
||||
select: vi.fn().mockReturnValue({
|
||||
from: vi.fn().mockReturnThis(),
|
||||
where: vi.fn().mockReturnThis(),
|
||||
limit: vi
|
||||
.fn()
|
||||
.mockReturnValue([
|
||||
{
|
||||
id: "plan-1",
|
||||
brandCount: 1,
|
||||
priceMonthly: 20000,
|
||||
priceYearly: 200000,
|
||||
isActive: true,
|
||||
},
|
||||
]),
|
||||
limit: vi.fn().mockReturnValue([
|
||||
{
|
||||
id: "plan-1",
|
||||
brandCount: 1,
|
||||
priceMonthly: 20000,
|
||||
priceYearly: 200000,
|
||||
isActive: true,
|
||||
},
|
||||
]),
|
||||
}),
|
||||
insert: vi.fn().mockReturnValue({
|
||||
values: vi.fn().mockReturnThis(),
|
||||
@@ -175,17 +173,15 @@ describe("PaymentsService", () => {
|
||||
select: vi.fn().mockReturnValue({
|
||||
from: vi.fn().mockReturnThis(),
|
||||
where: vi.fn().mockReturnThis(),
|
||||
limit: vi
|
||||
.fn()
|
||||
.mockReturnValue([
|
||||
{
|
||||
id: "plan-1",
|
||||
brandCount: 0,
|
||||
priceMonthly: 99900,
|
||||
priceYearly: 999000,
|
||||
isActive: true,
|
||||
},
|
||||
]),
|
||||
limit: vi.fn().mockReturnValue([
|
||||
{
|
||||
id: "plan-1",
|
||||
brandCount: 0,
|
||||
priceMonthly: 99900,
|
||||
priceYearly: 999000,
|
||||
isActive: true,
|
||||
},
|
||||
]),
|
||||
}),
|
||||
insert: vi.fn().mockReturnValue({
|
||||
values: vi.fn().mockReturnThis(),
|
||||
|
||||
@@ -14,7 +14,7 @@ describe("Telemetry module", () => {
|
||||
|
||||
describe("isOtelEnabled", () => {
|
||||
it("should be false when OTEL_ENABLED is not set", async () => {
|
||||
delete process.env.OTEL_ENABLED;
|
||||
process.env.OTEL_ENABLED = undefined;
|
||||
const { isOtelEnabled } = await import("../index");
|
||||
expect(isOtelEnabled).toBe(false);
|
||||
});
|
||||
@@ -53,7 +53,7 @@ describe("Telemetry module", () => {
|
||||
describe("sdk-factory", () => {
|
||||
it("should not throw when OTel is enabled but endpoint is missing", async () => {
|
||||
process.env.OTEL_ENABLED = "true";
|
||||
delete process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
||||
process.env.OTEL_EXPORTER_OTLP_ENDPOINT = undefined;
|
||||
const { createNodeSDK } = await import("../sdk-factory");
|
||||
expect(() =>
|
||||
createNodeSDK({
|
||||
@@ -64,7 +64,7 @@ describe("Telemetry module", () => {
|
||||
});
|
||||
|
||||
it("should return null when endpoint is not configured", async () => {
|
||||
delete process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
||||
process.env.OTEL_EXPORTER_OTLP_ENDPOINT = undefined;
|
||||
const { createNodeSDK } = await import("../sdk-factory");
|
||||
const sdk = createNodeSDK({
|
||||
serviceName: "test",
|
||||
|
||||
@@ -32,7 +32,7 @@ function parseHeaders(headerString: string): Record<string, string> {
|
||||
export function createNodeSDK(config: SDKConfig): NodeSDK | null {
|
||||
const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
||||
if (!endpoint) {
|
||||
console.log(`[otel] No OTLP endpoint configured — telemetry will not be exported`);
|
||||
console.log("[otel] No OTLP endpoint configured — telemetry will not be exported");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -247,57 +247,52 @@ function AdminCopyLogsPage() {
|
||||
</>
|
||||
)}
|
||||
|
||||
{tab === "top" && (
|
||||
<>
|
||||
{topLoading ? (
|
||||
<div className="space-y-3">
|
||||
{Array.from({ length: 10 }).map((_, i) => (
|
||||
<Skeleton key={`top-skel-${i}`} className="h-12 w-full" />
|
||||
))}
|
||||
</div>
|
||||
) : !topCodes || topCodes.length === 0 ? (
|
||||
<Card>
|
||||
<CardContent className="flex flex-col items-center gap-3 py-16 text-center">
|
||||
<TrendingUp className="h-12 w-12 text-muted-foreground" />
|
||||
<p className="text-lg font-medium">Veri bulunamadi</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Son 30 gunde kopyalanan OEM kodu yok
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : (
|
||||
<Card>
|
||||
<CardContent className="overflow-x-auto p-0">
|
||||
<div className="min-w-[500px]">
|
||||
<div className="grid grid-cols-4 items-center gap-4 border-b px-6 py-3 text-sm font-medium text-muted-foreground">
|
||||
<span>#</span>
|
||||
<span>OEM Kodu</span>
|
||||
<span className="text-center">Kopyalanma</span>
|
||||
<span className="text-center">Benzersiz Kullanici</span>
|
||||
</div>
|
||||
<div className="divide-y">
|
||||
{topCodes.map((item, idx) => (
|
||||
<div
|
||||
key={item.oemCode}
|
||||
className="grid grid-cols-4 items-center gap-4 px-6 py-3 text-sm"
|
||||
>
|
||||
<span className="text-muted-foreground">{idx + 1}</span>
|
||||
<div>
|
||||
<code className="rounded bg-muted px-1.5 py-0.5 text-xs font-semibold">
|
||||
{item.oemCode}
|
||||
</code>
|
||||
</div>
|
||||
<div className="text-center font-medium">{item.copyCount}</div>
|
||||
<div className="text-center text-muted-foreground">{item.uniqueUsers}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{tab === "top" &&
|
||||
(topLoading ? (
|
||||
<div className="space-y-3">
|
||||
{Array.from({ length: 10 }).map((_, i) => (
|
||||
<Skeleton key={`top-skel-${i}`} className="h-12 w-full" />
|
||||
))}
|
||||
</div>
|
||||
) : !topCodes || topCodes.length === 0 ? (
|
||||
<Card>
|
||||
<CardContent className="flex flex-col items-center gap-3 py-16 text-center">
|
||||
<TrendingUp className="h-12 w-12 text-muted-foreground" />
|
||||
<p className="text-lg font-medium">Veri bulunamadi</p>
|
||||
<p className="text-sm text-muted-foreground">Son 30 gunde kopyalanan OEM kodu yok</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : (
|
||||
<Card>
|
||||
<CardContent className="overflow-x-auto p-0">
|
||||
<div className="min-w-[500px]">
|
||||
<div className="grid grid-cols-4 items-center gap-4 border-b px-6 py-3 text-sm font-medium text-muted-foreground">
|
||||
<span>#</span>
|
||||
<span>OEM Kodu</span>
|
||||
<span className="text-center">Kopyalanma</span>
|
||||
<span className="text-center">Benzersiz Kullanici</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<div className="divide-y">
|
||||
{topCodes.map((item, idx) => (
|
||||
<div
|
||||
key={item.oemCode}
|
||||
className="grid grid-cols-4 items-center gap-4 px-6 py-3 text-sm"
|
||||
>
|
||||
<span className="text-muted-foreground">{idx + 1}</span>
|
||||
<div>
|
||||
<code className="rounded bg-muted px-1.5 py-0.5 text-xs font-semibold">
|
||||
{item.oemCode}
|
||||
</code>
|
||||
</div>
|
||||
<div className="text-center font-medium">{item.copyCount}</div>
|
||||
<div className="text-center text-muted-foreground">{item.uniqueUsers}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
17
biome.json
17
biome.json
@@ -9,6 +9,18 @@
|
||||
"recommended": true
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "space",
|
||||
@@ -16,6 +28,9 @@
|
||||
"lineWidth": 100
|
||||
},
|
||||
"javascript": {
|
||||
"parser": {
|
||||
"unsafeParameterDecoratorsEnabled": true
|
||||
},
|
||||
"formatter": {
|
||||
"quoteStyle": "double",
|
||||
"semicolons": "always",
|
||||
@@ -23,6 +38,6 @@
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
"ignore": ["node_modules", "dist", ".next", "*.min.js"]
|
||||
"ignore": ["node_modules", "dist", ".next", "*.min.js", "**/*.gen.ts"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,9 @@ export const envSchema = z.object({
|
||||
|
||||
export type Env = z.infer<typeof envSchema>;
|
||||
|
||||
export function validateEnv(env: Record<string, unknown> = process.env as Record<string, unknown>): Env {
|
||||
export function validateEnv(
|
||||
env: Record<string, unknown> = process.env as Record<string, unknown>,
|
||||
): Env {
|
||||
const result = envSchema.safeParse(env);
|
||||
if (!result.success) {
|
||||
const formatted = result.error.format();
|
||||
|
||||
@@ -23,7 +23,12 @@ export type { PaginationInput, PaginatedResult } from "./types/pagination.js";
|
||||
|
||||
// Schemas
|
||||
export { vinSchema } from "./schemas/vin.js";
|
||||
export { loginSchema, registerSchema, forgotPasswordSchema, resetPasswordSchema } from "./schemas/auth.js";
|
||||
export {
|
||||
loginSchema,
|
||||
registerSchema,
|
||||
forgotPasswordSchema,
|
||||
resetPasswordSchema,
|
||||
} from "./schemas/auth.js";
|
||||
export { paginationSchema } from "./schemas/pagination.js";
|
||||
|
||||
// Constants
|
||||
@@ -40,4 +45,10 @@ export {
|
||||
extractModelYear,
|
||||
} from "./utils/vin-validator.js";
|
||||
export { formatTRY, kurusToLira, liraToKurus } from "./utils/currency.js";
|
||||
export { formatVin, formatDate, formatDateTime, slugify, generateReferralCode } from "./utils/formatters.js";
|
||||
export {
|
||||
formatVin,
|
||||
formatDate,
|
||||
formatDateTime,
|
||||
slugify,
|
||||
generateReferralCode,
|
||||
} from "./utils/formatters.js";
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
import { VIN_REGEX } from "../constants/regex.js";
|
||||
|
||||
const TRANSLITERATION: Record<string, number> = {
|
||||
A: 1, B: 2, C: 3, D: 4, E: 5, F: 6, G: 7, H: 8,
|
||||
J: 1, K: 2, L: 3, M: 4, N: 5, P: 7, R: 9,
|
||||
S: 2, T: 3, U: 4, V: 5, W: 6, X: 7, Y: 8, Z: 9,
|
||||
A: 1,
|
||||
B: 2,
|
||||
C: 3,
|
||||
D: 4,
|
||||
E: 5,
|
||||
F: 6,
|
||||
G: 7,
|
||||
H: 8,
|
||||
J: 1,
|
||||
K: 2,
|
||||
L: 3,
|
||||
M: 4,
|
||||
N: 5,
|
||||
P: 7,
|
||||
R: 9,
|
||||
S: 2,
|
||||
T: 3,
|
||||
U: 4,
|
||||
V: 5,
|
||||
W: 6,
|
||||
X: 7,
|
||||
Y: 8,
|
||||
Z: 9,
|
||||
};
|
||||
|
||||
const POSITION_WEIGHTS = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2];
|
||||
@@ -38,11 +58,36 @@ export function extractWmi(vin: string): string {
|
||||
export function extractModelYear(vin: string): number | null {
|
||||
const yearChar = vin.toUpperCase()[9];
|
||||
const yearMap: Record<string, number> = {
|
||||
A: 2010, B: 2011, C: 2012, D: 2013, E: 2014, F: 2015, G: 2016, H: 2017,
|
||||
J: 2018, K: 2019, L: 2020, M: 2021, N: 2022, P: 2023, R: 2024, S: 2025,
|
||||
T: 2026, V: 2027, W: 2028, X: 2029, Y: 2030,
|
||||
"1": 2001, "2": 2002, "3": 2003, "4": 2004, "5": 2005,
|
||||
"6": 2006, "7": 2007, "8": 2008, "9": 2009,
|
||||
A: 2010,
|
||||
B: 2011,
|
||||
C: 2012,
|
||||
D: 2013,
|
||||
E: 2014,
|
||||
F: 2015,
|
||||
G: 2016,
|
||||
H: 2017,
|
||||
J: 2018,
|
||||
K: 2019,
|
||||
L: 2020,
|
||||
M: 2021,
|
||||
N: 2022,
|
||||
P: 2023,
|
||||
R: 2024,
|
||||
S: 2025,
|
||||
T: 2026,
|
||||
V: 2027,
|
||||
W: 2028,
|
||||
X: 2029,
|
||||
Y: 2030,
|
||||
"1": 2001,
|
||||
"2": 2002,
|
||||
"3": 2003,
|
||||
"4": 2004,
|
||||
"5": 2005,
|
||||
"6": 2006,
|
||||
"7": 2007,
|
||||
"8": 2008,
|
||||
"9": 2009,
|
||||
};
|
||||
return yearMap[yearChar] ?? null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { type VariantProps, cva } from "class-variance-authority";
|
||||
import type * as React from "react";
|
||||
import { cn } from "./utils";
|
||||
|
||||
const badgeVariants = cva(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react";
|
||||
import { Slot } from "@radix-ui/react-slot";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { type VariantProps, cva } from "class-variance-authority";
|
||||
import * as React from "react";
|
||||
import { cn } from "./utils";
|
||||
|
||||
const buttonVariants = cva(
|
||||
@@ -44,7 +44,9 @@ export interface ButtonProps
|
||||
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
({ className, variant, size, asChild = false, ...props }, ref) => {
|
||||
const Comp = asChild ? Slot : "button";
|
||||
return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />;
|
||||
return (
|
||||
<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
|
||||
);
|
||||
},
|
||||
);
|
||||
Button.displayName = "Button";
|
||||
|
||||
@@ -3,7 +3,11 @@ import { cn } from "./utils";
|
||||
|
||||
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<div ref={ref} className={cn("rounded-xl border bg-card text-card-foreground shadow", className)} {...props} />
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn("rounded-xl border bg-card text-card-foreground shadow", className)}
|
||||
{...props}
|
||||
/>
|
||||
),
|
||||
);
|
||||
Card.displayName = "Card";
|
||||
@@ -17,7 +21,11 @@ CardHeader.displayName = "CardHeader";
|
||||
|
||||
const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<div ref={ref} className={cn("font-semibold leading-none tracking-tight", className)} {...props} />
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn("font-semibold leading-none tracking-tight", className)}
|
||||
{...props}
|
||||
/>
|
||||
),
|
||||
);
|
||||
CardTitle.displayName = "CardTitle";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react";
|
||||
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
||||
import { X } from "lucide-react";
|
||||
import * as React from "react";
|
||||
import { cn } from "./utils";
|
||||
|
||||
const Dialog = DialogPrimitive.Root;
|
||||
@@ -53,7 +53,10 @@ const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivEleme
|
||||
DialogHeader.displayName = "DialogHeader";
|
||||
|
||||
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
||||
<div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
|
||||
<div
|
||||
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
DialogFooter.displayName = "DialogFooter";
|
||||
|
||||
@@ -73,7 +76,11 @@ const DialogDescription = React.forwardRef<
|
||||
React.ComponentRef<typeof DialogPrimitive.Description>,
|
||||
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<DialogPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
|
||||
<DialogPrimitive.Description
|
||||
ref={ref}
|
||||
className={cn("text-sm text-muted-foreground", className)}
|
||||
{...props}
|
||||
/>
|
||||
));
|
||||
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from "react";
|
||||
import * as LabelPrimitive from "@radix-ui/react-label";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { type VariantProps, cva } from "class-variance-authority";
|
||||
import * as React from "react";
|
||||
import { cn } from "./utils";
|
||||
|
||||
const labelVariants = cva(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react";
|
||||
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
||||
import * as React from "react";
|
||||
import { cn } from "./utils";
|
||||
|
||||
const Separator = React.forwardRef<
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react";
|
||||
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
||||
import * as React from "react";
|
||||
import { cn } from "./utils";
|
||||
|
||||
const Tabs = TabsPrimitive.Root;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { clsx, type ClassValue } from "clsx";
|
||||
import { type ClassValue, clsx } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
|
||||
Reference in New Issue
Block a user