Abandon native experiment... (for now).
This commit is contained in:
parent
4461670e14
commit
1075c7ff4a
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"presets": [
|
|
||||||
"env",
|
|
||||||
"stage-0",
|
|
||||||
"react"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
node_modules
|
|
||||||
bin
|
|
|
@ -1,70 +0,0 @@
|
||||||
import React, { Component } from 'react';
|
|
||||||
import fs from 'fs-extra';
|
|
||||||
import {
|
|
||||||
render,
|
|
||||||
Window,
|
|
||||||
App,
|
|
||||||
TextInput,
|
|
||||||
Dialog,
|
|
||||||
Menu,
|
|
||||||
Box,
|
|
||||||
} from 'proton-native';
|
|
||||||
import { Provider } from 'react-redux';
|
|
||||||
|
|
||||||
class Mcopy extends Component {
|
|
||||||
state = { text: '' };
|
|
||||||
|
|
||||||
save() {
|
|
||||||
const filename = Dialog('Save');
|
|
||||||
if (filename) {
|
|
||||||
fs.writeFileSync(filename, this.state.text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open() {
|
|
||||||
const filename = Dialog('Open');
|
|
||||||
if (filename) {
|
|
||||||
let data = fs.readFileSync(filename);
|
|
||||||
this.setState({ text: data });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
|
||||||
if (typeof nextState.text === 'string') return false;
|
|
||||||
// nextState is set from input
|
|
||||||
else return true; // nextState is set from file
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
|
|
||||||
<App onShouldQuit={() => console.log('Quitting')}>
|
|
||||||
<Menu label="File">
|
|
||||||
<Menu.Item type="Item" onClick={() => this.open()}>
|
|
||||||
Open
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item type="Item" onClick={() => this.save()}>
|
|
||||||
Save
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item type="Quit" />
|
|
||||||
</Menu>
|
|
||||||
<Window
|
|
||||||
onClose={() => console.log('Closing')}
|
|
||||||
title="mcopy-native"
|
|
||||||
size={{ w: 800, h: 600 }}
|
|
||||||
>
|
|
||||||
<Box>
|
|
||||||
<TextInput
|
|
||||||
onChange={text => this.setState({ text })}
|
|
||||||
multiline={true}
|
|
||||||
>
|
|
||||||
{this.state.text}
|
|
||||||
</TextInput>
|
|
||||||
</Box>
|
|
||||||
</Window>
|
|
||||||
</App>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render(<Mcopy />);
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,51 +0,0 @@
|
||||||
{
|
|
||||||
"name": "mcopy-native",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"description": "Small guage film optical printer platform written in proton-native",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"start": "node_modules/.bin/babel-node index.js",
|
|
||||||
"build": "node_modules/.bin/babel index.js -d bin/",
|
|
||||||
"pack": "electron-builder --dir",
|
|
||||||
"dist": "electron-builder"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/sixteenmillimeter/mcopy.git"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/sixteenmillimeter/mcopy/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/sixteenmillimeter/mcopy#readme",
|
|
||||||
"dependencies": {
|
|
||||||
"fs-extra": "^7.0.1",
|
|
||||||
"humanize-duration": "^3.17.0",
|
|
||||||
"moment": "^2.24.0",
|
|
||||||
"proton-native": "^1.1.11",
|
|
||||||
"react": "^16.8.3",
|
|
||||||
"react-redux": "^6.0.1",
|
|
||||||
"redux": "^4.0.1",
|
|
||||||
"redux-thunk": "^2.3.0",
|
|
||||||
"serialport": "^7.1.4",
|
|
||||||
"uuid": "^3.3.2",
|
|
||||||
"winston": "^3.2.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/fs-extra": "^5.0.5",
|
|
||||||
"@types/proton-native": "^1.1.5",
|
|
||||||
"@types/react": "^16.8.6",
|
|
||||||
"@types/react-redux": "^7.0.1",
|
|
||||||
"@types/redux-thunk": "^2.1.0",
|
|
||||||
"@types/serialport": "^7.0.1",
|
|
||||||
"@types/uuid": "^3.4.4",
|
|
||||||
"babel-cli": "^6.26.0",
|
|
||||||
"babel-preset-env": "^1.7.0",
|
|
||||||
"babel-preset-react": "^6.24.1",
|
|
||||||
"babel-preset-stage-0": "^6.24.1",
|
|
||||||
"electron-builder": "^20.38.5",
|
|
||||||
"react-native-typescript-transformer": "^1.2.11",
|
|
||||||
"typescript": "^3.3.3333"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue