remove the map and ui shim packages
Both failed the deletion test in the telling direction: - @trails-cool/ui: Button/Input/Card had zero consumers — both apps roll their own elements inline. The only live part was a 6-line styles.css (the Tailwind entry + one keyframe), which now lives in each app as app/styles.css. - @trails-cool/map: MapView and RouteLayer had zero consumers; the package was otherwise a re-export of two map-core constants, and the two import sites now use @trails-cool/map-core directly. The "map components go in @trails-cool/map" convention had drifted long ago — the real map components live in apps/planner/app/components. CLAUDE.md's repository structure and conventions updated to match reality (including pointing shared-type guidance at the post-#515 sources: db row types, api contracts, Waypoint in types). Dockerfiles no longer COPY the deleted package manifests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
1a65b40d18
commit
765c9f49a8
28 changed files with 13 additions and 357 deletions
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"name": "@trails-cool/map",
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"lint": "eslint .",
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trails-cool/map-core": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18",
|
||||
"react-dom": ">=18",
|
||||
"leaflet": ">=1.9",
|
||||
"react-leaflet": ">=5"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
import { MapContainer, TileLayer, LayersControl } from "react-leaflet";
|
||||
import { baseLayers } from "./layers.ts";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
|
||||
export interface MapViewProps {
|
||||
center?: [number, number];
|
||||
zoom?: number;
|
||||
className?: string;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export function MapView({
|
||||
center = [50.1, 10.0],
|
||||
zoom = 6,
|
||||
className = "h-full w-full",
|
||||
children,
|
||||
}: MapViewProps) {
|
||||
return (
|
||||
<MapContainer center={center} zoom={zoom} className={className}>
|
||||
<LayersControl position="topright">
|
||||
{baseLayers.map((layer, i) => (
|
||||
<LayersControl.BaseLayer key={layer.name} checked={i === 0} name={layer.name}>
|
||||
<TileLayer
|
||||
url={layer.url}
|
||||
attribution={layer.attribution}
|
||||
maxZoom={layer.maxZoom}
|
||||
/>
|
||||
</LayersControl.BaseLayer>
|
||||
))}
|
||||
</LayersControl>
|
||||
{children}
|
||||
</MapContainer>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import { GeoJSON } from "react-leaflet";
|
||||
import type { GeoJsonObject } from "geojson";
|
||||
|
||||
export interface RouteLayerProps {
|
||||
data: GeoJsonObject;
|
||||
color?: string;
|
||||
weight?: number;
|
||||
}
|
||||
|
||||
export function RouteLayer({ data, color = "#2563eb", weight = 4 }: RouteLayerProps) {
|
||||
return (
|
||||
<GeoJSON
|
||||
key={JSON.stringify(data)}
|
||||
data={data}
|
||||
style={{ color, weight, opacity: 0.8 }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { baseLayers, overlayLayers } from "./index.ts";
|
||||
|
||||
describe("map package exports", () => {
|
||||
it("re-exports baseLayers from map-core", () => {
|
||||
expect(baseLayers).toBeDefined();
|
||||
expect(baseLayers.length).toBeGreaterThan(0);
|
||||
expect(baseLayers[0]!.name).toBe("OpenStreetMap");
|
||||
});
|
||||
|
||||
it("re-exports overlayLayers from map-core", () => {
|
||||
expect(overlayLayers).toBeDefined();
|
||||
expect(overlayLayers.length).toBeGreaterThan(0);
|
||||
expect(overlayLayers.every((l) => l.id)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
export { MapView } from "./MapView.tsx";
|
||||
export type { MapViewProps } from "./MapView.tsx";
|
||||
export { RouteLayer } from "./RouteLayer.tsx";
|
||||
export type { RouteLayerProps } from "./RouteLayer.tsx";
|
||||
export { baseLayers, overlayLayers } from "@trails-cool/map-core";
|
||||
export type { TileLayerConfig, OverlayLayerConfig } from "@trails-cool/map-core";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export type { TileLayerConfig, OverlayLayerConfig } from "@trails-cool/map-core";
|
||||
export { baseLayers, overlayLayers } from "@trails-cool/map-core";
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
export { default } from "../../vitest.shared.ts";
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "@trails-cool/ui",
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./styles.css": "./src/styles.css"
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"lint": "eslint .",
|
||||
"typecheck": "tsc"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
import type { ButtonHTMLAttributes } from "react";
|
||||
|
||||
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: "primary" | "secondary" | "ghost";
|
||||
size?: "sm" | "md" | "lg";
|
||||
}
|
||||
|
||||
const variantStyles = {
|
||||
primary: "bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800",
|
||||
secondary: "bg-gray-100 text-gray-900 hover:bg-gray-200 active:bg-gray-300",
|
||||
ghost: "text-gray-700 hover:bg-gray-100 active:bg-gray-200",
|
||||
};
|
||||
|
||||
const sizeStyles = {
|
||||
sm: "px-2.5 py-1.5 text-sm",
|
||||
md: "px-4 py-2 text-sm",
|
||||
lg: "px-6 py-3 text-base",
|
||||
};
|
||||
|
||||
export function Button({
|
||||
variant = "primary",
|
||||
size = "md",
|
||||
className = "",
|
||||
...props
|
||||
}: ButtonProps) {
|
||||
return (
|
||||
<button
|
||||
className={`inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ${variantStyles[variant]} ${sizeStyles[size]} ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
export interface CardProps {
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export function Card({ className = "", children }: CardProps) {
|
||||
return (
|
||||
<div className={`rounded-lg border border-gray-200 bg-white p-6 shadow-sm ${className}`}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import type { InputHTMLAttributes } from "react";
|
||||
|
||||
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||
label?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export function Input({ label, error, className = "", id, ...props }: InputProps) {
|
||||
const inputId = id ?? label?.toLowerCase().replace(/\s+/g, "-");
|
||||
return (
|
||||
<div className="flex flex-col gap-1.5">
|
||||
{label && (
|
||||
<label htmlFor={inputId} className="text-sm font-medium text-gray-700">
|
||||
{label}
|
||||
</label>
|
||||
)}
|
||||
<input
|
||||
id={inputId}
|
||||
className={`rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm transition-colors focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 ${error ? "border-red-500" : ""} ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
{error && <p className="text-sm text-red-600">{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { describe, it, expect, afterEach } from "vitest";
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { render, screen, cleanup } from "@testing-library/react";
|
||||
import { Button } from "./Button.tsx";
|
||||
import { Input } from "./Input.tsx";
|
||||
import { Card } from "./Card.tsx";
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
describe("Button", () => {
|
||||
it("renders with text", () => {
|
||||
render(<Button>Click me</Button>);
|
||||
expect(screen.getByRole("button", { name: "Click me" })).toBeDefined();
|
||||
});
|
||||
|
||||
it("applies primary variant by default", () => {
|
||||
render(<Button>Test</Button>);
|
||||
expect(screen.getByRole("button").className).toContain("bg-blue-600");
|
||||
});
|
||||
|
||||
it("applies secondary variant", () => {
|
||||
render(<Button variant="secondary">Test</Button>);
|
||||
expect(screen.getByRole("button").className).toContain("bg-gray-100");
|
||||
});
|
||||
|
||||
it("applies ghost variant", () => {
|
||||
render(<Button variant="ghost">Test</Button>);
|
||||
expect(screen.getByRole("button").className).toContain("text-gray-700");
|
||||
});
|
||||
|
||||
it("applies size classes", () => {
|
||||
render(<Button size="lg">Test</Button>);
|
||||
expect(screen.getByRole("button").className).toContain("px-6");
|
||||
});
|
||||
|
||||
it("forwards disabled prop", () => {
|
||||
render(<Button disabled>Test</Button>);
|
||||
expect(screen.getByRole("button")).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Input", () => {
|
||||
it("renders with label", () => {
|
||||
render(<Input label="Email" />);
|
||||
expect(screen.getByLabelText("Email")).toBeDefined();
|
||||
});
|
||||
|
||||
it("generates id from label", () => {
|
||||
render(<Input label="First Name" />);
|
||||
expect(screen.getByLabelText("First Name").id).toBe("first-name");
|
||||
});
|
||||
|
||||
it("uses provided id over generated one", () => {
|
||||
render(<Input label="Email" id="custom-id" />);
|
||||
expect(screen.getByLabelText("Email").id).toBe("custom-id");
|
||||
});
|
||||
|
||||
it("shows error message", () => {
|
||||
render(<Input label="Email" error="Required" />);
|
||||
expect(screen.getByText("Required")).toBeDefined();
|
||||
});
|
||||
|
||||
it("applies error border class", () => {
|
||||
render(<Input label="Email" error="Required" />);
|
||||
expect(screen.getByLabelText("Email").className).toContain("border-red-500");
|
||||
});
|
||||
|
||||
it("renders without label", () => {
|
||||
render(<Input placeholder="Type here" />);
|
||||
expect(screen.getByPlaceholderText("Type here")).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Card", () => {
|
||||
it("renders children", () => {
|
||||
render(<Card>Card content</Card>);
|
||||
expect(screen.getByText("Card content")).toBeDefined();
|
||||
});
|
||||
|
||||
it("applies additional className", () => {
|
||||
const { container } = render(<Card className="mt-4">Content</Card>);
|
||||
expect(container.firstElementChild?.className).toContain("mt-4");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
export { Button } from "./Button.tsx";
|
||||
export type { ButtonProps } from "./Button.tsx";
|
||||
export { Input } from "./Input.tsx";
|
||||
export type { InputProps } from "./Input.tsx";
|
||||
export { Card } from "./Card.tsx";
|
||||
export type { CardProps } from "./Card.tsx";
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
@import "tailwindcss";
|
||||
|
||||
@keyframes slide {
|
||||
0% { transform: translateX(-100%); }
|
||||
100% { transform: translateX(400%); }
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import { defineConfig, mergeConfig } from "vitest/config";
|
||||
import shared from "../../vitest.shared.ts";
|
||||
|
||||
export default mergeConfig(shared, defineConfig({
|
||||
test: {
|
||||
setupFiles: ["../../vitest.setup.ts"],
|
||||
},
|
||||
}));
|
||||
Loading…
Add table
Add a link
Reference in a new issue