feat: more ts, fix tailwind

- rename more files to .ts/.tsx
- update tailwind config to use .tsx files from all dirs
- merge css files into a single main.css to avoid import order
  dependencies
- minor cleanups due to ts complaints
This commit is contained in:
Vyacheslav Matyukhin 2022-03-26 03:36:50 +03:00
parent 42c0f0967b
commit b481212721
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
70 changed files with 193 additions and 223 deletions

View File

@ -2,8 +2,8 @@ import {
mongoRead,
mongoReadWithReadCredentials,
mongoUpsert,
} from "./mongo-wrapper.js";
import { pgRead, pgReadWithReadCredentials, pgUpsert } from "./pg-wrapper.js";
} from "./mongo-wrapper";
import { pgRead, pgReadWithReadCredentials, pgUpsert } from "./pg-wrapper";
export async function databaseUpsert({ contents, group }) {
// No, this should be more rational, ({contents, group, schema})? Or should this be managed by this layer? Unclear.

View File

@ -1,5 +1,5 @@
import pkg from "mongodb";
import { roughSizeOfObject } from "../utils/roughSize.js";
import { roughSizeOfObject } from "../utils/roughSize";
const { MongoClient } = pkg;
export async function mongoUpsert(

View File

@ -1,7 +1,7 @@
import pkg from "pg";
import { platformNames } from "../platforms/all/platformNames.js";
import { hash } from "../utils/hash.js";
import { roughSizeOfObject } from "../utils/roughSize.js";
import { platformNames } from "../platforms/all/platformNames";
import { hash } from "../utils/hash";
import { roughSizeOfObject } from "../utils/roughSize";
const { Pool } = pkg;
// Definitions

View File

@ -1,8 +1,8 @@
import { mergeEverything } from "./mergeEverything.js";
import { updateHistory } from "./history/updateHistory.js";
import { rebuildAlgoliaDatabase } from "../utils/algolia.js";
import { rebuildNetlifySiteWithNewData } from "./rebuildNetliftySiteWithNewData.js";
import { platformFetchers } from "../platforms/all-platforms.js";
import { platformFetchers } from "../platforms/all-platforms";
import { rebuildAlgoliaDatabase } from "../utils/algolia";
import { updateHistory } from "./history/updateHistory";
import { mergeEverything } from "./mergeEverything";
import { rebuildNetlifySiteWithNewData } from "./rebuildNetliftySiteWithNewData";
/* Do everything */
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));

View File

@ -1,3 +1,3 @@
import { doEverything } from "./doEverything.js";
import { doEverything } from "./doEverything";
doEverything();

View File

@ -1,8 +1,7 @@
import { writeFileSync } from "fs";
import {
databaseReadWithReadCredentials,
databaseUpsert,
} from "../../database/database-wrapper.js";
} from "../../database/database-wrapper";
let isEmptyArray = (arr) => arr.length == 0;
export async function addToHistory() {

View File

@ -1,7 +1,4 @@
import {
databaseRead,
databaseUpsert,
} from "../../database/database-wrapper.js";
import { databaseRead, databaseUpsert } from "../../database/database-wrapper";
export async function createHistoryForMonth() {
let currentDate = new Date();

View File

@ -1,4 +1,4 @@
import { databaseRead, databaseUpsert } from "../database-wrapper.js";
import { databaseRead, databaseUpsert } from "../database-wrapper";
let createInitialHistory = async () => {
let metaforecasts = await databaseRead({ group: "combined" });

View File

@ -1,5 +1,5 @@
import { addToHistory } from "./addToHistory.js";
import { createHistoryForMonth } from "./createHistoryForMonth.js";
import { addToHistory } from "./addToHistory";
import { createHistoryForMonth } from "./createHistoryForMonth";
export async function updateHistoryOld() {
let currentDate = new Date();

View File

@ -1,7 +1,7 @@
import {
databaseReadWithReadCredentials,
databaseUpsert,
} from "../../database/database-wrapper.js";
} from "../../database/database-wrapper";
export async function updateHistory() {
let latest = await databaseReadWithReadCredentials({ group: "combined" });

View File

@ -1,5 +1,5 @@
import { databaseRead, databaseUpsert } from "../database/database-wrapper.js";
import { platformNames } from "../platforms/all-platforms.js";
import { databaseRead, databaseUpsert } from "../database/database-wrapper";
import { platformNames } from "../platforms/all-platforms";
/* Merge everything */
export async function mergeEverythingInner() {

View File

@ -1,5 +1,5 @@
import axios from "axios";
import { applyIfSecretExists } from "../utils/getSecrets.js";
import { applyIfSecretExists } from "../utils/getSecrets";
async function rebuildNetlifySiteWithNewData_inner(cookie) {
let payload = {};

View File

@ -3,14 +3,14 @@ import 'dotenv/config';
import readline from 'readline';
import { pgInitialize } from './database/pg-wrapper.js';
import { doEverything, tryCatchTryAgain } from './flow/doEverything.js';
import { updateHistory } from './flow/history/updateHistory.js';
import { mergeEverything } from './flow/mergeEverything.js';
import { rebuildNetlifySiteWithNewData } from './flow/rebuildNetliftySiteWithNewData.js';
import { pgInitialize } from './database/pg-wrapper';
import { doEverything, tryCatchTryAgain } from './flow/doEverything';
import { updateHistory } from './flow/history/updateHistory';
import { mergeEverything } from './flow/mergeEverything';
import { rebuildNetlifySiteWithNewData } from './flow/rebuildNetliftySiteWithNewData';
import { rebuildFrontpage } from './frontpage';
import { platformFetchers } from './platforms/all-platforms.js';
import { rebuildAlgoliaDatabase } from './utils/algolia.js';
import { platformFetchers } from './platforms/all-platforms';
import { rebuildAlgoliaDatabase } from './utils/algolia';
/* Support functions */
let functions = [

View File

@ -1,6 +1,6 @@
import "dotenv/config";
import fs from "fs";
import { databaseReadWithReadCredentials } from "../database/database-wrapper.js";
import { databaseReadWithReadCredentials } from "../database/database-wrapper";
let main = async () => {
let json = await databaseReadWithReadCredentials({ group: "combined" });

View File

@ -1,3 +1,3 @@
import { pgInitialize } from "../database/pg-wrapper.js";
import { pgInitialize } from "../database/pg-wrapper";
pgInitialize();

View File

@ -1,5 +1,5 @@
import fs from "fs";
import { databaseUpsert } from "../database/database-wrapper.js";
import { databaseUpsert } from "../database/database-wrapper";
/* This is necessary for estimize, the database of x-risk estimates, and for the OpenPhil/GiveWell predictions. Unlike the others, I'm not fetching them constantly, but only once. */

View File

@ -1,5 +1,5 @@
/* Imports */
import { goodjudgment } from "../platforms/goodjudgment-fetch.js";
import { goodjudgment } from "../platforms/goodjudgment-fetch";
/* Definitions */

View File

@ -1,2 +1,2 @@
export { platformFetchers } from "./all/platformFetchers.js";
export { platformNames } from "./all/platformNames.js";
export { platformFetchers } from "./all/platformFetchers";
export { platformNames } from "./all/platformNames";

View File

@ -1,27 +1,27 @@
import { betfair } from "../betfair-fetch.js";
import { fantasyscotus } from "../fantasyscotus-fetch.js";
import { foretold } from "../foretold-fetch.js";
import { goodjudgment } from "../goodjudgment-fetch.js";
import { goodjudgmentopen } from "../goodjudmentopen-fetch.js";
import { infer } from "../infer-fetch.js";
import { kalshi } from "../kalshi-fetch.js";
import { manifoldmarkets } from "../manifoldmarkets-fetch.js";
import { metaculus } from "../metaculus-fetch.js";
import { polymarket } from "../polymarket-fetch.js";
import { predictit } from "../predictit-fetch.js";
import { rootclaim } from "../rootclaim-fetch.js";
import { smarkets } from "../smarkets-fetch.js";
import { wildeford } from "../wildeford-fetch.js";
import { betfair } from "../betfair-fetch";
import { fantasyscotus } from "../fantasyscotus-fetch";
import { foretold } from "../foretold-fetch";
import { goodjudgment } from "../goodjudgment-fetch";
import { goodjudgmentopen } from "../goodjudmentopen-fetch";
import { infer } from "../infer-fetch";
import { kalshi } from "../kalshi-fetch";
import { manifoldmarkets } from "../manifoldmarkets-fetch";
import { metaculus } from "../metaculus-fetch";
import { polymarket } from "../polymarket-fetch";
import { predictit } from "../predictit-fetch";
import { rootclaim } from "../rootclaim-fetch";
import { smarkets } from "../smarkets-fetch";
import { wildeford } from "../wildeford-fetch";
/* Deprecated
import { astralcodexten } from "../platforms/astralcodexten-fetch.js"
import { coupcast } from "../platforms/coupcast-fetch.js"
import { csetforetell } from "../platforms/csetforetell-fetch.js"
import { elicit } from "../platforms/elicit-fetch.js"
import { estimize } from "../platforms/estimize-fetch.js"
import { hypermind } from "../platforms/hypermind-fetch.js"
import { ladbrokes } from "../platforms/ladbrokes-fetch.js";
import { williamhill } from "../platforms/williamhill-fetch.js";
import { astralcodexten } from "../platforms/astralcodexten-fetch"
import { coupcast } from "../platforms/coupcast-fetch"
import { csetforetell } from "../platforms/csetforetell-fetch"
import { elicit } from "../platforms/elicit-fetch"
import { estimize } from "../platforms/estimize-fetch"
import { hypermind } from "../platforms/hypermind-fetch"
import { ladbrokes } from "../platforms/ladbrokes-fetch";
import { williamhill } from "../platforms/williamhill-fetch";
*/
export const platformFetchers = [

View File

@ -1,8 +1,8 @@
/* Imports */
import axios from "axios";
import https from "https";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let endpoint = process.env.SECRET_BETFAIR_ENDPOINT;

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let graphQLendpoint = "https://api.foretold.io/graphql";

View File

@ -1,8 +1,8 @@
/* Imports */
import axios from "axios";
import Papa from "papaparse";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let coupCastEndpoint =

View File

@ -1,10 +1,10 @@
/* Imports */
import axios from "axios";
import { Tabletojson } from "tabletojson";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { applyIfSecretExists } from "../utils/getSecrets.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
import { databaseUpsert } from "../utils/database-wrapper";
import { applyIfSecretExists } from "../utils/getSecrets";
import { calculateStars } from "../utils/stars";
import toMarkdown from "../utils/toMarkdown";
/* Definitions */
let htmlEndPoint = "https://www.cset-foretell.com/questions?page=";

View File

@ -2,8 +2,8 @@
import axios from "axios";
import Papa from "papaparse";
import readline from "readline";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let elicitEndpoint =

View File

@ -1,6 +1,6 @@
import fs from "fs";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper";
import { calculateStars } from "../utils/stars";
export async function estimize() {
let data = fs.readFileSync(

View File

@ -1,10 +1,10 @@
/* Imports */
import axios from "axios";
import https from "https";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { applyIfSecretExists } from "../utils/getSecrets.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
import { databaseUpsert } from "../utils/database-wrapper";
import { applyIfSecretExists } from "../utils/getSecrets";
import { calculateStars } from "../utils/stars";
import toMarkdown from "../utils/toMarkdown";
/* Definitions */
let hypermindEnpoint1 = "https://predict.hypermind.com/dash/jsx.json";

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let endpointPolitics = `https://ss-aka-ori.ladbrokes.com/openbet-ssviewer/Drilldown/2.31/EventToOutcomeForClass/302,301,300?simpleFilter=event.siteChannels:contains:M&simpleFilter=event.eventSortCode:intersects:TNMT,TR01,TR02,TR03,TR04,TR05,TR06,TR07,TR08,TR09,TR10,TR11,TR12,TR13,TR14,TR15,TR16,TR17,TR18,TR19,TR20&simpleFilter=event.suspendAtTime:greaterThan:${new Date().toISOString()}.000Z&limitRecords=outcome:1&limitRecords=market:1&translationLang=en&responseFormat=json&prune=event&prune=market`;

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../../utils/database-wrapper.js";
import { calculateStars } from "../../utils/stars.js";
import { databaseUpsert } from "../../utils/database-wrapper";
import { calculateStars } from "../../utils/stars";
/* Definitions */
let graphQLendpoint = "https://api.thegraph.com/subgraphs/name/protofire/omen";

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../utils/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../utils/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let endpoint = "https://sports.williamhill.com/betting/en-gb/politics";

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let endpoint = "https://example.com/";

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let unixtime = new Date().getTime();

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let graphQLendpoint = "https://api.foretold.io/graphql";

View File

@ -1,8 +1,8 @@
/* Imports */
import axios from "axios";
import fs from "fs";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Support functions */
async function fetchPage(url) {

View File

@ -2,9 +2,9 @@
import axios from "axios";
import { Tabletojson } from "tabletojson";
import tunnel from "tunnel";
import { databaseUpsert } from "../database/database-wrapper.js";
import { hash } from "../utils/hash.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { hash } from "../utils/hash";
import { calculateStars } from "../utils/stars";
/* Definitions */
let endpoint = "https://goodjudgment.io/superforecasts/";

View File

@ -1,10 +1,10 @@
/* Imports */
import axios from "axios";
import { Tabletojson } from "tabletojson";
import { databaseUpsert } from "../database/database-wrapper.js";
import { applyIfSecretExists } from "../utils/getSecrets.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
import { databaseUpsert } from "../database/database-wrapper";
import { applyIfSecretExists } from "../utils/getSecrets";
import { calculateStars } from "../utils/stars";
import toMarkdown from "../utils/toMarkdown";
/* Definitions */
let htmlEndPoint = "https://www.gjopen.com/questions?page=";

View File

@ -1,10 +1,10 @@
/* Imports */
import axios from "axios";
import { Tabletojson } from "tabletojson";
import { databaseUpsert } from "../database/database-wrapper.js";
import { applyIfSecretExists } from "../utils/getSecrets.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
import { databaseUpsert } from "../database/database-wrapper";
import { applyIfSecretExists } from "../utils/getSecrets";
import { calculateStars } from "../utils/stars";
import toMarkdown from "../utils/toMarkdown";
/* Definitions */
let htmlEndPoint = "https://www.infer-pub.com/questions";

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let jsonEndpoint = "https://trading-api.kalshi.com/v1/cached/markets/"; //"https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket"//"https://subgraph-backup.poly.market/subgraphs/name/TokenUnion/polymarket"//'https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket3'

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let endpoint = "https://manifold.markets/api/v0/markets";

View File

@ -1,8 +1,8 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
import toMarkdown from "../utils/toMarkdown";
/* Definitions */
let jsonEndPoint = "https://www.metaculus.com/api2/questions/?page=";

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let graphQLendpoint =

View File

@ -1,8 +1,8 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
import toMarkdown from "../utils/toMarkdown";
/* Support functions */
async function fetchmarkets() {

View File

@ -1,8 +1,8 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import toMarkdown from "../utils/toMarkdown.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
import toMarkdown from "../utils/toMarkdown";
/* Definitions */
let jsonEndpoint =

View File

@ -1,7 +1,7 @@
/* Imports */
import axios from "axios";
import { databaseUpsert } from "../database/database-wrapper.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { calculateStars } from "../utils/stars";
/* Definitions */
let htmlEndPointEntrance = "https://api.smarkets.com/v3/events/";

View File

@ -1,10 +1,10 @@
/* Imports */
// import axios from "axios"
import { GoogleSpreadsheet } from "google-spreadsheet";
import { databaseUpsert } from "../database/database-wrapper.js";
import { applyIfSecretExists } from "../utils/getSecrets.js";
import { hash } from "../utils/hash.js";
import { calculateStars } from "../utils/stars.js";
import { databaseUpsert } from "../database/database-wrapper";
import { applyIfSecretExists } from "../utils/getSecrets";
import { hash } from "../utils/hash";
import { calculateStars } from "../utils/stars";
/* Definitions */
const SHEET_ID = "1xcgYF7Q0D95TPHLLSgwhWBHFrWZUGJn7yTyAhDR4vi0"; // spreadsheet key is the long id in the sheets URL

View File

@ -1,6 +1,6 @@
import algoliasearch from "algoliasearch";
import { databaseReadWithReadCredentials } from "../database/database-wrapper.js";
import { mergeEverythingInner } from "../flow/mergeEverything.js";
import { databaseReadWithReadCredentials } from "../database/database-wrapper";
import { mergeEverythingInner } from "../flow/mergeEverything";
let cookie = process.env.ALGOLIA_MASTER_API_KEY;
const client = algoliasearch("96UD3NTQ7L", cookie);

View File

@ -1,6 +1,6 @@
/* Imports */
import fs from "fs";
import { databaseReadWithReadCredentials } from "../database-wrapper.js";
import { databaseReadWithReadCredentials } from "../database-wrapper";
/* Definitions */

View File

@ -1,6 +1,6 @@
/* Imports */
import fs from "fs";
import { databaseReadWithReadCredentials } from "../database-wrapper.js";
import { databaseReadWithReadCredentials } from "../database-wrapper";
/* Definitions */

View File

@ -1,6 +1,6 @@
/* Imports */
import fs from "fs";
import { databaseReadWithReadCredentials } from "../database-wrapper.js";
import { databaseReadWithReadCredentials } from "../database-wrapper";
/* Definitions */
let locationData = "./data/";

View File

@ -1,5 +1,4 @@
import "../styles/tailwind.css";
import "../styles/globals.css";
import '../styles/main.css';
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />;

View File

@ -1,7 +1,9 @@
import React from "react";
import ReactMarkdown from "react-markdown";
import gfm from "remark-gfm";
import Layout from "./layout.js";
import React from 'react';
import ReactMarkdown from 'react-markdown';
import gfm from 'remark-gfm';
import Layout from './layout';
let readmeMarkdownText = `# About
This is a search engine for probabilities. Given a query, it searches for relevant questions in various prediction markets and forecasting platforms (namely Betfair, FantasySCOTUS, Foretold, Good Judgment, Good Judgment Open, Guesstimate, GiveWell & OpenPhilanthropy blogposts as of early 2021, Kalshi, Infer, Ladbrokes, Manifold Markets, Metaculus, Polymarket, PredictIt, Smarkets, William Hill, and Michael Aird's database of existential risk estimates). For example, try searching for "China", "North Korea", "Semiconductors", "COVID", "Trump", or "X-risk".
@ -26,18 +28,11 @@ Also note that, whatever other redeeming features they might have, prediction ma
export default function About() {
return (
<Layout
key="index"
page="about"
lastUpdated={null}
captureToggle={null}
switchCaptureToggle={() => null}
>
<Layout page="about">
<div className="px-2 py-2 bg-white rounded-md shadow place-content-stretch flex-grow place-self-center">
<ReactMarkdown
plugins={[gfm]}
remarkPlugins={[gfm]}
children={readmeMarkdownText}
allowDangerousHtml
className="m-5"
/>
</div>

View File

@ -1,8 +1,9 @@
import Head from "next/head";
import Link from "next/link";
import React from "react";
import Head from 'next/head';
import Link from 'next/link';
import React from 'react';
// import { GiDiceEightFacesEight } from "react-icons/gi";
import { Logo2 } from "../web/icons/index.js";
import { Logo2 } from '../web/icons/index';
/* Utilities */
const classNameSelected = (isSelected) =>
@ -25,7 +26,10 @@ let calculateLastUpdate = () => {
};
// Error catcher
class ErrorBoundary extends React.Component {
class ErrorBoundary extends React.Component<
any,
{ error: any; errorInfo: any }
> {
// https://reactjs.org/docs/error-boundaries.html
constructor(props) {
super(props);
@ -78,7 +82,7 @@ export default function Layout({ page, children }) {
// https://developer.mozilla.org/en-US/docs/Web/API/Location/assign
// window.location.hostname
if (typeof window !== "undefined") {
if (window.location != window.location.pathname) {
if ((window.location as any) != window.location.pathname) {
window.location.assign(window.location.pathname);
}
}

View File

@ -1,4 +1,4 @@
import React, { useEffect } from "react";
import React, { useEffect } from 'react';
function Recursion() {
useEffect(() => {

View File

@ -4,7 +4,7 @@
import { useRouter } from "next/router"; // https://nextjs.org/docs/api-reference/next/router
import React, { useState } from "react";
// Data
import displayForecasts from "../web/display/displayForecasts.js";
import displayForecasts from "../web/display/displayForecasts";
import { getDashboardForecastsByDashboardId } from "../web/worker/getDashboardForecasts";
/* get Props */

View File

@ -2,7 +2,7 @@
import React from 'react';
import { displayForecast } from '../web/display/displayForecasts.js';
import { displayForecast } from '../web/display/displayForecasts';
import { platformsWithLabels } from '../web/platforms';
import searchAccordingToQueryData from '../web/worker/searchAccordingToQueryData';

View File

@ -1,34 +1,18 @@
import React, { useState } from "react";
import Link from "next/link";
import Layout from "./layout.js";
import Link from 'next/link';
import React from 'react';
/* Helper functions */
let calculateLastUpdate = () => {
let today = new Date().toISOString();
let yesterdayObj = new Date();
yesterdayObj.setDate(yesterdayObj.getDate() - 1);
let yesterday = yesterdayObj.toISOString();
if (today.slice(11, 16) > "02:00") {
return today.slice(0, 10);
} else {
return yesterday.slice(0, 10);
}
};
/* get Props */
export async function getStaticProps() {
//getServerSideProps
let lastUpdated = calculateLastUpdate(); // metaforecasts.find(forecast => forecast.platform == "Good Judgment Open").timestamp
return {
props: {
lastUpdated,
},
};
}
import Layout from './layout';
/* Display one tool */
function displayTool({ sameWebpage, title, description, link, url, img, i }) {
function displayTool({
sameWebpage,
title,
description,
link,
url,
img,
i,
}: any) {
switch (sameWebpage) {
case true:
return (
@ -50,7 +34,6 @@ function displayTool({ sameWebpage, title, description, link, url, img, i }) {
return (
<a
href={url}
passHref
key={`tool-${i}`}
className="hover:bg-gray-100 hover:no-underline cursor-pointer flex flex-col px-4 py-3 bg-white rounded-md shadow place-content-stretch flex-grow no-underline b-6"
>
@ -111,12 +94,7 @@ export default function Tools({ lastUpdated }) {
},
];
return (
<Layout
key="tools"
page="tools"
lastUpdated={lastUpdated}
captureToggle={"search"}
>
<Layout page="tools">
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4 mb-8">
{tools.map((tool, i) => displayTool({ ...tool, i }))}
</div>

View File

@ -1,3 +1,11 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
.text-orange-400 {
color: #ffac75;
}
html,
body {
padding: 0;

View File

@ -1,7 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
.text-orange-400 {
color: #ffac75;
}

View File

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState } from 'react';
let exampleInput = `{
"title": "Random example",
@ -54,8 +54,8 @@ Your old input was: ${value}`;
<textarea
value={value}
onChange={handleChange}
rows="8"
cols="50"
rows={8}
cols={50}
className=""
/>
<br />

View File

@ -1,7 +1,7 @@
/* Imports */
import React, { useState } from "react";
import ReactMarkdown from "react-markdown";
import { FaRegClipboard } from "react-icons/fa";
import React from 'react';
import { FaRegClipboard } from 'react-icons/fa';
import ReactMarkdown from 'react-markdown';
/* Definitions */
@ -603,8 +603,8 @@ export function displayForecast({
onClick={(e) => {
e.preventDefault();
navigator.clipboard.writeText(`"${id}"`);
setIsJustCopiedSignalVisible(true);
setTimeout(() => setIsJustCopiedSignalVisible(false), 1000);
// setIsJustCopiedSignalVisible(true);
// setTimeout(() => setIsJustCopiedSignalVisible(false), 1000);
// This is just personal preference.
// I prefer to not show the whole text area selected.
}}

View File

@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'react';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import { uploadToImgur } from '../worker/uploadToImgur';
import { displayForecast } from './displayForecasts.js';
import { displayForecast } from './displayForecasts';
function displayOneForecastInner(result, containerRef) {
return (

View File

@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from 'react';
export default function DropdownForStars({
value,

View File

@ -1,4 +1,4 @@
import React, { useRef } from "react";
import React from 'react';
export default function Form({ value, onChange, placeholder }) {
const handleInputChange = (event) => {
@ -16,7 +16,6 @@ export default function Form({ value, onChange, placeholder }) {
onChange={handleInputChange}
name="query"
id="query"
label="Query"
placeholder={placeholder}
onSubmit={(e) => e.preventDefault()}
/>

View File

@ -1,7 +1,8 @@
import chroma from "chroma-js";
import React from "react";
import Select from "react-select";
import { platformsWithLabels } from "../platforms";
import chroma from 'chroma-js';
import React from 'react';
import Select from 'react-select';
import { platformsWithLabels } from '../platforms';
const colourStyles = {
control: (styles) => ({ ...styles, backgroundColor: "white" }),

View File

@ -1,6 +1,7 @@
/* Imports */
import { Slider, Rail, Handles, Tracks, Ticks } from "react-compound-slider";
import React, { useState } from "react";
import React from 'react';
import { Handles, Rail, Slider, Tracks } from 'react-compound-slider';
// https://sghall.github.io/react-compound-slider/#/getting-started/tutorial
/* Definitions */

View File

@ -1,4 +1,4 @@
import * as React from "react";
import * as React from 'react';
function SvgFavicon(props) {
return (

View File

@ -1,4 +1,4 @@
import * as React from "react";
import * as React from 'react';
function SvgLogo(props) {
return (

View File

@ -1,4 +1,4 @@
import * as React from "react";
import * as React from 'react';
function SvgLogo2(props) {
return (

View File

@ -1,5 +1,5 @@
import searchGuesstimate from './searchGuesstimate.js';
import searchWithAlgolia from './searchWithAlgolia.js';
import searchGuesstimate from './searchGuesstimate';
import searchWithAlgolia from './searchWithAlgolia';
export default async function searchAccordingToQueryData(queryData) {
let results = [];

View File

@ -1,9 +1,5 @@
module.exports = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx}",
"./src/web/display/**/*.{js,ts,jsx,tsx}",
"./src/web/icons/**/*.{js,ts,jsx,tsx}",
],
content: ["./src/web/**/*.tsx", "./src/pages/**/*.tsx"],
darkMode: "media", // or 'media' or 'class'
theme: {
extend: {