diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e379c2b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,23 @@ +.git +.claude +ignored +node_modules +dist +dist-ssr +coverage +playwright-report +test-results + +*.log +pnpm-debug.log* +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +.env +.env.* +!.env.example + +.DS_Store +.idea +.vscode diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..ed69ec1 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +VITE_PLIMI_REPO_URL=https://github.com/your-org/plimi diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4689fd3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# syntax=docker/dockerfile:1 + +FROM node:22-alpine AS deps +WORKDIR /app +RUN corepack enable && corepack prepare pnpm@10.33.2 --activate +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile + +FROM node:22-alpine AS build +WORKDIR /app +RUN corepack enable && corepack prepare pnpm@10.33.2 --activate +ARG VITE_PLIMI_REPO_URL=https://github.com/your-org/plimi +ENV VITE_PLIMI_REPO_URL=$VITE_PLIMI_REPO_URL +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN pnpm build + +FROM nginx:1.27-alpine AS runtime +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 80 +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1 +CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index 5e16118..86b4ad6 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,27 @@ npm test npm run build ``` +### Docker +Build and run the static production app with Nginx: + +```bash +docker build \ + --build-arg VITE_PLIMI_REPO_URL=https://github.com/your-org/plimi \ + -t plimi:local . + +docker run --rm -p 8080:80 --name plimi plimi:local +``` + +Or use Docker Compose: + +```bash +VITE_PLIMI_REPO_URL=https://github.com/your-org/plimi PLIMI_PORT=8080 docker compose up --build +``` + +Environment: +- `VITE_PLIMI_REPO_URL`: build-time public repository URL shown on the Contribute page. +- `PLIMI_PORT`: host port used by Docker Compose, default `8080`. + --- ## How to Create a Tool (Plugin) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..913c26d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +services: + plimi: + build: + context: . + args: + VITE_PLIMI_REPO_URL: ${VITE_PLIMI_REPO_URL:-https://github.com/your-org/plimi} + image: plimi:local + container_name: plimi + ports: + - "${PLIMI_PORT:-8080}:80" + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..046c0ae --- /dev/null +++ b/nginx.conf @@ -0,0 +1,39 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + server_tokens off; + + gzip on; + gzip_comp_level 6; + gzip_min_length 1024; + gzip_types + text/plain + text/css + text/xml + text/javascript + application/javascript + application/json + application/xml + image/svg+xml + font/woff2; + + location /assets/ { + try_files $uri =404; + expires 1y; + add_header Cache-Control "public, immutable"; + } + + location = /favicon.svg { + try_files $uri =404; + expires 30d; + add_header Cache-Control "public"; + } + + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/src/App.css b/src/App.css deleted file mode 100644 index f460279..0000000 --- a/src/App.css +++ /dev/null @@ -1,184 +0,0 @@ -.counter { - font-size: 16px; - padding: 5px 10px; - border-radius: 5px; - color: var(--accent); - background: var(--accent-bg); - border: 2px solid transparent; - transition: border-color 0.3s; - margin-bottom: 24px; - - &:hover { - border-color: var(--accent-border); - } - &:focus-visible { - outline: 2px solid var(--accent); - outline-offset: 2px; - } -} - -.hero { - position: relative; - - .base, - .framework, - .vite { - inset-inline: 0; - margin: 0 auto; - } - - .base { - width: 170px; - position: relative; - z-index: 0; - } - - .framework, - .vite { - position: absolute; - } - - .framework { - z-index: 1; - top: 34px; - height: 28px; - transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg) - scale(1.4); - } - - .vite { - z-index: 0; - top: 107px; - height: 26px; - width: auto; - transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg) - scale(0.8); - } -} - -#center { - display: flex; - flex-direction: column; - gap: 25px; - place-content: center; - place-items: center; - flex-grow: 1; - - @media (max-width: 1024px) { - padding: 32px 20px 24px; - gap: 18px; - } -} - -#next-steps { - display: flex; - border-top: 1px solid var(--border); - text-align: left; - - & > div { - flex: 1 1 0; - padding: 32px; - @media (max-width: 1024px) { - padding: 24px 20px; - } - } - - .icon { - margin-bottom: 16px; - width: 22px; - height: 22px; - } - - @media (max-width: 1024px) { - flex-direction: column; - text-align: center; - } -} - -#docs { - border-right: 1px solid var(--border); - - @media (max-width: 1024px) { - border-right: none; - border-bottom: 1px solid var(--border); - } -} - -#next-steps ul { - list-style: none; - padding: 0; - display: flex; - gap: 8px; - margin: 32px 0 0; - - .logo { - height: 18px; - } - - a { - color: var(--text-h); - font-size: 16px; - border-radius: 6px; - background: var(--social-bg); - display: flex; - padding: 6px 12px; - align-items: center; - gap: 8px; - text-decoration: none; - transition: box-shadow 0.3s; - - &:hover { - box-shadow: var(--shadow); - } - .button-icon { - height: 18px; - width: 18px; - } - } - - @media (max-width: 1024px) { - margin-top: 20px; - flex-wrap: wrap; - justify-content: center; - - li { - flex: 1 1 calc(50% - 8px); - } - - a { - width: 100%; - justify-content: center; - box-sizing: border-box; - } - } -} - -#spacer { - height: 88px; - border-top: 1px solid var(--border); - @media (max-width: 1024px) { - height: 48px; - } -} - -.ticks { - position: relative; - width: 100%; - - &::before, - &::after { - content: ""; - position: absolute; - top: -4.5px; - border: 5px solid transparent; - } - - &::before { - left: 0; - border-left-color: var(--border); - } - &::after { - right: 0; - border-right-color: var(--border); - } -} diff --git a/src/App.tsx b/src/App.tsx deleted file mode 100644 index 1fd432d..0000000 --- a/src/App.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import { useState } from "react"; -import reactLogo from "./assets/react.svg"; -import viteLogo from "./assets/vite.svg"; -import heroImg from "./assets/hero.png"; -import "./App.css"; - -function App() { - const [count, setCount] = useState(0); - - return ( - <> -
-
- - React logo - Vite logo -
-
-

