0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 09:22:44 +00:00
Commit Graph

620 Commits

Author SHA1 Message Date
Gazook89
8a67e1eccd Merge branch 'Functional-Tag-Editor' into Func-Tag-Editor-Features 2024-09-19 14:54:28 -05:00
Gazook89
7ea1696065 Adjust html structure to handle tags as list
Begin work on setting a better html structure for the component.

Create a .less file for the component, which I may not actually use.
2024-09-19 10:40:09 -05:00
Gazook89
5b4a7c168f Add comma to "submit" buttons
Now comma (`,`) submits a tag, like `Enter`
2024-09-18 23:54:12 -05:00
Gazook89
a54adc1e4b Set new tag input to clear itself after submission
Now whenever a new tag is submitted, the input element is cleared and ready for the next tag.

Whitespace cleanup.
2024-09-18 23:39:26 -05:00
Gazook89
c1288ce4bb Use index to find and remove tags
Fixes issue in last commit, so removing a tag that has duplicate value of other tags only removes the correct one, not the others as well.
2024-09-18 23:24:10 -05:00
Gazook89
c65210b3ed Add 'remove' button and method
New button that triggers `submitTag()` method directly (rather than throw onKeyDown event) and passes `null` as the newValue.  New `if` condition checks for null on newValue and if true, removes the tag that matches the originalValue.

This *does* currently delete all duplicate tags if they match the one you are deleting.  Not sure when you'd ever want duplicate tags, but regardless i'll likely switch this to work via Index, not value.
2024-09-18 23:13:46 -05:00
Gazook89
70a3cb9ef9 Add method for adding new tags
Component now accepts new tags entered in the always-present input field.  Entering a value and hitting Enter submits the tag, and it appears as a new tag.

Updated the tag list keys to be unique (via `index`).

To-Do: empty 'new tag' input after submitting.
2024-09-18 22:46:00 -05:00
Gazook89
d1686c4c8f Add in handlers for TagInput value changes
Now brew metadata is actually updated and preserved across reloads to match updated tag values.  useEffect calls the props.onChange event from the parent component on every change to the valueContext state of this component (right now, after hitting Enter in a tag input).
2024-09-18 22:18:18 -05:00
Gazook89
c5033db336 add editing of input functionality
Currently uses uncontrolled inputs with a `defaultValue` attribute set to the values passed in via props.  The input can then be edited, and when `Enter` is pressed, it updates the stored value state.  Later, this can be updated to be trigger with `Tab` or clicking outside the active input element.
2024-09-18 21:00:24 -05:00
Gazook89
36aa4ea508 Add click handler for readTags to open text input
Clicking on a readTag now converts that tag to a text input, and maintains the tag value.  It also closes any other open text inputs amongst the tags (but leaves the "new tag" input open).
2024-09-17 23:50:59 -05:00
Gazook89
d5c5b4315b Render tags as "write" or "read"
Tags are now either "readTag" or "writeTag", with the former being a div with the tag value and the latter a text input with the value.

Minor class name change in LESS.
2024-09-17 23:28:56 -05:00
Gazook89
d505e4e24c Render element for each value from props
Take an array of values from props, load it into valueContext state with an "editing" boolean for each value.  Then, when rendering the component, take each value in the valueContext array and create a div for each --

at this point, if the value is "being edited", it returns a div with text "editing".  If not being edited, it returns a div with the value as text.

