diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..ac27ec7 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,40 @@ +const path = require("path") + +module.exports = { + env: { + browser: true, + es6: true, + }, + extends: [ + "airbnb-typescript", + "airbnb/hooks", + "next", + "next/core-web-vitals", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:import/recommended", + "plugin:react/jsx-runtime", + "plugin:react/recommended", + "prettier", + ], + plugins: [ + "@typescript-eslint", + "import", + "prettier", + "react", + ], + "settings": { + "react": { + "version": "detect" + } + }, + rules: { + "newline-per-chained-call": "off", + "react/jsx-pascal-case": "off", + "react/require-default-props": "off", + }, + parserOptions: { + project: "./tsconfig.json", + }, + overrides: [], +} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c05a05d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,45 @@ +name: Publish + +on: + release: + types: + - published + push: + branches: + - main + pull_request_target: + branches: + - main + +jobs: + storybook: + name: Publish storybook + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install NodeJS + uses: actions/setup-node@v3 + with: + registry-url: https://npm.pkg.github.com + scope: "@eveshipfit" + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: npm install + + - name: Build website + run: npm run build + + - name: Publish to Cloudflare Pages + uses: cloudflare/pages-action@v1 + id: pages + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }} + directory: dist + branch: ${{ github.event_name == 'release' && 'main' || github.event_name == 'push' && 'latest' || format('pr/{0}', github.event.pull_request.number) }} diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..7ed4d7d --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,32 @@ +name: Testing + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + testing: + name: Testing + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install NodeJS + uses: actions/setup-node@v3 + with: + registry-url: https://npm.pkg.github.com + scope: "@eveshipfit" + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: npm install + + - name: Run linter + run: npm run lint diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ee83eac --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/dist +/node_modules +/.next diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..5cf5267 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@eveshipfit:registry=https://npm.pkg.github.com diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..68b1edc --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023 TrueBrain + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d03f064 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# EVEShip.fit + +This repository contains the website as shown on [https://eveship.fit](https://eveship.fit). + +It is a NextJS project, and depends on the [ESF React Component Library](https://github.com/EVEShipFit/react) for all visuals. diff --git a/app/favicon.ico b/app/favicon.ico new file mode 100644 index 0000000..718d6fe Binary files /dev/null and b/app/favicon.ico differ diff --git a/app/globals.css b/app/globals.css new file mode 100644 index 0000000..d94d416 --- /dev/null +++ b/app/globals.css @@ -0,0 +1,5 @@ +* { + box-sizing: border-box; + padding: 0; + margin: 0; +} diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 0000000..b495fd6 --- /dev/null +++ b/app/layout.tsx @@ -0,0 +1,21 @@ +import React from 'react' +import type { Metadata } from 'next' + +import './globals.css' + +export const metadata: Metadata = { + title: 'EVEShip.fit', + description: 'View, Create, and Share your EVE Online ship fits online', +} + +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + + {children} + + ) +} diff --git a/app/page.module.css b/app/page.module.css new file mode 100644 index 0000000..ff9de33 --- /dev/null +++ b/app/page.module.css @@ -0,0 +1,23 @@ +.main { + margin: 0 auto; + width: 1580px; +} + +.content { + background-color: #111111; + border-radius: 25px; + display: flex; + margin-top: 10px; + justify-content: flex-end; + padding: 20px; +} + +.selection { +} + +.fit { +} + +.statistics { + margin-top: 50px; +} diff --git a/app/page.tsx b/app/page.tsx new file mode 100644 index 0000000..9fd58b3 --- /dev/null +++ b/app/page.tsx @@ -0,0 +1,42 @@ +"use client"; + +import React from "react"; + +import { DogmaEngineProvider, EveDataProvider, ShipFitExtended, ShipSnapshotProvider, ShipStatistics } from "@eveshipfit/react"; +import type { EsiFit } from "@eveshipfit/react"; + +import { Banner } from "@/components/Banner"; +import { Debug } from "@/components/Debug"; + +import styles from "./page.module.css"; + +const Page = () => { + const [activeFit, setActiveFit] = React.useState({"name": "C3 Ratter : NishEM", "ship_type_id": 29984, "description": "", "items": [{"flag": 125, "quantity": 1, "type_id": 45626}, {"flag": 126, "quantity": 1, "type_id": 45591}, {"flag": 127, "quantity": 1, "type_id": 45601}, {"flag": 128, "quantity": 1, "type_id": 45615}, {"flag": 11, "quantity": 1, "type_id": 22291}, {"flag": 12, "quantity": 1, "type_id": 22291}, {"flag": 13, "quantity": 1, "type_id": 22291}, {"flag": 19, "quantity": 1, "type_id": 41218}, {"flag": 20, "quantity": 1, "type_id": 35790}, {"flag": 21, "quantity": 1, "type_id": 2281}, {"flag": 22, "quantity": 1, "type_id": 15766}, {"flag": 23, "quantity": 1, "type_id": 19187}, {"flag": 24, "quantity": 1, "type_id": 19187}, {"flag": 25, "quantity": 1, "type_id": 35790}, {"flag": 27, "quantity": 1, "type_id": 25715}, {"flag": 28, "quantity": 1, "type_id": 25715}, {"flag": 29, "quantity": 1, "type_id": 25715}, {"flag": 30, "quantity": 1, "type_id": 25715}, {"flag": 31, "quantity": 1, "type_id": 25715}, {"flag": 32, "quantity": 1, "type_id": 25715}, {"flag": 33, "quantity": 1, "type_id": 28756}, {"flag": 92, "quantity": 1, "type_id": 31724}, {"flag": 93, "quantity": 1, "type_id": 31824}, {"flag": 94, "quantity": 1, "type_id": 31378}, {"flag": 5, "quantity": 3720, "type_id": 24492}, {"flag": 5, "quantity": 5472, "type_id": 2679}, {"flag": 5, "quantity": 1, "type_id": 35795}, {"flag": 5, "quantity": 1, "type_id": 35794}, {"flag": 5, "quantity": 8, "type_id": 30486}, {"flag": 5, "quantity": 1, "type_id": 35794}, {"flag": 5, "quantity": 396, "type_id": 24492}]}); + + return + +
+
+
+
+ +
+
+ +
+
+ +
; +} + +export default function Home() { + return ( +
+ + + + + +
+ ) +} diff --git a/components/Banner/Banner.module.css b/components/Banner/Banner.module.css new file mode 100644 index 0000000..032321a --- /dev/null +++ b/components/Banner/Banner.module.css @@ -0,0 +1,27 @@ +.banner { + background-color: #cdcdcd; + border-radius: 25px; + margin-top: 10px; + padding: 20px 0; + position: relative; + text-align: center; +} + +.bannerLinks { + display: inline; + position: absolute; + right: 20px; + top: 13px; +} + +.bannerConstruction { + background-color: #c84824; + border-radius: 25px; + color: #c5c5c5; + margin-top: 10px; + padding: 20px 0; + text-align: center; +} +.bannerConstruction > a { + color: #c5f5c5; +} diff --git a/components/Banner/Banner.tsx b/components/Banner/Banner.tsx new file mode 100644 index 0000000..9426bd9 --- /dev/null +++ b/components/Banner/Banner.tsx @@ -0,0 +1,21 @@ +import React from "react"; +import Image from "next/image"; + +import styles from "./Banner.module.css"; + +export const Banner = () => { + return <> +
+ EVEShip.fit - View, Create, and Share your EVE Online ship fits online +
+ + GitHub + +
+
+
+ This website is currently a work in progress; not all functionalities are available yet.
+ Found a bug? Please report it here. +
+ +} diff --git a/components/Banner/index.ts b/components/Banner/index.ts new file mode 100644 index 0000000..f4930c0 --- /dev/null +++ b/components/Banner/index.ts @@ -0,0 +1 @@ +export { Banner } from './Banner'; diff --git a/components/Debug/Debug.module.css b/components/Debug/Debug.module.css new file mode 100644 index 0000000..d810256 --- /dev/null +++ b/components/Debug/Debug.module.css @@ -0,0 +1,17 @@ +.debug { + background-color: #cdcdcd; + border-radius: 25px; + margin-top: 10px; + padding: 20px 0; + position: relative; + text-align: center; +} + +.debugTextArea { + width: 100%; + height: 200px; +} + +.debugError { + color: #c84824; +} diff --git a/components/Debug/Debug.tsx b/components/Debug/Debug.tsx new file mode 100644 index 0000000..c5086be --- /dev/null +++ b/components/Debug/Debug.tsx @@ -0,0 +1,48 @@ +import React from "react"; + +import { useFormatEftToEsi } from "@eveshipfit/react"; +import type { EsiFit } from "@eveshipfit/react"; + +import styles from "./Debug.module.css"; + +const useFormatEsi = () => { + return (esi: string): EsiFit | undefined => { + if (!esi.startsWith("{")) return undefined; + return JSON.parse(esi); + } +}; + +export const Debug = ({ fit, setFit }: { fit: EsiFit, setFit: (fit: EsiFit) => void }) => { + const [fitText, setFitText] = React.useState(JSON.stringify(fit, null, 2)); + const [error, setError] = React.useState(""); + + const formatEsi = useFormatEsi(); + const formatEft = useFormatEftToEsi(); + + function formatFit() { + let esiFit; + try { + esiFit = formatEsi(fitText) || formatEft(fitText); + } catch (e) { + if (e instanceof Error) { + setError(e.message); + } + return; + } + + if (!esiFit) { + setError("String doesn't appear to be either an ESI or an EFT fit."); + return; + } + + setFit(esiFit); + setError(""); + } + + return
+ Still tool is still a work in progress; this textarea allows you, for the time being, to easily import ESI or EFT fits.
+