mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: fix build errors
This commit is contained in:
1 parent
1608b4b9aa
commit
7f96f602ce
11 files changed
+22
-16
No files matched your search
+4
-1
@@ -40,10 +40,13 @@ const configFlat = (name) => (name === 'packages/ui-default' ? {
|
||||
exclude: [
|
||||
'./public',
|
||||
],
|
||||
include: ['**/*.ts'],
|
||||
compilerOptions: {
|
||||
experimentalDecorators: true,
|
||||
resolveJsonModule: true,
|
||||
jsx: 'react',
|
||||
module: 'es2020',
|
||||
module: 'commonjs',
|
||||
skipLibCheck: true,
|
||||
allowSyntheticDefaultImports: true,
|
||||
target: 'es2020',
|
||||
baseUrl: '.',
|
||||
|
||||
@@ -12,7 +12,7 @@ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
||||
import WebpackBar from 'webpackbar';
|
||||
import root from '../utils/root';
|
||||
|
||||
export default function (env: { production?: boolean, measure?: boolean } = {}) {
|
||||
export default function (env: { watch?: boolean, production?: boolean, measure?: boolean } = {}) {
|
||||
function esbuildLoader() {
|
||||
return {
|
||||
loader: 'esbuild-loader',
|
||||
|
||||
@@ -29,6 +29,7 @@ export const config = {
|
||||
theme: {
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
path: `${UiContext.cdn_prefix}vditor/dist/css/content-theme`,
|
||||
current: 'light',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -44,6 +44,7 @@ const endpoint = url.toString().replace('http', 'ws');
|
||||
|
||||
const initWorkerMode = () => {
|
||||
console.log('Messages: using SharedWorker');
|
||||
// @ts-ignore
|
||||
const worker = new SharedWorker(new URL('./worker?inline', import.meta.url), { name: 'HydroMessagesWorker' });
|
||||
worker.port.start();
|
||||
window.addEventListener('beforeunload', () => {
|
||||
|
||||
@@ -83,9 +83,9 @@ function ExtraFilesConfig() {
|
||||
|
||||
function LangConfig() {
|
||||
const langs = useSelector((state: RootState) => state.config.langs) || [];
|
||||
const prefixes = new Set(Object.keys(LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||
const data = Object.keys(LANGS).filter((i) => !prefixes.has(i))
|
||||
.map((i) => ({ name: LANGS[i].display, _id: i }));
|
||||
const prefixes = new Set(Object.keys(window.LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||
const data = Object.keys(window.LANGS).filter((i) => !prefixes.has(i))
|
||||
.map((i) => ({ name: window.LANGS[i].display, _id: i }));
|
||||
const dispatch = useDispatch();
|
||||
const ref = React.useRef<any>();
|
||||
const selectedKeys = langs.filter((i) => !prefixes.has(i));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Card, NumericInput, Tag } from '@blueprintjs/core';
|
||||
import { parseMemoryMB, parseTimeMS } from '@hydrooj/utils/lib/common';
|
||||
import { SubtaskConfig } from 'hydrooj/src/interface';
|
||||
import type { SubtaskConfig } from 'hydrooj/src/interface';
|
||||
import { isEqual, pick } from 'lodash';
|
||||
import React from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
@@ -22,9 +22,9 @@ declare module 'hydrooj' {
|
||||
'ui-default.nav_logo_dark_2x': string;
|
||||
}
|
||||
interface UiContextBase {
|
||||
nav_logo_dark: string;
|
||||
nav_logo_dark_2x: string;
|
||||
constantVersion: string;
|
||||
nav_logo_dark?: string;
|
||||
nav_logo_dark_2x?: string;
|
||||
constantVersion?: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"@types/redux-logger": "^3.0.9",
|
||||
"@types/serviceworker": "^0.0.51",
|
||||
"@types/sharedworker": "^0.0.80",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@vscode/codicons": "^0.0.32",
|
||||
"autoprefixer": "^10.4.8",
|
||||
"browser-update": "^3.3.40",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { normalizeSubtasks, readSubtasksFromFiles, size } from '@hydrooj/utils/lib/common';
|
||||
import { SubtaskType } from 'hydrooj/src/interface';
|
||||
import type { SubtaskType } from 'hydrooj/src/interface';
|
||||
import $ from 'jquery';
|
||||
import yaml from 'js-yaml';
|
||||
import React from 'react';
|
||||
|
||||
@@ -4,7 +4,7 @@ const target = [
|
||||
'https://us.hydro.ac',
|
||||
];
|
||||
|
||||
this.addEventListener('install', () => {
|
||||
(this as any).addEventListener('install', () => {
|
||||
console.log('Service Worker installing');
|
||||
});
|
||||
async function get(url) {
|
||||
@@ -23,7 +23,7 @@ async function get(url) {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
this.addEventListener('fetch', (event) => {
|
||||
(this as any).addEventListener('fetch', (event) => {
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (new URL(event.request.url).origin !== location.origin) return;
|
||||
event.respondWith(get(event.request.url));
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const prefixes = new Set(Object.keys(LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||
const prefixes = new Set(Object.keys(window.LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||
|
||||
export default function getAvailableLangs(langsList?: string[]) {
|
||||
const Langs = {};
|
||||
for (const key in LANGS) {
|
||||
for (const key in window.LANGS) {
|
||||
if (prefixes.has(key)) continue;
|
||||
if (langsList && langsList.length && langsList.join('') && !langsList.includes(key)) continue;
|
||||
else if (LANGS[key].hidden && !langsList?.includes(key)) continue;
|
||||
Langs[key] = LANGS[key];
|
||||
else if (window.LANGS[key].hidden && !langsList?.includes(key)) continue;
|
||||
Langs[key] = window.LANGS[key];
|
||||
}
|
||||
return Langs;
|
||||
}
|
||||
Reference in new issue
Block a user