Merge pull request #116 from gempir/develop

Display more whitespace, upgrade all frontend deps
This commit is contained in:
gempir 2021-08-21 12:42:21 +02:00 committed by GitHub
commit 9fad849263
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 1896 additions and 1081 deletions

View file

@ -1,20 +1,20 @@
{
"files": {
"main.js": "/static/js/main.a621f860.chunk.js",
"main.js.map": "/static/js/main.a621f860.chunk.js.map",
"main.js": "/static/js/main.86fabd34.chunk.js",
"main.js.map": "/static/js/main.86fabd34.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.aef01254.js",
"runtime-main.js.map": "/static/js/runtime-main.aef01254.js.map",
"static/css/2.0a74b1fe.chunk.css": "/static/css/2.0a74b1fe.chunk.css",
"static/js/2.e6885029.chunk.js": "/static/js/2.e6885029.chunk.js",
"static/js/2.e6885029.chunk.js.map": "/static/js/2.e6885029.chunk.js.map",
"static/css/2.bc4e7c69.chunk.css": "/static/css/2.bc4e7c69.chunk.css",
"static/js/2.a2dffc57.chunk.js": "/static/js/2.a2dffc57.chunk.js",
"static/js/2.a2dffc57.chunk.js.map": "/static/js/2.a2dffc57.chunk.js.map",
"index.html": "/index.html",
"static/css/2.0a74b1fe.chunk.css.map": "/static/css/2.0a74b1fe.chunk.css.map",
"static/js/2.e6885029.chunk.js.LICENSE.txt": "/static/js/2.e6885029.chunk.js.LICENSE.txt"
"static/css/2.bc4e7c69.chunk.css.map": "/static/css/2.bc4e7c69.chunk.css.map",
"static/js/2.a2dffc57.chunk.js.LICENSE.txt": "/static/js/2.a2dffc57.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.aef01254.js",
"static/css/2.0a74b1fe.chunk.css",
"static/js/2.e6885029.chunk.js",
"static/js/main.a621f860.chunk.js"
"static/css/2.bc4e7c69.chunk.css",
"static/js/2.a2dffc57.chunk.js",
"static/js/main.86fabd34.chunk.js"
]
}