Nothing is being edited at this point since that functionality doesn't exist yet.
2024-09-17 23:16:06 -05:00
Gazook89
ea7f18e3b0 Merge branch 'master' into Functional-Tag-Editor 2024-09-17 14:50:31 -05:00
Gazook89
e8e16f4d66 Initial commit: Rename component, set basic structure
No actual functionality implemented yet, just renames the component from "StringArrayEditor" to "TagInput", for brevity at the possible cost of clarity.  For now, the original StringArrayEditor is kept and named "TagInput-class.jsx" so that I can reference it as I work on the functional component.
2024-09-17 14:46:56 -05:00
Víctor Losada Hernández
61d77b4d2d fix 2024-09-17 19:55:50 +02:00
G.Ambatte
83a7636b6f Simplify historyExists state logic 2024-09-17 07:41:34 +12:00
G.Ambatte
8ceb422156 Separate bundled setState calls 2024-09-16 19:40:11 +12:00
G.Ambatte
59f6f40ace Add seconds to display options 2024-09-16 19:24:39 +12:00
Trevor Buckner
dfd3b99232 Merge branch 'master' into experimentalLocalStorageHistory 2024-09-16 01:50:54 -04:00
Trevor Buckner
5cc5eec619 Lint toolbar and snippetbar 2024-09-16 01:41:46 -04:00
Trevor Buckner
b5490e3a53 Lint editor.jsx 2024-09-16 01:40:21 -04:00
Trevor Buckner
98c5b798a7 Merge branch 'master' into experimentalLocalStorageHistory 2024-09-16 01:03:29 -04:00
Trevor Buckner
48bdc417fa More logic simplification 2024-09-16 00:39:04 -04:00
Trevor Buckner
25a40e31c5 Remove console logs 2024-09-15 22:31:29 -04:00
Trevor Buckner
a353425d07 More cleanup 2024-09-15 22:13:41 -04:00
Trevor Buckner
81ab9417d3 Clean up unused code 2024-09-15 21:42:55 -04:00
Trevor Buckner
84c0242eee Put page jump checks in componentDidUpdate
Jump when the current page for brew or editor changes
2024-09-15 00:13:49 -04:00
G.Ambatte
eddc81d051 Merge branch 'master' into experimentalLocalStorageHistory 2024-09-15 14:23:14 +12:00
G.Ambatte
72257dc71b Lint fixes 2024-09-15 14:09:56 +12:00
G.Ambatte
b456bb955a Initial UI functionality 2024-09-15 14:09:47 +12:00
Trevor Buckner
181c6bf65a Update editor.jsx 2024-09-14 19:15:39 -04:00
Trevor Buckner
d4fa5d55d0 Merge branch 'master' into pr/3484 2024-09-14 19:15:12 -04:00
Trevor Buckner
26a126859d Lint 2024-09-14 19:02:55 -04:00
Trevor Buckner
5c2acf3183 Let Editor pass changes up and inherit values down 2024-09-14 18:52:13 -04:00
G.Ambatte
7ec2558eef Add guard clause for history UI items 2024-09-14 23:43:26 +12:00
G.Ambatte
a7cf49557a Tweak dropdown padding 2024-09-14 23:04:18 +12:00
G.Ambatte
c4c5ffff9b Tweak UI styling 2024-09-14 22:49:53 +12:00
G.Ambatte
719cc0c485 Remove onClick from UI 2024-09-14 22:49:39 +12:00
G.Ambatte
d01548feb6 Add getHistoryItems function 2024-09-14 21:20:31 +12:00
G.Ambatte
48eb42862a Add History styling 2024-09-14 17:32:20 +12:00
G.Ambatte
ace790739f Stub out History function on Editor Nav Bar 2024-09-14 17:32:07 +12:00
Trevor Buckner
3ef91cb1ea Add check for scroll event complete/ lift page state up 2024-09-12 12:55:11 -04:00
Trevor Buckner
e5ab223571 Better line position (viewport has some margin) 2024-09-10 01:25:26 -04:00
Trevor Buckner
45a9501459 Jump based on scroll position, not cursor position 2024-09-10 01:11:28 -04:00
Trevor Buckner
ec74b994d7 Simplify scroll event for source editor using lodash Throttle 2024-09-10 00:43:44 -04:00
David Bolack
1e9c7423c7 Fix "clicked on the toggle ring" crash with scroll lock.
The code was doing dom-climbing math based on clicking on the div contents but was attached to the div. Moved the onClick to the contents.
2024-09-07 22:36:27 -05:00
David Bolack
7a37bf47c5 Bodge Render side mirroring back into place. 2024-09-07 21:33:51 -05:00
Trevor Buckner
b124e55b3d Merge branch 'master' into Issue_241_Part_II 2024-09-06 23:51:14 -04:00
Trevor Buckner
22678b15af Fix snippet filter 2024-09-06 16:35:18 -04:00
David Bolack
88caa81baa Merge branch 'master' into snippets-no-gen 2024-09-06 12:25:22 -05:00