Initial commit

This commit is contained in:
root 2025-02-08 21:31:43 +01:00
commit cc5d147da3
15 changed files with 301 additions and 0 deletions

21
.gitignore vendored Normal file
View file

@ -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-*

1
.npmrc Normal file
View file

@ -0,0 +1 @@
engine-strict=true

4
.prettierignore Normal file
View file

@ -0,0 +1,4 @@
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock

15
.prettierrc Normal file
View file

@ -0,0 +1,15 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}

38
README.md Normal file
View file

@ -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.

BIN
bun.lockb Executable file

Binary file not shown.

23
eslint.config.js Normal file
View file

@ -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/']
}
];

13
jsconfig.json Normal file
View file

@ -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
}

29
package.json Normal file
View file

@ -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"
}
}

20
src/app.html Normal file
View file

@ -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>

1
src/lib/index.js Normal file
View file

@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

116
src/routes/+page.svelte Normal file
View file

@ -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>

BIN
static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

14
svelte.config.js Normal file
View file

@ -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;

6
vite.config.js Normal file
View file

@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
});