diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d330a4c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab +indent_size = 4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5fb2562 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: Deploy tweaks to GitHub Pages + +on: + push: + branches: ['main'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: write + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: 'pages' + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - run: bun ci + + - name: Validate Tweaks + run: bun test + + - run: bun run build + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './dist' + + deploy: + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c09d625 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +node_modules/ +tweaks/schema.json +tweaks/tweaks.json +tweaks/*.md +# Ignore any sub directories under tweaks +tweaks/*/ +dist/ +*.py diff --git a/.postcssrc.json b/.postcssrc.json new file mode 100644 index 0000000..9ac0be0 --- /dev/null +++ b/.postcssrc.json @@ -0,0 +1,8 @@ +{ + "plugins": { + "autoprefixer": {}, + "tailwindcss/nesting": {}, + "tailwindcss": {}, + "cssnano": {} + } +} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..b088170 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "trailingComma": "es5", + "semi": true, + "singleQuote": true, + "editorconfig": true, + "printWidth": 120 +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..509f1b3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,23 @@ +{ + "css.customData": [".vscode/tailwind.json"], + "nixEnvSelector.suggestion": false, + "editor.detectIndentation": false, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": ["source.addMissingImports", "source.fixAll.eslint"], + "[nix]": { + "editor.defaultFormatter": "jnoortheen.nix-ide" + }, + "nix.enableLanguageServer": true, + "nix.serverPath": "nixd", + "[toml]": { + "editor.defaultFormatter": "tamasfe.even-better-toml" + }, + "[rust]": { + "editor.defaultFormatter": "rust-lang.rust-analyzer" + }, + "nixEnvSelector.nixFile": "${workspaceFolder}/shell.nix", + "nixEnvSelector.args": "--impure", + "tailwindCSS.suggestions": true, + "tailwindCSS.experimental.classRegex": ["className: '(.*)'"] +} diff --git a/.vscode/tailwind.json b/.vscode/tailwind.json new file mode 100644 index 0000000..96a1f57 --- /dev/null +++ b/.vscode/tailwind.json @@ -0,0 +1,55 @@ +{ + "version": 1.1, + "atDirectives": [ + { + "name": "@tailwind", + "description": "Use the `@tailwind` directive to insert Tailwind's `base`, `components`, `utilities` and `screens` styles into your CSS.", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#tailwind" + } + ] + }, + { + "name": "@apply", + "description": "Use the `@apply` directive to inline any existing utility classes into your own custom CSS. This is useful when you find a common utility pattern in your HTML that you’d like to extract to a new component.", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#apply" + } + ] + }, + { + "name": "@responsive", + "description": "You can generate responsive variants of your own classes by wrapping their definitions in the `@responsive` directive:\n```css\n@responsive {\n .alert {\n background-color: #E53E3E;\n }\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#responsive" + } + ] + }, + { + "name": "@screen", + "description": "The `@screen` directive allows you to create media queries that reference your breakpoints by **name** instead of duplicating their values in your own CSS:\n```css\n@screen sm {\n /* ... */\n}\n```\n…gets transformed into this:\n```css\n@media (min-width: 640px) {\n /* ... */\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#screen" + } + ] + }, + { + "name": "@variants", + "description": "Generate `hover`, `focus`, `active` and other **variants** of your own utilities by wrapping their definitions in the `@variants` directive:\n```css\n@variants hover, focus {\n .btn-brand {\n background-color: #3182CE;\n }\n}\n```\n", + "references": [ + { + "name": "Tailwind Documentation", + "url": "https://tailwindcss.com/docs/functions-and-directives#variants" + } + ] + } + ] +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..df09573 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2023 Rainbow Café + +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/Makefile b/Makefile new file mode 100644 index 0000000..e9f5960 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +develop: +ifeq ($(shell printenv IN_NIX_SHELL),) + @nix develop --impure --command $(shell printenv SHELL) +else + $(info You are already running in a nix shell!) +endif diff --git a/README.md b/README.md new file mode 100644 index 0000000..8f09795 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +## Protontweaks DB + +> [!IMPORTANT] +> This is the Protontweaks DB repository, you can find the `protontweaks` cli [over here](https://github.com/rain-cafe/protontweaks) + +### Usage + +Its highly recommended that if you're planning on fetching tweaks from our api that you lock into a specific version. + +`https://tweaks.rains.cafe/api/v2/.json` + +Old versions will get any new apps that are added, however if a feature isn't supported in the old api it won't get mapped. + +### Adding a tweak? + +- Lookup your the app id of your steam app. + +> [!TIP] +> You can discover the app id by using [https://steamdb.info](https://steamdb.info/apps/)! + +- Copy the contents of [template](./tweaks/.template.json) and create a json file with the name `[your-app-id].json` +- Add any dlls, fonts, etc. +- Create a PR with your changes! + +### Example Tweak File + +```ts +{ + "name": "They Are Billions", + "tweaks": { + // Specify any protontricks here + "tricks": ["gdiplus"], + // Set any environment variables here + "env": {}, + "settings": { + // Informs the client that ESync should be disabled + "esync": false, + // Informs the client that FSync should be disabled + "fsync": false + } + } +} +``` + +### TODO + +- Add support for gpu vendor specific configs diff --git a/app/App.tsx b/app/App.tsx new file mode 100644 index 0000000..5e17693 --- /dev/null +++ b/app/App.tsx @@ -0,0 +1,35 @@ +import { useState, type FC } from 'react'; +import { Outlet, useNavigate } from 'react-router-dom'; +import { AppHeader } from './components/AppHeader'; +import { SearchContext } from './context/search'; +import { Toaster } from 'sonner'; +import { AppFooter } from './components/AppFooter'; + +export const Component: FC = () => { + const navigate = useNavigate(); + const [search, setSearch] = useState(''); + + return ( + + { + navigate('/'); + setSearch(value); + }} + /> +
+ + +
+ +
+ ); +}; diff --git a/app/components/AppFooter.tsx b/app/components/AppFooter.tsx new file mode 100644 index 0000000..8dbfb3b --- /dev/null +++ b/app/components/AppFooter.tsx @@ -0,0 +1,47 @@ +import { type FC } from 'react'; +import { Link } from 'react-router-dom'; +import { Bug, Code2 } from 'lucide-react'; +import { Button } from './Button'; + +export const AppFooter: FC = () => { + return ( +
+
+
+ Built with ❤️ by the{' '} + + Rainbow Cafe + {' '} + Team~ +
+
+ This site uses data from Steam as well as data provided by{' '} + + SteamDB + {' '} + via{' '} + + Algolia + + . +
+
+ This site has no affiliation with Valve Software. This site uses data from All game images and logos are + property of their respective owners. +
+
+
+ + +
+
+ ); +}; diff --git a/app/components/AppHeader.tsx b/app/components/AppHeader.tsx new file mode 100644 index 0000000..7e6a097 --- /dev/null +++ b/app/components/AppHeader.tsx @@ -0,0 +1,77 @@ +import { useEffect, type FC, useState } from 'react'; +import { useSearch } from '../context/search'; +import { Link, useParams } from 'react-router-dom'; +import { ArrowUp, Edit } from 'lucide-react'; +import { cn } from '../utils/cn'; +import { Button } from './Button'; + +type Props = { + onChange?: (value: string) => void; +}; + +export const AppHeader: FC = ({ onChange }) => { + const search = useSearch(); + const [sticky, setSticky] = useState(false); + const { id } = useParams(); + + useEffect(() => { + const listener = () => { + setSticky(window.scrollY > 0); + }; + + window.addEventListener('scroll', listener, { passive: true }); + + return () => { + window.removeEventListener('scroll', listener); + }; + }); + + return ( + <> +
+
+ + Protontweaks DB + +
+ onChange?.(e.target.value)} + /> + +
+
+ + + ); +}; diff --git a/app/components/AppImage.tsx b/app/components/AppImage.tsx new file mode 100644 index 0000000..2b5fe70 --- /dev/null +++ b/app/components/AppImage.tsx @@ -0,0 +1,25 @@ +import { type FC } from 'react'; +import { Link } from 'react-router-dom'; +import { cn } from '../utils/cn'; + +type Props = { + className?: string; + id: string; + to?: string; +}; + +export const AppImage: FC = ({ className, id, to }) => { + return to ? ( + + + + ) : ( + + ); +}; diff --git a/app/components/Button.tsx b/app/components/Button.tsx new file mode 100644 index 0000000..47ccd51 --- /dev/null +++ b/app/components/Button.tsx @@ -0,0 +1,71 @@ +import { type ComponentProps, type FC, type ReactNode } from 'react'; +import { Link } from 'react-router-dom'; +import { cn } from '../utils/cn'; + +type SharedProps = { + children?: ReactNode; + className?: string; +}; + +type LinkProps = SharedProps & { + to: string; + target?: ComponentProps<'a'>['target']; +}; + +type ButtonProps = SharedProps & { + onClick?: () => void; +}; + +type Props = LinkProps | ButtonProps; + +const isLink = (props: Props): props is LinkProps => { + return Object.hasOwn(props, 'to'); +}; + +export const Button: FC = (props) => { + if (isLink(props)) { + if (props.to.startsWith('#')) { + return ( +