commit cc5d147da3a6ba8d275ffd3183329547b40416f9 Author: root <root@dev.> Date: Sat Feb 8 21:31:43 2025 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79518f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +node_modules + +# Output +.output +.vercel +/.svelte-kit +/build + +# OS +.DS_Store +Thumbs.db + +# Env +.env +.env.* +!.env.example +!.env.test + +# Vite +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ab78a95 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +# Package Managers +package-lock.json +pnpm-lock.yaml +yarn.lock diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..3f7802c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,15 @@ +{ + "useTabs": true, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "overrides": [ + { + "files": "*.svelte", + "options": { + "parser": "svelte" + } + } + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5b2950 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# sv + +Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). + +## Creating a project + +If you're seeing this, you've probably already done this step. Congrats! + +```bash +# create a new project in the current directory +npx sv create + +# create a new project in my-app +npx sv create my-app +``` + +## Developing + +Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: + +```bash +npm run dev + +# or start the server and open the app in a new browser tab +npm run dev -- --open +``` + +## Building + +To create a production version of your app: + +```bash +npm run build +``` + +You can preview the production build with `npm run preview`. + +> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..ab63f82 Binary files /dev/null and b/bun.lockb differ diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..dae2fad --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,23 @@ +import prettier from 'eslint-config-prettier'; +import js from '@eslint/js'; +import svelte from 'eslint-plugin-svelte'; +import globals from 'globals'; + +/** @type {import('eslint').Linter.Config[]} */ +export default [ + js.configs.recommended, + ...svelte.configs['flat/recommended'], + prettier, + ...svelte.configs['flat/prettier'], + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node + } + } + }, + { + ignores: ['build/', '.svelte-kit/', 'dist/'] + } +]; diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..d73b913 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "./.svelte-kit/tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": false, + "moduleResolution": "bundler" + } + // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias + // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files + // + // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes + // from the referenced tsconfig.json - TypeScript does not merge them in +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..a7c91a6 --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "scoreboard", + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "format": "prettier --write .", + "lint": "prettier --check . && eslint ." + }, + "devDependencies": { + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/kit": "^2.0.0", + "@sveltejs/vite-plugin-svelte": "^4.0.0", + "eslint": "^9.7.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-svelte": "^2.36.0", + "globals": "^15.0.0", + "prettier": "^3.3.2", + "prettier-plugin-svelte": "^3.2.6", + "svelte": "^5.0.0", + "svelte-adapter-bun": "^0.5.2", + "vite": "^5.0.3" + }, + "dependencies": { + "bootstrap": "^5.3.3" + } +} diff --git a/src/app.html b/src/app.html new file mode 100644 index 0000000..1f5296d --- /dev/null +++ b/src/app.html @@ -0,0 +1,20 @@ +<!doctype html> +<html lang="en"> + + <head> + <meta charset="utf-8" /> + <link rel="icon" href="%sveltekit.assets%/favicon.png" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + %sveltekit.head% + <!-- Add these styles to the head of your HTML file --> + <link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.min.css"> + <!-- Add these scripts to the bottom of your HTML file, just before the closing body tag --> + <script src="/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script> + + </head> + + <body data-sveltekit-preload-data="hover"> + <div style="display: contents">%sveltekit.body%</div> + </body> + +</html> \ No newline at end of file diff --git a/src/lib/index.js b/src/lib/index.js new file mode 100644 index 0000000..856f2b6 --- /dev/null +++ b/src/lib/index.js @@ -0,0 +1 @@ +// place files you want to import through the `$lib` alias in this folder. diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte new file mode 100644 index 0000000..1427948 --- /dev/null +++ b/src/routes/+page.svelte @@ -0,0 +1,116 @@ +<script> + import { onMount } from 'svelte'; + let timeRemaining = '15:00'; + let heatDetails = 'Heat 3 - Round 1'; + let competitors = [ + { name: 'John Doe', score: 8.5, color: 'red' }, + { name: 'Jane Smith', score: 7.2, color: 'blue' } + ]; + let showSponsor = true; + + function updateCompetitor(index, field, value) { + competitors = competitors.map((comp, i) => (i === index ? { ...comp, [field]: value } : comp)); + } +</script> + +<div class="container-fluid d-flex flex-column justify-content-between bg-light p-3"> + <div class="scoreboard"> + <div class="heat-details"> + <h2 class="fw-bold">{heatDetails}</h2> + <p>Time Remaining: {timeRemaining}</p> + </div> + + <div class="p-2 border rounded"> + {#each competitors as competitor, index} + <div class="competitor-card" style="border-color: {competitor.color};"> + <div class="competitor-color" style="background-color: {competitor.color};"></div> + <div class="card-body d-flex justify-content-between w-100"> + <span>{competitor.name}</span> + <span class="fw-bold">{competitor.score}</span> + </div> + </div> + {/each} + </div> + + {#if showSponsor} + <div class="sponsor-box"> + <img src="/favicon.png" alt="Sponsor Logo" class="img-fluid" /> + </div> + {/if} + </div> + + <div class="control-panel"> + <h2 class="fw-bold">Update Scores</h2> + {#each competitors as competitor, index} + <div class="mb-2"> + <label class="form-label">{competitor.name} Score:</label> + <input + type="number" + class="form-control" + bind:value={competitor.score} + on:input={(e) => updateCompetitor(index, 'score', parseFloat(e.target.value) || 0)} + /> + </div> + {/each} + <button class="btn btn-primary w-100 mt-2">Update</button> + <button class="btn btn-secondary w-100 mt-2" on:click={() => (showSponsor = !showSponsor)}> + {showSponsor ? 'Hide Sponsor' : 'Show Sponsor'} + </button> + </div> +</div> + +<style> + .container-fluid { + width: 1920px; + height: 1080px; + } + .scoreboard { + position: absolute; + top: 0; + left: 0; + padding: 1rem; + background: #343a40; + color: white; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); + border-radius: 8px; + } + .heat-details { + padding: 1rem; + background: #6c757d; + border-radius: 8px; + } + .competitor-card { + display: flex; + align-items: center; + background: #343a40; + color: white; + border-left: 4px solid; + margin-bottom: 0.5rem; + padding: 0.5rem; + border-radius: 8px; + } + .competitor-color { + width: 25px; + height: 25px; + border-radius: 8px; + margin-right: 10px; + } + .sponsor-box { + margin-top: 1rem; + padding: 1rem; + background: #6c757d; + text-align: center; + border-radius: 8px; + } + .control-panel { + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + padding: 1rem; + background: white; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); + border-radius: 8px; + width: 300px; + } +</style> diff --git a/static/favicon.png b/static/favicon.png new file mode 100644 index 0000000..825b9e6 Binary files /dev/null and b/static/favicon.png differ diff --git a/svelte.config.js b/svelte.config.js new file mode 100644 index 0000000..18d7c26 --- /dev/null +++ b/svelte.config.js @@ -0,0 +1,14 @@ +// import adapter from '@sveltejs/adapter-auto'; +import adapter from "svelte-adapter-bun"; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + kit: { + // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. + // If your environment is not supported, or you settled on a specific environment, switch out the adapter. + // See https://svelte.dev/docs/kit/adapters for more information about adapters. + adapter: adapter() + } +}; + +export default config; diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..bbf8c7d --- /dev/null +++ b/vite.config.js @@ -0,0 +1,6 @@ +import { sveltekit } from '@sveltejs/kit/vite'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + plugins: [sveltekit()] +});