View file

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#090A0B"/><title>justlog</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/><link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/><style>:root{--bg:#0e0e10;--bg-bright:#18181b;--bg-brighter:#3d4146;--bg-dark:#121416;--theme:#00CC66;--theme-bright:#00FF80;--theme2:#2980b9;--theme2-bright:#3498db;--text:#F5F5F5;--text-dark:#616161;--danger:#e74c3c}body{margin:0;padding:0;background:var(--bg);font-family:Helvetica,Arial,sans-serif;height:100%;width:100%}*{box-sizing:border-box}</style><link href="/static/css/2.0a74b1fe.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var f=this.webpackJsonpweb=this.webpackJsonpweb||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([])</script><script src="/static/js/2.e6885029.chunk.js"></script><script src="/static/js/main.a621f860.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#090A0B"/><title>justlog</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/><link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/><style>:root{--bg:#0e0e10;--bg-bright:#18181b;--bg-brighter:#3d4146;--bg-dark:#121416;--theme:#00CC66;--theme-bright:#00FF80;--theme2:#2980b9;--theme2-bright:#3498db;--text:#F5F5F5;--text-dark:#616161;--danger:#e74c3c}body{margin:0;padding:0;background:var(--bg);font-family:Helvetica,Arial,sans-serif;height:100%;width:100%}*{box-sizing:border-box}</style><link href="/static/css/2.bc4e7c69.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var f=this.webpackJsonpweb=this.webpackJsonpweb||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([])</script><script src="/static/js/2.a2dffc57.chunk.js"></script><script src="/static/js/main.86fabd34.chunk.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@ object-assign
*/
/*!
Copyright (c) 2017 Jed Watson.
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
@ -64,7 +64,7 @@ object-assign
* Licensed under the MIT License.
*/
/*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.0.8/LICENSE */
/*! @license DOMPurify 2.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.1/LICENSE */
/*! For license information please see swagger-ui.js.LICENSE.txt */
@ -72,6 +72,8 @@ object-assign
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/**
@ -91,7 +93,7 @@ object-assign
* @public
*/
/** @license React v0.20.1
/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@ -109,7 +111,7 @@ object-assign
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.1
/** @license React v17.0.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@ -118,7 +120,16 @@ object-assign
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.1
/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@ -127,7 +138,7 @@ object-assign
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.1
/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -10,12 +10,12 @@
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-linkify": "^1.0.0-alpha",
"react-query": "^2.25.2",
"react-scripts": "4.0.0",
"react-query": "^3.21.0",
"react-scripts": "^4.0.3",
"react-window": "^1.8.6",
"swagger-ui-react": "^3.37.2",
"swagger-ui-react": "^4.0.0-beta.4",
"typescript": "^4.0.3",
"web-vitals": "^0.2.4"
"web-vitals": "^2.1.0"
},
"scripts": {
"start": "react-scripts start",
@ -43,11 +43,11 @@
},
"devDependencies": {
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.2",
"@testing-library/user-event": "^12.2.2",
"@types/jest": "^26.0.15",
"@types/react": "^16.9.56",
"@types/react-dom": "^16.9.9",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/jest": "^27.0.1",
"@types/react": "^17.0.19",
"@types/react-dom": "^17.0.9",
"@types/react-linkify": "^1.0.0",
"@types/react-window": "^1.8.2",
"@types/styled-components": "^5.1.4",

View file

@ -1,7 +1,7 @@
import { Button, TextField } from "@material-ui/core";
import { Autocomplete } from '@material-ui/lab';
import React, { FormEvent, useContext } from "react";
import { useQueryCache } from "react-query";
import { useQueryClient } from "react-query";
import styled from "styled-components";
import { useChannels } from "../hooks/useChannels";
import { store } from "../store";
@ -33,7 +33,7 @@ const FiltersWrapper = styled.div`
export function Filters() {
const { setCurrents, state } = useContext(store);
const queryCache = useQueryCache();
const queryClient = useQueryClient();
const channels = useChannels();
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
@ -45,7 +45,7 @@ export function Filters() {
const channel = data.get("channel") as string | null;
const username = data.get("username") as string | null;
queryCache.invalidateQueries(["log", { channel: channel?.toLowerCase(), username: username?.toLowerCase() }]);
queryClient.invalidateQueries(["log", { channel: channel?.toLowerCase(), username: username?.toLowerCase() }]);
setCurrents(channel, username);
}

View file

@ -6,6 +6,7 @@ import { LogMessage } from "../types/log";
import { ThirdPartyEmote } from "../types/ThirdPartyEmote";
const MessageContainer = styled.div`
white-space: pre-wrap;
a {
margin: 0 2px;

View file

@ -9,44 +9,44 @@ export type AvailableLogs = Array<{ month: string, year: string }>;
export function useAvailableLogs(channel: string | null, username: string | null): [AvailableLogs, Error | undefined] {
const { state, setState } = useContext(store);
// @ts-ignore
// @ts-ignore I don't understand this error :)
const { data } = useQuery<[AvailableLogs, Error | undefined]>(["availableLogs", { channel: channel, username: username }], () => {
if (channel && username) {
const channelIsId = isUserId(channel);
const usernameIsId = isUserId(username);
if (channelIsId) {
channel = getUserId(channel)
}
if (usernameIsId) {
username = getUserId(username)
}
const queryUrl = new URL(`${state.apiBaseUrl}/list`);
queryUrl.searchParams.append(`channel${channelIsId ? "id" : ""}`, channel);
queryUrl.searchParams.append(`user${usernameIsId ? "id" : ""}`, username);
return fetch(queryUrl.toString()).then((response) => {
if (response.ok) {
return response;
}
setState({ ...state, error: true });
if (response.status === 403) {
throw new OptOutError();
}
throw Error(response.statusText);
}).then(response => response.json())
.then((data: { availableLogs: AvailableLogs }) => [data.availableLogs, undefined])
.catch((err) => {
return [[], err];
});
if (!channel || !username) {
return Promise.resolve([[], undefined]);
}
return [[], undefined];
const channelIsId = isUserId(channel);
const usernameIsId = isUserId(username);
if (channelIsId) {
channel = getUserId(channel)
}
if (usernameIsId) {
username = getUserId(username)
}
const queryUrl = new URL(`${state.apiBaseUrl}/list`);
queryUrl.searchParams.append(`channel${channelIsId ? "id" : ""}`, channel);
queryUrl.searchParams.append(`user${usernameIsId ? "id" : ""}`, username);
return fetch(queryUrl.toString()).then((response) => {
if (response.ok) {
return response;
}
setState({ ...state, error: true });
if (response.status === 403) {
throw new OptOutError();
}
throw Error(response.statusText);
}).then(response => response.json())
.then((data: { availableLogs: AvailableLogs }) => [data.availableLogs, undefined])
.catch((err) => {
return [[], err];
});
}, { refetchOnWindowFocus: false, refetchOnReconnect: false });
return data ?? [[], undefined];
return data as [AvailableLogs, Error | undefined] | undefined ?? [[], undefined];
}

View file

@ -1,7 +1,7 @@
import React from 'react';
import { useContext } from 'react';
import ReactDOM from 'react-dom';
import { ReactQueryCacheProvider } from 'react-query';
import { QueryClientProvider } from 'react-query';
import { Page } from './components/Page';
import { StateProvider, store } from './store';
import { unstable_createMuiStrictModeTheme as createMuiTheme } from '@material-ui/core';
@ -16,9 +16,9 @@ const pageTheme = createMuiTheme({
function App() {
const { state } = useContext(store);
return <ReactQueryCacheProvider queryCache={state.queryCache}>
return <QueryClientProvider client={state.queryClient}>
<Page />
</ReactQueryCacheProvider>
</QueryClientProvider>
}
ReactDOM.render(

View file

@ -1,5 +1,5 @@
import React, { createContext, useState } from "react";
import { QueryCache } from "react-query";
import { QueryClient } from 'react-query'
import { useLocalStorage } from "./hooks/useLocalStorage";
export interface Settings {
@ -25,7 +25,7 @@ export interface Setting {
export interface State {
settings: Settings,
queryCache: QueryCache,
queryClient: QueryClient,
apiBaseUrl: string,
currentChannel: string | null,
currentUsername: string | null,
@ -39,7 +39,7 @@ export type Action = Record<string, unknown>;
const url = new URL(window.location.href);
const defaultContext = {
state: {
queryCache: new QueryCache(),
queryClient: new QueryClient(),
apiBaseUrl: process.env.REACT_APP_API_BASE_URL ?? window.location.protocol + "//" + window.location.host,
settings: {
showEmotes: {
@ -103,7 +103,7 @@ const StateProvider = ({ children }: { children: JSX.Element }): JSX.Element =>
}
}
state.queryCache.removeQueries("log");
state.queryClient.removeQueries("log");
setSettingsStorage(newSettings);
setState({ ...state, settings: newSettings });

View file

@ -1,26 +1,26 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": [
"src"
]
}
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}

File diff suppressed because it is too large Load diff