Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/app/public/data/2026/df_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"charity":{"0":"Association Petits Princes","1":"Association Petits Princes","2":"Association Petits Princes","3":"Association Petits Princes","4":"Association Petits Princes","5":"Association Petits Princes","6":"Imagine For Margo","7":"Imagine For Margo","8":"Imagine For Margo","9":"Imagine For Margo","10":"Imagine For Margo","11":"Imagine For Margo","12":"La cha\u00eene de l'espoir","13":"La cha\u00eene de l'espoir","14":"La cha\u00eene de l'espoir","15":"La cha\u00eene de l'espoir","16":"La cha\u00eene de l'espoir","17":"La cha\u00eene de l'espoir","18":"Tout le monde contre le cancer","19":"Tout le monde contre le cancer","20":"Tout le monde contre le cancer","21":"Tout le monde contre le cancer","22":"Tout le monde contre le cancer","23":"Tout le monde contre le cancer","24":"Sourire \u00e0 la vie","25":"Sourire \u00e0 la vie","26":"Sourire \u00e0 la vie","27":"Sourire \u00e0 la vie","28":"Sourire \u00e0 la vie","29":"Sourire \u00e0 la vie","30":"Premiers de cord\u00e9e","31":"Premiers de cord\u00e9e","32":"Premiers de cord\u00e9e","33":"Premiers de cord\u00e9e","34":"Premiers de cord\u00e9e","35":"Premiers de cord\u00e9e"},"choice":{"0":"Choice 1","1":"Choice 2","2":"Choice 3","3":"Choice 4","4":"Choice 5","5":"Choice 6","6":"Choice 1","7":"Choice 2","8":"Choice 3","9":"Choice 4","10":"Choice 5","11":"Choice 6","12":"Choice 1","13":"Choice 2","14":"Choice 3","15":"Choice 4","16":"Choice 5","17":"Choice 6","18":"Choice 1","19":"Choice 2","20":"Choice 3","21":"Choice 4","22":"Choice 5","23":"Choice 6","24":"Choice 1","25":"Choice 2","26":"Choice 3","27":"Choice 4","28":"Choice 5","29":"Choice 6","30":"Choice 1","31":"Choice 2","32":"Choice 3","33":"Choice 4","34":"Choice 5","35":"Choice 6"},"count":{"0":73,"1":41,"2":26,"3":25,"4":22,"5":14,"6":36,"7":43,"8":36,"9":36,"10":27,"11":23,"12":32,"13":36,"14":45,"15":40,"16":33,"17":15,"18":39,"19":31,"20":28,"21":31,"22":31,"23":41,"24":14,"25":36,"26":41,"27":32,"28":55,"29":23,"30":7,"31":14,"32":25,"33":37,"34":33,"35":85},"median":{"0":2.0,"1":2.0,"2":2.0,"3":2.0,"4":2.0,"5":2.0,"6":3.0,"7":3.0,"8":3.0,"9":3.0,"10":3.0,"11":3.0,"12":3.0,"13":3.0,"14":3.0,"15":3.0,"16":3.0,"17":3.0,"18":4.0,"19":4.0,"20":4.0,"21":4.0,"22":4.0,"23":4.0,"24":4.0,"25":4.0,"26":4.0,"27":4.0,"28":4.0,"29":4.0,"30":5.0,"31":5.0,"32":5.0,"33":5.0,"34":5.0,"35":5.0},"total":{"0":201,"1":201,"2":201,"3":201,"4":201,"5":201,"6":201,"7":201,"8":201,"9":201,"10":201,"11":201,"12":201,"13":201,"14":201,"15":201,"16":201,"17":201,"18":201,"19":201,"20":201,"21":201,"22":201,"23":201,"24":201,"25":201,"26":201,"27":201,"28":201,"29":201,"30":201,"31":201,"32":201,"33":201,"34":201,"35":201},"half":{"0":100,"1":100,"2":100,"3":100,"4":100,"5":100,"6":100,"7":100,"8":100,"9":100,"10":100,"11":100,"12":100,"13":100,"14":100,"15":100,"16":100,"17":100,"18":100,"19":100,"20":100,"21":100,"22":100,"23":100,"24":100,"25":100,"26":100,"27":100,"28":100,"29":100,"30":100,"31":100,"32":100,"33":100,"34":100,"35":100},"median_count":{"0":41,"1":41,"2":41,"3":41,"4":41,"5":41,"6":36,"7":36,"8":36,"9":36,"10":36,"11":36,"12":45,"13":45,"14":45,"15":45,"16":45,"17":45,"18":31,"19":31,"20":31,"21":31,"22":31,"23":31,"24":32,"25":32,"26":32,"27":32,"28":32,"29":32,"30":33,"31":33,"32":33,"33":33,"34":33,"35":33},"median_count_half":{"0":28,"1":28,"2":28,"3":28,"4":28,"5":28,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":33,"13":33,"14":33,"15":33,"16":33,"17":33,"18":3,"19":3,"20":3,"21":3,"22":3,"23":3,"24":10,"25":10,"26":10,"27":10,"28":10,"29":10,"30":18,"31":18,"32":18,"33":18,"34":18,"35":18},"median_percent":{"0":0.6829268293,"1":0.6829268293,"2":0.6829268293,"3":0.6829268293,"4":0.6829268293,"5":0.6829268293,"6":0.6111111111,"7":0.6111111111,"8":0.6111111111,"9":0.6111111111,"10":0.6111111111,"11":0.6111111111,"12":0.7333333333,"13":0.7333333333,"14":0.7333333333,"15":0.7333333333,"16":0.7333333333,"17":0.7333333333,"18":0.0967741935,"19":0.0967741935,"20":0.0967741935,"21":0.0967741935,"22":0.0967741935,"23":0.0967741935,"24":0.3125,"25":0.3125,"26":0.3125,"27":0.3125,"28":0.3125,"29":0.3125,"30":0.5454545455,"31":0.5454545455,"32":0.5454545455,"33":0.5454545455,"34":0.5454545455,"35":0.5454545455}}
270 changes: 270 additions & 0 deletions app/app/src/pages/2026/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
---
import plotlyjs from 'plotly.js/dist/plotly.min.js?url'
---

<html>
<head>

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Votes Fluff Event 2026</title>

<link rel="icon" href="https://fluffevent.fr/wp-content/uploads/2022/12/cropped-FluffEveent-logo-onglet-contour-192x192.png" sizes="192x192" />
<link rel="apple-touch-icon" href="https://fluffevent.fr/wp-content/uploads/2022/12/cropped-FluffEveent-logo-onglet-contour-180x180.png" />

<link rel="stylesheet" href="style.css" type="text/css" media="all" />

<script src={plotlyjs} defer></script>

</head>
<body>

<header>
<img src="https://fluffevent.fr/img/fluff_logo_2026.svg" class="logo" alt="Logo Fluff Event" />
<h1>Votes Fluff Event 2026</h1>
</header>

<main>

<div>
<div>
Résultats des votes (<span id="nb_votes">…</span> votes comptabilisés)
</div>

<div id="graph"></div>
</div>

</main>

<footer>
<div>© 2023-2026 - <a href="https://fluffevent.fr/">Fluff Event</a></div>
<div><a href="https://github.com/FluffEvent/Votes">Open Source</a></div>
<!-- <div>Site réalisé par <a href="https://matiboux.me/">Matiboux</a></div> -->
</footer>

</body>
</html>

<script>
declare const Plotly: any

function updateGraph()
{
const graph = document.getElementById('graph') as (HTMLDivElement & { on: CallableFunction }) | null
const nbVotesElement = document.getElementById('nb_votes') as HTMLSpanElement | null
if (!graph || !nbVotesElement)
{
return
}

fetch(`/data/2026/df_data.json`)
.then(response => response.json())
.then(data =>
{
console.log(data)

// const length = Object.values(data['charity']).length
const graphData: {
name: string,
type: string,
x: string[],
y: number[],
[key: string]: any,
}[] = []

const charities: string[] = [...new Set(Object.values(data['charity'] as string))]
console.log(charities, charities.length)

let nbVotes = 0

const line_x: string[] = []
const line_y: number[] = []

for (let i = 0; i < charities.length; ++i)
{
const charityIndex = i * charities.length
if (nbVotes < data['total'][charityIndex])
{
nbVotes = data['total'][charityIndex]!
}

line_x.push(charities[i]!)
line_y.push(data['half'][charityIndex]!)

const bar_x: string[] = []
const bar_y: number[] = []

for (let j = i; data['charity'].hasOwnProperty(j); j += charities.length)
{
bar_x.push(data['charity'][j]!)
bar_y.push(data['count'][j]!)
}

graphData.push({
x: bar_x,
y: bar_y,
type: 'bar',
legendgroup: 'votes',
name: `Choix ${i + 1}`,
})
}

graphData.push({
x: line_x,
y: line_y,
type: 'line',
legendgroup: 'median',
name: 'Votes median',
line: { color: 'black' },
})

console.log(graphData)

nbVotesElement.innerText = nbVotes.toString()

Plotly.newPlot(graph, graphData,
{
barmode: 'stack',
showlegend: true,
margin: { t: 0, },
})
graph.on('plotly_legendclick', function() { return false; })
})
}

document.addEventListener('DOMContentLoaded', () =>
{
updateGraph()
})

window.addEventListener('resize', () =>
{
updateGraph()
})
</script>

<style>
html, body {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
}

body {
background: #fff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0;
padding: 0;
font-family: 'Open Sans', sans-serif;
color: #fff;
font-size: 14px;
line-height: 1.5;
}

a {
color: inherit;
}

header {
display: flex;
align-items: center;
justify-content: center;
background: #e6386bc0;
width: 100%;
height: 200px;
box-sizing: content-box;
padding: 20px;
flex-grow: 0;
flex-shrink: 0;

> * {
flex-grow: 0;
margin-right: 50px;
}

> *:last-child {
margin-right: 0;
}

> .logo {
width: 200px;
height: 200px;
}

> h1 {
font-size: 42px;
font-weight: 300;
}
}

main {
display: flex;
flex-direction: column;
align-items: center;
background: linear-gradient(180deg, #e6386bc0 0%, #9d29a5c0 100%);
width: 100%;
padding: 20px;
flex-grow: 1;

> div {
display: flex;
flex-direction: column;
align-items: stretch;
width: 100%;
max-width: 1440px;
height: 100%;
box-sizing: content-box;
padding: 0 20px;

> #graph {
background: #fff;
min-height: 300px;
max-height: 600px;
box-sizing: content-box;
padding: 20px;
flex-grow: 1;
}
}
}

footer {
display: flex;
align-items: center;
justify-content: center;
background: #9d29a5c0;
width: 100%;
height: 40px;
box-sizing: content-box;
padding: 20px;
flex-grow: 0;
flex-shrink: 0;
}

footer > * {
flex-grow: 0;
margin-right: 30px;
}

footer > *:last-child {
margin-right: 0;
}

@media screen and (max-height: 719.98px) {
header {
height: 120px;
}

header > .logo {
height: 120px;
}

main > div {
max-width: 1080px;
}
}
</style>
2 changes: 1 addition & 1 deletion app/app/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
return Astro.redirect('/2024')
return Astro.redirect('/2026')
---
Loading