bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

Add calendar component

Open gfeun opened this issue 2 years ago • 12 comments

gfeun avatar Oct 28 '21 15:10 gfeun

This is a good start! If I read correctly, this should be considered a work-in-progress, correct?

meowgorithm avatar Oct 28 '21 16:10 meowgorithm

Yes, i should have written it explicitly here :slightly_smiling_face:, this is WIP

This is linked to this issue where i wrote a bit about it: https://github.com/charmbracelet/bubbles/issues/8#issuecomment-953969558

I'd like to tweak weekday handling to support internationalization and it also needs some UI considerations. I'm not sure where the key mapping handling is to be added. I put it in the example at the moment: https://github.com/charmbracelet/bubbletea/pull/145/files

And I did not take a lot of time to study other component in order to make this one coherent.

gfeun avatar Oct 28 '21 16:10 gfeun

I haven't tested it yet, but the code looks pretty good! I agree with making the weekday naming editable.

There's a keybinding bubble you can use for keybinding definitions (example). I'll make a few other quick comments inline.

meowgorithm avatar Oct 28 '21 16:10 meowgorithm

@gfeun This is absolutely awesome! I know it's been a while but do you still want more reviews on this? If not, I can probably pick up where you left off. I think it would be a useful addition to Gum for easy date picking.

maaslalani avatar Aug 18 '22 17:08 maaslalani

Hey @maaslalani,

Thanks for awaking this PR, its been so long !

I have some unpushed changes locally that allows displaying multiple months side by side Let me clean this up tonight and i'll push that, happy to have a review after that :smiley:

image

gfeun avatar Aug 18 '22 17:08 gfeun

Oh sweet! Cool, just ping me when you need a review!

maaslalani avatar Aug 18 '22 17:08 maaslalani

Hi again :wave:

I have pushed the multi months part and tried to add some more comments to explain the whole thing. I recorded a demo to get a feel of how it looks / works: render1660860649057

The demo runs the code available in the companion PR here: https://github.com/charmbracelet/bubbletea/pull/145/files

The code is not so straightforward due to padding, line returns etc. And i feel i may have missed opportunities to make it simpler in some places.

I got no more time to work on this today but for reference, this line smells like it could be optimized by pre-allocating the array once instead of in each View call: https://github.com/charmbracelet/bubbles/pull/76/files#diff-2f6b59027d9f6ec18fb232ae4f569614c7aa43fc4806b5f8586bdf9cda0a296eR91

The calendar is also English centric atm, and i did not test a non-english one so there may be some trouble there too.

Another limitation is that it is currently only working with week start on Monday, which may not suit everyone.

Finally i am not familiar with the other components, best practices, conventions around this projects so don´t hesitate to point me to examples.

gfeun avatar Aug 18 '22 22:08 gfeun

Thanks so much @gfeun, appreciate all the work!

maaslalani avatar Aug 18 '22 22:08 maaslalani

@gfeun just wanted to say, that I love your work here and the fact that you took inspiration from cal utility.

I know, that this is a work in progress, just wanted to cheap in saying that it would be awesome to have an ability to highlight or mark multiple days in that calendar. Once this will get merged, I might take a stab to implement that. Would be awesome if you consider this feature as future addition in your current implementation.

Thanks.

skatkov avatar Aug 23 '22 16:08 skatkov

This is cool!

knz avatar Aug 24 '22 11:08 knz

@meowgorithm are there any styling changes we would want to see before merging?

bashbunni avatar Jun 23 '23 20:06 bashbunni

Will be a little bit before we can properly re-review this, but thank you @bashbunni for bubbling this up.

meowgorithm avatar Jun 23 '23 20:06 meowgorithm