From ff4e354d887d6be2baefe61fff9aaf066e4f1cac Mon Sep 17 00:00:00 2001 From: itsneufox Date: Wed, 18 Nov 2026 00:18:58 +0000 Subject: [PATCH 1/4] ignore the local build-next output --- frontend/.gitignore | 3 + .../src/components/HomepageFeatures/index.tsx | 145 ------------------ .../HomepageFeatures/styles.module.css | 144 ----------------- 3 files changed, 3 insertions(+), 289 deletions(-) delete mode 100644 frontend/src/components/HomepageFeatures/index.tsx delete mode 100644 frontend/src/components/HomepageFeatures/styles.module.css diff --git a/frontend/.gitignore b/frontend/.gitignore index b2d6de30624f..e1b24c7c0b43 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -18,3 +18,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +# Local build output +/build-next diff --git a/frontend/src/components/HomepageFeatures/index.tsx b/frontend/src/components/HomepageFeatures/index.tsx deleted file mode 100644 index 441768625df8..000000000000 --- a/frontend/src/components/HomepageFeatures/index.tsx +++ /dev/null @@ -1,145 +0,0 @@ -import React, { type ReactNode } from "react"; -import clsx from "clsx"; -import Heading from "@theme/Heading"; -import Image from "@theme/ThemedImage"; -import styles from "./styles.module.css"; -import Link from "@docusaurus/Link"; - -import Translate from '@docusaurus/Translate'; - -type FeatureItem = { - title: ReactNode; - Img: string; - description: ReactNode; - link: string; - linkText: ReactNode; -}; - -const FeatureList: FeatureItem[] = [ - { - title: ( - - Fully backwards compatible with existing scripts and clients - - ), - Img: "images/assets/f1.png", - description: ( - - Got an old AMX lying about? Load it up on the open.mp server straight - out of the box and join your friends playing on the SA:MP client. Then - when you want to enhance your code look in our docs. - - ), - link: "/docs", - linkText: ( - - Getting Started - - ), - }, - { - title: ( - - New and improved scripting system - - ), - Img: "images/assets/f5.png", - description: ( - - We've stuck with pawn, but with a new compiler engineered to make your - code more robust, and more functions to manipulate the server and - client. - - ), - link: "https://github.com/openmultiplayer/omp-stdlib/#openmp-includes", - linkText: ( - - Learn about the improvements - - ), - }, - { - title: ( - - Community driven development - - ), - Img: "images/assets/github.png", - description: ( - - The server is fully open source, and we welcome all contributions big - or small. Help write the next version, or just post about any problems you - find, despite our attempts to have perfect code, bugs happen and your feedback is valuable. - - ), - link: "https://github.com/openmultiplayer", - linkText: ( - - Visit the GitHub organization - - ), - }, - { - title: ( - - Extensible C++ API - - ), - Img: "images/assets/f4.png", - description: ( - - Get access to all the server features available in pawn, plus the - universe of C++ libraries and frameworks. Once you've mastered this why - not help improve the server via our open contribution process on GitHub. - - ), - link: "https://github.com/openmultiplayer/open.mp-sdk", - linkText: ( - - Check out SDK repository - - ), - }, -]; - -const Feature = ({ title, Img, description, link, linkText }: FeatureItem) => { - return ( -
-
- {`${title} -
-
- {title} -

{description}

-
-
- - {linkText} - -
-
- ); -}; - -const HomepageFeatures = (): React.ReactElement => { - return ( -
-
-
- {FeatureList.map((props, idx) => ( - - ))} -
-
-
- ); -}; - -export default HomepageFeatures; \ No newline at end of file diff --git a/frontend/src/components/HomepageFeatures/styles.module.css b/frontend/src/components/HomepageFeatures/styles.module.css deleted file mode 100644 index d53e316e71ef..000000000000 --- a/frontend/src/components/HomepageFeatures/styles.module.css +++ /dev/null @@ -1,144 +0,0 @@ -.featuresSection { - display: flex; - align-items: center; - padding: 0 0 3rem; - width: 100%; - background: none; - position: relative; - overflow: hidden; -} - -.featuresRow { - display: flex; - flex-wrap: wrap; - justify-content: space-around; - gap: 2rem; -} - -.featureItem { - display: flex; - flex-direction: column; - align-items: center; - max-width: 450px; - flex: 1 1 calc(50% - 2rem); - min-width: 280px; - padding: 1.5rem; - border-radius: 12px; - box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07); - transition: transform 0.3s ease, box-shadow 0.3s ease; - background-color: var(--ifm-card-background-color); - animation: fadeInUp 0.5s ease forwards; - opacity: 0; -} - -.featureItem:hover { - transform: translateY(-5px); - box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1); -} - -.featureItem:nth-child(1) { - animation-delay: 0.1s; -} - -.featureItem:nth-child(2) { - animation-delay: 0.2s; -} - -.featureItem:nth-child(3) { - animation-delay: 0.3s; -} - -.featureItem:nth-child(4) { - animation-delay: 0.4s; -} - -.featureImageContainer { - text-align: center; - margin-bottom: 1.25rem; - padding: 0.75rem; - border-radius: 50%; - background-color: var(--ifm-color-primary-lightest); - width: 100px; - height: 100px; - display: flex; - align-items: center; - justify-content: center; -} - -.featureImage { - height: auto; - width: 100%; - max-width: 70px; - object-fit: contain; -} - -.featureContent { - text-align: center; - padding: 0 1rem; - flex-grow: 1; -} - -.featureContent h3 { - margin-bottom: 0.75rem; - font-size: 1.35rem; - color: var(--ifm-color-primary); -} - -.featureContent p { - color: var(--ifm-color-emphasis-700); - line-height: 1.6; -} - -.featureFooter { - margin-top: 1.5rem; - width: 100%; - display: flex; - justify-content: center; -} - -.button { - transition: all 0.3s ease; - padding: 0.75rem 1.5rem; - font-weight: 600; - border-radius: 8px; - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); - text-align: center; -} - -.button:hover { - transform: translateY(-3px); - box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15); -} - -@keyframes fadeInUp { - from { - opacity: 0; - transform: translateY(20px); - } - - to { - opacity: 1; - transform: translateY(0); - } -} - -@media (max-width: 768px) { - .featureItem { - flex: 1 1 100%; - margin-bottom: 1.5rem; - } - - .featuresRow { - flex-direction: column; - gap: 1.5rem; - } - - .featureImageContainer { - width: 90px; - height: 90px; - } - - .featureContent h3 { - font-size: 1.25rem; - } -} \ No newline at end of file From f8d3934b43318377c97d83ca3bc94e77a8278c48 Mon Sep 17 00:00:00 2001 From: itsneufox Date: Wed, 18 Nov 2026 00:19:04 +0000 Subject: [PATCH 2/4] write Markdown copies of the English pages for agents After docusaurus build, scripts/agent-build.mjs gives every English page a .md copy linked from its HTML, and writes llms.txt, agent-instructions.md, sitemap.md, robots.txt and a Markdown 404. All plain files, so they work on GitHub Pages as is. Translated pages are skipped to keep the build small. SITE_URL overrides the site origin. --- frontend/docusaurus.config.ts | 2 +- frontend/package-lock.json | 210 ++++++++++++++++++++++++--- frontend/package.json | 7 +- frontend/scripts/agent-build.mjs | 235 +++++++++++++++++++++++++++++++ 4 files changed, 428 insertions(+), 26 deletions(-) create mode 100644 frontend/scripts/agent-build.mjs diff --git a/frontend/docusaurus.config.ts b/frontend/docusaurus.config.ts index e44240a8e7d2..59b4498302b6 100644 --- a/frontend/docusaurus.config.ts +++ b/frontend/docusaurus.config.ts @@ -22,7 +22,7 @@ const config: Config = { favicon: "favicon.ico", // Set the production url of your site here - url: "https://open.mp/", + url: process.env.SITE_URL || "https://open.mp/", // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' baseUrl: "/", diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 5abe999ddc11..fed06b8748b6 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -13,6 +13,7 @@ "@docusaurus/preset-classic": "^3.5.2", "@mdx-js/react": "^3.0.0", "@pondorasti/remark-img-links": "^1.0.8", + "cheerio": "^1.2.0", "clsx": "^2.0.0", "nprogress": "^0.2.0", "prism-react-renderer": "^2.3.0", @@ -23,7 +24,9 @@ "react-dom": "^18.3.1", "react-icons": "^5.4.0", "react-router-dom": "^7.1.5", - "react-window": "^2.2.7" + "react-window": "^2.2.7", + "turndown": "^7.2.5", + "turndown-plugin-gfm": "^1.0.2" }, "devDependencies": { "@docusaurus/module-type-aliases": "^3.10.1", @@ -3711,6 +3714,46 @@ "react-dom": "^18.0.0 || ^19.0.0" } }, + "node_modules/@docusaurus/plugin-content-blog/node_modules/cheerio": { + "version": "1.0.0-rc.12", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", + "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", + "license": "MIT", + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "htmlparser2": "^8.0.1", + "parse5": "^7.0.0", + "parse5-htmlparser2-tree-adapter": "^7.0.0" + }, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/@docusaurus/plugin-content-blog/node_modules/htmlparser2": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", + "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "entities": "^4.4.0" + } + }, "node_modules/@docusaurus/plugin-content-docs": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.10.1.tgz", @@ -4777,6 +4820,12 @@ "react": ">=16" } }, + "node_modules/@mixmark-io/domino": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@mixmark-io/domino/-/domino-2.2.0.tgz", + "integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==", + "license": "BSD-2-Clause" + }, "node_modules/@module-federation/error-codes": { "version": "0.22.0", "resolved": "https://registry.npmjs.org/@module-federation/error-codes/-/error-codes-0.22.0.tgz", @@ -7533,21 +7582,25 @@ } }, "node_modules/cheerio": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", - "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.2.0.tgz", + "integrity": "sha512-WDrybc/gKFpTYQutKIK6UvfcuxijIZfMfXaYm8NMsPQxSYvf+13fXUJ4rztGGbJcBQ/GF55gvrZ0Bc0bj/mqvg==", "license": "MIT", "dependencies": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "htmlparser2": "^8.0.1", - "parse5": "^7.0.0", - "parse5-htmlparser2-tree-adapter": "^7.0.0" + "domutils": "^3.2.2", + "encoding-sniffer": "^0.2.1", + "htmlparser2": "^10.1.0", + "parse5": "^7.3.0", + "parse5-htmlparser2-tree-adapter": "^7.1.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^7.19.0", + "whatwg-mimetype": "^4.0.0" }, "engines": { - "node": ">= 6" + "node": ">=20.18.1" }, "funding": { "url": "https://github.com/cheeriojs/cheerio?sponsor=1" @@ -7855,6 +7908,15 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, + "node_modules/compression/node_modules/negotiator": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", + "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -9001,6 +9063,31 @@ "node": ">= 0.8" } }, + "node_modules/encoding-sniffer": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz", + "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==", + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "funding": { + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + } + }, + "node_modules/encoding-sniffer/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/enhanced-resolve": { "version": "5.21.6", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.21.6.tgz", @@ -10509,9 +10596,9 @@ } }, "node_modules/htmlparser2": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", - "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.1.0.tgz", + "integrity": "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==", "funding": [ "https://github.com/fb55/htmlparser2?sponsor=1", { @@ -10523,8 +10610,20 @@ "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" + "domutils": "^3.2.2", + "entities": "^7.0.1" + } + }, + "node_modules/htmlparser2/node_modules/entities": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", + "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" } }, "node_modules/http-cache-semantics": { @@ -14165,15 +14264,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/negotiator": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", - "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -14674,6 +14764,18 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "license": "MIT", + "dependencies": { + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/parse5/node_modules/entities": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", @@ -18592,6 +18694,25 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "license": "0BSD" }, + "node_modules/turndown": { + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/turndown/-/turndown-7.2.5.tgz", + "integrity": "sha512-EKZvCCFHh8sWttpAMs10U6niZFJ2cpz8LkCPlylxoG4JcHF50J7EHnnBW3AY1qXtUMu7kDjCp7dnggB1sIbqEQ==", + "license": "MIT", + "dependencies": { + "@mixmark-io/domino": "^2.2.0" + }, + "engines": { + "node": ">=18", + "npm": ">=9" + } + }, + "node_modules/turndown-plugin-gfm": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/turndown-plugin-gfm/-/turndown-plugin-gfm-1.0.2.tgz", + "integrity": "sha512-vwz9tfvF7XN/jE0dGoBei3FXWuvll78ohzCZQuOb+ZjWrs3a0XhQVomJEb2Qh4VHTPNRO4GPZh0V7VRbiWwkRg==", + "license": "MIT" + }, "node_modules/type-fest": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", @@ -18661,6 +18782,15 @@ "node": ">=14.17" } }, + "node_modules/undici": { + "version": "7.30.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.2.tgz", + "integrity": "sha512-mLyPQnHwUxaM/rideoK/+KL8DaAJLRl4aBCfmX444aCSLnIaomqPLtNRe2jdCYcsk5wZzXrDIQC8ZeYNRAYyIA==", + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, "node_modules/undici-types": { "version": "7.24.6", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", @@ -19522,6 +19652,40 @@ "node": ">=0.8.0" } }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation", + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-encoding/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index c452cbd2304e..c5fb64396b97 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,7 +5,7 @@ "scripts": { "docusaurus": "docusaurus", "start": "docusaurus start", - "build": "docusaurus build", + "build": "docusaurus build && node scripts/agent-build.mjs", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", @@ -20,6 +20,7 @@ "@docusaurus/preset-classic": "^3.5.2", "@mdx-js/react": "^3.0.0", "@pondorasti/remark-img-links": "^1.0.8", + "cheerio": "^1.2.0", "clsx": "^2.0.0", "nprogress": "^0.2.0", "prism-react-renderer": "^2.3.0", @@ -30,7 +31,9 @@ "react-dom": "^18.3.1", "react-icons": "^5.4.0", "react-router-dom": "^7.1.5", - "react-window": "^2.2.7" + "react-window": "^2.2.7", + "turndown": "^7.2.5", + "turndown-plugin-gfm": "^1.0.2" }, "devDependencies": { "@docusaurus/module-type-aliases": "^3.10.1", diff --git a/frontend/scripts/agent-build.mjs b/frontend/scripts/agent-build.mjs new file mode 100644 index 000000000000..ce86839cd287 --- /dev/null +++ b/frontend/scripts/agent-build.mjs @@ -0,0 +1,235 @@ +// Runs after `docusaurus build`. Gives every page a Markdown twin and writes the files +// agents look for: llms.txt, agent-instructions.md, sitemap.md, robots.txt and 404.md. All +// plain files, so any static host (GitHub Pages included) serves them. Also writes +// agent-manifest.json, an inventory of the build for a server that wants to answer +// Accept: text/markdown on the page URLs themselves. Usage: agent-build.mjs [buildDir] +import * as cheerio from "cheerio"; +import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises"; +import path from "node:path"; +import TurndownService from "turndown"; +import { gfm } from "turndown-plugin-gfm"; + +const buildDir = path.resolve(process.argv[2] || "build"); +const origin = (process.env.SITE_URL || "https://open.mp").replace(/\/$/, ""); + +const turndown = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced", bulletListMarker: "-" }); +turndown.use(gfm); +turndown.addRule("codeBlock", { + filter: (node) => node.nodeName === "PRE", + replacement: (_content, node) => { + const code = node.querySelector("code") || node; + const language = /language-([\w-]+)/.exec(`${code.getAttribute("class") || ""} ${node.getAttribute("class") || ""}`)?.[1] || ""; + return `\n\n\`\`\`${language}\n${code.textContent.replace(/\n$/, "")}\n\`\`\`\n\n`; + }, +}); + +const MIME = { + html: "text/html", md: "text/markdown", txt: "text/plain", xml: "application/xml", json: "application/json", + js: "text/javascript", css: "text/css", map: "application/json", png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", + gif: "image/gif", webp: "image/webp", svg: "image/svg+xml", ico: "image/x-icon", woff: "font/woff", woff2: "font/woff2", + ttf: "font/ttf", otf: "font/otf", mp4: "video/mp4", webm: "video/webm", mp3: "audio/mpeg", pdf: "application/pdf", + zip: "application/zip", webmanifest: "application/manifest+json", +}; +const typeOf = (file) => MIME[path.extname(file).slice(1).toLowerCase()] || "application/octet-stream"; + +async function walk(dir, found = []) { + for (const entry of await readdir(dir, { withFileTypes: true })) { + if (entry.name.startsWith(".")) continue; + const full = path.join(dir, entry.name); + if (entry.isDirectory()) await walk(full, found); + else found.push(full); + } + return found; +} + +const webPath = (file) => `/${path.relative(buildDir, file).split(path.sep).join("/")}`; +const isErrorDoc = (p) => /^\/(?:[a-zA-Z-]+\/)?404\.html$/.test(p); +// Static HTML files that are not pages of the site. +const isVerification = (p) => /^(?:\/[a-zA-Z-]+)?\/google[0-9a-f]+\.html$/.test(p) || /^(?:\/[a-zA-Z-]+)?\/images\//.test(p); +const routeOf = (htmlPath) => { + const route = htmlPath.replace(/(?:\/index)?\.html$/, ""); + return route === "" ? "/" : route; +}; +const markdownOf = (htmlPath) => (htmlPath === "/index.html" ? "/index.md" : htmlPath.replace(/\.html$/, ".md")); + +// Live data the page only loads in the browser, which a Markdown reader would otherwise miss. +const LIVE_NOTES = [ + [/^(?:\/[a-zA-Z-]+)?\/servers$/, `The server list is loaded live in the browser. Read it directly as JSON from https://api.open.mp/servers/ (details for one server: https://api.open.mp/servers/{ip:port}).`], + [/^(?:\/[a-zA-Z-]+)?\/partners$/, `The partner list is loaded live in the browser. Read it from https://api.open.mp/servers/ and keep the entries where \`pr\` is true.`], +]; + +function toMarkdown(html, route) { + const $ = cheerio.load(html); + const title = $("title").first().text().trim(); + const description = $('meta[name="description"]').attr("content")?.trim() || ""; + const language = $("html").attr("lang") || "en"; + const root = $("article").length === 1 ? $("article").first() : $("#__docusaurus_skipToContent_fallback").first(); + root.find( + 'script, style, svg, button, nav, aside, footer, [aria-hidden="true"], [role="img"], .hash-link, .pagination-nav, .theme-edit-this-page, .theme-doc-toc-mobile, .theme-doc-toc-desktop, .theme-doc-breadcrumbs, .theme-doc-version-badge, .loading-banner, img[alt=""]', + ).remove(); + root.find("pre br").replaceWith("\n"); + root.find("pre .token-line").each((_, line) => { + const node = $(line); + if (!node.text().endsWith("\n")) node.append("\n"); + }); + root.find("a[href]").each((_, a) => { + const href = $(a).attr("href"); + if (href?.startsWith("/")) $(a).attr("href", `${origin}${href}`); + }); + root.find("img[src]").each((_, img) => { + const src = $(img).attr("src"); + if (src?.startsWith("/")) $(img).attr("src", `${origin}${src}`); + }); + const body = turndown.turndown(root.html() || "").replace(/\n{3,}/g, "\n\n").trim(); + const note = LIVE_NOTES.find(([pattern]) => pattern.test(route))?.[1]; + const canonical = `${origin}${route === "/" ? "/" : route}`; + const front = [ + "---", + `title: ${JSON.stringify(title)}`, + ...(description ? [`description: ${JSON.stringify(description)}`] : []), + `canonical: ${canonical}`, + `language: ${language}`, + "---", + "", + ].join("\n"); + return { title, description, canonical, language, markdown: `${front}\n${body || description}${note ? `\n\n${note}` : ""}\n` }; +} + +// The theme is normally set by an inline script, which would leave the page light with +// JavaScript off. This is the fallback: with JavaScript on, the script replaces it before paint. +const withTheme = (html) => html.replace(/]*data-theme)/, " + withTheme(html).replace( + "", + ``, + ); + +// Only English pages get a Markdown copy: agents read English, and copying all 25 languages +// would add tens of thousands of files and minutes to every build for little gain. +const isEnglish = (html) => /]*\slang=["']?en(?:-[A-Za-z]+)?(?=["'\s>])/.test(html); + +const files = await walk(buildDir); +const routes = {}; +const pages = []; +const errorDocs = []; + +for (const file of files) { + const htmlPath = webPath(file); + if (!htmlPath.endsWith(".html") || isVerification(htmlPath)) continue; + const html = await readFile(file, "utf8"); + if (!isEnglish(html)) { + await writeFile(file, withTheme(html)); + continue; + } + if (isErrorDoc(htmlPath)) { + errorDocs.push(htmlPath); + const prefix = htmlPath.replace(/\/404\.html$/, ""); + await writeFile(file, injectLinks(html, `${origin}${prefix}/404.md`)); + await writeFile( + path.join(buildDir, `${prefix.slice(1)}/404.md`.replace(/^\//, "")), + `# 404: page not found\n\nThis address does not exist on open.mp. Do not keep guessing URLs; use one of these:\n\n- [Site index for agents](${origin}/llms.txt)\n- [Every page](${origin}/sitemap.md)\n- [XML sitemap](${origin}/sitemap.xml)\n`, + ); + continue; + } + const route = routeOf(htmlPath); + const mdPath = markdownOf(htmlPath); + const page = toMarkdown(html, route); + await writeFile(path.join(buildDir, mdPath.slice(1)), page.markdown); + await writeFile(file, injectLinks(html, `${origin}${mdPath}`)); + routes[route] = { html: htmlPath, markdown: mdPath, canonical: page.canonical, language: page.language }; + pages.push({ route, mdPath, title: page.title.replace(/ \| .*$/, ""), language: page.language }); +} + +const defaultLanguagePages = pages.filter((page) => !/^\/(?:ar|bs|de|es|fa|fil|fr|hu|id|it|nl|pl|pt-BR|ro|ru|sl|sr|ta|th|tr|uk|vi|zh-CN|zh-TW)(?:\/|$)/.test(page.route)); +const link = (page) => `- [${page.title}](${origin}${page.mdPath})`; +const pick = (pattern) => defaultLanguagePages.filter((page) => pattern.test(page.route)).sort((a, b) => a.route.localeCompare(b.route)); + +const llms = `# open.mp + +> open.mp (Open Multiplayer) is a multiplayer mod for Grand Theft Auto: San Andreas, fully backwards compatible with SA-MP. This site has its documentation, scripting reference, downloads, server list and blog. + +## When to use this site + +- Install or run the open.mp launcher or server. +- Look up Pawn scripting functions, callbacks and constants for open.mp and SA-MP. +- Move a SA-MP gamemode or server to open.mp. +- Find current launcher and server releases, or list public servers. + +## Start here + +- [Agent instructions](${origin}/agent-instructions.md) +- [Every page](${origin}/sitemap.md) +- [Documentation](${origin}/docs.md) +- [Server installation](${origin}/docs/server/Installation.md) +- [Launcher downloads](${origin}/downloads/launcher.md) +- [Server downloads](${origin}/downloads/server.md) +- [Changelog](${origin}/docs/changelog.md) + +## Data + +- [Public server list as JSON](https://api.open.mp/servers/) + +## Optional + +- [Blog](${origin}/blog.md) +- [Animations reference](${origin}/animations.md) +- [Source code](https://github.com/openmultiplayer) +`; + +const instructions = `# open.mp: how to use this site + +> The canonical website is ${origin}/. Pages are available as HTML for people and as Markdown for agents. + +## Reading pages + +Add \`.md\` to any page's path to get it as Markdown: + +\`\`\`bash +curl ${origin}/docs/server/Installation.md +\`\`\` + +Start from [llms.txt](${origin}/llms.txt) or the [list of every page](${origin}/sitemap.md). Each Markdown page begins with frontmatter holding its title, canonical URL and language. Cite the canonical URL. + +## Live data + +The server list is at https://api.open.mp/servers/ as a JSON array. Useful fields: \`ip\`, \`hn\` (name), \`pc\` (players), \`pm\` (max players), \`gm\` (game mode), \`la\` (language), \`pa\` (password), \`omp\` (runs open.mp), \`pr\` (partner). Details for one server are at https://api.open.mp/servers/{ip:port}. + +## Boundaries + +This website does not offer an MCP server, or any API for changing a game server. Reading a page or the server list does not change anything. Do not claim otherwise, and do not invent endpoints. + +## Missing pages + +If a page is missing, go back to these indexes rather than guessing addresses. +`; + +const sitemapMd = `# open.mp: every page\n\n${[ + ["Main", /^\/(?:$|servers$|partners$|downloads\/|animations$|uid$)/], + ["Documentation", /^\/docs(?:\/|$)/], + ["Blog", /^\/blog(?:\/|$)/], +] + .map(([name, pattern]) => `## ${name}\n\n${pick(pattern).map(link).join("\n")}`) + .join("\n\n")}\n\n## For agents\n\n- [llms.txt](${origin}/llms.txt)\n- [Agent instructions](${origin}/agent-instructions.md)\n`; + +await writeFile(path.join(buildDir, "llms.txt"), llms); +await writeFile(path.join(buildDir, "agent-instructions.md"), instructions); +await writeFile(path.join(buildDir, "sitemap.md"), sitemapMd); +await writeFile( + path.join(buildDir, "robots.txt"), + `User-agent: *\nContent-Signal: search=yes, ai-input=yes, ai-train=yes\nAllow: /\n\nSitemap: ${origin}/sitemap.xml\n`, +); + +const manifestFiles = {}; +for (const file of await walk(buildDir)) { + const p = webPath(file); + if (p === "/agent-manifest.json") continue; + manifestFiles[p] = { type: typeOf(p) }; +} +for (const route of Object.values(routes)) manifestFiles[route.markdown].canonical = route.canonical; +for (const doc of errorDocs) { + manifestFiles[doc.replace(/\.html$/, ".md")].noindex = true; +} +const manifest = { origin, routes, files: manifestFiles, errorDocuments: errorDocs }; +await writeFile(path.join(buildDir, "agent-manifest.json"), `${JSON.stringify(manifest)}\n`); +const size = (await stat(path.join(buildDir, "agent-manifest.json"))).size; +console.log(`Agent build: ${pages.length} pages mirrored to Markdown, ${errorDocs.length} error documents, manifest ${Math.round(size / 1024)} KB.`); From 59db51d9731f35f8a9c073c36252c393ea3400e6 Mon Sep 17 00:00:00 2001 From: itsneufox Date: Wed, 18 Nov 2026 00:19:04 +0000 Subject: [PATCH 3/4] redesign the site New homepage with a launcher preview and still feature tiles, shared page and UI styles, a server list split into pages, quiet notice cards, a new footer, and restyled downloads, partners, servers, uid, animations and 404 pages. --- frontend/docusaurus.config.ts | 40 +- frontend/public/images/launcher/add.svg | 3 + .../images/launcher/close_side_lists.svg | 49 + frontend/public/images/launcher/copy.png | Bin 0 -> 1519 bytes frontend/public/images/launcher/darktheme.svg | 4 + frontend/public/images/launcher/discord.svg | 11 + frontend/public/images/launcher/fav_add.svg | 4 + .../public/images/launcher/fav_remove.svg | 7 + frontend/public/images/launcher/fav_tab.svg | 4 + frontend/public/images/launcher/favorite.png | Bin 0 -> 1857 bytes frontend/public/images/launcher/filter.svg | 4 + frontend/public/images/launcher/game.svg | 26 + frontend/public/images/launcher/internet.svg | 4 + frontend/public/images/launcher/ip.svg | 4 + frontend/public/images/launcher/language.svg | 2 + .../public/images/launcher/lighttheme.svg | 4 + frontend/public/images/launcher/locked.svg | 4 + frontend/public/images/launcher/mode.svg | 4 + frontend/public/images/launcher/nickname.svg | 4 + frontend/public/images/launcher/omp.png | Bin 0 -> 2359 bytes .../images/launcher/open_side_lists.svg | 47 + frontend/public/images/launcher/partner.svg | 4 + frontend/public/images/launcher/play.svg | 1 + frontend/public/images/launcher/recently.svg | 4 + frontend/public/images/launcher/search.svg | 4 + frontend/public/images/launcher/settings.svg | 4 + frontend/public/images/launcher/unlocked.svg | 4 + .../public/images/launcher/window_close.svg | 1 + .../images/launcher/window_maximize.svg | 1 + .../images/launcher/window_minimize.svg | 1 + frontend/src/components/HomeArt/index.tsx | 304 ++++ .../src/components/HomeArt/styles.module.css | 629 +++++++ .../LauncherSim/JoinPrompt.module.css | 126 ++ .../src/components/LauncherSim/JoinPrompt.tsx | 58 + frontend/src/components/LauncherSim/index.tsx | 517 ++++++ .../components/LauncherSim/styles.module.css | 755 ++++++++ frontend/src/components/PhoneFrame/index.tsx | 21 + .../components/PhoneFrame/styles.module.css | 69 + frontend/src/components/ServerInfoPage.tsx | 172 +- frontend/src/components/ServerList/index.tsx | 530 ++++++ frontend/src/components/ServerRow.tsx | 112 +- frontend/src/components/ui/Carousel.tsx | 149 ++ frontend/src/components/ui/Notice.tsx | 56 + frontend/src/components/ui/Page.tsx | 39 + frontend/src/components/ui/useScrollReveal.ts | 26 + frontend/src/css/custom.css | 1559 +++++------------ frontend/src/css/ui.css | 1156 ++++++++++++ frontend/src/lib/downloads/common.tsx | 50 +- frontend/src/pages/animations.module.css | 416 +---- frontend/src/pages/animations.tsx | 69 +- frontend/src/pages/downloads.module.css | 421 ++--- frontend/src/pages/index.module.css | 1023 +++++++++-- frontend/src/pages/index.tsx | 891 +++++++--- frontend/src/pages/partners.tsx | 443 +---- frontend/src/pages/servers/index.tsx | 594 +------ frontend/src/pages/uid.tsx | 44 +- frontend/src/theme/Footer/Layout/index.tsx | 19 + frontend/src/theme/Footer/LinkItem/index.tsx | 38 + frontend/src/theme/NotFound/Content/index.tsx | 8 +- .../theme/NotFound/Content/styles.module.css | 55 +- 60 files changed, 7207 insertions(+), 3391 deletions(-) create mode 100644 frontend/public/images/launcher/add.svg create mode 100644 frontend/public/images/launcher/close_side_lists.svg create mode 100644 frontend/public/images/launcher/copy.png create mode 100644 frontend/public/images/launcher/darktheme.svg create mode 100644 frontend/public/images/launcher/discord.svg create mode 100644 frontend/public/images/launcher/fav_add.svg create mode 100644 frontend/public/images/launcher/fav_remove.svg create mode 100644 frontend/public/images/launcher/fav_tab.svg create mode 100644 frontend/public/images/launcher/favorite.png create mode 100644 frontend/public/images/launcher/filter.svg create mode 100644 frontend/public/images/launcher/game.svg create mode 100644 frontend/public/images/launcher/internet.svg create mode 100644 frontend/public/images/launcher/ip.svg create mode 100644 frontend/public/images/launcher/language.svg create mode 100644 frontend/public/images/launcher/lighttheme.svg create mode 100644 frontend/public/images/launcher/locked.svg create mode 100644 frontend/public/images/launcher/mode.svg create mode 100644 frontend/public/images/launcher/nickname.svg create mode 100644 frontend/public/images/launcher/omp.png create mode 100644 frontend/public/images/launcher/open_side_lists.svg create mode 100644 frontend/public/images/launcher/partner.svg create mode 100644 frontend/public/images/launcher/play.svg create mode 100644 frontend/public/images/launcher/recently.svg create mode 100644 frontend/public/images/launcher/search.svg create mode 100644 frontend/public/images/launcher/settings.svg create mode 100644 frontend/public/images/launcher/unlocked.svg create mode 100644 frontend/public/images/launcher/window_close.svg create mode 100644 frontend/public/images/launcher/window_maximize.svg create mode 100644 frontend/public/images/launcher/window_minimize.svg create mode 100644 frontend/src/components/HomeArt/index.tsx create mode 100644 frontend/src/components/HomeArt/styles.module.css create mode 100644 frontend/src/components/LauncherSim/JoinPrompt.module.css create mode 100644 frontend/src/components/LauncherSim/JoinPrompt.tsx create mode 100644 frontend/src/components/LauncherSim/index.tsx create mode 100644 frontend/src/components/LauncherSim/styles.module.css create mode 100644 frontend/src/components/PhoneFrame/index.tsx create mode 100644 frontend/src/components/PhoneFrame/styles.module.css create mode 100644 frontend/src/components/ServerList/index.tsx create mode 100644 frontend/src/components/ui/Carousel.tsx create mode 100644 frontend/src/components/ui/Notice.tsx create mode 100644 frontend/src/components/ui/Page.tsx create mode 100644 frontend/src/components/ui/useScrollReveal.ts create mode 100644 frontend/src/css/ui.css create mode 100644 frontend/src/theme/Footer/Layout/index.tsx create mode 100644 frontend/src/theme/Footer/LinkItem/index.tsx diff --git a/frontend/docusaurus.config.ts b/frontend/docusaurus.config.ts index 59b4498302b6..f482c50563d0 100644 --- a/frontend/docusaurus.config.ts +++ b/frontend/docusaurus.config.ts @@ -207,7 +207,7 @@ const config: Config = { onUntruncatedBlogPosts: "warn", }, theme: { - customCss: "./src/css/custom.css", + customCss: ["./src/css/custom.css", "./src/css/ui.css"], }, } satisfies Preset.Options, ], @@ -302,23 +302,25 @@ const config: Config = { { type: "docSidebar", sidebarId: "docsSidebar", - position: "right", + position: "left", label: "Docs", + className: "navbar-icon navbar-icon-docs", + }, + { to: "/blog", label: "Blog", position: "left", className: "navbar-icon navbar-icon-blog" }, + { to: "https://forum.open.mp/", label: "Forums", position: "left", className: "navbar-icon navbar-icon-forums" }, + { to: "/servers", label: "Servers", position: "left", className: "navbar-icon navbar-icon-servers" }, + { to: "/partners", label: "Partners", position: "left", className: "navbar-icon navbar-icon-partners" }, + { + href: "https://opencollective.com/openmultiplayer", + label: "Donate to us", + position: "left", + className: "navbar-icon navbar-icon-donate navbar-donate", }, - { to: "/blog", label: "Blog", position: "right" }, - { to: "https://forum.open.mp/", label: "Forums", position: "right" }, - { to: "/servers", label: "Servers", position: "right" }, - { to: "/partners", label: "Partners", position: "right" }, // { // href: "https://github.com/openmultiplayer", // label: "GitHub", // position: "right", // }, - { - href: "https://opencollective.com/openmultiplayer", - label: "Donate", - position: "right", - }, { type: "localeDropdown", // This adds the language switcher position: "right", @@ -327,12 +329,14 @@ const config: Config = { }, footer: { logo: { - alt: "open.mp logo", - src: "images/assets/logo.svg", + alt: "open.mp", + src: "images/assets/wordmark-coloured.svg", + href: "/", + height: 44, }, links: [ { - title: "Documentations", + title: "Documentation", items: [ { label: "Introduction", @@ -376,6 +380,14 @@ const config: Config = { { title: "More", items: [ + { + label: "Download Launcher", + to: "/downloads/launcher", + }, + { + label: "Download Server", + to: "/downloads/server", + }, { label: "Servers", to: "/servers", diff --git a/frontend/public/images/launcher/add.svg b/frontend/public/images/launcher/add.svg new file mode 100644 index 000000000000..cf83fc08c303 --- /dev/null +++ b/frontend/public/images/launcher/add.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/public/images/launcher/close_side_lists.svg b/frontend/public/images/launcher/close_side_lists.svg new file mode 100644 index 000000000000..74f284b84a17 --- /dev/null +++ b/frontend/public/images/launcher/close_side_lists.svg @@ -0,0 +1,49 @@ + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/public/images/launcher/copy.png b/frontend/public/images/launcher/copy.png new file mode 100644 index 0000000000000000000000000000000000000000..27ed9a9a6ac9b3a7151ca40bb5c503439234a7d7 GIT binary patch literal 1519 zcmbV~c~H|=5XT=76oXU^;8icmVFZ-`9vHPXOj5|GDIf()D~5XEfk25JBh}GV#0wGY zXgCDyc%VpPFc63_nsAeZ1PCD^2{|DFA-0Mf5lDXwGmdSC{?Rw@y?wjy^WB}<*-PPs zP#5@OH~_!}ABK&D?6%3{O2^0W*L;%oK z02U?uV2=#n5rq@V)DR<*sYOz?NT$;Cyw;fqv?hzbx8MAFKp<1=%od25cDGOe zHH`|Y0%c?J8rr*zT2nt%?tgD652XF?dkUChK861g`8W0{0KGrD5IF^lI=ULA$`_5T z>^ku)VVj^`#o#vNmQ>_CF3&GzRn;{^UA_101@#fL^m#3l*OXUMQ9!TaG)VZOc5YK^ zjaVk?P*;m(uY^*l&$SXczgbq@EURx(uxdnw^s4;Q$~&c%cNv@}sq!9^OXJj1AD6Rg zgbl5o<$OV1i@dQ-$*vdwUdAb;v+pyxJfXCNUCrbRo^tCY3T>-W-=;FODs`QDv!-XV z&r=PTstsbfrmMTJU2Rb4OiDwq%Gj$m_BG49y1HMB6&h#;S~_)dZBI+5wnNh`>oVGG zHil-@9~zVdQY2v)WIrz7Yl@MHLD9)YcF`SU{9ubbsN98+&2)V3l2WygfbBnrz%uXs`~yHFrxSB@A-<8%*R-9b&~PyW48-E#oN;R|;k$3jfTSliJqH z2%k}LB4DzP-H+Qtu`D&%dqCG>_QHHo%q zyyjii%auu%H$7V)0&ot)^U3z{T6b&|K59DS3!*R3TeAz|-{+QtiN%-^w3?iA@qMo6 zwxS8sH_to}^NV2^4kw|r_)B|OkfYuwbDMbVTP&``QN>y4dNk@O`ECqm(X6#dda+k= zSrKKk>nL2yZZ$qEm9D3+NEqW#(X5KpPYZG?<$_+^x zNTpZ_dpi;aqb&oT$vVn{aR-Kk(&ON!HtE?vVwnp;7WC;dYbu$CD1A_x*GLG9VBY7_=q; zwFb2z3Kfh-1) + + + diff --git a/frontend/public/images/launcher/discord.svg b/frontend/public/images/launcher/discord.svg new file mode 100644 index 000000000000..174b1da35208 --- /dev/null +++ b/frontend/public/images/launcher/discord.svg @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/fav_add.svg b/frontend/public/images/launcher/fav_add.svg new file mode 100644 index 000000000000..df49d1776074 --- /dev/null +++ b/frontend/public/images/launcher/fav_add.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/fav_remove.svg b/frontend/public/images/launcher/fav_remove.svg new file mode 100644 index 000000000000..e7ac0c610cf5 --- /dev/null +++ b/frontend/public/images/launcher/fav_remove.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/fav_tab.svg b/frontend/public/images/launcher/fav_tab.svg new file mode 100644 index 000000000000..df49d1776074 --- /dev/null +++ b/frontend/public/images/launcher/fav_tab.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/favorite.png b/frontend/public/images/launcher/favorite.png new file mode 100644 index 0000000000000000000000000000000000000000..95f8d6a24d139269e0584ac9c4074b74893b16eb GIT binary patch literal 1857 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!6p}rHd>I(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4Fdy{bAV5XD^S4=J;z%HPB-+No*1}3HgJ7t=z3Sr z<*vTVJss!A+U|GsT<+<*T-A2Cp>BOg&-H(3=v_mvyLv!1&bRg5_B%M-F>twW=>9;< z?v9?@eLc5_n)Y{eo$mn^=sVxkcD$+Ya9`K?uA%EyBj@|NZuj(D9_YB-({sD4>vB)u z^{%e#9gsOL_q5&5Imcf&vbb*Od`sW)u8!LsT^Eou=!abI=uqFfJNnLa^a2+5-vI_P zEyM8t|Nqn2EbM^EXn#qNUoem+8L-GYB$U-ou}Va?UL zz;9ZQG2HP@5p!*q21sKj&iOU=cFxP!?ujVCM03 zaSVw#ym$Kd_{$Cw?fkC$Lkk+K^+O7@gSa@fye5h<>iR7RXbW&VEg+fX$QZal@0$o? z>Q2G!KdKU;k7*0qYSLR>0lD22!s{o)C2VD6tb-&XwahQMR<`h!=# zT$q}ZYx#FU*wOfo(5Nm$&dyI6-)h+HUOrOgO`iPZboe?ZZJn*z*Yj0wUo+8M>A9_K z>VZ`zx{qhv_`*{)ZN9zHrR2F?x3*k8Fl+zy@YhC?eJQEQZ>>_&3$GfLzS?QXU};_~ zdG5(e##*^@U32^6SqxlU-4gR8dfb@f*RI&mV7lgh!y}ZNgILsl zmGfl^p5MMD$Z<*79tUa8O_FIJnT)qxnEvXqdeYD3=Wl$s+SXOK+U`Ev=|hY1g^zE4 zsq1~Y>`jKaddB_E*lSzYE)M3of75XHu6Jy^cG*7Py<1>IdR}GUtB)}kgiY@!F=+L_ zPo8~hnd`^q{eCYc*I&6=>giCtKE3H)+Ht+pH=c9ePv7$VWZZ(S@fP>*chxq2>s`ce zpinV&jU+?Lxw%=5l>rj=8Fh@u{jT16bCh$I|J}kYy?LfQQ?u`Uo;BV1j?HahbKc#i z8Ev!EsxzLmTzYBnD9uUJ{RIohquYjW*xh{f#Aj7q))4ThC~kNsc_{wl=aUZ)9&mi5 zbztFj&YGG-uMgXNKYy-aV_{xh4bQturxYU}A3w{-!IOoXDzX*?zd9T3{_k$JRqdbF z4=pka!?S)Qn0Kt~=l${^Fwv%3xoN`Z%&K|w|Jit%w>A~dO8!!1yfS{xkMPetF?O~4 zmN(`xc**i;ttoun>_3+9Y_8L|6>SGyrS}-q1PLjRa8q{ zBT7;dOH!?pi&B9UgOP!ev96(ku7O#IfrXWUiIt&+wt<0_fx-IyOa7r~$jwj5OsmAL p;oc(|C!humxD6$lxv9k^iMa*1^>lu>oeR{%;OXk;vd$@?2>^vh3PJz? literal 0 HcmV?d00001 diff --git a/frontend/public/images/launcher/filter.svg b/frontend/public/images/launcher/filter.svg new file mode 100644 index 000000000000..08b747e55903 --- /dev/null +++ b/frontend/public/images/launcher/filter.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/game.svg b/frontend/public/images/launcher/game.svg new file mode 100644 index 000000000000..cdae9b49e854 --- /dev/null +++ b/frontend/public/images/launcher/game.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/internet.svg b/frontend/public/images/launcher/internet.svg new file mode 100644 index 000000000000..8ea78844ad77 --- /dev/null +++ b/frontend/public/images/launcher/internet.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/ip.svg b/frontend/public/images/launcher/ip.svg new file mode 100644 index 000000000000..951af7756407 --- /dev/null +++ b/frontend/public/images/launcher/ip.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/language.svg b/frontend/public/images/launcher/language.svg new file mode 100644 index 000000000000..ed78baada4b8 --- /dev/null +++ b/frontend/public/images/launcher/language.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/frontend/public/images/launcher/lighttheme.svg b/frontend/public/images/launcher/lighttheme.svg new file mode 100644 index 000000000000..3bac7d9bdd5c --- /dev/null +++ b/frontend/public/images/launcher/lighttheme.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/public/images/launcher/locked.svg b/frontend/public/images/launcher/locked.svg new file mode 100644 index 000000000000..4a334844b5fc --- /dev/null +++ b/frontend/public/images/launcher/locked.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/mode.svg b/frontend/public/images/launcher/mode.svg new file mode 100644 index 000000000000..e1efb4c13581 --- /dev/null +++ b/frontend/public/images/launcher/mode.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/nickname.svg b/frontend/public/images/launcher/nickname.svg new file mode 100644 index 000000000000..1a8d0c4a8d3c --- /dev/null +++ b/frontend/public/images/launcher/nickname.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/omp.png b/frontend/public/images/launcher/omp.png new file mode 100644 index 0000000000000000000000000000000000000000..15bca8cc33f414abfadeadac4378c4d8790538c7 GIT binary patch literal 2359 zcmZ{mc~H~W7RP@qk{Ci25FscMh(#2E$R-f9ECEpq(g+4kC}B@zl?0@q>|iJYQLupu zvPf}x>>w49rLnRI4G_W>wy=gBf=UwB7yo%P?~l&8=bpLWdp~pM-ZOLNq&PWVl7py1 z005A?Y>&o>BmA3#WyCW%GV;r}g_k|X0RSSk03bFI0Jg+Z>^uO3Apu~K008FM0H7R_ z`|c+T@rI1&)k|n#|C<#wzQ`0S2Se;{k^w+g;hRga#-ew`B8YO?!4|{=!<3cf-d5z( z001m`8Exh4`r#w}W&pk)*0%3gFJO-5@Vg>f4aZj^9JCxU3|}}^TiS_Zty5>6%BI(1 zlAP3OzrHRidi_2&YcuYKq|(( zSNA;DW~u>y63u$wRnOat;o(*VYRUS+C)wipQ(9-T^0C4&&a&s8# zCfnsAF(CUi+3i4&Z<$L5Yfnp4NeXC1JBFBjs-Fi9kp^{if7WSF2KE&Ba`Ch z#YcBC6?xabKD?IyH)cWeM+6vkIDsTB0hD9yUOi4&dLmz^NGuY;K&zXP&1Gt+U) zuK3?c`MI##Q+^;1kmvlu=n}g>Ao?bF8dlbCtGNpUi(qu54AYkJIZv6Hu700F5W*k# zmks6A2W!atZ`Eid#LVDxvl#g7T(xzH0*yB=Tc6U}G{aDfx8F6_oWA=(%4WDpSd|&< zibDx5j*pMx0_~R$mMu(i#Hq&R6EUtOJbH|=#pd4h?uUKrOJw~((#Y;JwTBnTi(R_ zA2B$R+(&qit&Yhmfe&t4uDy05r>1m06*_1~ziyI>C^h@P^QGZ!xdB?Zbe z0uGII*tH5vHOe}?-+vA7to@KQbpUPMq4pb06;Y%JRQe5inNnu@ub$xk7@&(v)t`m* zjnv+-0%ZJ-Cruqcv#MZgZ5(9Yd-2BW885Od57XIE!b(Yxqp8I(1!GUiNw3yiMvFcI zkXyZvm*}OU9q%V=C<}tElVY%~5eC&#|2BhKts{b`7*Y8TF12Qihnq*KU{stqAg|+? zY-Ac-2bKDp8a2#pRY64&=?(at(l46iteg*u;@(Zi8D!iO{>tWnmwCQ_Kc;ov@ih+(w%xi=q~wNm4snb*ToBlK z%N^Nv$K!1+?N&sL`vfbzts4pxR`F1Kx0R5s1XYtM7rB?|CWRN@z&U+63*Lh|K>9`}Ioqgu8F<7sKGURHpZ`dc+3-5lYBVYxv+=+vttg$f6>(?THuKXnFko*lDY28x~6FCMOW9c zm=06=F%vD#cpp0&)!5794&>QdKw2Uuo~#ETixmQCj27eB<-KjMz#`G z#jCRGu*F22meK%+9{Nk1uHHYM0gKYh1n9>N$&Dn~Xb*Xx4iK=3aF#aefcRm#skWyb z@^xn8>}x`OcocXwH$gk#U@(`?9Zq zjr@*Z{h0dg*FE`?!rS+(u%a@>$!whIgXO>ZE$ea52{uk7qS@JPd&)%(|c0bxfPu#b(itT65m3V!JjzN&wO$GW9+a$5HkOxS(! zb~pk{*25tRX9NxB$C@r*S?UWpC(~U)SYIA7H4K-IzZ%h$5DQ~4yBdk*&8w!osljL1 z-cA6pG;=q*1}Y=&Wq#i6KIF6A(=h#Lj#6Fo;E39-iMIUvi@I5PAFJ$N&OOLUM+q_< zqJ`YobSfc71D`KCD*AN&nY+A%Vb_m+c4sl5zh;-vw|&2l-(j7I*O21oHvf$68w*x7 zNv^)%5o#tVJ#5!`#jPT643mv6J_ONoKS^BMFz3F6ym--YD>$mDjNh6xEIMn~nqlqV z>>eVT<1A2r*d1-^&lG*i1COLgUC4{ds~3?~R4?31T{;?rNF1)-=p80lAMNzmsU0nl zXrYWwt;Rh{sNyeV4zWWT73&m1S({n|k!0g~aj6P0tMk-8Qd%z0c)LK^MBZBo|HycA z{;BVLE@{ZCDOA5Rx;27oe}SkPe$r*^yVDNY2Goe!-o1z~c_okd&jWCSW5mEAkpgcj zcHoLcOCh4-=kG%1+yB#fxHu7+Zi@(WNUp8RgWXq_O?p*Q;1X6rlIF<4&K_f(k?yK& zpzWhU2~}o&VBhO0CRm7#ssZf?gYd#}UoO*7YJTCJ?8-ll6_-hSX#eKQ%`g6s*RLZq ziDi1KtjMC8*#S|dTVr#Ku;A-BD295z*kJn@D`%}7`iDkCBr`14iIaf}szSJDlb+?m zxYuhEDiiLEzMq~9vssYY_1;zAAFR4};crMgHu7A(LVI-&mTbIjL3@H1<-0ppD9xq* zTK;BVk{PvL(yYL45H|?lQ*2!+-X0VmbFWYzaR3aE28OywQ(XgNX9GiX@i=FwgG8Dm zk+FF?=>G!(gS|< + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/public/images/launcher/partner.svg b/frontend/public/images/launcher/partner.svg new file mode 100644 index 000000000000..b8e4f2c0f7d1 --- /dev/null +++ b/frontend/public/images/launcher/partner.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/play.svg b/frontend/public/images/launcher/play.svg new file mode 100644 index 000000000000..eb75877b2933 --- /dev/null +++ b/frontend/public/images/launcher/play.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/public/images/launcher/recently.svg b/frontend/public/images/launcher/recently.svg new file mode 100644 index 000000000000..50cd894f0f9f --- /dev/null +++ b/frontend/public/images/launcher/recently.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/search.svg b/frontend/public/images/launcher/search.svg new file mode 100644 index 000000000000..7c8ffbae22ce --- /dev/null +++ b/frontend/public/images/launcher/search.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/settings.svg b/frontend/public/images/launcher/settings.svg new file mode 100644 index 000000000000..30165fc866f3 --- /dev/null +++ b/frontend/public/images/launcher/settings.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/unlocked.svg b/frontend/public/images/launcher/unlocked.svg new file mode 100644 index 000000000000..eb5ae3e95c58 --- /dev/null +++ b/frontend/public/images/launcher/unlocked.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/frontend/public/images/launcher/window_close.svg b/frontend/public/images/launcher/window_close.svg new file mode 100644 index 000000000000..08c0a8cfea72 --- /dev/null +++ b/frontend/public/images/launcher/window_close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/public/images/launcher/window_maximize.svg b/frontend/public/images/launcher/window_maximize.svg new file mode 100644 index 000000000000..bbc50a009a61 --- /dev/null +++ b/frontend/public/images/launcher/window_maximize.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/public/images/launcher/window_minimize.svg b/frontend/public/images/launcher/window_minimize.svg new file mode 100644 index 000000000000..49c2ef523f2a --- /dev/null +++ b/frontend/public/images/launcher/window_minimize.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/components/HomeArt/index.tsx b/frontend/src/components/HomeArt/index.tsx new file mode 100644 index 000000000000..788f83c6b882 --- /dev/null +++ b/frontend/src/components/HomeArt/index.tsx @@ -0,0 +1,304 @@ +import React, { useEffect, useRef, useState } from "react"; +import { FaGithub } from "react-icons/fa"; +import { FaCar, FaCrosshairs, FaFolderOpen, FaPersonWalking } from "react-icons/fa6"; +import { SiCplusplus } from "react-icons/si"; + +import styles from "./styles.module.css"; + +// Type-only art for the homepage feature tiles, matching the F9, .amx and C++ tiles. +// Decorative: the text beside them says the same thing. + +const THREATS = [ + ["exploit", "payload", "overflow", "injection", "crash", "exploit"], + ["overflow", "crash", "exploit", "payload", "injection", "overflow"], + ["payload", "injection", "crash", "overflow", "exploit", "payload"], + ["crash", "exploit", "injection", "payload", "overflow", "crash"], + ["injection", "overflow", "payload", "exploit", "crash", "injection"], +]; + +const ThreatWords = ({ words }: { words: string[] }) => ( + + {words.map((word, index) => ( + {word} + ))} + +); + +export const ShieldArt = (): React.ReactElement => ( + + + {THREATS.map((words, index) => ( + + + + + ))} + + RCE + +); + +// What players send, and what actually crosses the network. +const STREAMS = [ + ["/login ******** gg wp hey everyone /pm Ghost meet at grove ", "9f3a c1e8 07bd 52a6 e4f0 3b7c d218 6a9e b47e 1fd2 a805 6c39 "], + ["SetPlayerPos OnPlayerText anyone up for a race? /engine on ", "2d6c 8ea1 f350 b79d 416e ca02 7f8b e593 e071 5ab9 3cd4 f826 "], + ["nice shot /register ******** OnPlayerUpdate see you in LS ", "6ba4 d093 2e7f 81c5 a3d6 f90b 47e2 5c1a 09be 73a1 c6f4 1d58 "], +]; + +const StreamHalf = ({ text, encrypted }: { text: string; encrypted: boolean }) => ( + + + {text} + {text} + {text} + {text} + + +); + +// Readable text goes into the lock and comes out the far side as hex, in both directions. +// The lock clicks shut once when the card comes into view, and never opens again. +export const EncryptionArt = (): React.ReactElement => ( + + + {STREAMS.map(([plain, hex], index) => ( + + + + + ))} + + + + + + + + +); + +// Real repositories in github.com/openmultiplayer. +const REPOS = [ + ["open.mp", "launcher", "web", "omp-stdlib"], + ["open.mp-sdk", "RakNet", "compiler", "open.mp-capi"], + ["launcher", "omp-stdlib", "open.mp", "open.mp-sdk"], + ["compiler", "web", "open.mp-capi", "RakNet"], + ["omp-stdlib", "open.mp-sdk", "launcher", "compiler"], +]; + +const RepoNames = ({ names }: { names: string[] }) => ( + + {[...names, ...names].map((name, index) => ( + {name} + ))} + +); + +export const RepoArt = (): React.ReactElement => ( + + + {REPOS.map((names, index) => ( + + + + + ))} + + + +); + +export const Cursor = ({ pressed = false }: { pressed?: boolean }): React.ReactElement => ( + +); + +const AmxFile = () => ( + + + + AMX + +); + +// A file you might still have lying about: SA-MP's classic gamemode, sitting in the server's +// gamemodes folder as it is. Still on purpose: the card is about nothing needing to change. +export const AmxArt = (): React.ReactElement => ( + + + + + + + grandlarc.amx + + + +); + +// "The universe of C++ libraries": ones the open.mp server is built on (see lib/, SDK/lib/ and +// the Conan packages in its repository), in orbit around the logo. +const ORBITS = [ + { className: styles.orbitInner, names: ["RakNet", "SQLite", "OpenSSL", "ICU"] }, + { className: styles.orbitOuter, names: ["nlohmann/json", "cpp-httplib", "GLM", "cxxopts", "ttmath", "robin-hood"] }, +]; + +export const CppArt = (): React.ReactElement => ( + + {ORBITS.map(({ className, names }) => ( + + {names.map((name, index) => ( + + {name} + + ))} + + ))} + + +); + +// NPCs going about their day, under the code that made them. Each row swaps between two +// states on its own clock, so they never change together. +const NPCS = [ + { name: "Ghost", first: "On foot", Icon1: FaPersonWalking, second: "Aiming", Icon2: FaCrosshairs }, + { name: "Wheelie", first: "Driving", Icon1: FaCar, second: "On foot", Icon2: FaPersonWalking }, + { name: "Rookie", first: "On foot", Icon1: FaPersonWalking, second: "Driving", Icon2: FaCar }, +]; + +export const NpcListArt = (): React.ReactElement => ( + +); + +const CODE_START = "#include \n\nmain() {}\n\n"; +const CODE_SNIPPETS = [ + `public OnPlayerConnect(playerid)\n{\n SendClientMessage(playerid, -1, "Hey!");\n return 1;\n}`, + `public OnPlayerSpawn(playerid)\n{\n GivePlayerMoney(playerid, 1000);\n return 1;\n}`, + `public OnPlayerDeath(playerid)\n{\n SetPlayerScore(playerid, 0);\n return 1;\n}`, +]; +// Everyone writes the short name first. Then remembers it isn't defined, and goes back. +const FULL_NAME = "SendClientMessage"; +const SHORT_NAME = "SCM"; + +const CODE_TOKEN = /("[^"]*"?)|(#include|\bpublic\b|\breturn\b)|()|(\b[A-Za-z_]\w*(?=\())|(-?\b\d+\b)/g; + +const highlight = (text: string): React.ReactNode[] => { + const out: React.ReactNode[] = []; + let end = 0; + for (const match of text.matchAll(CODE_TOKEN)) { + const start = match.index; + if (start > end) out.push(text.slice(end, start)); + const className = match[1] || match[3] ? styles.tokString : match[2] ? styles.tokKeyword : match[4] ? styles.tokFunction : styles.tokNumber; + out.push({match[0]}); + end = start + match[0].length; + } + if (end < text.length) out.push(text.slice(end)); + return out; +}; + +const pause = (ms: number) => new Promise((resolve) => window.setTimeout(resolve, ms)); + +// Someone writing a gamemode, forever: one callback after another. The one that calls +// SendClientMessage gets written whole with SCM first, then corrected from the top. Static +// without JavaScript or with reduced motion, and idle while off screen. +export const CodeTyper = (): React.ReactElement => { + const first = CODE_START + CODE_SNIPPETS[0]; + const [code, setCode] = useState({ text: first, caret: first.length }); + const root = useRef(null); + + useEffect(() => { + if (window.matchMedia("(prefers-reduced-motion: reduce)").matches || !root.current) return undefined; + let stopped = false; + let visible = false; + const observer = new IntersectionObserver(([entry]) => { + visible = entry.isIntersecting; + }, { threshold: 0.5 }); + observer.observe(root.current); + const step = async (text: string, caret: number, ms: number) => { + await pause(ms); + while (!visible && !stopped) await pause(250); + if (!stopped) setCode({ text, caret }); + }; + const clear = async (text: string) => { + for (let n = text.length - 1; n >= CODE_START.length && !stopped; n -= 1) await step(text.slice(0, n), n, 10); + }; + const write = async (text: string) => { + for (let n = CODE_START.length + 1; n <= text.length && !stopped; n += 1) await step(text.slice(0, n), n, 24 + (n % 7) * 5); + }; + const writeWithMistake = async (correct: string) => { + const nameAt = correct.indexOf(FULL_NAME); + const before = correct.slice(0, nameAt); + const after = correct.slice(nameAt + FULL_NAME.length); + const wrong = before + SHORT_NAME + after; + await write(wrong); + await pause(1300); + for (let at = wrong.length - 1; at >= before.length + SHORT_NAME.length && !stopped; at -= 1) await step(wrong, at, 16); + await pause(450); + for (let k = SHORT_NAME.length - 1; k >= 0 && !stopped; k -= 1) { + await step(before + SHORT_NAME.slice(0, k) + after, before.length + k, 110); + } + await pause(250); + for (let k = 1; k <= FULL_NAME.length && !stopped; k += 1) { + await step(before + FULL_NAME.slice(0, k) + after, before.length + k, 36); + } + await pause(600); + await step(correct, correct.length, 10); + }; + const run = async () => { + let shown = first; + await pause(1800); + for (let snippet = 0; !stopped; snippet = (snippet + 1) % CODE_SNIPPETS.length) { + const next = CODE_START + CODE_SNIPPETS[snippet]; + await clear(shown); + await pause(450); + if (next.includes(FULL_NAME)) await writeWithMistake(next); + else await write(next); + shown = next; + await pause(3000); + } + }; + run(); + return () => { + stopped = true; + observer.disconnect(); + }; + }, [first]); + + return ( + + ); +}; diff --git a/frontend/src/components/HomeArt/styles.module.css b/frontend/src/components/HomeArt/styles.module.css new file mode 100644 index 000000000000..b0c427c74df2 --- /dev/null +++ b/frontend/src/components/HomeArt/styles.module.css @@ -0,0 +1,629 @@ +.rce { + position: relative; + display: inline-block; + background: none; + color: var(--omp-danger); + font-size: var(--badge-size, 6rem); + font-weight: 800; + letter-spacing: -0.03em; + line-height: 1; +} + +.rce::after { + content: ""; + position: absolute; + top: 54%; + right: -0.14em; + left: -0.14em; + height: 0.11em; + border-radius: 999px; + background: var(--omp-danger); + box-shadow: 0 0 0 0.045em var(--omp-item); + transform: rotate(-9deg); +} + +.threats { + position: relative; + display: grid; + width: 100%; + height: 100%; + place-items: center; + overflow: hidden; + background: none; +} + +.threatRows { + position: absolute; + inset: 0; + display: flex; + flex-direction: column; + justify-content: space-evenly; + overflow: hidden; + color: var(--omp-faint); + font-family: var(--ifm-font-family-monospace); + font-size: var(--cipher-size, 1.375rem); + font-weight: 600; + letter-spacing: normal; + line-height: 1; + white-space: nowrap; + opacity: 0.32; + -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent); + mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent); +} + +.threatRows .rowBack { + color: inherit; + opacity: 1; +} + +.threatRows s { + padding-right: 1.25em; +} + +.threats .rce { + z-index: 1; + padding: 0 0.15em; + text-shadow: + 0 0 0.25em var(--omp-item), + 0 0 0.5em var(--omp-item), + 0 0 0.8em var(--omp-item); +} + +/* Centred on its body, not its shackle, so the rows of text run straight into the body */ +.padlock { + position: absolute; + z-index: 1; + top: 50%; + left: 50%; + overflow: visible; + width: auto; + height: 52%; + color: var(--omp-ink); + filter: + drop-shadow(0 0 0.35rem var(--omp-item)) + drop-shadow(0 0 0.9rem var(--omp-item)); + translate: -50% -68.4%; +} + +.streams { + position: absolute; + top: 50%; + right: 0; + left: 0; + display: flex; + height: 28%; + flex-direction: column; + justify-content: space-evenly; + direction: ltr; + font-family: var(--ifm-font-family-monospace); + font-size: var(--stream-font, 1.0625rem); + font-weight: 600; + letter-spacing: 0; + line-height: 1; + white-space: pre; + translate: 0 -50%; + -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); + mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); +} + +.stream { + display: grid; + grid-template-columns: 1fr 1fr; +} + +.streamPlain, +.streamHex { + overflow: hidden; +} + +.streamPlain { + color: var(--omp-ink); +} + +.streamHex { + color: var(--omp-accent); +} + +.streamTrack { + display: flex; + width: max-content; +} + +/* The logo has see-through parts; keep the scrolling names from showing through them. */ +.githubMark { + border-radius: 50%; + background: var(--omp-item); +} + +.rowOut, +.rowBack { + display: flex; + width: max-content; + background: none; +} + +.rowOut > span, +.rowBack > span { + background: none; + transform: none; +} + +.rowBack { + color: var(--omp-ink); + opacity: 0.75; +} + +.repos { + position: absolute; + inset: 0; + display: flex; + width: 100%; + height: 100%; + flex-direction: column; + justify-content: space-evenly; + overflow: hidden; + background: none; + color: var(--omp-accent); + font-family: var(--ifm-font-family-monospace); + font-size: var(--cipher-size, 1.375rem); + letter-spacing: normal; + line-height: 1; + white-space: nowrap; + opacity: 0.6; + -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent); + mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent); +} + +.repos b { + padding-right: 1.5em; + font-weight: 600; +} + +/* The padlock: the shackle turns on its long right leg. It's a metal tube, so it narrows as + it turns but never gets thinner: the stroke ignores the scaling, and is set in real pixels + to match the padlock's size. */ +.shackle { + stroke-width: 21px; + transform-box: view-box; + transform-origin: 48px 34px; + vector-effect: non-scaling-stroke; +} + +@media (prefers-reduced-motion: no-preference) { + .shackle { + animation: shackleClose 2.8s linear 300ms both; + } + + .padlock { + animation: padlockState 2.8s linear 300ms both; + } +} + +/* Runs once and stays shut: this card is about encryption, so the lock is never seen opening. */ +@keyframes shackleClose { + 0%, 12% { + transform: translateY(-12px) scaleX(-1.000); + } + + 16% { + transform: translateY(-12px) scaleX(-0.966); + } + + 20% { + transform: translateY(-12px) scaleX(-0.866); + } + + 24% { + transform: translateY(-12px) scaleX(-0.707); + } + + 28% { + transform: translateY(-12px) scaleX(-0.500); + } + + 32% { + transform: translateY(-12px) scaleX(-0.259); + } + + 36% { + transform: translateY(-12px) scaleX(0.020); + } + + 40% { + transform: translateY(-12px) scaleX(0.259); + } + + 44% { + transform: translateY(-12px) scaleX(0.500); + } + + 48% { + transform: translateY(-12px) scaleX(0.707); + } + + 52% { + transform: translateY(-12px) scaleX(0.866); + } + + 56% { + transform: translateY(-12px) scaleX(0.966); + } + + 60%, 66% { + transform: translateY(-12px) scaleX(1.000); + } + + 78%, 100% { + transform: translateY(0px) scaleX(1.000); + } +} + +@keyframes padlockState { + 0%, 74%, 92%, 100% { + color: var(--omp-ink); + transform: none; + } + + 78% { + color: var(--omp-accent); + transform: translateY(1.5px); + } +} + +/* C++ libraries in orbit. Each ring turns; each label turns back the same amount, so the text + stays upright. */ +.universe { + position: relative; + display: grid; + width: 100%; + height: 100%; + place-items: center; + overflow: hidden; + direction: ltr; + letter-spacing: 0; +} + +.cppLogo { + z-index: 1; + width: 5.5rem; + height: 5.5rem; + color: #659ad2; + filter: drop-shadow(0 0 1rem var(--omp-item)); +} + +.orbit { + --orbit-size: 15rem; + position: absolute; + top: 50%; + left: 50%; + width: var(--orbit-size); + height: var(--orbit-size); + margin: calc(var(--orbit-size) / -2) 0 0 calc(var(--orbit-size) / -2); + border: 1px dashed var(--omp-line); + border-radius: 50%; +} + +.orbitOuter { + --orbit-size: 26rem; +} + +.planet { + position: absolute; + top: 50%; + left: 50%; + transform: rotate(var(--angle)) translateX(calc(var(--orbit-size) / 2)) rotate(calc(var(--angle) * -1)); +} + +.planet > span { + display: block; + padding: 0.2rem 0.5rem; + border-radius: var(--omp-radius-small); + background: var(--omp-surface); + color: var(--omp-muted); + font-family: var(--ifm-font-family-monospace); + font-size: 0.8125rem; + font-weight: 600; + line-height: 1.3; + white-space: nowrap; + translate: -50% -50%; +} + + +@media (max-width: 720px) { + .cppLogo { + width: 4.25rem; + height: 4.25rem; + } + + .orbit { + --orbit-size: 11.5rem; + } + + .orbitOuter { + --orbit-size: 20rem; + } + + .planet > span { + font-size: 0.6875rem; + } +} + +/* The grandlarc.amx tile */ +.amxWindow { + display: flex; + width: 100%; + height: 100%; + flex-direction: column; + background: var(--omp-surface); + box-shadow: inset 0 0 0 1px var(--omp-line); + color: var(--omp-ink); + letter-spacing: 0; +} + +.amxBar { + display: flex; + flex: none; + align-items: center; + gap: 0.5rem; + padding: 0.625rem 0.875rem; + background: var(--omp-item); + color: var(--omp-muted); + font-size: 0.8125rem; + font-weight: 500; + line-height: 1.2; +} + +.amxBar svg { + flex: none; + color: var(--omp-accent); + font-size: 0.9375rem; +} + +.amx { + position: relative; + display: grid; + flex: 1; + place-items: center; + min-height: 0; + overflow: hidden; +} + +.amxItem { + display: flex; + width: 11rem; + height: 10.5rem; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 0.5rem; + border-radius: var(--omp-radius-small); + background: color-mix(in srgb, var(--omp-primary) 32%, transparent); + box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--omp-primary) 70%, transparent); +} + +.cursor { + display: block; + filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); + transition: transform 120ms ease; +} + +.cursorDown { + transform: scale(0.78); +} + +.amxFile { + width: auto; + height: 5.5rem; + flex: none; +} + +.amxSheet { + fill: var(--omp-row); +} + +.amxFold { + fill: var(--omp-button-hover); +} + +.amxLabel { + fill: var(--omp-accent); + font-family: var(--ifm-font-family-monospace); + font-size: 12px; + font-weight: 700; +} + +.amxName { + font-family: var(--ifm-font-family-monospace); + font-size: 0.9375rem; + font-weight: 500; + line-height: 1; +} + +/* NPC list, under the code in the NPC tile */ +.npcs { + position: absolute; + z-index: 1; + right: 1rem; + bottom: 1rem; + left: 1rem; + display: grid; + gap: 0.4rem; + font-size: 0.8125rem; +} + +.npc { + display: flex; + height: 2.125rem; + align-items: center; + gap: 0.5rem; + padding: 0 0.625rem; + border-radius: var(--omp-radius-small); + background: var(--omp-row); + color: var(--omp-ink); +} + +.npcName { + font-weight: 600; +} + +.npcBadge { + padding: 0.1rem 0.3rem; + border-radius: 3px; + background: var(--omp-primary); + color: #fff; + font-size: 0.625rem; + font-weight: 700; + line-height: 1.2; +} + +/* Both states share one cell, one fading out as the other fades in */ +.npcStates { + display: grid; + margin-left: auto; + justify-items: end; + color: var(--omp-muted); +} + +.npcState { + display: inline-flex; + grid-area: 1 / 1; + align-items: center; + gap: 0.35rem; + white-space: nowrap; +} + +.npcState + .npcState { + opacity: 0; +} + +@media (prefers-reduced-motion: no-preference) { + .npcState { + animation: npcStateA var(--npc-time, 7.1s) ease-in-out infinite; + } + + .npcState + .npcState { + animation-name: npcStateB; + } + + .npc:nth-child(2) { --npc-time: 9.7s; } + .npc:nth-child(3) { --npc-time: 5.3s; } +} + +@keyframes npcStateA { + 0%, 44%, 100% { opacity: 1; } + 50%, 94% { opacity: 0; } +} + +@keyframes npcStateB { + 0%, 44%, 100% { opacity: 0; } + 50%, 94% { opacity: 1; } +} + +/* The editor in the scripting tile: dark in both themes, like most people's */ +.editor { + display: flex; + height: 100%; + flex-direction: column; + background: #1e1e24; + color: #e6e6ea; +} + +.editorBar { + display: flex; + flex: none; + align-items: center; + gap: 0.375rem; + padding: 0.625rem 0.875rem; + background: #16161a; + color: #ffffff99; + font-size: 0.75rem; + font-weight: 500; +} + +.editorBar i { + width: 0.5625rem; + height: 0.5625rem; + border-radius: 50%; + background: #ffffff2e; +} + +.editorBar span { + margin-left: 0.5rem; +} + +.editorCode { + flex: 1; + margin: 0; + padding: 0.875rem 1rem; + overflow: hidden; + border-radius: 0; + background: none; + color: inherit; + font-size: var(--editor-font, 0.8125rem); + line-height: 1.55; + white-space: pre; +} + +.editorCaret { + display: inline-block; + width: 2px; + height: 1.1em; + margin: 0 -1px; + background: #a79aeb; + vertical-align: text-bottom; +} + +.tokKeyword { color: #c792ea; font-style: italic; } +.tokString { color: #f78fb3; } +.tokFunction { color: #7ee787; } +.tokNumber { color: #ffcb8b; } + +@media (max-width: 720px) { + .streams { + --stream-font: 0.8125rem; + } + + .shackle { + stroke-width: 16px; + } + + .editorCode { + --editor-font: 0.6875rem; + padding: 0.75rem; + } + + .npcs { + right: 0.75rem; + bottom: 0.625rem; + left: 0.75rem; + gap: 0.25rem; + font-size: 0.75rem; + } + + .npc { + height: 1.625rem; + } + + /* Short tile: two NPCs fit beside the code */ + .npc:nth-child(3) { + display: none; + } + + .amxItem { + width: 9rem; + height: 8rem; + } + + .amxBar { + padding: 0.5rem 0.75rem; + font-size: 0.75rem; + } + + .amxFile { + height: 4rem; + } + + .amxName { + font-size: 0.8125rem; + } +} diff --git a/frontend/src/components/LauncherSim/JoinPrompt.module.css b/frontend/src/components/LauncherSim/JoinPrompt.module.css new file mode 100644 index 000000000000..3aac7f77b1fa --- /dev/null +++ b/frontend/src/components/LauncherSim/JoinPrompt.module.css @@ -0,0 +1,126 @@ +/* Sizes follow the launcher's JoinServerPrompt styles after its sc() scaler. */ +.prompt { + position: relative; + width: 100%; + max-width: 21.25rem; + overflow: hidden; + border-radius: 9px; + background: var(--omp-surface); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); + color: var(--omp-ink); + font-size: 0.875rem; + line-height: 1.35; + text-align: left; +} + +.banner { + display: flex; + height: 5rem; + align-items: center; + justify-content: center; + background: + linear-gradient(rgba(20, 16, 50, 0.45), rgba(20, 16, 50, 0.45)), + url(/images/assets/hero-bg.jpg) center / cover; + color: #fff; + font-size: 1.75rem; + font-weight: 800; + letter-spacing: -0.02em; +} + +.close { + position: absolute; + top: 0.5rem; + right: 0.5rem; + display: flex; + width: 1.5rem; + height: 1.5rem; + align-items: center; + justify-content: center; + border-radius: 4px; + background: #897af1; +} + + +.closeIcon { + background-color: #fff !important; +} + +.logoRow { + display: flex; + align-items: flex-start; + justify-content: space-between; + height: 2.25rem; + padding: 0.45rem 1.1rem 0 0.6rem; +} + +.logo { + display: grid; + width: 4.375rem; + height: 4.375rem; + flex: none; + place-items: center; + margin-top: -2.5rem; + border: 2px solid var(--omp-surface); + border-radius: 50%; + background: var(--omp-item); +} + +.play { + background-color: #897af1 !important; +} + +.info { + padding: 0.6rem 0.95rem 0; +} + +.infoLine { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.form { + padding: 0.75rem 0.95rem 0.95rem; +} + +.input { + display: flex; + height: 2.05rem; + align-items: center; + margin-top: 0.25rem; + padding: 0 0.55rem; + border-radius: 4px; + background: var(--omp-input); + color: var(--omp-faint); + font-style: italic; +} + +.version { + display: flex; + align-items: center; + gap: 0.55rem; + margin-top: 0.6rem; +} + +.version span { + display: flex; + height: 1.65rem; + flex: 1; + align-items: center; + justify-content: center; + border-radius: 4px; + background: var(--omp-input); +} + +.connect { + display: flex; + height: 2.05rem; + align-items: center; + justify-content: center; + margin-top: 0.75rem; + border-radius: 4px; + background: var(--omp-primary); + color: #fff !important; + font-weight: 600; + text-decoration: none !important; +} diff --git a/frontend/src/components/LauncherSim/JoinPrompt.tsx b/frontend/src/components/LauncherSim/JoinPrompt.tsx new file mode 100644 index 000000000000..03445e23f0ee --- /dev/null +++ b/frontend/src/components/LauncherSim/JoinPrompt.tsx @@ -0,0 +1,58 @@ +import Translate from "@docusaurus/Translate"; +import React from "react"; + +import { Icon } from "./index"; +import styles from "./JoinPrompt.module.css"; + +// The launcher's join dialog (src/containers/JoinServerPrompt in the launcher repo). +// A picture used in the homepage bento; nothing in it is clickable. +type Props = { + name: string; + address: string; + players: string; + nickname?: string; +}; + +const JoinPrompt = ({ name, address, players, nickname = "Ghost" }: Props): React.ReactElement => { + const connect = Connect; + const closeIcon = ; + + return ( +
+
+ + Your Server + +
+ {closeIcon} +
+ + + + +
+
+
+ Server: {name} +
+
+ Address: {address} +
+
+ Players: {players} +
+
+
+ Nickname: +
{nickname}
+
+ SA-MP Version: + 0.3.7-R1 ▾ +
+ {connect} +
+
+ ); +}; + +export default JoinPrompt; diff --git a/frontend/src/components/LauncherSim/index.tsx b/frontend/src/components/LauncherSim/index.tsx new file mode 100644 index 000000000000..4b2745c97054 --- /dev/null +++ b/frontend/src/components/LauncherSim/index.tsx @@ -0,0 +1,517 @@ +import Translate, { translate } from "@docusaurus/Translate"; +import clsx from "clsx"; +import React, { useEffect, useState, type CSSProperties, type ReactNode } from "react"; + +import styles from "./styles.module.css"; + +// A static picture of the open.mp launcher window, drawn in HTML (openmultiplayer/ +// launcher, src/containers). Nothing in it is clickable. Every server here is made up on purpose: the front page must +// not promote real servers, and the addresses are from the reserved 192.0.2.0/24 +// documentation range. When the launcher's layout or theme changes, this file and +// its stylesheet follow by hand. + +const ICONS = "/images/launcher"; +const PING_POINTS = 25; + +export type SampleServer = { + address: string; + name: string; + mode: string; + language: string; + ping: number; + players: number; + maxPlayers: number; + omp: boolean; + password: boolean; + partner: boolean; +}; + +const sample = ( + id: number, + name: string, + mode: string, + language: string, + ping: number, + players: number, + maxPlayers: number, + flags: { omp?: boolean; password?: boolean; partner?: boolean } = {}, +): SampleServer => ({ + address: `192.0.2.${id}:7777`, + name, + mode, + language, + ping, + players, + maxPlayers, + omp: flags.omp ?? false, + password: flags.password ?? false, + partner: flags.partner ?? false, +}); + +export const SAMPLE_SERVERS: SampleServer[] = [ + sample(13, "Demo Cops & Robbers", "Cops and Robbers", "English", 48, 198, 300), + sample(10, "Example Roleplay | Sample Server", "Roleplay", "English", 34, 428, 500, { omp: true, partner: true }), + sample(18, "Sample Zombie Survival", "Survival", "English", 83, 52, 100), + sample(15, "Sample Deathmatch Arena", "Deathmatch", "Russian", 118, 131, 200), + sample(11, "Demo Freeroam #1", "Freeroam", "English", 52, 312, 500, { omp: true }), + sample(20, "Demo Private Community", "Roleplay", "English", 29, 18, 50, { omp: true, password: true }), + sample(16, "Example Trucking Company", "Trucking", "English", 44, 87, 150, { omp: true }), + sample(22, "Example Build Server", "Sandbox", "English", 58, 6, 32, { omp: true, password: true }), + sample(12, "Sample Stunt Arena", "Stunts", "Spanish", 71, 246, 300, { omp: true, partner: true }), + sample(19, "Example Mini-Games", "Mini-games", "Polish", 67, 41, 100, { omp: true }), + sample(14, "Example Drift Club", "Drift", "Portuguese", 96, 154, 200, { omp: true }), + sample(23, "Demo Testing Grounds", "Sandbox", "English", 25, 0, 32, { omp: true }), + sample(17, "Demo Race Series", "Racing", "German", 39, 64, 100, { omp: true }), + sample(21, "Sample Derby Nights", "Derby", "Turkish", 142, 12, 50), +]; + +const PLAYER_NAMES = [ + "Ghost", "Nitro", "Rookie", "Sprinter", "Wheelie", "Bandit", + "Drifter", "Comet", "Falcon", "Maverick", "Pixel", "Turbo", +]; + +const playersOf = (server: SampleServer) => + PLAYER_NAMES.slice(0, Math.min(server.players, PLAYER_NAMES.length)) + .map((name, index) => ({ + name, + score: ((server.ping * (index + 3) * 37) % 900) + 12, + })) + .sort((a, b) => b.score - a.score); + +const rulesOf = (server: SampleServer): [string, string][] => [ + ["allowed_clients", "0.3.7, 0.3.DL"], + ["artwork", server.omp ? "Yes" : "No"], + ["lagcomp", "On"], + ["mapname", "San Andreas"], + ["version", server.omp ? "omp" : "0.3.7-R2"], + ["weather", String(server.ping % 20)], + ["weburl", "example.com"], + ["worldtime", `${String(server.ping % 24).padStart(2, "0")}:00`], +]; + +export const Icon = ({ + name, + size = 16, + className, +}: { + name: string; + size?: number; + className?: string; +}) => ( +