Skip to content

Commit

Permalink
Moved everything to one file for easier transport
Browse files Browse the repository at this point in the history
  • Loading branch information
edvilme committed Sep 15, 2021
1 parent 2005d33 commit 69304be
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
11 changes: 7 additions & 4 deletions alt-bits.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import './components/alt-bits-participant.js'
import './components/alt-bits-participant-detail.js'
import './components/alt-bits-participation.js'
import './components/ui-modal.js'
import SETTINGS from './settings.js'
// import SETTINGS from './settings.js'

if(SETTINGS == undefined) throw "Missing configuration settings";
// if(SETTINGS == undefined) throw "Missing configuration settings";

async function load(){
async function AltBits(SETTINGS){
let raw = await fetch(SETTINGS.baseURL);
let json = await raw.json();
let members = Object.values(json.members).sort((a, b)=>(b?._participations?.total || 0) - (a?._participations.total || 0));
Expand Down Expand Up @@ -40,4 +40,7 @@ async function load(){
})
})
}
load();

window.AltBits = AltBits;
export default AltBits;
// load();
22 changes: 21 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ <h1>Acerca de</h1>
<p>Made with ❤️ by <a href="https://ctrl-alt-tec.hackclub.com">Ctrl Alt Tec</a></p>
</footer>

<script src="./alt-bits.js" type="module"></script>
<!-- <script src="./alt-bits.js" type="module"></script> -->
<script type="module">
import AltBits from './alt-bits.js'
AltBits({
columnNames: {
member: {
name: member => `${member['Nombre(s)']} ${member['Apellido Paterno']} ${member['Apellido Materno']}` || 'Unasigned',
id: member => member['Matrícula'],
score: member => member?._participations?.total || 1,
participations: member => member?._participations?.participations
},
participation: {
date: participation => participation['Fecha'],
category: participation => participation['Categoría'],
description: participation => participation['Descripción'],
score: participation => participation['Bits']
}
},
baseURL: 'http://ctrl-api.hackclub.com/api/participation?org=ctrl-alt-tec'
})
</script>
</body>
</html>
17 changes: 0 additions & 17 deletions settings.js

This file was deleted.

0 comments on commit 69304be

Please sign in to comment.