Get started

-

- Edit src/App.tsx and save to test HMR -

-
- -
- -
- -
-
- -

Documentation

-

Your questions, answered

- -
-
- -

Connect with us

-

Join the Vite community

- -
-
- -
-
- - ); -} - -export default App; diff --git a/src/app/router.tsx b/src/app/router.tsx index ca4fe06..dd3d495 100644 --- a/src/app/router.tsx +++ b/src/app/router.tsx @@ -4,6 +4,7 @@ import { HomePage } from "../pages/HomePage"; import { ToolsPage } from "../pages/ToolsPage"; import { ToolDetailPage } from "../pages/ToolDetailPage"; import { HowItWorksPage } from "../pages/HowItWorksPage"; +import { ContributePage } from "../pages/ContributePage"; export const router = createBrowserRouter([ { @@ -26,6 +27,10 @@ export const router = createBrowserRouter([ path: "how-it-works", element: , }, + { + path: "contribute", + element: , + }, ], }, ]); diff --git a/src/assets/hero.png b/src/assets/hero.png deleted file mode 100644 index 02251f4..0000000 Binary files a/src/assets/hero.png and /dev/null differ diff --git a/src/assets/react.svg b/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/assets/vite.svg b/src/assets/vite.svg deleted file mode 100644 index 5101b67..0000000 --- a/src/assets/vite.svg +++ /dev/null @@ -1 +0,0 @@ -Vite diff --git a/src/components/directory/DirectoryComponents.tsx b/src/components/directory/DirectoryComponents.tsx index dd6e3be..60d2039 100644 --- a/src/components/directory/DirectoryComponents.tsx +++ b/src/components/directory/DirectoryComponents.tsx @@ -42,21 +42,19 @@ export function PlimiSearch({ return (
inputRef.current?.focus()} > @@ -78,9 +76,9 @@ export function PlimiSearch({ onChange(''); } }} - placeholder="Start typing to find a tool…" + placeholder="Search tools…" spellCheck={false} - className="flex-1 min-w-0 border-none outline-none bg-transparent text-[var(--p-text)] text-2xl font-sans tracking-tight font-medium" + className="flex-1 min-w-0 border-none outline-none bg-transparent text-[var(--p-text)] text-lg md:text-2xl font-sans tracking-tight font-medium" /> {value ? ( @@ -94,7 +92,7 @@ export function PlimiSearch({ clear ) : ( - + {shortcutText} )} @@ -102,7 +100,7 @@ export function PlimiSearch({
{value ? `${count} match${count === 1 ? '' : 'es'}` : `${total} tools`} - ↑↓ to browse · enter to open + ↑↓ to browse · enter to open
); @@ -120,14 +118,14 @@ export function CategoryChips({ categories: { id: string; label: string }[]; }) { return ( -
+
{categories.map((c) => { const on = active === c.id; return (
+ ); } diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index 0053350..4788638 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -1,6 +1,18 @@ +import { useEffect, useState } from "react"; import { Link, useLocation } from "react-router-dom"; import { useTheme } from "../../app/useTheme"; +const NAV_ITEMS = [ + { label: "Tools", to: "/tools" }, + { label: "How it works", to: "/how-it-works" }, + { label: "Contribute", to: "/contribute" }, +]; + +function isNavActive(to: string, pathname: string): boolean { + if (to === "/tools") return pathname.startsWith("/tools"); + return pathname === to; +} + function PlimiMark({ size = 28 }: { size?: number }) { return ( void }) ); } +function MenuToggle({ open, onClick }: { open: boolean; onClick: () => void }) { + return ( + + ); +} + export function Header() { const { dark, toggleTheme } = useTheme(); const location = useLocation(); + const [menuOpen, setMenuOpen] = useState(false); + + // Close the mobile menu whenever the route changes. + useEffect(() => { + setMenuOpen(false); + }, [location.pathname]); + + // Lock body scroll while the mobile menu sheet is open. + useEffect(() => { + if (!menuOpen) return; + const previous = document.body.style.overflow; + document.body.style.overflow = "hidden"; + return () => { + document.body.style.overflow = previous; + }; + }, [menuOpen]); return ( -
-
- +
+
+ -
- - + -
- +
+ + setMenuOpen((o) => !o)} /> +
-
+ + {menuOpen && ( + <> + {/* Tap-away backdrop below the bar */} + + {sourceFile && ( +
+ source: {sourceFile.name} +
+ )} + {error &&
{error}
} + {result && } + + ); + return ( -
-
+
+
{ if (files[0]) void loadImageFile(files[0]); }} - className="min-h-0 w-full p-3 sm:w-[260px]" + className="min-h-0 w-full p-2.5 sm:w-[240px]" /> -
+
- - - - - + + + + +
-
- - -
-
+
@@ -627,152 +809,35 @@ export default function ImageEditorUi({
-