Skip to content

Commit

Permalink
Prettify files
Browse files Browse the repository at this point in the history
  • Loading branch information
ryespresso committed Sep 28, 2022
1 parent 1af9e2e commit 42e14f6
Show file tree
Hide file tree
Showing 24 changed files with 10,022 additions and 6,034 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.next
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"printWidth": 100
}
2 changes: 1 addition & 1 deletion api/hello.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction

export default function helloAPI(req, res) {
res.status(200).json({ name: 'John Doe' })
res.status(200).json({ name: 'John Doe' });
}
20 changes: 10 additions & 10 deletions components/Game/Dino.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from "react";
import React from 'react';

import Resources from "./Resources.js";
import DinoScript from "../../api/DinoScript.js";
import DinoStyle from "../../api/DinoStyle";
import "./Dino.module.css";
import Resources from './Resources.js';
import DinoScript from '../../api/DinoScript.js';
import DinoStyle from '../../api/DinoStyle';
import './Dino.module.css';

class ChromeDinoComponent extends React.Component {
appendDinoScript() {
let dinoScriptContainer = document.createElement("script");
let dinoScriptContainer = document.createElement('script');
dinoScriptContainer.appendChild(document.createTextNode(DinoScript));
this.startDiv.appendChild(dinoScriptContainer);
}

appendRunnerScript() {
let runnerScriptContainer = document.createElement("script");
let runnerScriptContainer = document.createElement('script');
runnerScriptContainer.appendChild(
document.createTextNode(`new Runner('.interstitial-wrapper');`)
document.createTextNode(`new Runner('.interstitial-wrapper');`),
);

this.endDiv.appendChild(runnerScriptContainer);
Expand All @@ -29,12 +29,12 @@ class ChromeDinoComponent extends React.Component {

render() {
return (
<div ref={(el) => (this.startDiv = el)}>
<div ref={el => (this.startDiv = el)}>
<style>{DinoStyle}</style>

<div id="main-frame-error" className="interstitial-wrapper">
<Resources />
<div ref={(el) => (this.endDiv = el)}></div>
<div ref={el => (this.endDiv = el)}></div>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion components/Game/Resources.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 14 additions & 31 deletions lib/db/hasura.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ async function queryHasuraGQL(
operationsDoc: string,
operationName: string,
variables: Record<string, any>,
token: string
token: string,
) {
const result = await fetch(process.env.NEXT_PUBLIC_HASURA_ADMIN_URL, {
method: 'POST',
Expand All @@ -25,7 +25,7 @@ async function queryHasuraGQL(
async function adminQueryHasuraGQL(
operationsDoc: string,
operationName: string,
variables: Record<string, any>
variables: Record<string, any>,
) {
const result = await fetch(process.env.NEXT_PUBLIC_HASURA_ADMIN_URL, {
method: 'POST',
Expand Down Expand Up @@ -59,7 +59,7 @@ export async function createNewUser(token: string, address: string) {
{
address,
},
token
token,
);

return response?.data?.ideas;
Expand All @@ -81,7 +81,7 @@ export async function isNewUser(token: string, address: string) {
{
address,
},
token
token,
);

return response?.data?.users?.length === 0;
Expand Down Expand Up @@ -146,13 +146,9 @@ export async function getLikesForAddress(address: string) {
}
`;

const response = await adminQueryHasuraGQL(
operationsDoc,
'getLikesForAddress',
{
address,
}
);
const response = await adminQueryHasuraGQL(operationsDoc, 'getLikesForAddress', {
address,
});

return response?.data?.ideas_likes;
}
Expand All @@ -166,19 +162,10 @@ export async function insertIdea(token, { address, title, description }) {
}
}
`;
return await queryHasuraGQL(
operationsDoc,
'insertIdea',
{ address, title, description },
token
);
return await queryHasuraGQL(operationsDoc, 'insertIdea', { address, title, description }, token);
}

export async function isLikedForIdeaAndAddress(
token: string,
ideaId: string,
address: string
) {
export async function isLikedForIdeaAndAddress(token: string, ideaId: string, address: string) {
const operationsDoc = `
query isLikedForIdeaAndAddress($address: String!, $ideaId: bigint!) {
ideas_likes(where: {address: {_eq: $address}, idea_id: {_eq: $ideaId}}) {
Expand All @@ -195,7 +182,7 @@ export async function isLikedForIdeaAndAddress(
address,
ideaId,
},
token
token,
);

return response?.data?.ideas_likes?.length > 0;
Expand All @@ -205,7 +192,7 @@ export async function updateLikedForIdeaAndAddress(
token: string,
ideaId: string,
address: string,
liked: boolean
liked: boolean,
) {
const operationsDoc = `
mutation updateLikedForIdeaAndAddress($address: String!, $ideaId: bigint!, $liked: Boolean!) {
Expand All @@ -226,17 +213,13 @@ export async function updateLikedForIdeaAndAddress(
ideaId,
liked,
},
token
token,
);

return response?.data;
}

export async function insertLikedForIdeaAndAddress(
token: string,
ideaId: string,
address: string
) {
export async function insertLikedForIdeaAndAddress(token: string, ideaId: string, address: string) {
const operationsDoc = `
mutation insertLikedForIdeaAndAddress($address: String!, $ideaId: bigint!) {
insert_ideas_likes_one(object: {address: $address, idea_id: $ideaId, liked: true}) {
Expand All @@ -254,7 +237,7 @@ export async function insertLikedForIdeaAndAddress(
address,
ideaId,
},
token
token,
);

return response?.data;
Expand Down
2 changes: 1 addition & 1 deletion lib/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function fetcher(url: string, data = undefined) {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
}).then((res) => {
}).then(res => {
if (res.status > 399 && res.status < 200) {
throw new Error();
}
Expand Down
5 changes: 1 addition & 4 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ interface JwtPayload {

export async function verifyToken(token) {
if (token) {
const decodedToken = jwt.verify(
token,
process.env.JWT_SECRET
) as JwtPayload;
const decodedToken = jwt.verify(token, process.env.JWT_SECRET) as JwtPayload;

return decodedToken?.eoa;
}
Expand Down
56 changes: 28 additions & 28 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,73 @@ module.exports = {
async redirects() {
return [
{
source: "/talks",
destination: "/podcast",
source: '/talks',
destination: '/podcast',
permanent: true,
},
{
source: "/podcasts",
destination: "/podcast",
source: '/podcasts',
destination: '/podcast',
permanent: true,
},
{
source: "/nounstalgia",
destination: "/history",
source: '/nounstalgia',
destination: '/history',
permanent: true,
},
{
source: "/project",
destination: "/projects",
source: '/project',
destination: '/projects',
permanent: true,
},
{
source: "/funding/small-grants",
destination: "/funding/smallgrants",
source: '/funding/small-grants',
destination: '/funding/smallgrants',
permanent: true,
},
{
source: "/funding/sg",
destination: "/funding/smallgrants",
source: '/funding/sg',
destination: '/funding/smallgrants',
permanent: true,
},
{
source: "/small-grants",
destination: "/funding/smallgrants",
source: '/small-grants',
destination: '/funding/smallgrants',
permanent: true,
},
{
source: "/sg",
destination: "/funding/smallgrants",
source: '/sg',
destination: '/funding/smallgrants',
permanent: true,
},
{
source: "/smallgrants",
destination: "/funding/smallgrants",
source: '/smallgrants',
destination: '/funding/smallgrants',
permanent: true,
},
{
source: "/proposals",
destination: "/funding/proposals",
source: '/proposals',
destination: '/funding/proposals',
permanent: true,
},
{
source: "/trait",
destination: "/traits",
source: '/trait',
destination: '/traits',
permanent: true,
},
{
source: "/asset",
destination: "/assets",
source: '/asset',
destination: '/assets',
permanent: true,
},
{
source: "/note",
destination: "/notes",
source: '/note',
destination: '/notes',
permanent: true,
},
{
source: "/subdao",
destination: "/subdaos",
source: '/subdao',
destination: '/subdaos',
permanent: true,
},
];
Expand Down
Loading

0 comments on commit 42e14f6

Please sign in to comment.