Skip to content

Commit 2ce252a

Browse files
authored
chore: upgrade and refactor the web client (#236)
* chore: upgrade dependencies * refactor: fix issues after upgrading * chore: introduce tailwind * refactor: make the style more compact * chore: update readme * chore: add new screenshot * chore: update screenshot * chore: remove console.log * chore: bump node and go versions
1 parent 11585d7 commit 2ce252a

27 files changed

Lines changed: 783 additions & 393 deletions

.github/workflows/ci_build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
# Install runtimes
2929
- uses: actions/setup-go@v2
3030
with:
31-
go-version: "^1.17.0"
31+
go-version: "^1.23.0"
3232
- uses: actions/setup-node@v2
3333
with:
34-
node-version: "12"
34+
node-version: "18"
3535
- run: go version
3636
- name: Install dependencies
3737
run: |

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
</h1>
44
<p align="center">
55
Quick and simple file sharing between different devices.
6-
(<a href="https://github.com/ihexxa/quickshare/blob/main/docs/screenshots.md">Screenshots</a>)
6+
(
7+
<a href="https://github.com/ihexxa/quickshare/blob/main/docs/screenshots.md">Screenshots</a>&nbsp;|&nbsp;
8+
<a href="https://github.com/ihexxa/quickshare/blob/main/docs/imgs/v0.9.1/quickshare_1920.gif">Demo</a>
9+
)
710
</p>
811
<p align="center">
912
<a href="https://github.com/ihexxa/quickshare/actions">
@@ -20,7 +23,7 @@
2023
</a>
2124
<p>
2225

23-
<image src="./docs/imgs/v0.9.1/quickshare_1920.gif" title="preview">
26+
<image src="./docs/imgs/v0.11.0/newlook.png" title="preview">
2427

2528

2629
English | [简体中文](./docs/README_zh-cn.md)

docs/README_zh-cn.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
</h1>
44
<p align="center">
55
简单的文件共享服务, 使用Go/Golang, Typescript, Gin, React, Boltdb等构建.
6-
(<a href="https://github.com/ihexxa/quickshare/blob/main/docs/screenshots.md">界面截图</a>)
6+
(
7+
<a href="https://github.com/ihexxa/quickshare/blob/main/docs/screenshots.md">界面截图</a>&nbsp;|&nbsp;
8+
<a href="https://github.com/ihexxa/quickshare/blob/main/docs/imgs/v0.9.1/quickshare_1920.gif">录频</a>
9+
)
710
</p>
811
<p align="center">
912
<a href="https://github.com/ihexxa/quickshare/actions">
@@ -20,7 +23,7 @@
2023
</a>
2124
<p>
2225

23-
<image src="./imgs/v0.9.1/quickshare_1920.gif" title="preview">
26+
<image src="./imgs/v0.11.0/newlook.png" title="preview">
2427

2528
[English](../README.md) | 简体中文
2629

docs/imgs/v0.11.0/newlook.png

1.42 MB
Loading

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
"scripts": {
77
"build:fe": "yarn && bash scripts/copy_js.sh && webpack --config src/client/web/webpack.app.prod.js",
88
"build:fe:dev": "yarn && bash scripts/copy_js_dev.sh && webpack --config src/client/web/webpack.app.dev.js --watch",
9-
"build:fe:watch": "yarn && bash scripts/copy_js.sh && webpack --config src/client/web/webpack.app.prod.js --watch",
9+
"build:fe:prod": "yarn && bash scripts/copy_js.sh && webpack --config src/client/web/webpack.app.prod.js --watch",
1010
"start": "yarn build:fe && go run cmd/start/main.go -c `pwd`/configs/dev.yml",
11+
"server:dev": "go run cmd/start/main.go -c `pwd`/configs/dev.yml",
1112
"build": "yarn build:fe && bash scripts/build_be.sh",
1213
"build:docker": "docker build . -f Dockerfile_default -t hexxa/quickshare:latest",
1314
"build:docker:heroku": "docker build . -t hexxa/quickshare:latest"

src/client/web/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@
1616
"@babel/plugin-transform-runtime": "^7.4.4",
1717
"@babel/preset-env": "^7.4.4",
1818
"@babel/preset-react": "^7.0.0",
19+
"@tailwindcss/postcss": "^4.1.7",
1920
"@types/assert": "^1.4.2",
2021
"@types/deep-diff": "^1.0.0",
2122
"@types/jest": "^27.0.1",
2223
"@types/object-hash": "^2.2.1",
2324
"assert": "^2.0.0",
2425
"babel-loader": "^8.2.2",
26+
"css-loader": "^7.1.2",
2527
"deep-diff": "^1.0.2",
2628
"html-webpack-plugin": "^5.5.0",
2729
"jest": "^27.2.0",
30+
"postcss": "^8.5.3",
31+
"postcss-loader": "^8.1.1",
32+
"style-loader": "^4.0.0",
33+
"tailwindcss": "^4.1.7",
2834
"terser-webpack-plugin": "^5.2.4",
2935
"ts-jest": "^27.0.5",
3036
"ts-loader": "^9.2.8",

src/client/web/postcss.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
plugins: {
3+
"@tailwindcss/postcss": {},
4+
}
5+
}

src/client/web/src/app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { StateMgr } from "./components/state_mgr";
55
import { ErrorLogger } from "./common/log_error";
66
import { errCorsScript } from "./common/errors";
77

8+
import './style/tailwind.css';
9+
810
window.onerror = (
911
msg: string,
1012
source: string,

src/client/web/src/components/control/btn_list.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,29 @@ export const BtnList = (props: Props) => {
1515
const titleIcon =
1616
props.titleIcon != null ? (
1717
getIconWithProps(props.titleIcon, {
18-
size: "3rem",
19-
className: "major-font margin-r-m",
18+
size: "1.8rem",
19+
className: "major-font mr-4",
2020
})
2121
) : (
2222
<span></span>
2323
);
2424

2525
const btns = props.btnNames.map((btnName: string, i: number) => {
2626
const cb = props.btnCallbacks.get(i);
27+
const isLast = i === props.btnNames.size - 1;
2728
return (
28-
<button key={`rows-${i}`} className="inline-block margin-r-m button-default" onClick={cb}>
29+
<button
30+
key={`rows-${i}`}
31+
className={`inline-block ${isLast ? "" : "mr-8"}`}
32+
onClick={cb}
33+
>
2934
{btnName}
3035
</button>
3136
);
3237
});
3338

3439
return (
35-
<div className="margin-b-l">
40+
<div>
3641
<Flexbox
3742
children={List([titleIcon, <span>{btns}</span>])}
3843
childrenStyles={List([{ flex: "0 0 auto" }, { flex: "0 0 auto" }])}

src/client/web/src/components/control/tabs.tsx

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import * as React from "react";
2-
import { Map } from "immutable";
2+
import { List, Map } from "immutable";
33

44
import { updater } from "../state_updater";
55
import { ICoreState, MsgProps, UIProps } from "../core_state";
66
import { Env } from "../../common/env";
77
import { IconProps, getIcon } from "../visual/icons";
88
import { colorClass } from "../visual/colors";
9+
import { Flexbox } from "../layout/flexbox";
910

1011
const defaultIconProps: IconProps = {
1112
name: "RiFolder2Fill",
@@ -52,19 +53,19 @@ export class Tabs extends React.Component<Props, State, {}> {
5253

5354
const iconColor = displaying === option ? iconProps.color : "normal";
5455
const icon = getIcon(iconProps.name, iconProps.size, iconColor);
55-
const fontColor =
56-
displaying === option ? `${colorClass(iconColor)}-font` : "normal-font";
56+
const fontWeight =
57+
displaying === option ? `font-bold` : "";
5758

5859
return (
5960
<button
6061
key={`${this.props.targetControl}-${option}`}
6162
onClick={() => {
6263
this.setTab(this.props.targetControl, option);
6364
}}
64-
className="float-l margin-r-m minor-bg"
65+
className="float-left mr-12"
6566
>
66-
<div className="float-l icon-s margin-r-s">{icon}</div>
67-
<div className={`float-l font-xs ${fontColor}`}>
67+
<div className="float-left icon-s margin-r-s">{icon}</div>
68+
<div className={`float-left font-xs ${fontWeight}`}>
6869
{this.props.msg.pkg.get(
6970
`control.${this.props.targetControl}.${option}`
7071
)}
@@ -75,10 +76,21 @@ export class Tabs extends React.Component<Props, State, {}> {
7576
});
7677

7778
return (
78-
<div className={`tabs control-${this.props.targetControl}`}>
79-
{tabs}
80-
<div className="fix"></div>
81-
</div>
79+
<Flexbox
80+
children={List([
81+
<div className={`tabs control-${this.props.targetControl}`}>
82+
{tabs}
83+
<div className="fix"></div>
84+
</div>,
85+
<a href="//github.com/ihexxa/quickshare" className="major-font">
86+
{getIcon("FaGithub", "2rem", "normal")}
87+
</a>,
88+
])}
89+
childrenStyles={List([
90+
{ flex: "0 0 auto" },
91+
{ justifyContent: "flex-end" },
92+
])}
93+
/>
8294
);
8395
}
8496
}

0 commit comments

Comments
 (0)