básico
This commit is contained in:
parent
9c5ae25598
commit
7af9a1b695
6 changed files with 135 additions and 1 deletions
10
package.json
10
package.json
|
@ -22,5 +22,13 @@
|
||||||
"typescript": "^5.0.0",
|
"typescript": "^5.0.0",
|
||||||
"vite": "^4.4.2"
|
"vite": "^4.4.2"
|
||||||
},
|
},
|
||||||
"type": "module"
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"bulma": "^0.9.4",
|
||||||
|
"date-fns": "^2.30.0",
|
||||||
|
"erina-sign-teller": "^3.4.5",
|
||||||
|
"unslugify": "^1.0.4",
|
||||||
|
"wikiapi": "^1.19.4",
|
||||||
|
"wikibase-sdk": "^9.2.2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,26 @@ settings:
|
||||||
autoInstallPeers: true
|
autoInstallPeers: true
|
||||||
excludeLinksFromLockfile: false
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
bulma:
|
||||||
|
specifier: ^0.9.4
|
||||||
|
version: 0.9.4
|
||||||
|
date-fns:
|
||||||
|
specifier: ^2.30.0
|
||||||
|
version: 2.30.0
|
||||||
|
erina-sign-teller:
|
||||||
|
specifier: ^3.4.5
|
||||||
|
version: 3.4.5
|
||||||
|
unslugify:
|
||||||
|
specifier: ^1.0.4
|
||||||
|
version: 1.0.4
|
||||||
|
wikiapi:
|
||||||
|
specifier: ^1.19.4
|
||||||
|
version: 1.19.4
|
||||||
|
wikibase-sdk:
|
||||||
|
specifier: ^9.2.2
|
||||||
|
version: 9.2.2
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@sveltejs/adapter-auto':
|
'@sveltejs/adapter-auto':
|
||||||
specifier: ^2.0.0
|
specifier: ^2.0.0
|
||||||
|
@ -43,6 +63,13 @@ packages:
|
||||||
'@jridgewell/trace-mapping': 0.3.19
|
'@jridgewell/trace-mapping': 0.3.19
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@babel/runtime@7.22.15:
|
||||||
|
resolution: {integrity: sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==}
|
||||||
|
engines: {node: '>=6.9.0'}
|
||||||
|
dependencies:
|
||||||
|
regenerator-runtime: 0.14.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@esbuild/android-arm64@0.18.20:
|
/@esbuild/android-arm64@0.18.20:
|
||||||
resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==}
|
resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
@ -434,6 +461,10 @@ packages:
|
||||||
resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==}
|
resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/bulma@0.9.4:
|
||||||
|
resolution: {integrity: sha512-86FlT5+1GrsgKbPLRRY7cGDg8fsJiP/jzTqXXVqiUZZ2aZT8uemEOHlU1CDU+TxklPEZ11HZNNWclRBBecP4CQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/busboy@1.6.0:
|
/busboy@1.6.0:
|
||||||
resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}
|
resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}
|
||||||
engines: {node: '>=10.16.0'}
|
engines: {node: '>=10.16.0'}
|
||||||
|
@ -446,6 +477,11 @@ packages:
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/cejs@4.5.5:
|
||||||
|
resolution: {integrity: sha512-226z/O8jdaPl0Byk7JZvpblvrlWxc010Uz1Ev+hHcJwvRaM9T8pL8eVyp3qlMSq4V6eVI9mBzsETcFVooLov/g==}
|
||||||
|
engines: {node: '>=0.10'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/chokidar@3.5.3:
|
/chokidar@3.5.3:
|
||||||
resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==}
|
resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==}
|
||||||
engines: {node: '>= 8.10.0'}
|
engines: {node: '>= 8.10.0'}
|
||||||
|
@ -488,6 +524,13 @@ packages:
|
||||||
source-map-js: 1.0.2
|
source-map-js: 1.0.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/date-fns@2.30.0:
|
||||||
|
resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==}
|
||||||
|
engines: {node: '>=0.11'}
|
||||||
|
dependencies:
|
||||||
|
'@babel/runtime': 7.22.15
|
||||||
|
dev: false
|
||||||
|
|
||||||
/debug@4.3.4:
|
/debug@4.3.4:
|
||||||
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
||||||
engines: {node: '>=6.0'}
|
engines: {node: '>=6.0'}
|
||||||
|
@ -519,6 +562,10 @@ packages:
|
||||||
resolution: {integrity: sha512-KqFl6pOgOW+Y6wJgu80rHpo2/3H07vr8ntR9rkkFIRETewbf5GaYYcakYfiKz89K+sLsuPkQIZaXDMjUObZwWg==}
|
resolution: {integrity: sha512-KqFl6pOgOW+Y6wJgu80rHpo2/3H07vr8ntR9rkkFIRETewbf5GaYYcakYfiKz89K+sLsuPkQIZaXDMjUObZwWg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/erina-sign-teller@3.4.5:
|
||||||
|
resolution: {integrity: sha512-aptPYhjGn80c0RDNWcfp03bgmFfYbMMeKs7JJndxjqGPbYXqvd2PHWzOysWlqwOs5+uBpTlTD9I0DRFRdun8wQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/es6-promise@3.3.1:
|
/es6-promise@3.3.1:
|
||||||
resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==}
|
resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -846,6 +893,10 @@ packages:
|
||||||
picomatch: 2.3.1
|
picomatch: 2.3.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/regenerator-runtime@0.14.0:
|
||||||
|
resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/resolve-from@4.0.0:
|
/resolve-from@4.0.0:
|
||||||
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
|
@ -1071,6 +1122,10 @@ packages:
|
||||||
busboy: 1.6.0
|
busboy: 1.6.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/unslugify@1.0.4:
|
||||||
|
resolution: {integrity: sha512-dBKQsLodC8wtJ4Zgcy3emA5/CFM5w3Ta2jW8P3Y72agNhukEeNCBYD7PvCbBTCYQsoBxX2biSC3OETU/2Cws9g==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/vite@4.4.9:
|
/vite@4.4.9:
|
||||||
resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==}
|
resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==}
|
||||||
engines: {node: ^14.18.0 || >=16.0.0}
|
engines: {node: ^14.18.0 || >=16.0.0}
|
||||||
|
@ -1117,6 +1172,18 @@ packages:
|
||||||
vite: 4.4.9
|
vite: 4.4.9
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/wikiapi@1.19.4:
|
||||||
|
resolution: {integrity: sha512-gh6M026re+FxkQS6DEjTTii/zs3VGvCT8HYkIG17NsNGPW9hiZT8uWovU/uu0JUKZ3OXdy+JD94Jk4ko++AZ8Q==}
|
||||||
|
engines: {node: '>=12.0'}
|
||||||
|
dependencies:
|
||||||
|
cejs: 4.5.5
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/wikibase-sdk@9.2.2:
|
||||||
|
resolution: {integrity: sha512-w0koO+KfkySfjGCce61vFDm45UNRcHa98Jdf324DwuzLKlwBfH8sqlxP7uYAuA+KGvm3SpU+L3Ui3fs67Gj+wA==}
|
||||||
|
engines: {node: '>= 12.0.0'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/wrappy@1.0.2:
|
/wrappy@1.0.2:
|
||||||
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
1
src/app.css
Normal file
1
src/app.css
Normal file
|
@ -0,0 +1 @@
|
||||||
|
@import 'bulma/css/bulma.css';
|
5
src/routes/+layout.svelte
Normal file
5
src/routes/+layout.svelte
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<script>
|
||||||
|
import '../app.css';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<slot />
|
24
src/routes/w/[slug]/+page.server.ts
Normal file
24
src/routes/w/[slug]/+page.server.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import { error } from '@sveltejs/kit';
|
||||||
|
import Wikiapi from 'wikiapi';
|
||||||
|
import unslugify from 'unslugify';
|
||||||
|
|
||||||
|
export type Birth = { year: number; month: number; day: number };
|
||||||
|
|
||||||
|
let cache = new Map<string, Birth>();
|
||||||
|
|
||||||
|
/** @type {import('./$types').PageLoad} */
|
||||||
|
export async function load({ params }) {
|
||||||
|
const nombre = unslugify(params.slug);
|
||||||
|
const wiki = new Wikiapi();
|
||||||
|
let birth: Birth;
|
||||||
|
if (cache.has(nombre)) {
|
||||||
|
birth = cache.get(nombre)!;
|
||||||
|
} else {
|
||||||
|
const data = await wiki.data(nombre, 'P569');
|
||||||
|
if (data.length === 0) throw error(404, 'Not found');
|
||||||
|
const [year, month, day] = data[0];
|
||||||
|
birth = { year, month, day };
|
||||||
|
cache.set(nombre, birth);
|
||||||
|
}
|
||||||
|
return { nombre: nombre, birth };
|
||||||
|
}
|
29
src/routes/w/[slug]/+page.svelte
Normal file
29
src/routes/w/[slug]/+page.svelte
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import signo from 'erina-sign-teller';
|
||||||
|
import type { Birth } from './+page.server.js';
|
||||||
|
|
||||||
|
export let data;
|
||||||
|
$: birth = data.birth;
|
||||||
|
$: detalleSigno = signo(birth);
|
||||||
|
|
||||||
|
const twoDigitNum = (num: number) => (num < 10 ? `0${num}` : num);
|
||||||
|
|
||||||
|
const intl = Intl.DateTimeFormat('es', { dateStyle: 'long' });
|
||||||
|
const formatDate = (date: Date) => intl.format(date);
|
||||||
|
const formatBirth = (birth: Birth) =>
|
||||||
|
formatDate(new Date(birth.year, birth.month - 1, birth.day));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<section class="hero">
|
||||||
|
<div class="hero-body">
|
||||||
|
<p class="title">
|
||||||
|
{data.nombre} es de {detalleSigno.sign}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="subtitle">
|
||||||
|
Cumple el {formatBirth(birth)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
Loading…
Reference in a new issue