switching to electron because no clipboard support and flex box doesn't work properly

master
Adam Veldhousen 4 years ago
parent 5f10bce64f
commit ed7c6300f2

@ -0,0 +1,4 @@
{
"orientation": "vertical",
"noteDirectory": "~/.xnv/notes"
}

@ -7,6 +7,7 @@
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"date-fns": "^2.9.0",
"lodash.debounce": "^4.0.8",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-markdown": "^4.3.1",

@ -84,6 +84,7 @@ class App extends PureComponent {
notes={notes}
onSelect={this.handleSelectNote}
onTagUpdate={this.handleTagUpdate}
selectedNote={selectedNote}
/>
<NoteContent
note={selectedNote}

@ -1,5 +1,9 @@
.EditableNoteArea {
height: 100%;
height: 90%;
border: gray solid 1px;
padding: 10px;
display: flex;
justify-content: stretch;
}
.EditableNoteArea pre {
@ -10,6 +14,21 @@
.EditableNoteArea textarea {
width: 100%;
height: 100%;
border: none;
background-color: black;
color: white;
}
.EditableNoteArea .markdownPreview {
flex-basis: 1 1 min-content;
overflow: scroll;
}
.EditableNoteArea .markdownPreview h1,
.EditableNoteArea .markdownPreview h2,
.EditableNoteArea .markdownPreview h3,
.EditableNoteArea .markdownPreview h4,
.EditableNoteArea .markdownPreview h5,
.EditableNoteArea .markdownPreview p {
margin-top: 0;
}

@ -9,17 +9,18 @@ export default function EditableNoteArea({
onSave = noop,
preview = false
}) {
const [newContent, setNewContent] = useState(content);
const updateContent = ({ target }) =>
setNewContent(target.value || newContent);
const updateContent = ({ target: { value } }) => {
onSave(value);
};
return (
<section className="EditableNoteArea">
{!preview ? (
<textarea defaultValue={content} onChange={updateContent} />
<textarea value={content} onChange={updateContent} />
) : (
<ReactMarkdown source={content} />
<div className="markdownPreview">
<ReactMarkdown source={content} />
</div>
)}
</section>
);

@ -1,5 +1,5 @@
.NoteContent {
height: 80%;
min-height: 70%;
background-color: black;
display: flex;
flex-direction: column;
@ -8,7 +8,11 @@
padding: 0 10px 15px 10px;
}
.NoteContent p {
margin: 0;
}
.NoteContent .controls {
padding: 10px;
padding: 10px 0;
display: flex;
}

@ -1,25 +1,32 @@
.NoteList {
min-height: 80px;
height: 25%;
flex-basis: 1 1 content;
list-style-type: none;
border-color: black;
border-width: 2px;
border-width: 1px;
border-style: groove;
border-top-style: none;
border-bottom-style: none;
margin: 0;
padding: 0;
text-align: left;
overflow-y: scroll;
min-height: 75px;
}
.NoteList li:hover {
cursor: pointer;
}
.NoteList li:nth-child(even) {
background-color: #222222;
}
.NoteList li.selected {
background-color: orange;
color: black;
}
.NoteList li:hover {
cursor: pointer;
}
.NoteList .NoteListItem {
padding: 0 10px;
display: flex;

@ -8,12 +8,17 @@ import "./NoteList.css";
export default function NoteList({
notes = [],
onSelect = noop,
onTagUpdate = noop
onTagUpdate = noop,
selectedNote = {}
}) {
const { title: selectedNoteTitle } = selectedNote || {};
return (
<ul className="NoteList">
{notes.map(n => (
<li key={n.title}>
<li
className={n.title === selectedNoteTitle && "selected"}
key={n.title}
>
<NoteListItem
{...n}
onSelect={onSelect}

@ -1,3 +1,5 @@
import debounce from "lodash.debounce";
export const noop = () => {};
export const enterKeyPressed = (cb = noop) => ({ charCode }) =>
charCode === 13 && cb();
@ -60,7 +62,93 @@ const notesStore = {
}),
createNote({
title: "this is not an ass 5",
content: "this is an ass note",
content: `
# Secret info about database
## auctioneers_auct_catalogs
- ncatalog_status
- null when the catalog isnt published/proofed
- online when the catalog is publically visible
- live during live sales
- ncatalog_type
- 1 Timed Sales
- 10 White Label
- 1/11 Gold
- 2/12 Platinum
- 3/13 Platinum Plus
- 1 Timed
- 10+ White label
For ncatalog_type 1 and 11 were "Gold," 2 and 12 were "Platinum," 3 and 13 were "Platinum Plus," but now 1 will typically be timed sales and 3/13 will be traditional. 10 is white label _only_ which means that the auction is not displayed on our site, except by direct URL. 10 + the level (1,2,3) means the catalog can be accessed as white label _and_ is displayed as a normal catalog on our site. ncatalog_type = 10 is really the only important functionality of that variable now, but there are still some gotchas lingering.
- auction_type
- j = jewelry only
- c = Business and Industrial or Real Estate or Automotive categories
- t = Dolls and Toys category
- a = timed (?)
## auctioneers_auct2_lots_sold
- Lots sold; 1 = sold, 2 = not sold
## auctioneers_auct2_np_bid_history
- The bidder_id in np_bid_history is 0 for competing/floor bids sourceid = 1 is also for floor bids.
- sourceid: 1=floor bids, 2=live, 3=absentee bid executed, 4=ios, 5=android, 6=automated bids to clear reserve price
- Competing/floor bids are entered by the clerk and are supposed to represent anyone bidding live outside of our system (at the auction house, over the phone, on another internet platform, etc), and those will always have a bidder_id of 0.
Sub catalogs; they don't exist in the system formally, they're just lots grouped by listing_agent_id
## auctioneers_auct2_np_bid_history
absforcebidderid set to 20; 20 would be the SFS (smart fox server) internal userId for the live bidder that placed a bid, thus forcing the existing absentee bid (which preempts the live bid) to be sent to the clerk.
All you really need to know is that there was a live bid that forced the absentee bid to be placed.
Only one bid is sent
sourceid 1= floor, 2=internet, 3=absentee, 4=iPhone, 5=Android
## auctioneers_auct2_npb
npb_type 1 = active dispute, 0 = resolved dispute
auctioneers_users
role known possible values: admin, auctioneer, bidder
admin_group possible values: exec, support, development, admin_group, <NULL>
## auctioneers_auct2_approval
\`SELECT distinct approval_approved FROM liveauct_liveauctioneers.auctioneers_auct2_approval;\`
approval_approved = 0 - not reviewed, 1 - approved, 2 - declined, 4 - blocked by auctioneer, 5 - suspended
## auctioneers_auct_bids
## auctioneers_auct_houses
## auctioneers_auct2_lots_sold
has ~29 million lots, we only index 21 million since some houses do high volume listings and we ignore any
plaintext passwords for many of our clients just hanging out in here
usernames and passwords are generally the same
FAQ
Q. Can someone tell me where we are keeping the stats that we are reporting on for auction houses? I think they have stats like number of views of their items and such.
A. They are stored in the statistics database, which is a separate machine from our main database; however, they are aggregated and stored in auctioneers_auct_catalogs_admin_data and auctioneers_auct2_lots_admin_data for catalog and lot-specific data respectively.
Q. Whats with all the ncatalog stuff?
A. In the mainhost codebase the letter "n" is often used to mean new (unfortunately) to distinguish from similarly named things from the eBay era.
ncatalog_status is the status of the catalog once it is proofed. It is null until the catalog is proofed (i.e. published/made public on our site), at which point it is "online". "Live" indicates that the auction is taking place right now (or soon), and "done" means done.
ncatalog_type is not as important as it used to be. We used to have tiered service levels that had access to different features. For ncatalog_type 1 and 11 were "Gold," 2 and 12 were "Platinum," 3 and 13 were "Platinum Plus," but now 1 will typically be timed sales and 3/13 will be traditional. 10 is white label _only_ which means that the auction is not displayed on our site, except by direct URL. 10 + the level (1,2,3) means the catalog can be accessed as white label _and_ is displayed as a normal catalog on our site. ncatalog_type = 10 is really the only important functionality of that variable now, but there are still some gotchas lingering.
`,
tags: ["not ass"]
})
]

@ -6388,6 +6388,11 @@ lodash.camelcase@^4.3.0:
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY=
lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=
lodash.memoize@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"

@ -3,6 +3,7 @@ module github.com/adamveld12/xnv
go 1.13
require (
github.com/Equanox/gotron v0.2.23 // indirect
github.com/ImVexed/muon v0.0.0-20191209030120-589db8f0f250
github.com/markbates/pkger v0.14.0
)

@ -1,3 +1,8 @@
bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg=
github.com/Benchkram/errz v0.0.0-20180825145403-619d291cb54f h1:FRzI8csOWCO+a4dtjCk+C5lsb8t6UIStMT7ay+5rnxk=
github.com/Benchkram/errz v0.0.0-20180825145403-619d291cb54f/go.mod h1:twnWNXfJK5tkeR2E3YIZI5t//54pW/QIbykQoKtAqtk=
github.com/Equanox/gotron v0.2.23 h1:Jm02KIizTzJ0oUFUieBELzFg8IPmRuWczc8tPzfcdnw=
github.com/Equanox/gotron v0.2.23/go.mod h1:NIsLI7BT06TWQMspklCjtyy536p80QRD8bfqUx5jeK4=
github.com/ImVexed/muon v0.0.0-20191209030120-589db8f0f250 h1:+KkMpIteI+2TQUEscOPk6Mj7laXTAP2ZMwAAWPt4UqQ=
github.com/ImVexed/muon v0.0.0-20191209030120-589db8f0f250/go.mod h1:DkpeS5mqL3RyvGnhKG47yMrQSfsxtjgNXU7V1DC0q8g=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -5,6 +10,9 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gobuffalo/here v0.6.0 h1:hYrd0a6gDmWxBM4TnrGw8mQg24iSVoIkHEk7FodQcBI=
github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@ -12,11 +20,24 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/markbates/pkger v0.14.0 h1:z6KCEBkr3zJTkAMz5SJzjA9Izo+Ipb6XXvOIjQEW+PU=
github.com/markbates/pkger v0.14.0/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI=
github.com/otiai10/copy v1.0.1 h1:gtBjD8aq4nychvRZ2CyJvFWAw0aja+VHazDdruZKGZA=
github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc=
github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/zerolog v1.11.0 h1:DRuq/S+4k52uJzBQciUcofXx45GrMC6yrEbb/CoK6+M=
github.com/rs/zerolog v1.11.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b h1:gQZ0qzfKHQIybLANtM3mBXNUtOfsCFXeTsnBqCsx1KM=
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae/go.mod h1:quDq6Se6jlGwiIKia/itDZxqC5rj6/8OdFyMMAwTxCs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

@ -2,10 +2,13 @@
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
"time"
"github.com/ImVexed/muon"
@ -14,11 +17,24 @@ import (
"net/http"
)
var (
verbose = flag.Bool("verbose", false, "debug logging")
configPath = flag.String("config", "~/.config/xnv/config.json", "the config file to use")
dev = flag.String("dev", "", "development mode")
)
func main() {
fileHandler := http.FileServer(pkger.Dir("/frontend/build/"))
flag.Parse()
var fileHandler http.Handler
if *dev != "" {
log.Println("using local files for view")
fileHandler = http.FileServer(http.Dir(*dev))
} else {
fileHandler = http.FileServer(pkger.Dir("/frontend/build/"))
}
cfg := &muon.Config{
Title: "xnv",
Title: "XNV",
Height: 500,
Width: 640,
Titled: true,
@ -30,11 +46,14 @@ func main() {
as := &AppState{
Settings: Settings{
Directory: "K:/private/aveldhousen/notes/posts",
Directory: "/keybase/private/aveldhousen/notes/",
Orientation: "vertical",
},
Notes: []Note{},
}
if *verbose {
log.Printf("Using config: %+v", as.Settings)
}
m.Bind("add", add)
@ -73,21 +92,37 @@ type LoadNoteResult struct {
func (as *AppState) LoadNotes() LoadNoteResult {
notes := []Note{}
if *verbose {
log.Printf("trying to load notes...")
}
if err := filepath.Walk(as.Settings.Directory, func(path string, info os.FileInfo, err error) error {
if info == nil {
return nil
fileExt := strings.TrimPrefix(filepath.Ext(path), ".")
if *verbose {
log.Printf("checking '%s' - has '%s' extension", path, fileExt)
}
fileExt := filepath.Ext(info.Name())
if fileExt == "md" || fileExt == "txt" || fileExt == "utf" || fileExt == "todo" {
content, err := ioutil.ReadFile(path)
if err != nil {
log.Printf("ERROR could not load file @ '%s': %v", path, err)
return nil
}
if *verbose {
log.Printf("Found '%s'", path)
}
finfo, err := os.Stat(path)
if err != nil {
log.Printf("ERROR could not load file info: %v", err)
return nil
}
notes = append(notes, Note{
Title: info.Name(),
LastModified: info.ModTime(),
Created: info.ModTime(),
Title: filepath.Base(path),
LastModified: finfo.ModTime(),
Created: finfo.ModTime(),
Content: string(content),
})
}

@ -63,4 +63,4 @@ $(OUTPUT_DIR)/darwin/xnv: pkged.go $(OUTPUT_DIR)/darwin
7zr e -y -o'$(OUTPUT_DIR)/darwin/' -i'!./bin/*.dylib' \
$(OUTPUT_DIR)/darwin/ultralight-sdk-latest-mac-x64.7z
@echo 'to run do:'
@echo 'LD_LIBRARY_PATH=$$PWD/.bin/darwin'
@echo 'LD_LIBRARY_PATH=$$PWD/.bin/darwin .bin/darwin/xnv'
Loading…
Cancel
Save