mirror of
https://github.com/System-End/site.git
synced 2026-04-19 20:55:09 +00:00
Data! Data! Oh the data!
This commit is contained in:
parent
4a05865217
commit
9ad4e71992
3 changed files with 63 additions and 6 deletions
|
|
@ -17,6 +17,7 @@
|
|||
"@mdx-js/loader": "^1.6.22",
|
||||
"@next/mdx": "^11.0.0",
|
||||
"airtable-plus": "^1.0.4",
|
||||
"country-emoji": "^1.5.6",
|
||||
"framer-motion": "^4.1.17",
|
||||
"globby": "^11.0.4",
|
||||
"lodash": "^4.17.21",
|
||||
|
|
|
|||
63
pages/alt.js
63
pages/alt.js
|
|
@ -496,6 +496,7 @@ export default function Page({ dataPieces }) {
|
|||
|
||||
export async function getStaticProps() {
|
||||
var mojier = require('mojier')
|
||||
const { flag } = require('country-emoji')
|
||||
let dataPieces = []
|
||||
let initialBankData = await fetch('https://bank.hackclub.com/stats').then(r =>
|
||||
r.json()
|
||||
|
|
@ -620,24 +621,74 @@ export async function getStaticProps() {
|
|||
x =>
|
||||
`${packagesText[Math.floor(packagesText.length * Math.random())]} to ${
|
||||
x.fields['Receiver Country']
|
||||
? (x.fields['Receiver Country'][0]?.split(' ')[0] == 'United'
|
||||
? x.fields['Receiver Country'][0]?.split(' ')[0] == 'United'
|
||||
? 'the ' + x.fields['Receiver Country'][0]?.split('(')[0]
|
||||
: x.fields['Receiver Country'][0]?.split('(')[0])
|
||||
: x.fields['Receiver Country'][0]?.split('(')[0]
|
||||
: 'a hacker'
|
||||
}!`
|
||||
)
|
||||
.slice(0, 20)
|
||||
|
||||
console.log(packagesData)
|
||||
let clubsData = (
|
||||
await fetch(
|
||||
'https://api2.hackclub.com/v0.1/Operations/Clubs?select={"sort":[{"field":"Acceptance%20Time","direction":"desc"}]}'
|
||||
).then(r => r.json())
|
||||
)
|
||||
.map(
|
||||
x =>
|
||||
`${
|
||||
flag(
|
||||
x.fields['Address Country']
|
||||
? x.fields['Address Country'][0]
|
||||
: 'hgfdhsbuvisulr'
|
||||
) === undefined
|
||||
? '🚩'
|
||||
: flag(x.fields['Address Country'][0])
|
||||
} New club started ${
|
||||
x.fields['Address Country']
|
||||
? x.fields['Address Country'][0]?.split(' ')[0] == 'United'
|
||||
? 'in the ' + x.fields['Address Country'][0]?.split('(')[0].trim()
|
||||
: 'in ' + x.fields['Address Country'][0]?.split('(')[0].trim()
|
||||
: 'by a hacker'
|
||||
}!`
|
||||
)
|
||||
.slice(0, 40)
|
||||
|
||||
let meetingsData = (
|
||||
await fetch('https://api2.hackclub.com/v0.1/Operations/Clubs').then(r =>
|
||||
r.json()
|
||||
)
|
||||
)
|
||||
.map(x =>
|
||||
(x.fields['Meeting sizes'] && x.fields['Address Country'])
|
||||
? `📆 A club meeting ${
|
||||
x.fields['Address Country']
|
||||
? x.fields['Address Country'][0]?.split(' ')[0] == 'United'
|
||||
? 'in the ' +
|
||||
x.fields['Address Country'][0]?.split('(')[0].trim()
|
||||
: 'in ' + x.fields['Address Country'][0]?.split('(')[0].trim()
|
||||
: ''
|
||||
} of ${
|
||||
x.fields['Meeting sizes'][x.fields['Meeting sizes'].length - 1]
|
||||
} just happened!`
|
||||
: null
|
||||
)
|
||||
.filter(function (el) {
|
||||
return el != null
|
||||
})
|
||||
.sort(() => 0.5 - Math.random())
|
||||
.slice(0, 8)
|
||||
|
||||
console.log(meetingsData)
|
||||
|
||||
dataPieces = [
|
||||
...newScrapbooks,
|
||||
...newScrapbookUsers,
|
||||
...dataPieces,
|
||||
...reactionsUsed,
|
||||
...new Set(
|
||||
packagesData
|
||||
),
|
||||
...new Set(packagesData),
|
||||
...new Set(clubsData),
|
||||
...meetingsData,
|
||||
...new Set(
|
||||
initialGitHubData.filter(function (el) {
|
||||
return el != null
|
||||
|
|
|
|||
|
|
@ -1225,6 +1225,11 @@ cosmiconfig@^6.0.0:
|
|||
path-type "^4.0.0"
|
||||
yaml "^1.7.2"
|
||||
|
||||
country-emoji@^1.5.6:
|
||||
version "1.5.6"
|
||||
resolved "https://registry.yarnpkg.com/country-emoji/-/country-emoji-1.5.6.tgz#cca1e637f3eac8cd2c3f2f910213d9a521b1307e"
|
||||
integrity sha512-pSB8OOROfimFc2bcN+H41DuzXYIod/JQ6SgF4pYXkRCm9f8uF1JAJ0vXPhenug6xkpt3Gv33mdypMXB49CJWRA==
|
||||
|
||||
create-ecdh@^4.0.0:
|
||||
version "4.0.4"
|
||||
resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue