Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give users the option to add symbols #55

Closed
wants to merge 15 commits into from
Closed

Conversation

technetium
Copy link

@technetium technetium commented Apr 22, 2024

As suggested in issue #54

I've added a "+"-button at the right side of the search field. Feel free to style the button as you like.

All symbols can be edited by double clicking it. Double clicking the name will open a editbox for the name.
Clicking the trashcan will remove the symbol. (Trashcan is styled in CSS, feel free to change it)

Suggestion: Change the text: "Open a PR!" to "Add it yourself" with a link to the addSymbol function.
That will save to some pull requests and discussions about what symbols to include.
Then the only discussion will be what will be a good set of default symbols.

Also made the symbols draggable, so users can get them in their prefered order.
When a symbol is dragged the opacity is reduced to 40%,
use the drag class to change the style of dragged symbols.
The target of the symbol gets a solid border,
the class over can be used to change that.

Copy link
Owner

@samwho samwho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really good start! I've left a smattering of review comments.

I'm on the fence about editing the default symbols. On the one hand, it's unobtrusive. On the other I feel like it's fairly easy to screw things up in a way that's tricky to correct should you want to.

symbols.js Show resolved Hide resolved
symbols.js Outdated Show resolved Hide resolved
symbols.js Show resolved Hide resolved
symbols.js Outdated Show resolved Hide resolved
symbols.js Outdated Show resolved Hide resolved
symbols.js Outdated
window.addEventListener("dblclick", (e) => {
let target = e.target;
while(target) {
console.log(target);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(target);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also removed in 914415c

symbols.js Outdated
window.addEventListener("dragstart", handleDragStart);
window.addEventListener("dragover", handleDragOver);
window.addEventListener("dragenter", handleDragEnter);
window.addEventListener("dragleave", handleDragLeave);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can likely remove this, the handler for it is empty.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dragover needs to be handled, else the elements are not droppable
dragleave can be removed and is in 914415c
other handlers are not empty, they stay.

symbols.css Outdated Show resolved Hide resolved
@technetium
Copy link
Author

Preventing the deletion/change of the default symbols is extra code.
To restore the defaults is a matter of removing the symbols key from the local storage.
I'm on the fence regarding a button to reset to the default values:
A custom layout might be gone too easy.
Other option is to have the option of importing and exporting the symbols.
The website gets further and further away from being dumb.

Comment on lines +441 to +449
try {
// Catching invallid json, not an invalid symbol array
symbols = JSON.parse(window.localStorage.getItem("symbols"));
} catch(err) {
console.error(err);
}
if (!symbols) {
symbols = symbols_default;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about this earlier today: what happens when the default symbols are updated? I think currently the user won't see them, they'll load what's in local storage and completely ignore the defaults.

We probably need some sort of merging. Alternately, we track users' custom symbols separately to the defaults.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to merge new defaults, with the existing symbols, we need to label either the user symbols or the defaults (which adds complexity) and then disable the editing of the defaults (which adds complexity) then it will be impossible for users to move the frequently used default symbols to the top of the list, resulting in users that will add existing default symbols also to the user symbols. Reducing the benefits of a list of default symbols.

Another method is to track all the changes made by the user (which adds way more complexity) and apply them every time the defaults are loaded (which is so complex I cannot imagine how to do that)

If you can program that, you're welcome to do that. I probably don't have the knowledge, and if I did my time is also limited.

Another solution would be to publish sets of symbols, including a default. When a set (e.g. the default set) is updated let the user load that set into their collection. That's something I could implement in a few hours. As a matter of fact, I already did. It's in pull request #59

@samwho
Copy link
Owner

samwho commented Apr 28, 2024

Sorry I've not gotten around to taking a closer look at this yet. I'll be travelling for work next week as well, so it's likely I won't get to this for a couple of weeks. I really appreciate the time you've put in to this, so I'm sorry for the delay.

@technetium
Copy link
Author

O.K. I've scratched even more itches, but I won't bother you with yet another pull request.
Let everything gradually improved.

@samwho
Copy link
Owner

samwho commented Jun 29, 2024

@technetium sorry for the delay on this, but I've decided to not merge this PR. It adds a level of complexity I don't think I want to maintain in the tool. You have my blessing to fork and re-host if this is something that makes a substantial difference to your workflow. I appreciate the time and effort you've put in to contributing to symbol.wtf <3

@samwho samwho closed this Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants