parent
ed7c6300f2
commit
3ae0f73e05
@ -1,37 +0,0 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@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",
|
||||
"react-scripts": "3.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
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,46 +0,0 @@
|
||||
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=
|
||||
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=
|
||||
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=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
|
||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
@ -1,165 +0,0 @@
|
||||
//go:generate pkger -o frontend/build
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ImVexed/muon"
|
||||
"github.com/markbates/pkger"
|
||||
|
||||
"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() {
|
||||
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",
|
||||
Height: 500,
|
||||
Width: 640,
|
||||
Titled: true,
|
||||
Resizeable: true,
|
||||
Maximizable: true,
|
||||
}
|
||||
|
||||
m := muon.New(cfg, fileHandler)
|
||||
|
||||
as := &AppState{
|
||||
Settings: Settings{
|
||||
Directory: "/keybase/private/aveldhousen/notes/",
|
||||
Orientation: "vertical",
|
||||
},
|
||||
Notes: []Note{},
|
||||
}
|
||||
if *verbose {
|
||||
log.Printf("Using config: %+v", as.Settings)
|
||||
}
|
||||
|
||||
m.Bind("add", add)
|
||||
|
||||
m.Bind("Orientation", as.GetOrientation)
|
||||
m.Bind("LoadNotes", as.LoadNotes)
|
||||
m.Bind("SaveNote", as.SaveNote)
|
||||
|
||||
if err := m.Start(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
type AppState struct {
|
||||
Settings Settings `json:"settings,omitempty"`
|
||||
Notes []Note `json:"notes,omitempty"`
|
||||
}
|
||||
|
||||
type Note struct {
|
||||
Title string `json:"title,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
LastModified time.Time `json:"lastModified,omitempty"`
|
||||
Created time.Time `json:"created,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Directory string `json:"directory,omitempty"`
|
||||
Orientation string `json:"orientation,omitempty"`
|
||||
}
|
||||
|
||||
type LoadNoteResult struct {
|
||||
Error error `json:"error,omitempty"`
|
||||
Notes []Note `json:"notes"`
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
fileExt := strings.TrimPrefix(filepath.Ext(path), ".")
|
||||
|
||||
if *verbose {
|
||||
log.Printf("checking '%s' - has '%s' extension", path, fileExt)
|
||||
}
|
||||
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: filepath.Base(path),
|
||||
LastModified: finfo.ModTime(),
|
||||
Created: finfo.ModTime(),
|
||||
Content: string(content),
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
return LoadNoteResult{Error: fmt.Errorf("could not enumerate notes: %w", err)}
|
||||
}
|
||||
|
||||
return LoadNoteResult{
|
||||
Notes: notes,
|
||||
Error: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func (as *AppState) SaveNote(n Note) error {
|
||||
as.Notes = append(as.Notes, n)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (as *AppState) DeleteNote(n Note) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (as *AppState) UpdateNote(n Note) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (as *AppState) GetOrientation() string {
|
||||
return as.Settings.Orientation
|
||||
}
|
||||
|
||||
/*
|
||||
Notes CRUD
|
||||
Settings R/U
|
||||
*/
|
||||
|
||||
func add(a float64, b float64) float64 {
|
||||
return a + b
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
const electron = require("electron");
|
||||
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const app = electron.app;
|
||||
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
let win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true
|
||||
}
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== "prod") {
|
||||
win.loadURL("http://localhost:3000");
|
||||
} else {
|
||||
// and load the index.html of the app.
|
||||
win.loadFile("./build/index.html");
|
||||
}
|
||||
}
|
||||
console.log(Object.keys(electron));
|
||||
|
||||
app.on("ready", createWindow);
|
@ -1,66 +0,0 @@
|
||||
APP:=xnv
|
||||
GOBIN := $(GOPATH)/bin
|
||||
PKGER_BIN := $(GOBIN)/pkger
|
||||
FRONTEND_DIR := ./frontend/build
|
||||
FRONTEND_DEPS := ./frontend/node_modules
|
||||
PLATFORMS = linux darwin windows
|
||||
OUTPUT_DIR := .bin
|
||||
.SHELLARGS = -eou pipefail
|
||||
|
||||
build-all: $(OUTPUT_DIR)/linux/xnv $(OUTPUT_DIR)/windows/xnv.exe $(OUTPUT_DIR)/darwin/xnv
|
||||
linux: $(OUTPUT_DIR)/linux/xnv
|
||||
darwin: $(OUTPUT_DIR)/darwin/xnv
|
||||
windows: $(OUTPUT_DIR)/windows/xnv.exe
|
||||
|
||||
clean:
|
||||
@rm -rf ./$(OUTPUT_DIR) ./pkged.go ./xnv $(FRONTEND_DIR)
|
||||
|
||||
clobber: clean
|
||||
@rm -rf $(FRONTEND_DEPS)
|
||||
|
||||
.PHONY: clean clobber build-all darwin linux windows
|
||||
|
||||
$(OUTPUT_DIR)/xnv: pkged.go $(OUTPUT_DIR)
|
||||
go build -ldflags "-r ." -o $(OUTPUT_DIR)/xnv
|
||||
|
||||
$(OUTPUT_DIR):
|
||||
mkdir -p $(OUTPUT_DIR)
|
||||
|
||||
$(OUTPUT_DIR)/%:
|
||||
mkdir -p $@
|
||||
|
||||
pkged.go: $(PKGER_BIN) $(FRONTEND_DIR)
|
||||
$(PKGER_BIN) -include /frontend/build -o /
|
||||
|
||||
$(PKGER_BIN):
|
||||
go get github.com/markbates/pkger/cmd/pkger
|
||||
|
||||
$(FRONTEND_DIR): $(FRONTEND_DEPS)
|
||||
cd frontend && npm run build
|
||||
|
||||
$(FRONTEND_DEPS):
|
||||
cd frontend && npm install
|
||||
|
||||
$(OUTPUT_DIR)/windows/xnv.exe: pkged.go $(OUTPUT_DIR)/windows
|
||||
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc go build -v \
|
||||
-ldflags "-r=ultralight -H=windowsgui" -o $(OUTPUT_DIR)/windows/$(APP).exe
|
||||
curl https://ultralight-sdk.sfo2.cdn.digitaloceanspaces.com/ultralight-sdk-latest-win-x64.7z \
|
||||
-o $(OUTPUT_DIR)/windows/ultralight-sdk-latest-win-x64.7z && \
|
||||
7zr e -y -o'$(OUTPUT_DIR)/windows/' -i'!./bin/*.dll' -i'!./bin/*.so' -i'!./bin/*.lib' \
|
||||
$(OUTPUT_DIR)/windows/ultralight-sdk-latest-win-x64.7z
|
||||
|
||||
$(OUTPUT_DIR)/linux/xnv: pkged.go $(OUTPUT_DIR)/linux
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -ldflags "-r=ultralight" -o $(OUTPUT_DIR)/linux/$(APP)
|
||||
curl https://ultralight-sdk.sfo2.cdn.digitaloceanspaces.com/ultralight-sdk-latest-linux-x64.7z \
|
||||
-o $(OUTPUT_DIR)/linux/ultralight-sdk-latest-linux-x64.7z && \
|
||||
7zr e -y -o'$(OUTPUT_DIR)/linux/' -i'!./bin/*.so' \
|
||||
$(OUTPUT_DIR)/linux/ultralight-sdk-latest-linux-x64.7z
|
||||
|
||||
$(OUTPUT_DIR)/darwin/xnv: pkged.go $(OUTPUT_DIR)/darwin
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -v -ldflags="-r ." -o $(OUTPUT_DIR)/darwin/$(APP)
|
||||
curl https://ultralight-sdk.sfo2.cdn.digitaloceanspaces.com/ultralight-sdk-latest-mac-x64.7z \
|
||||
-o $(OUTPUT_DIR)/darwin/ultralight-sdk-latest-mac-x64.7z && \
|
||||
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 .bin/darwin/xnv'
|
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@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",
|
||||
"react-scripts": "3.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "electron ./main.js",
|
||||
"dev": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^7.1.9"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
@ -1,4 +1,4 @@
|
||||
import React, { useState } from "react";
|
||||
import React from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import { noop } from "../../state";
|
||||
|
@ -1,5 +1,6 @@
|
||||
.NoteContent {
|
||||
min-height: 70%;
|
||||
max-height: 70vh;
|
||||
background-color: black;
|
||||
display: flex;
|
||||
flex-direction: column;
|
@ -1,5 +1,5 @@
|
||||
import React, { useState } from "react";
|
||||
import { noop, enterKeyPressed } from "../state.js";
|
||||
import { noop, enterKeyPressed } from "../state";
|
||||
|
||||
import "./Omnibar.css";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { Fragment, useState } from "react";
|
||||
import { noop, enterKeyPressed } from "../../state.js";
|
||||
import { noop, enterKeyPressed } from "../../state";
|
||||
import "./TagList.css";
|
||||
|
||||
export default function TagList({ tags = [], onTagUpdate = noop }) {
|
Loading…
Reference in new issue