Skip to content

Commit 69304be

Browse files
committed
Moved everything to one file for easier transport
1 parent 2005d33 commit 69304be

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

alt-bits.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import './components/alt-bits-participant.js'
44
import './components/alt-bits-participant-detail.js'
55
import './components/alt-bits-participation.js'
66
import './components/ui-modal.js'
7-
import SETTINGS from './settings.js'
7+
// import SETTINGS from './settings.js'
88

9-
if(SETTINGS == undefined) throw "Missing configuration settings";
9+
// if(SETTINGS == undefined) throw "Missing configuration settings";
1010

11-
async function load(){
11+
async function AltBits(SETTINGS){
1212
let raw = await fetch(SETTINGS.baseURL);
1313
let json = await raw.json();
1414
let members = Object.values(json.members).sort((a, b)=>(b?._participations?.total || 0) - (a?._participations.total || 0));
@@ -40,4 +40,7 @@ async function load(){
4040
})
4141
})
4242
}
43-
load();
43+
44+
window.AltBits = AltBits;
45+
export default AltBits;
46+
// load();

index.html

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,26 @@ <h1>Acerca de</h1>
4646
<p>Made with ❤️ by <a href="https://ctrl-alt-tec.hackclub.com">Ctrl Alt Tec</a></p>
4747
</footer>
4848

49-
<script src="./alt-bits.js" type="module"></script>
49+
<!-- <script src="./alt-bits.js" type="module"></script> -->
50+
<script type="module">
51+
import AltBits from './alt-bits.js'
52+
AltBits({
53+
columnNames: {
54+
member: {
55+
name: member => `${member['Nombre(s)']} ${member['Apellido Paterno']} ${member['Apellido Materno']}` || 'Unasigned',
56+
id: member => member['Matrícula'],
57+
score: member => member?._participations?.total || 1,
58+
participations: member => member?._participations?.participations
59+
},
60+
participation: {
61+
date: participation => participation['Fecha'],
62+
category: participation => participation['Categoría'],
63+
description: participation => participation['Descripción'],
64+
score: participation => participation['Bits']
65+
}
66+
},
67+
baseURL: 'http://ctrl-api.hackclub.com/api/participation?org=ctrl-alt-tec'
68+
})
69+
</script>
5070
</body>
5171
</html>

settings.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)