onDoubleClick doesn't work in muon so I need to fix that somehow - maybe implement my own

master
Adam Veldhousen 4 years ago
parent cd7ce3b685
commit 5f41c5c5f4
Signed by: adam
GPG Key ID: 6DB29003C6DD1E4B

Binary file not shown.

@ -9,7 +9,7 @@ import { createNote, getNotes } from "./state";
import "./App.css";
class App extends PureComponent {
state = { notes: getNotes(), selectedNote: null };
state = { ...getNotes(), selectedNote: null };
handleSearch = text => {
const { notes } = this.state;

@ -19,7 +19,11 @@ export default function EditableNoteArea({ content = null, onSave = noop }) {
setNewContent(target.value || newContent);
return (
<section className="EditableNoteArea" onDoubleClick={toggleEditMode}>
<section
className="EditableNoteArea"
onClick={toggleEditMode}
// onDoubleClick={toggleEditMode}
>
{editMode ? (
<textarea
defaultValue={content}

@ -1,5 +1,6 @@
import React, { useState } from "react";
import { noop } from "../state.js";
import "./Omnibar.css";
export default function Omnibar({ onSearch = noop, onEnter = noop }) {

@ -16,40 +16,44 @@ export const createNote = ({ title = null, content = "", tags = [] }) => {
};
};
export const getNotes = () => [
createNote({
title: "ass 1",
content: "this is an ass note",
tags: [
"first",
"second",
"third",
"fourth",
"fifth",
"sixth",
"seventh"
]
}),
createNote({
title: "ass 2",
content: "# ass2\nthis is a dope ass note",
tags: ["ass"]
}),
createNote({
title: "ass 3",
content: "this is an ass note",
tags: ["ass"]
}),
createNote({
title: "ass 4",
content: "this is an ass note",
tags: ["ass"]
}),
createNote({
title: "ass 5",
content: "this is an ass note",
tags: ["not ass"]
})
];
export const getNotes = window.LoadNotes || (() => defaultNotes);
export const upsertNote = () => {};
const defaultNotes = {
error: null,
notes: [
createNote({
title: "ass 1",
content: "this is an ass note",
tags: [
"first",
"second",
"third",
"fourth",
"fifth",
"sixth",
"seventh"
]
}),
createNote({
title: "ass 2",
content: "# ass2\nthis is a dope ass note",
tags: ["ass"]
}),
createNote({
title: "ass 3",
content: "this is an ass note",
tags: ["ass"]
}),
createNote({
title: "ass 4",
content: "this is an ass note",
tags: ["ass"]
}),
createNote({
title: "ass 5",
content: "this is an ass note",
tags: ["not ass"]
})
]
};

@ -2,6 +2,10 @@
package main
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"time"
"github.com/ImVexed/muon"
@ -26,7 +30,7 @@ func main() {
as := &AppState{
Settings: Settings{
Directory: ".",
Directory: "K:/private/aveldhousen/notes/posts",
Orientation: "vertical",
},
Notes: []Note{},
@ -62,13 +66,36 @@ type Settings struct {
}
type LoadNoteResult struct {
Error error
Notes []Note
Error error `json:"error,omitempty"`
Notes []Note `json:"notes"`
}
func (as *AppState) LoadNotes() LoadNoteResult {
notes := []Note{}
if err := filepath.Walk(as.Settings.Directory, func(path string, info os.FileInfo, err error) error {
fileExt := filepath.Ext(info.Name())
if fileExt == "md" || fileExt == "txt" || fileExt == "utf" || fileExt == "todo" {
content, err := ioutil.ReadFile(path)
if err != nil {
return nil
}
notes = append(notes, Note{
Title: info.Name(),
LastModified: info.ModTime(),
Created: info.ModTime(),
Content: string(content),
})
}
return nil
}); err != nil {
return LoadNoteResult{Error: fmt.Errorf("could not enumerate notes: %w", err)}
}
return LoadNoteResult{
Notes: as.Notes,
Notes: notes,
Error: nil,
}
}

Loading…
Cancel
Save