nextjs + new client id

This commit is contained in:
xhyrom 2021-12-22 18:40:46 +01:00
parent a4beab6615
commit b0841b319c
25 changed files with 9780 additions and 218 deletions

View file

@ -16,4 +16,4 @@ jobs:
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages
folder: src/web
folder: src/web-old

View file

@ -4,7 +4,7 @@
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/src/web/dist"
"savePath": "/src/web/styles/css"
}
]
}

View file

@ -4,4 +4,4 @@
Discord bot for reaction roles that works with [Cloudflare Workers](https://workers.cloudflare.com/).
You can add the bot to your server, just click [here](https://discord.com/api/oauth2/authorize?client_id=905540851718037565&permissions=268435456&scope=bot%20applications.commands).
You can add the bot to your server, just click [here](https://discord.com/api/oauth2/authorize?client_id=923267906941370368&permissions=268435456&scope=bot%20applications.commands).

View file

@ -1,4 +1,4 @@
{
module.exports = {
"message": "lol",
"channel": "862700556438732851",
"roles": [

3
src/web/.eslintrc.json Normal file
View file

@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

37
src/web/.gitignore vendored Normal file
View file

@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
# typescript
*.tsbuildinfo

34
src/web/README.md Normal file
View file

@ -0,0 +1,34 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

5
src/web/next-env.d.ts vendored Normal file
View file

@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

9404
src/web/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

22
src/web/package.json Normal file
View file

@ -0,0 +1,22 @@
{
"name": "web",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.0.7",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"@types/node": "17.0.2",
"@types/react": "17.0.37",
"eslint": "8.5.0",
"eslint-config-next": "12.0.7",
"typescript": "4.5.4"
}
}

6
src/web/pages/_app.tsx Normal file
View file

@ -0,0 +1,6 @@
import '../styles/css/style.css';
import type { AppProps } from 'next/app';
export default function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}

31
src/web/pages/index.tsx Normal file
View file

@ -0,0 +1,31 @@
import Head from "next/head";
export default function Home() {
return (
<div>
<Head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css" />
</Head>
<section className="flex-container">
<div className="container animate__animated animate__fadeIn">
<h1>Generate</h1>
<form>
<input placeholder="Your Message" name="message" id="message"/><br />
<input placeholder="Channel Id" name="channel" id="channel"/>
</form>
<button id="addRole">Add Role</button>
<button id="buttonCopy">Copy</button>
<img src="slash.png" className="responsive" />
<pre className={`hljs language-json copy`} id="jsonPre"><code id="json" className="code"></code></pre>
</div>
</section>
<script src="https://kit.fontawesome.com/5acf4d9e80.js" crossOrigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="script.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</div>
)
}

View file

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View file

@ -1,68 +1,68 @@
let json = {
roles: []
}
$('input').change((e) => {
json[e.currentTarget.id] = e.currentTarget.value;
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
})
$('button[id=addRole]').click((e) => {
Swal.fire({
title: 'Add Role',
html:
'<input id="swal-input1" class="swal2-input" placeholder="Button Label*" required>' +
'<input id="swal-input2" class="swal2-input" placeholder="Role Id*" required>' +
'<input id="swal-input3" class="swal2-input" placeholder="Emoji">',
preConfirm: function () {
return new Promise(function (resolve) {
resolve([
$('#swal-input1').val(),
$('#swal-input2').val(),
$('#swal-input3').val()
])
})
},
}).then(function (result) {
if (result.value?.[0] && result.value?.[1]) {
json.roles.push({
id: result.value[1],
label: result.value[0],
emoji: result.value[2] || null
})
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
} else Swal.fire('Missing parameters')
}).catch(swal.noop)
})
$('pre[id=jsonPre].copy').click((e) => {
navigator.clipboard.writeText(e?.currentTarget?.textContent || e.textContent);
Swal.fire({
position: 'top-end',
icon: 'success',
title: 'Copied!',
showConfirmButton: false,
timer: 1500
})
})
$('button[id=buttonCopy]').click((e) => {
const element = $('pre[id=jsonPre].copy')[0];
navigator.clipboard.writeText(element?.currentTarget?.textContent || element.textContent);
Swal.fire({
position: 'top-end',
icon: 'success',
title: 'Copied!',
showConfirmButton: false,
timer: 1500
})
})
$(window).on('load', () => {
$('input').toArray().forEach((i) => i.value = '');
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
let json = {
roles: []
}
$('input').change((e) => {
json[e.currentTarget.id] = e.currentTarget.value;
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
})
$('button[id=addRole]').click((e) => {
Swal.fire({
title: 'Add Role',
html:
'<input id="swal-input1" class="swal2-input" placeholder="Button Label*" required />' +
'<input id="swal-input2" class="swal2-input" placeholder="Role Id*" required />' +
'<input id="swal-input3" class="swal2-input" placeholder="Emoji" />',
preConfirm: function () {
return new Promise(function (resolve) {
resolve([
$('#swal-input1').val(),
$('#swal-input2').val(),
$('#swal-input3').val()
])
})
}
}).then(function (result) {
if (result.value?.[0] && result.value?.[1]) {
json.roles.push({
id: result.value[1],
label: result.value[0],
emoji: result.value[2] || null
})
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
} else Swal.fire('Missing parameters')
}).catch(swal.noop)
})
$('pre[id=jsonPre].copy').click((e) => {
navigator.clipboard.writeText(e?.currentTarget?.textContent || e.textContent);
Swal.fire({
position: 'top-end',
icon: 'success',
title: 'Copied!',
showConfirmButton: false,
timer: 1500
})
})
$('button[id=buttonCopy]').click((e) => {
const element = $('pre[id=jsonPre].copy')[0];
navigator.clipboard.writeText(element?.currentTarget?.textContent || element.textContent);
Swal.fire({
position: 'top-end',
icon: 'success',
title: 'Copied!',
showConfirmButton: false,
timer: 1500
})
})
$(window).on('load', () => {
$('input').toArray().forEach((i) => i.value = '');
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
})

View file

Before

Width:  |  Height:  |  Size: 14 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AM,SAAS,EAAE,KAAK;EAC/B,AAAA,KAAK,CAAC;IACF,SAAS,EAAE,IAAI;GAClB;EACD,AAAA,MAAM,CAAC;IACH,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,WAAW;GACvB;EACD,AAAA,KAAK,CAAA;IACD,SAAS,EAAE,KAAK;GACf",
"sources": [
"../app/scss/style.scss",
"../app/scss/_globals.scss",
"../app/scss/_vars.scss",
"../app/scss/_containers.scss",
"../app/scss/_textstyle.scss",
"../app/scss/_forumstyle.scss"
"../scss/style.scss",
"../scss/_globals.scss",
"../scss/_vars.scss",
"../scss/_containers.scss",
"../scss/_textstyle.scss",
"../scss/_forumstyle.scss"
],
"names": [],
"file": "style.css"

View file

@ -1,37 +1,37 @@
.flex-container{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
//border-style: dashed;
//border-color: white;
}
.container {
background-color: #0e0e0e;
filter: drop-shadow(0 0 0.75rem #0e0e0e);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding: 4rem 8rem;
border-radius: 1.2rem;
//border-style: dashed;
//border-color: white;
}
form{
flex-direction: column;
//border-style: dashed;
//border-color: white;
}
@media screen and (max-width:600px) {
.container {
padding: 1rem 1.2rem;
border-radius: 1.2rem;
//border-style: dashed;
//border-color: white;
}
.flex-container{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
//border-style: dashed;
//border-color: white;
}
.container {
background-color: #0e0e0e;
filter: drop-shadow(0 0 0.75rem #0e0e0e);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding: 4rem 8rem;
border-radius: 1.2rem;
//border-style: dashed;
//border-color: white;
}
form{
flex-direction: column;
//border-style: dashed;
//border-color: white;
}
@media screen and (max-width:600px) {
.container {
padding: 1rem 1.2rem;
border-radius: 1.2rem;
//border-style: dashed;
//border-color: white;
}
}

View file

@ -1,53 +1,53 @@
button {
background-color: var(--yellow);
border-radius: .2rem;
border-style: none;
margin-top: .8rem;
font-size: 1.2rem;
padding: .2rem .8rem;
filter: drop-shadow(0 0 0.75rem #363636);
transition: .2s;
cursor: pointer;
&:hover{
background-color: var(--yellow-dark);
}
}
input {
color: white;
padding: .2rem .5rem;
background-color: var(--codeblock);
margin-top: .3rem;
font-size: 1.2rem;
border-style: none;
border-radius: .2rem;
}
.code{
max-width: 900px;
}
.copy {
cursor: pointer;
}
.responsive {
width: 100%;
padding: 10px;
max-width: 100rem;
height: auto;
}
@media screen and (max-width:600px) {
input {
font-size: 1rem;
}
button {
font-size: 1rem;
padding: .1rem .5rem;
}
.code{
max-width: 300px;
}
button {
background-color: var(--yellow);
border-radius: .2rem;
border-style: none;
margin-top: .8rem;
font-size: 1.2rem;
padding: .2rem .8rem;
filter: drop-shadow(0 0 0.75rem #363636);
transition: .2s;
cursor: pointer;
&:hover{
background-color: var(--yellow-dark);
}
}
input {
color: white;
padding: .2rem .5rem;
background-color: var(--codeblock);
margin-top: .3rem;
font-size: 1.2rem;
border-style: none;
border-radius: .2rem;
}
.code{
max-width: 900px;
}
.copy {
cursor: pointer;
}
.responsive {
width: 100%;
padding: 10px;
max-width: 100rem;
height: auto;
}
@media screen and (max-width:600px) {
input {
font-size: 1rem;
}
button {
font-size: 1rem;
padding: .1rem .5rem;
}
.code{
max-width: 300px;
}
}

View file

@ -1,17 +1,17 @@
html {
font-size: 100%;
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
font-family: Arial, Helvetica, sans-serif;
line-height: 1.3;
margin: 0;
padding: 0;
background-color: var(--darkmode);
color: white;
}
html {
font-size: 100%;
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
font-family: Arial, Helvetica, sans-serif;
line-height: 1.3;
margin: 0;
padding: 0;
background-color: var(--darkmode);
color: white;
}

View file

@ -1,26 +1,26 @@
p {
font-family: 'Open Sans', sans-serif;
//color: white;
font-size: 1rem;
font-weight: 200;
}
h1{
font-family: 'Open Sans', sans-serif;
color: white;
font-size: 2rem;
font-weight: 800;
}
a{
font-family: 'Open Sans', sans-serif;
color: white;
font-size: 1rem;
text-decoration: none;
font-weight: 400;
}
button {
font-family: 'Open Sans', sans-serif;
color: white;
font-size: 1rem;
text-decoration: none;
font-weight: 400;
p {
font-family: 'Open Sans', sans-serif;
//color: white;
font-size: 1rem;
font-weight: 200;
}
h1{
font-family: 'Open Sans', sans-serif;
color: white;
font-size: 2rem;
font-weight: 800;
}
a{
font-family: 'Open Sans', sans-serif;
color: white;
font-size: 1rem;
text-decoration: none;
font-weight: 400;
}
button {
font-family: 'Open Sans', sans-serif;
color: white;
font-size: 1rem;
text-decoration: none;
font-weight: 400;
}

View file

@ -1,7 +1,7 @@
:root {
--hyro: #eeee32;
--yellow: #ead800;
--yellow-dark: #d8a603;
--darkmode: #151515;
--codeblock: #242424;
:root {
--hyro: #eeee32;
--yellow: #ead800;
--yellow-dark: #d8a603;
--darkmode: #151515;
--codeblock: #242424;
}

View file

@ -1,6 +1,6 @@
@import "globals";
@import "vars";
@import "containers";
@import "textstyle";
@import "forumstyle";
@import "globals";
@import "vars";
@import "containers";
@import "textstyle";
@import "forumstyle";
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,500;0,600;0,800;1,300;1,600;1,700&display=swap'); //font-family: 'Open Sans', sans-serif;

20
src/web/tsconfig.json Normal file
View file

@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}