Conversation
✅ Deploy Preview for graypaper-reader ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
* Add version name to location hash url * refactor version name with default empty
* Update readme * Update main readme. * Update tools/links-check/README.md Co-authored-by: Mewa <ms1997sokol@gmail.com> --------- Co-authored-by: Mewa <ms1997sokol@gmail.com>
* clean commit history * button confirmation instead of alert * saving deleted notes to file * refactor * Add countdown timer for delete confirmation button * refactor * refactor redundant method
…r-reader into 147-hierarchical-labels
|
Still as draft, because it doesn't re-trigger filteredNotes on label change. |
…r-reader into 147-hierarchical-labels
| if (!("parent" in x && (x.parent === null || isLabel(x.parent)))) { | ||
| return false; | ||
| } | ||
| if (!("children" in x && Array.isArray(x.children))) { | ||
| return false; | ||
| } | ||
| if (!("notes" in x && Array.isArray(x.notes))) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
This should not be here. In local storage the notes should be stored in a flat format as currently and not as a tree.
| ## Options | ||
|
|
||
| ``` | ||
| Usage: gp-links-check [options] <paths...> | ||
|
|
||
| Arguments: | ||
| paths Paths of files to be scanned. Supports glob patterns. |
There was a problem hiding this comment.
These changes are already on main, there is something funky happening in the PR. Can you please try to re-open it as a new one or clean up the history?
| if (parts.length === 1) { | ||
| if (parts[0] === LABEL_LOCAL || parts[0] === LABEL_REMOTE) { | ||
| root.notes.push(note); | ||
| continue; | ||
| } | ||
| } | ||
| addToTree(parts, note, root); |
There was a problem hiding this comment.
| if (parts.length === 1) { | |
| if (parts[0] === LABEL_LOCAL || parts[0] === LABEL_REMOTE) { | |
| root.notes.push(note); | |
| continue; | |
| } | |
| } | |
| addToTree(parts, note, root); | |
| // if the label starts with `local` or `remote` just trim the first part. | |
| if (parts[0] === LABEL_LOCAL || parts[0] === LABEL_REMOTE) { | |
| parts.shift(); | |
| } | |
| addToTree(parts, note, root); |
I think this is more correct way to handle that case. I wonder however where does this special casing come from? Do we currently have notes with explicit local or remote label within them? I think it's totally fine if they were displayed as local/local - the user may remove that label if it was added there unnecessarily.
There was a problem hiding this comment.
Our other mechanism continuously adds the ‘local’ label, resulting in ‘local/local’ on each page refresh.
|
|
||
| export function Label({ label, prefix = "" }: { label: string; prefix?: string }) { | ||
| const backgroundColor = useMemo(() => labelToColor(label), [label]); | ||
| const backgroundColor = useMemo(() => labelToColor(label.split("/").pop() || ""), [label]); |
There was a problem hiding this comment.
| const backgroundColor = useMemo(() => labelToColor(label.split("/").pop() || ""), [label]); | |
| const backgroundColor = useMemo(() => labelToColor(label), [label]); |
Background color should depend on the whole "path" (i.e. remote label v0.4.5 should have different color than a local one with the same name)
There was a problem hiding this comment.
it makes labels in notes and labels on the tree displays differently (w/ different color)
There was a problem hiding this comment.
Hmm, we should have full path in notes then.
There was a problem hiding this comment.
full path displayed on tree?
eg.
local
local/a
local/a/b
local/a/c
There was a problem hiding this comment.
What I mean is that we should always use full path for color and display the text-label depending on the context:
- In the tree we just display shorter label (since it's nested)
- In the note we display full label (perhaps without the source part)
| <div | ||
| className="label-node-header" | ||
| onClick={() => onToggleLabel(label)} | ||
| onKeyUp={(e) => e.key === "Enter" && setExpanded(!expanded)} |
There was a problem hiding this comment.
| onKeyUp={(e) => e.key === "Enter" && setExpanded(!expanded)} |
that shouldn't be needed. The group should be expanded when it's active and folded when inactive.
| ); | ||
|
|
||
| function LabelNode({ label, onToggleLabel }: LabelLinkProps) { | ||
| const [expanded, setExpanded] = useState(true); |
There was a problem hiding this comment.
| const [expanded, setExpanded] = useState(true); | |
| const expanded = label.isActive; |
Co-authored-by: Tomek Drwięga <tomusdrw@users.noreply.github.com>
|
Continued in #196 |
#147