initial commit

This commit is contained in:
2023-12-15 12:06:06 +01:00
parent 47adb8c9f8
commit 224cf9aa9b
26 changed files with 4844 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
# create-svelte
Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
Read more about creating a library [in the docs](https://kit.svelte.dev/docs/packaging).
## 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
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest 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
```
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
## Building
To build your library:
```bash
npm run package
```
To create a production version of your showcase 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://kit.svelte.dev/docs/adapters) for your target environment.
## Publishing
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
To publish your library to [npm](https://www.npmjs.com):
```bash
npm publish
```
+4445
View File
File diff suppressed because it is too large Load Diff
+55
View File
@@ -0,0 +1,55 @@
{
"name": "loteria",
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"build": "vite build && npm run package",
"preview": "vite preview",
"package": "svelte-kit sync && svelte-package && publint",
"prepublishOnly": "npm run package",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "vitest",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"svelte": "./dist/index.js"
}
},
"files": [
"dist",
"!dist/**/*.test.*",
"!dist/**/*.spec.*"
],
"peerDependencies": {
"svelte": "^4.0.0"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.27.4",
"@sveltejs/package": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.28.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-svelte": "^2.30.0",
"postcss": "^8.4.31",
"prettier": "^3.0.0",
"prettier-plugin-svelte": "^3.0.0",
"publint": "^0.1.9",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"tailwindcss": "^3.3.5",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.2",
"vitest": "^0.34.0"
},
"svelte": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module"
}
+6
View File
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
};
BIN
View File
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
html {
scroll-behavior: smooth;
}
.tech {
font-family: 'Share Tech Mono';
}
@layer utilities {
.text-muted-bright {
@apply text-gray-500;
}
.text-muted-dark {
@apply text-gray-300;
}
.text-highlight {
@apply text-amber-500;
}
.border-bright {
@apply border-amber-500;
}
}
+12
View File
@@ -0,0 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};
+23
View File
@@ -0,0 +1,23 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
<title>Lotería | Bitcoin Txoko</title>
<meta property="description" content="Juego de preguntas!" />
</head>
<body data-sveltekit-preload-data="hover" class="relative overscroll-auto">
<div style="display: contents" class="relative z[1]">%sveltekit.body%</div>
</body>
</html>
+15
View File
@@ -0,0 +1,15 @@
<script>
</script>
<h1 class="mt-6 font-semibold font-serif text-4xl text-center text-highlight">🎄 Compra aquí tus boletos de lotería!</h1>
<div class="m-6 p-2 sm:p-4 md:p-6 rounded-2xl border border-solid hover:border-bright bg-white text-muted-bright font-mono max-w-lg">
<div class="text-gray-600 mx-2 justify-center text-center">
<a href="lightning:LNURL1DP68GURN8GHJ7CNFW33K76TWW3UX76M09E3K7MF0D3H82UNVWQH4556Y2S69Q258JYP"><img src="./qrcode.png" alt="qr-code"></a>
<div>
<p class="mb-4" id="address">loteria@bitcointxoko.com <button id="copyButton" onclick="navigator.clipboard.writeText('loteria@bitcointxoko.com')"><i class="fa-regular fa-copy hover:text-gray-300 inline-block duration-200" ></i></button></p>
</div>
</div>
</div>
+25
View File
@@ -0,0 +1,25 @@
<script>
import { onMount } from 'svelte';
let balance;
onMount(async () => {
const response = await fetch(
"https://bitcointxoko.com/api/v1/wallet",
{
method: 'GET',
headers: {
'x-api-key': "fe69e5485e09418d94811fd585f66615",
},
},
);
const data = await response.json();
balance = Math.trunc((data.balance) / 1000);
});
</script>
<div class="p-4 font-bold tech text-3xl text-highlight">
{#if balance}
<p>Saldo: <span class="hover:text-amber-400 hover:underline hover:decoration-dashed">{balance}</span> sats</p>
{:else}
<p class="animate-pulse">cargando...</p>
{/if}
</div>
+3
View File
@@ -0,0 +1,3 @@
<header class="mt-6 flex flex-wrap justify-center">
<img src="./logo.png" class="h-12" alt="logo" />
</header>
+36
View File
@@ -0,0 +1,36 @@
<script>
let instructions = [
{
name: "Abrir la billetera",
description:
"Abre una billetera Lightning que soporta LNURL. Sugerencia: Tu billetera Bitcoin Txoko LNbits funciona muy bien.",
},
{
name: "Escanear código QR",
description:
"Escanea el código QR desde tu billetera o púlsalo para abrirlo en tu billetera. También puedes copiar la dirección Lightning y pegarla en tu billetera.",
},
{
name: "Enviar sats",
description:
"Establece una cantidad a enviar y pulsa enviar.",
},
{
name: "Comprobar el saldo",
description:
"Actualiza esta página para ver el saldo actualizado de la lotería.",
},
];
</script>
<div class="m-6 p-2 sm:p-4 md:p-6 rounded-2xl border border-solid hover:border-bright bg-white font-mono max-w-lg">
<div class="text-muted-bright mx-2 justify-center">
<h2 class="font-bold text-xl text-center">Instrucciones</h2>
{#each instructions as instruction, index}
<div class="my-2">
<h3 class="text-md font-semibold">{index+1}. {instruction.name}</h3>
<p class="mx-2 mt">{instruction.description}</p>
</div>
{/each}
</div>
</div>
+4
View File
@@ -0,0 +1,4 @@
<div class="m-4 mb-8 mx-6 p-2 sm:p-4 md:p-6 rounded-2xl bg-amber-400 hover:border-amber-500 text-black font-mono max-w-lg">
<p class="m-2">¡El 17 de diciembre tendrás la oportunidad de ganar estos sats con tu equipo respondiendo a preguntas sobre Bitcoin! </p>
<a href="https://rsvp.bitcointxoko.com/b2864f90174986cb4f9eb1998905756f3d2ac43e33fc8e033285b611bbeb73ce" class="underline decoration-dashed hover:decoration-2 hover:text-gray-600 mx-2">Haznos saber que vas a venir. </a>
</div>
+16
View File
@@ -0,0 +1,16 @@
<script>
import Address from "./Address.svelte";
import Balance from "./Balance.svelte";
import Instructions from "./Instructions.svelte";
import Invite from "./Invite.svelte";
import Rules from "./Rules.svelte";
</script>
<div class="flex flex-col justify-center items-center">
<Address/>
<Balance/>
<Instructions/>
<Invite/>
<Rules/>
</div>
+43
View File
@@ -0,0 +1,43 @@
<script>
let rules = [
{
name: "👬 Equipos",
description:
"Forma equipos de no más de tres miembros por equipo. ",
},
{
name: "❓ Preguntas",
description:
"El concurso de preguntas consta de 21 preguntas de opción múltiple. Con preguntas de desempate adicionales.",
},
{
name: "⏳ Tiempo",
description:
"Tienes 3 minutos para responder a cada pregunta con tu equipo. No puedes utilizar un dispositivo conectado a Internet para responder a las preguntas. ",
},
{
name: "💯 Puntos",
description:
"Una respuesta correcta vale un punto. No hay puntos por respuestas incorrectas. ",
},
{
name: "🏆 Ganador",
description:
"El equipo con el mayor número de puntos gana los sats.",
},
];
</script>
<div class="mx-6 mb-8 p-2 sm:p-4 md:p-6 rounded-2xl border border-solid hover:border-bright bg-white font-mono max-w-lg">
<div class="text-muted-bright mx-2 justify-center">
<h2 class="font-bold text-xl text-center">Reglas</h2>
<ul>
{#each rules as rule}
<li class="my-2">
<h3 class="text-md font-semibold">{rule.name}</h3>
<p class="mx-2 mt">{rule.description}</p>
</li>
{/each}
</ul>
</div>
</div>
+7
View File
@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';
describe('sum test', () => {
it('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});
+1
View File
@@ -0,0 +1 @@
// Reexport your entry components here
+10
View File
@@ -0,0 +1,10 @@
<script>
import "../app.css";
import Header from "../components/Header.svelte"
</script>
<div class="container relative flex flex-col max-w-[1800px] mx-auto w-full text-sm sm:text-base min-h-screen">
<Header/>
<slot />
</div>
+14
View File
@@ -0,0 +1,14 @@
<script>
import Main from "../components/Main.svelte";
</script>
<Main />
<style lang="postcss">
:global(html) {
background-color: theme(colors.emerald.800);
}
</style>
Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

+10
View File
@@ -0,0 +1,10 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/kit/vite';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter()
},
preprocess: vitePreprocess()
};
export default config;
+8
View File
@@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {}
},
plugins: []
};
+15
View File
@@ -0,0 +1,15 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"module": "NodeNext",
"moduleResolution": "NodeNext"
}
}
+9
View File
@@ -0,0 +1,9 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
});