use modified dependencies

This commit is contained in:
刘浩远 2020-06-05 10:05:54 +08:00
parent 93926536aa
commit a83479f46f
10 changed files with 58 additions and 27 deletions

BIN
dist/icons/fabric-icons-2-63c99abf.woff vendored Normal file

Binary file not shown.

8
dist/styles.css vendored
View File

@ -98,9 +98,15 @@ i.ms-Nav-chevron {
vertical-align: top;
}
.btn-group .btn.system {
position: sticky;
position: relative;
z-index: 10;
}
nav.hide-btns .btn-group .btn {
display: none;
}
nav.hide-btns .btn-group .btn.system {
display: inline-block;
}
.btn-group .btn:hover {
background-color: #0001;
}

View File

@ -21,6 +21,7 @@
"@types/redux-thunk": "^2.1.0",
"@types/reselect": "^2.2.0",
"@yang991178/electron-proxy-agent": "^1.2.1",
"@yang991178/rss-parser": "^3.8.1",
"electron": "^8.3.0",
"electron-react-devtools": "^0.5.3",
"electron-window-state": "^5.0.3",
@ -35,7 +36,6 @@
"redux-devtools": "^3.5.0",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"rss-parser": "^3.8.0",
"ts-loader": "^7.0.4",
"typescript": "^3.9.2",
"webpack": "^4.43.0",

View File

@ -23,9 +23,9 @@ export class Menu extends React.Component<MenuProps> {
{
links: [
{
name: "主页",
key: "home",
icon: "Home",
name: "搜索",
key: "search",
icon: "Search",
url: null
},
{

View File

@ -1,5 +1,5 @@
import * as React from "react"
import { ipcRenderer } from "electron"
import { ipcRenderer, remote } from "electron"
import { Icon } from "@fluentui/react/lib/Icon"
import { AppState, MenuStatus } from "../scripts/models/app"
import { NavReduxProps } from "../containers/nav-container"
@ -12,14 +12,46 @@ type NavProps = NavReduxProps & {
settings: () => void
}
class Nav extends React.Component<NavProps> {
ipcSend(message:string) {
ipcRenderer.send(message)
type NavState = {
maximized: boolean,
window: Electron.BrowserWindow
}
class Nav extends React.Component<NavProps, NavState> {
constructor(props) {
super(props)
let window = remote.getCurrentWindow()
window.on("maximize", () => {
this.setState({ maximized: true })
})
window.on("unmaximize", () => {
this.setState({ maximized: false })
})
this.state = {
maximized: remote.getCurrentWindow().isMaximized(),
window: window
}
}
minimize = () => {
this.state.window.minimize()
}
maximize = () => {
if (this.state.maximized) {
this.state.window.unmaximize()
} else {
this.state.window.maximize()
}
this.setState({ maximized: !this.state.maximized })
}
close = () => {
this.state.window.close()
}
canFetch = () => this.props.state.sourceInit && this.props.state.feedInit && !this.props.state.fetchingItems
fetching = () => !this.canFetch() ? " fetching" : ""
menuOn = () => this.props.state.menu == MenuStatus.Open ? " on" : ""
hideButtons = () => (this.props.state.menu == MenuStatus.Open || this.props.state.settings.display) ? "hide-btns" : ""
fetch = () => {
if (this.canFetch()) this.props.fetch()
@ -27,7 +59,7 @@ class Nav extends React.Component<NavProps> {
render() {
return (
<nav>
<nav className={this.hideButtons()}>
<div className="btn-group">
<a className="btn" title="菜单" onClick={this.props.menu}><Icon iconName="GlobalNavButton" /></a>
</div>
@ -41,9 +73,11 @@ class Nav extends React.Component<NavProps> {
<a className="btn" title="视图"><Icon iconName="View" /></a>
<a className="btn" title="选项" onClick={this.props.settings}><Icon iconName="Settings" /></a>
<span className="seperator"></span>
<a className={"btn system"+this.menuOn()} title="最小化" onClick={() => this.ipcSend("minimize")} style={{fontSize: 12}}><Icon iconName="Remove" /></a>
<a className={"btn system"+this.menuOn()} title="最大化" onClick={() => this.ipcSend("maximize")} style={{fontSize: 10}}><Icon iconName="Checkbox" /></a>
<a className={"btn system close"+this.menuOn()} title="关闭" onClick={() => this.ipcSend("close")}><Icon iconName="Cancel" /></a>
<a className={"btn system"+this.menuOn()} title="最小化" onClick={this.minimize} style={{fontSize: 12}}><Icon iconName="Remove" /></a>
<a className={"btn system"+this.menuOn()} title="最大化" onClick={this.maximize}>
{this.state.maximized ? <Icon iconName="ChromeRestore" style={{fontSize: 11}} /> :<Icon iconName="Checkbox" style={{fontSize: 10}} />}
</a>
<a className={"btn system close"+this.menuOn()} title="关闭" onClick={this.close}><Icon iconName="Cancel" /></a>
</div>
</nav>
)

View File

@ -49,7 +49,7 @@ class ProxyTab extends React.Component {
</Stack.Item>
<Stack.Item>
<DefaultButton
disabled={urlTest(this.state.pacUrl)}
disabled={!urlTest(this.state.pacUrl)}
type="sumbit"
text="设置" />
</Stack.Item>

View File

@ -10,6 +10,7 @@ function createWindow() {
})
// Create the browser window.
mainWindow = new BrowserWindow({
backgroundColor: "#faf9f8",
x: mainWindowState.x,
y: mainWindowState.y,
width: mainWindowState.width,
@ -40,13 +41,3 @@ app.on('activate', function () {
createWindow()
}
})
ipcMain.on('minimize', e => mainWindow.minimize())
ipcMain.on('maximize', e => {
if (mainWindow.isMaximized()) {
mainWindow.unmaximize()
} else {
mainWindow.maximize()
}
})
ipcMain.on('close', e => mainWindow.close())

View File

@ -2,7 +2,7 @@ import * as db from "../db"
import { rssParser, domParser, htmlDecode, ActionStatus, AppThunk } from "../utils"
import { RSSSource } from "./source"
import { FeedActionTypes, INIT_FEED, LOAD_MORE } from "./feed"
import Parser = require("rss-parser")
import Parser = require("@yang991178/rss-parser")
export class RSSItem {
id: number

View File

@ -1,4 +1,4 @@
import Parser = require("rss-parser")
import Parser = require("@yang991178/rss-parser")
import * as db from "../db"
import { rssParser, faviconPromise, ActionStatus, AppThunk } from "../utils"
import { RSSItem, fetchItemsSuccess, insertItems } from "./item"

View File

@ -16,7 +16,7 @@ export type AppThunk<ReturnType = void> = ThunkAction<
export type AppDispatch = ThunkDispatch<RootState, undefined, AnyAction>
import Parser = require("rss-parser")
import Parser = require("@yang991178/rss-parser")
const customFields = {
item: ["thumb", "image", ["content:encoded", "fullContent"]] as Parser.CustomFieldItem[]
}