Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
0ccffe88ce
|
|||
|
a7230519ff
|
|||
|
21b2098c78
|
|||
|
d52c64d25a
|
|||
|
bec2d6538f
|
|||
|
aa2377df7f
|
34
.drone.yml
Normal file
34
.drone.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
clone:
|
||||||
|
depth: 1
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: frontend-web
|
||||||
|
image: node:19
|
||||||
|
commands:
|
||||||
|
- cd web
|
||||||
|
- npm install
|
||||||
|
- npm run build
|
||||||
|
|
||||||
|
- name: backend
|
||||||
|
image: golang:1.19
|
||||||
|
commands:
|
||||||
|
- go build -v .
|
||||||
|
environment:
|
||||||
|
CGO_ENABLED: 0
|
||||||
|
GOPROXY: goproxy.cn
|
||||||
|
|
||||||
|
- name: upload
|
||||||
|
image: plugins/s3-sync
|
||||||
|
settings:
|
||||||
|
bucket: msw-artifacts-public
|
||||||
|
region: ap-southeast-1
|
||||||
|
access_key:
|
||||||
|
from_secret: access_key
|
||||||
|
secret_key:
|
||||||
|
from_secret: secret_key
|
||||||
|
source: msw-open-music
|
||||||
|
target: /msw-open-music/${DRONE_COMMIT}/
|
||||||
2
Makefile
2
Makefile
@@ -4,7 +4,7 @@ web:
|
|||||||
cd web && npm run build
|
cd web && npm run build
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
go build -v -ldflags '-linkmode=external -extldflags=-static' -tags sqlite_omit_load_extension,netgo
|
CGO_ENABLED=0 go build -v -ldflags '-extldflags=-static'
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v
|
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v
|
||||||
|
|||||||
14
main.go
14
main.go
@@ -1,8 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
"msw-open-music/pkg/api"
|
"msw-open-music/pkg/api"
|
||||||
"msw-open-music/pkg/commonconfig"
|
"msw-open-music/pkg/commonconfig"
|
||||||
@@ -15,11 +17,21 @@ func init() {
|
|||||||
flag.StringVar(&ConfigFilePath, "config", "config.json", "backend config file path")
|
flag.StringVar(&ConfigFilePath, "config", "config.json", "backend config file path")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:embed web/build
|
||||||
|
var WEBFILES embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var err error
|
var err error
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
config := commonconfig.Config{}
|
WEBFS, err := fs.Sub(WEBFILES, "web/build")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
config := commonconfig.Config{
|
||||||
|
WEBFS: WEBFS,
|
||||||
|
}
|
||||||
configFile, err := os.Open(ConfigFilePath)
|
configFile, err := os.Open(ConfigFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gorilla/sessions"
|
|
||||||
"msw-open-music/pkg/commonconfig"
|
"msw-open-music/pkg/commonconfig"
|
||||||
"msw-open-music/pkg/database"
|
"msw-open-music/pkg/database"
|
||||||
"msw-open-music/pkg/tmpfs"
|
"msw-open-music/pkg/tmpfs"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gorilla/sessions"
|
||||||
)
|
)
|
||||||
|
|
||||||
type API struct {
|
type API struct {
|
||||||
@@ -103,7 +104,7 @@ func NewAPI(config commonconfig.Config) (*API, error) {
|
|||||||
apiMux.HandleFunc("/reset", api.HandleReset)
|
apiMux.HandleFunc("/reset", api.HandleReset)
|
||||||
|
|
||||||
mux.Handle("/api/v1/", http.StripPrefix("/api/v1", api.PermissionMiddleware(apiMux)))
|
mux.Handle("/api/v1/", http.StripPrefix("/api/v1", api.PermissionMiddleware(apiMux)))
|
||||||
mux.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir("web/build"))))
|
mux.Handle("/", http.StripPrefix("/", http.FileServer(http.FS(config.WEBFS))))
|
||||||
|
|
||||||
return api, nil
|
return api, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package commonconfig
|
package commonconfig
|
||||||
|
|
||||||
|
import "io/fs"
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
APIConfig APIConfig `json:"api"`
|
APIConfig APIConfig `json:"api"`
|
||||||
TmpfsConfig TmpfsConfig `json:"tmpfs"`
|
TmpfsConfig TmpfsConfig `json:"tmpfs"`
|
||||||
|
WEBFS fs.FS
|
||||||
}
|
}
|
||||||
|
|
||||||
type APIConfig struct {
|
type APIConfig struct {
|
||||||
|
|||||||
@@ -1,70 +1,9 @@
|
|||||||
# Getting Started with Create React App
|
# MSW Open Music Web Frontend
|
||||||
|
|
||||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
This is a React single page application. And use Preact instead of React to achieve a smaller file size.
|
||||||
|
|
||||||
## Available Scripts
|
`node_modules` only has 19M. We uses esbuild and shell scripts and build only takes a milliseconds!
|
||||||
|
|
||||||
In the project directory, you can run:
|
## How to build
|
||||||
|
|
||||||
### `npm start`
|
Simple run `./build.sh`, then all output files are under `./build/` directory.
|
||||||
|
|
||||||
Runs the app in the development mode.\
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
||||||
|
|
||||||
The page will reload if you make edits.\
|
|
||||||
You will also see any lint errors in the console.
|
|
||||||
|
|
||||||
### `npm test`
|
|
||||||
|
|
||||||
Launches the test runner in the interactive watch mode.\
|
|
||||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
||||||
|
|
||||||
### `npm run build`
|
|
||||||
|
|
||||||
Builds the app for production to the `build` folder.\
|
|
||||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
||||||
|
|
||||||
The build is minified and the filenames include the hashes.\
|
|
||||||
Your app is ready to be deployed!
|
|
||||||
|
|
||||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
||||||
|
|
||||||
### `npm run eject`
|
|
||||||
|
|
||||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
||||||
|
|
||||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
||||||
|
|
||||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
||||||
|
|
||||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
||||||
|
|
||||||
## Learn More
|
|
||||||
|
|
||||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
||||||
|
|
||||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
||||||
|
|
||||||
### Code Splitting
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
|
||||||
|
|
||||||
### Analyzing the Bundle Size
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
|
||||||
|
|
||||||
### Making a Progressive Web App
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
|
||||||
|
|
||||||
### Advanced Configuration
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
|
||||||
|
|
||||||
### Deployment
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
|
||||||
|
|
||||||
### `npm run build` fails to minify
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
|
||||||
|
|||||||
20
web/build.js
Normal file
20
web/build.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const esbuild = require("esbuild");
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
fs.rmSync("build", { recursive: true, force: true });
|
||||||
|
fs.cpSync("public", "build", { recursive: true });
|
||||||
|
|
||||||
|
const result = await esbuild.build({
|
||||||
|
entryPoints: ["src/index.jsx"],
|
||||||
|
bundle: true,
|
||||||
|
outfile: "build/msw-open-music.js",
|
||||||
|
sourcemap: true,
|
||||||
|
minify: true,
|
||||||
|
metafile: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const text = await esbuild.analyzeMetafile(result.metafile);
|
||||||
|
console.log(text);
|
||||||
|
console.log("Build done, output files udner ./build directory");
|
||||||
|
})();
|
||||||
27864
web/package-lock.json
generated
27864
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -3,42 +3,12 @@
|
|||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@preact/compat": "^17.1.2",
|
||||||
"@testing-library/react": "^13.4.0",
|
"esbuild": "^0.15.17",
|
||||||
"@testing-library/user-event": "^14.4.3",
|
|
||||||
"react": "^18.2.0",
|
|
||||||
"react-dom": "^18.2.0",
|
|
||||||
"react-router": "^6.4.4",
|
|
||||||
"react-router-dom": "^6.4.4",
|
"react-router-dom": "^6.4.4",
|
||||||
"react-scripts": "^5.0.1",
|
"water.css": "^2.1.1"
|
||||||
"water.css": "^2.1.1",
|
|
||||||
"web-vitals": "^3.1.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"build": "node build.js"
|
||||||
"build": "react-scripts build",
|
|
||||||
"test": "react-scripts test",
|
|
||||||
"eject": "react-scripts eject"
|
|
||||||
},
|
|
||||||
"eslintConfig": {
|
|
||||||
"extends": [
|
|
||||||
"react-app",
|
|
||||||
"react-app/jest"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"browserslist": {
|
|
||||||
"production": [
|
|
||||||
">0.2%",
|
|
||||||
"not dead",
|
|
||||||
"not op_mini all"
|
|
||||||
],
|
|
||||||
"development": [
|
|
||||||
"last 1 chrome version",
|
|
||||||
"last 1 firefox version",
|
|
||||||
"last 1 safari version"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/react": "^18.0.25"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,40 +2,18 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
|
<link rel="icon" href="./favicon.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="description" content="Personal music streaming platform" />
|
<meta name="description" content="Personal music streaming platform" />
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.png" />
|
<link rel="apple-touch-icon" href="./favicon.png" />
|
||||||
<!--
|
<link rel="manifest" href="./manifest.json" />
|
||||||
manifest.json provides metadata used when your web app is installed on a
|
<link rel="stylesheet" href="./msw-open-music.css" />
|
||||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
||||||
-->
|
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
||||||
<!--
|
|
||||||
Notice the use of %PUBLIC_URL% in the tags above.
|
|
||||||
It will be replaced with the URL of the `public` folder during the build.
|
|
||||||
Only files inside the `public` folder can be referenced from the HTML.
|
|
||||||
|
|
||||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
||||||
work correctly both with client-side routing and a non-root public URL.
|
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
|
||||||
-->
|
|
||||||
<!-- Add to homescreen for Chrome on Android -->
|
|
||||||
<meta name="mobile-web-app-capable" content="yes" />
|
<meta name="mobile-web-app-capable" content="yes" />
|
||||||
<title>MSW Open Music</title>
|
<title>MSW Open Music</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<!--
|
<script type="module" src="./msw-open-music.js"></script>
|
||||||
This HTML file is a template.
|
|
||||||
If you open it directly in the browser, you will see an empty page.
|
|
||||||
|
|
||||||
You can add webfonts, meta tags, or analytics to this file.
|
|
||||||
The build step will place the bundled scripts into the <body> tag.
|
|
||||||
|
|
||||||
To begin the development, run `npm start` or `yarn start`.
|
|
||||||
To create a production bundle, use `npm run build` or `yarn build`.
|
|
||||||
-->
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,16 +1,3 @@
|
|||||||
html {
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: auto;
|
|
||||||
padding-top: 1rem;
|
|
||||||
max-width: unset;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
#root {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.base {
|
.base {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-row-gap: 1em;
|
grid-row-gap: 1em;
|
||||||
@@ -48,54 +35,10 @@ body {
|
|||||||
color: rgb(229, 232, 245);
|
color: rgb(229, 232, 245);
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
a.unset {
|
|
||||||
color: unset;
|
|
||||||
text-decoration: unset;
|
|
||||||
}
|
|
||||||
a.active {
|
|
||||||
color: deeppink;
|
|
||||||
background-color: lightgray;
|
|
||||||
border-radius: 0.39em 0.39em 0 0;
|
|
||||||
}
|
|
||||||
.audio-player {
|
.audio-player {
|
||||||
height: 39px;
|
height: 39px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
td.clickable {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
div.clickable {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
div.page {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
div.search_toolbar {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: flex-end;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
div.feedback {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
button.refresh {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
td,
|
|
||||||
th {
|
|
||||||
padding-bottom: 0.5em;
|
|
||||||
padding-top: 0.5em;
|
|
||||||
}
|
|
||||||
dialog {
|
|
||||||
border: solid;
|
|
||||||
}
|
|
||||||
.player-options {
|
.player-options {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { HashRouter as Router, Routes, Route, NavLink } from "react-router-dom";
|
import { HashRouter as Router, Routes, Route, NavLink } from "react-router-dom";
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import {useNavigate} from "react-router";
|
import {useNavigate} from "react-router";
|
||||||
import {CalcReadableFilesizeDetail} from "./Common";
|
import {CalcReadableFilesizeDetail} from "./Common";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useState, useEffect, useContext } from "react";
|
import { useState, useEffect, useContext } from "react";
|
||||||
import { Tr, tr, langCodeContext } from "../translate";
|
import { Tr, tr, langCodeContext } from "../translate";
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { useParams, useNavigate } from "react-router";
|
import { useParams, useNavigate } from "react-router";
|
||||||
import { tr, Tr, langCodeContext } from "../translate";
|
import { tr, Tr, langCodeContext } from "../translate";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useState, useEffect, useContext } from "react";
|
import { useState, useEffect, useContext } from "react";
|
||||||
import { useParams, useNavigate } from "react-router";
|
import { useParams, useNavigate } from "react-router";
|
||||||
import { tr, Tr, langCodeContext } from "../translate";
|
import { tr, Tr, langCodeContext } from "../translate";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { convertIntToDateTime } from "./Common";
|
import { convertIntToDateTime } from "./Common";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
function FfmpegConfig(props) {
|
function FfmpegConfig(props) {
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { Tr } from "../translate";
|
import { Tr } from "../translate";
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { CalcReadableFilesize } from "./Common";
|
import { CalcReadableFilesize } from "./Common";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import {useNavigate, useParams} from "react-router";
|
import {useNavigate, useParams} from "react-router";
|
||||||
import {useContext, useEffect, useState} from "react";
|
import {useContext, useEffect, useState} from "react";
|
||||||
import {Tr, tr, langCodeContext} from "../translate";
|
import {Tr, tr, langCodeContext} from "../translate";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import {useParams} from "react-router";
|
import {useParams} from "react-router";
|
||||||
import {useState, useEffect} from "react";
|
import {useState, useEffect} from "react";
|
||||||
import {useNavigate} from "react-router-dom";
|
import {useNavigate} from "react-router-dom";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import FileEntry from "./FileEntry";
|
import FileEntry from "./FileEntry";
|
||||||
import { Tr } from "../translate";
|
import { Tr } from "../translate";
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { Tr } from "../translate";
|
import { Tr } from "../translate";
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useQuery } from "./Common";
|
import { useQuery } from "./Common";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useContext, useState } from "react";
|
import { useContext, useState } from "react";
|
||||||
import { Tr, tr, langCodeContext } from "../translate";
|
import { Tr, tr, langCodeContext } from "../translate";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import Database from "./Database";
|
import Database from "./Database";
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { Tr } from "../translate";
|
import { Tr } from "../translate";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useContext, useState } from "react";
|
import { useContext, useState } from "react";
|
||||||
import { tr, Tr, langCodeContext } from "../translate";
|
import { tr, Tr, langCodeContext } from "../translate";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { convertIntToDateTime } from "./Common";
|
import { convertIntToDateTime } from "./Common";
|
||||||
import { Tr, tr, langCodeContext } from "../translate";
|
import { Tr, tr, langCodeContext } from "../translate";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import ReviewEntry from "./ReviewEntry";
|
import ReviewEntry from "./ReviewEntry";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useState, useEffect, useContext } from "react";
|
import { useState, useEffect, useContext } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useQuery } from "./Common";
|
import { useQuery } from "./Common";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useQuery } from "./Common";
|
import { useQuery } from "./Common";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import FilesTable from "./FilesTable";
|
import FilesTable from "./FilesTable";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { Tr } from "../translate";
|
import { Tr } from "../translate";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useState, useEffect, useContext } from "react";
|
import { useState, useEffect, useContext } from "react";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import ReviewEntry from "./ReviewEntry";
|
import ReviewEntry from "./ReviewEntry";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
function UserStatus(props) {
|
function UserStatus(props) {
|
||||||
@@ -1,13 +1,66 @@
|
|||||||
|
#root {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
html {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: auto;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
padding-top: 1rem;
|
||||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
max-width: none;
|
||||||
|
min-height: 100vh;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||||
|
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||||
sans-serif;
|
sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||||
monospace;
|
monospace;
|
||||||
}
|
}
|
||||||
|
a.unset {
|
||||||
|
color: unset;
|
||||||
|
text-decoration: unset;
|
||||||
|
}
|
||||||
|
a.active {
|
||||||
|
color: deeppink;
|
||||||
|
background-color: lightgray;
|
||||||
|
border-radius: 0.39em 0.39em 0 0;
|
||||||
|
}
|
||||||
|
td.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
div.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
div.page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
div.search_toolbar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-end;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
div.feedback {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
button.refresh {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
padding-bottom: 0.5em;
|
||||||
|
padding-top: 0.5em;
|
||||||
|
}
|
||||||
|
dialog {
|
||||||
|
border: solid;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import ReactDOM from 'react-dom';
|
|
||||||
import './index.css';
|
|
||||||
import 'water.css';
|
|
||||||
import App from './App';
|
|
||||||
import reportWebVitals from './reportWebVitals';
|
|
||||||
|
|
||||||
ReactDOM.render(
|
|
||||||
<React.StrictMode>
|
|
||||||
<App />
|
|
||||||
</React.StrictMode>,
|
|
||||||
document.getElementById('root')
|
|
||||||
);
|
|
||||||
|
|
||||||
// If you want to start measuring performance in your app, pass a function
|
|
||||||
// to log results (for example: reportWebVitals(console.log))
|
|
||||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
||||||
reportWebVitals();
|
|
||||||
12
web/src/index.jsx
Normal file
12
web/src/index.jsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import 'water.css';
|
||||||
|
import './index.css';
|
||||||
|
import App from './App';
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<App />
|
||||||
|
</React.StrictMode>,
|
||||||
|
document.getElementById('root')
|
||||||
|
);
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
const reportWebVitals = onPerfEntry => {
|
|
||||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
||||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
||||||
getCLS(onPerfEntry);
|
|
||||||
getFID(onPerfEntry);
|
|
||||||
getFCP(onPerfEntry);
|
|
||||||
getLCP(onPerfEntry);
|
|
||||||
getTTFB(onPerfEntry);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default reportWebVitals;
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { createContext, renderToString } from "react";
|
import * as React from 'react';
|
||||||
|
import { createContext } from "react";
|
||||||
import MAP_zh_CN from "./zh_CN";
|
import MAP_zh_CN from "./zh_CN";
|
||||||
|
|
||||||
const LANG_OPTIONS = {
|
const LANG_OPTIONS = {
|
||||||
Reference in New Issue
Block a user