Conversation
a989841 to
fb181c1
Compare
| const [colorPickerModal, showColorPickerModal] = useState(false) | ||
|
|
||
| const openTagContextMenu: React.MouseEventHandler = useCallback( | ||
| (_) => { |
There was a problem hiding this comment.
If you don't need to access the event parameter, you don't need to provide the handler type
| title: 'Cannot update tag color.', | ||
| description: 'Invalid note or tag.', | ||
| }) | ||
| console.log('Tag name or note was null', 'requested color:', color) |
|
|
||
| const storageTags = useMemo(() => { | ||
| if (storage == null) return [] | ||
| return values(storage.tagMap).map((tag) => tag) |
There was a problem hiding this comment.
There is no values() on ObjectMap
So final should be:
return [...values(storage.tagMap)]? copy of tags
or maybe even
return values(storage.tagMap)? raw values
|
|
||
| const storageTags = useMemo(() => { | ||
| if (storage == null) return [] | ||
| return values(storage.tagMap).map((tag) => tag) |
There was a problem hiding this comment.
There is no values() on ObjectMap
So final should be:
return [...values(storage.tagMap)]? copy of tags
or maybe even
return values(storage.tagMap)? raw values
|
|
||
| const brightnessDefaultThreshold = 110 | ||
|
|
||
| export function getColorBrightness(color: RGBColor | string | null) { |
| } | ||
|
|
||
| export function isColorBright( | ||
| color: RGBColor | string | null, |
| return { | ||
| ...(await targetStorage.db.getTag(tagName))!, | ||
| name: tagName, | ||
| color: '', |
There was a problem hiding this comment.
If color is not set, I'd like to leave it as undefined
| map[name] = { | ||
| ...tagDoc, | ||
| name, | ||
| color: tagDoc.color || '', |
|
|
||
| export type TagDocEditibleProps = { | ||
| color?: string | ||
| data: JsonObject |
There was a problem hiding this comment.
I'd like to put it in data like bookmarked prop of NoteDoc
There was a problem hiding this comment.
It's a bit more work, because it is not a boolean.
But I think I managed to do it.
| justify-content: center; | ||
| ` | ||
|
|
||
| export const tagBgColor = ({ theme, color }: StyledProps & TagStyleProps) => ` |
d48ce37 to
f8ac689
Compare
| map[name] = { | ||
| ...tagDoc, | ||
| name, | ||
| color: tagColor, |
There was a problem hiding this comment.
We can access color directly from tagDoc.data.color I don't see any benifits
There was a problem hiding this comment.
True, a mistake! Fixed now!
|
|
||
| export type PopulatedTagDoc = TagDoc & { | ||
| name: string | ||
| color?: string |
There was a problem hiding this comment.
Yes, correct. Done!
|
@Rokt33r, @Komediruzecki: One concern I have with this is that the web browser users will not be able to right click on tags and open the context menu, as they can only perform left click. Instead, you can add a I've implemented this in #730. Feel free to copy over the code, or change the implementation. |
Hi, I agree that it will be a problem for users who don't have the typical right-click option (I suppose you mean mobile browser users or native android version in general?) I looked over the PR and I am missing some images how all of this looks like, can you share them? If the implementation wise makes sense, sure I will transfer the code or rebase it onto it if it merges to master sooner. |
|
I should've attached some pictures to make it clear, my bad. The web browser app (www.boostnote.io/app) will not allow users to right click. This is not the case only for mobile users, but for desktop browser users as well. This is what they'll see when they right click: By adding a control option (three vertical dots) to the list view, we can allow them to view the context menu by left clicking on this button: This control option may not be possible in the note view due to lack of space. But even then, I believe we should give the user the ability to use this feature through the list view |
Oh, I see, you are right. I'll rebase and integrate changes to make it easier for those users too. Thanks for the suggestion. |
4a3860f to
65e6637
Compare
| }, | ||
| [tag, updateTagColorByName] | ||
| ) | ||
| const tagColor = useCallback(() => { |
| colorBrightness: number | ||
| } | ||
|
|
||
| export default class DialogColorPicker extends React.Component< |
There was a problem hiding this comment.
I don't see any benefits to make a class component. Please covert this into a function component!
There was a problem hiding this comment.
True, refactored
Add tag context menu (right click on tag) for chosing colors Add react color as color pickers library Add basic DB management for tags with color (FSNote, PouchDB, createStore API) Add basic UI component (react-color) for choosing the color Add basic handling of color brightness in tags and hover styles (black/white inversion, brigther, dimmer when bg is dark/light) Add colored tags inside note list note tag list
65e6637 to
d71ce2c
Compare



Add tag colors setup (#323):
Fix right click context menu in sidebar
How it works:
Users can right click on any tag in note tag list. The color picker comes up and on selection it changes colors (preview is below in color slider at right corner), below that are some predefined colors which can be clicked. Once user is satisfied with color, to close the dialog any click outside of the color picker will do. The color is then updated in UI acordingly.
For background colors which are too dark, hovering the tag will brighten it up, opposite works too.
For background colors which are too dark, text and remove tag button are light/white and vice versa.
The following image shows picking color:

Some colored tags preview:

v0.11.5 - new tag location examples:


Test:
IssueHunt Summary
Referenced issues
This pull request has been submitted to: