Everywhere: Remove leftover files from previous website

This commit is contained in:
networkException 2022-01-05 15:33:12 +01:00
parent e544decc9d
commit 617fb7a5d6
7 changed files with 0 additions and 13712 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,83 +0,0 @@
import React from "react";
import 'react-calendar-heatmap/dist/styles.css';
import {AnimatePresence, motion} from "framer-motion";
import VisibilitySensor from "react-visibility-sensor";
export default class CopyrightNotice extends React.Component<null, {currentStep: number}> {
constructor(props) {
super(props);
this.state = {
currentStep: 0
}
}
render() {
let content;
switch (this.state.currentStep) {
case 0:
content = (
<>
copyright networkException $&#123;new Date().getFullYear()&#125;
</>
);
break;
case 1:
content = (
<>
copyright networkException&nbsp;
<span style={{color: "rgb(96, 104, 114)"}}>$</span>
<span style={{color: "rgb(120, 129, 141)"}}>&#123;</span>
<span style={{color: "rgb(73, 79, 86)"}}>new&nbsp;</span>
<span style={{color: "rgb(96, 104, 114)"}}>Date</span>
<span style={{color: "rgb(120, 129, 141)"}}>(</span>
<span style={{color: "rgb(120, 129, 141)"}}>)</span>
<span style={{color: "rgb(114, 119, 124)"}}>.</span>
<span style={{color: "rgb(96, 104, 114)"}}>getFullYear</span>
<span style={{color: "rgb(120, 129, 141)"}}>(</span>
<span style={{color: "rgb(120, 129, 141)"}}>)</span>
<span style={{color: "rgb(120, 129, 141)"}}>&#125;</span>
</>
);
break;
case 2:
content = (
<>copyright networkException {new Date().getFullYear()};</>
);
break;
}
return (
<div className={"relative"}>
<VisibilitySensor partialVisibility onChange={(visible) => {
console.log(visible);
if(visible) {
setTimeout(() => {
this.setState({currentStep: 1});
}, 4000);
setTimeout(() => {
this.setState({currentStep: 2});
}, 8000);
}
}}>
<AnimatePresence initial={false}>
<motion.div
className={"absolute inset-0 text-center"}
key={this.state.currentStep}
initial={{opacity: 0}}
animate={{opacity: 1}}
exit={{opacity: 0}}
>
{content}
</motion.div>
</AnimatePresence>
</VisibilitySensor>
</div>
);
}
}

View file

@ -1,80 +0,0 @@
import React from "react";
import useSWR from "swr";
import fetch from "node-fetch";
import CalendarHeatmap from "react-calendar-heatmap";
import 'react-calendar-heatmap/dist/styles.css';
// @ts-ignore
const fetcher = (...args) => fetch(...args).then(res => res.json())
export interface GitActivityProps {
}
export const GitActivity: React.FunctionComponent = () => {
const { data, error } = useSWR('/api/getGitActivity', fetcher);
if (error) {
return (
<div>FAILED TO LOAD</div>
);
}
else if (!data) {
return (
<div>LOADING</div>
);
}
else {
// let d = JSON.parse(data.data);
let startDate = new Date(data.data[data.data.length - 1].date);
startDate.setDate(startDate.getDate() - 365);
console.log(data.data);
let largest = 0;
for(let dataPoint of data.data) {
if(dataPoint.count > largest) {
largest = dataPoint.count;
}
}
console.log(largest);
return (
<div className={"w-1/2"}>
<CalendarHeatmap
startDate={startDate}
endDate={data.data[data.data.length - 1].date}
values={data.data}
classForValue={(obj) => {
let value = obj.count;
let ret = "fill-current ";
if (!value) {
ret += "text-primary-100";
}
else {
if(value <= largest * 0.25) {
ret += "text-primary-200";
}
else if (value <= largest * 0.5) {
ret += "text-primary-300";
}
else if (value <= largest * 0.75) {
ret += "text-primary-400";
}
else {
ret += "text-primary-500";
}
}
return ret;
}}
/>
</div>
);
}
}

View file

@ -1,122 +0,0 @@
import * as fs from "fs";
const path = "./cache/getGitActivity";
const validTime = 1000 * 60 * 30; // 30 min in milliseconds
export type GitActivityCache = {
data: Map<string, number>,
lastRefresh: number
}
export default (req, res) => {
if(fs.existsSync(path)) {
try {
let data: GitActivityCache = JSON.parse(fs.readFileSync(path).toString());
if(Date.now() - data.lastRefresh < validTime) {
res.statusCode = 200;
res.send(JSON.stringify(data));
}
else {
getData()
.then((data) => {
res.statusCode = 200;
res.send(data)
})
.catch(() => {
res.statusCode = 200;
res.send(data.data);
});
}
} catch (e) {
getData()
.then((data) => {
res.statusCode = 500;
res.send(data)
})
.catch(() => {
res.statusCode = 500;
res.send("Error while fetching data.");
});
}
}
else {
getData()
.then((data) => {
res.statusCode = 200;
res.send(data)
})
.catch(() => {
res.statusCode = 500;
res.send("Error while fetching data.");
});
}
}
async function getData(): Promise<string> {
let gitData = await getGitData();
fs.writeFileSync(path, JSON.stringify({data: gitData, lastRefresh: Date.now()}));
return JSON.stringify(gitData);
}
async function getGitData(): Promise<Array<{ date: string, count: number}>> {
console.log("Refreshing Data");
let token = "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";
let username = "networkException";
const output: { [date: string]: number } = {};
const headers = {
'Authorization': `bearer ${token}`,
};
const body = {
'query': `query {
user(login: "${username}") {
name
contributionsCollection {
contributionCalendar {
totalContributions
weeks {
contributionDays {
contributionCount
date
}
}
}
}
}
}`
};
const githubResponse = await fetch('https://api.github.com/graphql', { method: 'POST', body: JSON.stringify(body), headers });
(await githubResponse.json()).data.user.contributionsCollection.contributionCalendar.weeks.forEach((week: any) => {
week.contributionDays.forEach((day: any) => {
if (day.date in output) {
output[day.date] = output[day.date] + Number(day.contributionCount);
}
else {
output[day.date] = Number(day.contributionCount);
}
});
});
const gitlabResponse: { [date: string]: number } = await (await fetch('https://gitlab.upi.li/users/networkException/calendar.json')).json();
for (const date in gitlabResponse) {
if (date in output) {
output[date] = output[date] + gitlabResponse[date];
}
else {
output[date] = gitlabResponse[date];
}
}
return Object.keys(output).map(date => { return { date, count: output[date] }; });
}

View file

@ -1,16 +0,0 @@
import Head from "next/head"
import CopyrightNotice from "../components/CopyrightNotice";
export default function Home() {
return (
<>
<Head>
<title>nwex.de</title>
</Head>
<div style={{marginTop: 3000}}>
<CopyrightNotice />
</div>
</>
)
}

View file

@ -1,42 +0,0 @@
const purgeEnabled = process.env.NODE_ENV === "production"
console.log("\n")
console.log(` TailwindCSS \n`)
console.log(` ----------- \n`)
console.log(` ✅ purgeEnabled=${purgeEnabled}\n`)
module.exports = {
purge: {
enabled: purgeEnabled,
content: ["./src/**/*.html", "./src/**/*.tsx", "./src/**/*.jsx"]
},
darkMode: 'class', // or 'media' or 'class'
theme: {
extend: {
screens: {
'3xl': '1900px',
},
colors: {
'primary': {
100: '#FEE7D1',
200: '#FDD0A3',
300: '#FCB875',
400: '#FBA047',
500: '#fb8919',
},
'secondary': {
100: '#8f969e',
200: '#78818d',
300: '#72777c',
400: '#606872',
500: '#494f56',
600: '#2d3135'
}
}
}
},
variants: {
extend: {}
},
plugins: []
}

13368
yarn.lock

File diff suppressed because it is too large Load diff