feat: Edit relative reminders #3248

Merged
konrad merged 27 commits from ce72/frontend:main into main 2023-06-10 17:04:10 +00:00
Contributor

This is a full functional POC to use the new reminder API from vikunja/api#1427.
Maybe the styling can be improved, but I am not very good at that.

(The changes from the current PR require vikunja/api#1427. But vikunja/api#1427 supports both the old and the new frontend.)

Related to: #3216

This is a full functional POC to use the new reminder API from https://kolaente.dev/vikunja/api/pulls/1427. Maybe the styling can be improved, but I am not very good at that. (The changes from the current PR require https://kolaente.dev/vikunja/api/pulls/1427. But https://kolaente.dev/vikunja/api/pulls/1427 supports both the old and the new frontend.) Related to: https://kolaente.dev/vikunja/frontend/issues/3216
Member

Hi ce72!

Thank you for creating a PR!

I've deployed the changes of this PR on a preview environment under this URL: https://3248-main--vikunja-frontend-preview.netlify.app

You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.

Have a nice day!

Beep boop, I'm a bot.

Hi ce72! Thank you for creating a PR! I've deployed the changes of this PR on a preview environment under this URL: https://3248-main--vikunja-frontend-preview.netlify.app You can use this url to view the changes live and test them out. You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/. Have a nice day! > Beep boop, I'm a bot.
ce72 force-pushed main from a64fcfc4c1 to b09b5622aa 2023-03-16 09:32:48 +00:00 Compare
ce72 changed title from WIP: feat: Edit relative reminders to feat: Edit relative reminders 2023-03-16 16:08:01 +00:00
konrad requested changes 2023-03-16 19:18:34 +00:00
@ -0,0 +52,4 @@
}
function showRelativeReminder() {
return !reminder.value || reminder.value?.relativeTo

Please use a computed for both show... functions instead.

Please use a `computed` for both `show...` functions instead.
Author
Contributor

ok

ok
dpschen marked this conversation as resolved
@ -0,0 +1,207 @@
<template>
<div class="datepicker">
<BaseButton :disabled="disabled" class="show" v-if="!!reminder?.relativeTo" @click.stop="togglePeriodPopup">
{{ formatDuration(reminder.relativePeriod) }} <span v-html="formatBeforeAfter(reminder.relativePeriod)"></span>

What about inlining formatBeforeAfter to something like {{ reminder.relativePeriod <= 0 ? '&le;' : '&gt;' }}

What about inlining `formatBeforeAfter` to something like `{{ reminder.relativePeriod <= 0 ? '&le;' : '&gt;' }}`
Author
Contributor

ok

ok
ce72 marked this conversation as resolved
@ -0,0 +14,4 @@
v-model="periodInput.duration.days"
type="number"
min="0"
/> d

Please add a translation string for the d. (It does not look like much, but still)

Please add a translation string for the `d`. (It does not look like much, but still)

Same for the placeholders.

Same for the placeholders.
Author
Contributor

ok

ok

To be honest I was confused by the d when I first saw the interface.
Why don't we write it out?

To be honest I was confused by the `d` when I first saw the interface. Why don't we write it out?
Author
Contributor

ok

ok
ce72 marked this conversation as resolved
@ -0,0 +196,4 @@
<style lang="scss" scoped>
.input {
max-width: 70px;
width: 70px;

Please use `rem

Please use `rem
Author
Contributor

ok

ok
dpschen marked this conversation as resolved
@ -57,4 +35,2 @@
return true
},
},
disabled: {

Why remove the type?

Why remove the type?
Author
Contributor

The type has changed from Date | String to a complex type (Array as PropType<ITaskReminder[]>). I don't see why a validation is required. What do you suggest?

The type has changed from `Date | String` to a complex type (`Array as PropType<ITaskReminder[]>`). I don't see why a validation is required. What do you suggest?

@ce72: Sry I don't understand your answer here :)
What has the validation of the modelValue to do with the type of disabled?

@ce72: Sry I don't understand your answer here :) What has the validation of the modelValue to do with the type of disabled?
Author
Contributor

Can you please make a concrete suggestion what you expect here? I can find no other place in the code where you have a validation on a complex props type. And am not enough typescript native to understand what you want to have added here.

Can you please make a concrete suggestion what you expect here? I can find no other place in the code where you have a validation on a complex props type. And am not enough typescript native to understand what you want to have added here.

I think I misunderstood @konrads first question, because the lines changed. I assumed he is refering to the removed type from disabled and not the removed validation of the modelValue.

I think I misunderstood @konrads first question, because the lines changed. I assumed he is refering to the removed type from disabled and not the removed validation of the modelValue.
Author
Contributor

Then my question goes to @konrad

Then my question goes to @konrad

The type has changed from Date | String to a complex type (Array as PropType<ITaskReminder[]>). I don't see why a validation is required. What do you suggest?

Okay that actually makes sense.

> The type has changed from Date | String to a complex type (Array as PropType<ITaskReminder[]>). I don't see why a validation is required. What do you suggest? Okay that actually makes sense.
konrad marked this conversation as resolved
@ -0,0 +3,4 @@
/**
* Convert time period given as seconds to days, hour, minutes, seconds
*/
export function secondsToPeriod(seconds: number) {

Can you add a type hint for the return value?

Can you add a type hint for the return value?
Author
Contributor

ok

ok

Couldn't we instead define the return via as const?
Also we don' really need the declaration of the variables but could inline those definitions in the returned object directly

Couldn't we instead define the return via `as const`? Also we don' really need the declaration of the variables but could inline those definitions in the returned object directly
Author
Contributor

OK concerning the inlining. Can you please make a suggestion on how to replace the function using as const? My typescript might be not sufficient here.

OK concerning the inlining. Can you please make a suggestion on how to replace the function using `as const`? My typescript might be not sufficient here.
dpschen marked this conversation as resolved
Owner

I wonder if it would make sense to add a new component for absolute reminder dates?

I wonder if it would make sense to add a new component for absolute reminder dates?
Author
Contributor

I wonder if it would make sense to add a new component for absolute reminder dates?

The code uses Datepicker for absolute reminders. There might be advantages to write a wrapper around that, but given my web programming skills, I don't see how (and why) that should be done now.

> I wonder if it would make sense to add a new component for absolute reminder dates? The code uses Datepicker for absolute reminders. There might be advantages to write a wrapper around that, but given my web programming skills, I don't see how (and why) that should be done now.
ce72 requested review from konrad 2023-03-17 09:44:32 +00:00
dpschen reviewed 2023-03-20 16:49:46 +00:00
@ -74,3 +76,3 @@
repeatFromCurrentDate = false
repeatMode: IRepeatMode = TASK_REPEAT_MODES.REPEAT_MODE_DEFAULT
reminderDates: Date[] = []
reminderDates = null

If reminderDates is null why do we still define it?

If `reminderDates` is `null` why do we still define it?
Author
Contributor

We want to make sure to not return reminderDates to the server. The api currently supports both reminderDates (old API) and reminder (new API). If the frontend still sends the old reminderDates array back to the server, it assumes the old logic and ignores the new reminders. The whole thing will be removed, if the reminderDates will be entirely removed from the server.

We want to make sure to not return reminderDates to the server. The api currently supports both reminderDates (old API) and reminder (new API). If the frontend still sends the old reminderDates array back to the server, it assumes the old logic and ignores the new reminders. The whole thing will be removed, if the reminderDates will be entirely removed from the server.

Can you add this as comment to this line?

Can you add this as comment to this line?
Author
Contributor

ok

ok
ce72 marked this conversation as resolved
konrad requested review from dpschen 2023-03-24 19:13:39 +00:00
dpschen was assigned by konrad 2023-03-24 19:13:44 +00:00
ce72 force-pushed main from 9923794e74 to 7a7ff5a28e 2023-03-28 05:52:14 +00:00 Compare
konrad requested changes 2023-03-28 10:08:19 +00:00
@ -0,0 +1,64 @@
<template>
<div>
<ReminderPeriod v-if="showRelativeReminder" v-model="reminder" :disabled="disabled"

Nitpicking, but please format this like this:

<ReminderPeriod 
    v-if="showRelativeReminder"
    v-model="reminder"
    :disabled="disabled"
    @update:modelValue="() => updateData()"
/>

That way it's more readable.

Nitpicking, but please format this like this: ``` <ReminderPeriod v-if="showRelativeReminder" v-model="reminder" :disabled="disabled" @update:modelValue="() => updateData()" /> ``` That way it's more readable.

Fixed in my changes, see #3248 (comment)

Fixed in my changes, see https://kolaente.dev/vikunja/frontend/pulls/3248#issuecomment-47907
dpschen marked this conversation as resolved
@ -0,0 +95,4 @@
const periodInput = reactive({
duration: {days: 0, hours: 0, minutes: 0, seconds: 0},
relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE,
sign: -1,

What does sign mean in this context?

What's the advantage of using an object here instead of individual refs?

What does `sign` mean in this context? What's the advantage of using an object here instead of individual `ref`s?
@ -789,0 +790,4 @@
"hoursShort": "HH",
"minutesShort": "MM",
"daysShort": "d",
"days": "days"

Is it intended this is not Days? (Capital d)

Is it intended this is not `Days`? (Capital d)

Could we use Intl.DisplayNames to get the names instead?

> new Intl.DisplayNames(['de'], { type: 'dateTimeField' }).of('year')
< 'Jahr'

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of

Could we use `Intl.DisplayNames` to get the names instead? ``` > new Intl.DisplayNames(['de'], { type: 'dateTimeField' }).of('year') < 'Jahr' ``` See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of

Could we use Intl.DisplayNames to get the names instead?

Will try to use that in my changes.

> Could we use `Intl.DisplayNames` to get the names instead? Will try to use that in my changes.
@ -77,0 +78,4 @@
/* Make sure to not return reminderDates to the server.
The server currently supports both reminderDates (old API) and reminder (new API) and assumes the old logic
if it still receives reminderDates.
This line and reminderDates attributes will be removed after https://kolaente.dev/vikunja/api/pulls/1448 was merged.

But then you'll need another PR after this one and the api change to remove the old reminder_dates were merged? Wouldn't it be easier to remove all traces of the old reminder dates in this PR already and then only merge the api one to clean up the leftovers in the api?

But then you'll need another PR after this one and the api change to remove the old reminder_dates were merged? Wouldn't it be easier to remove all traces of the old reminder dates in this PR already and then only merge the api one to clean up the leftovers in the api?
Author
Contributor

The server still sends old reminderDates (in order to be non-breaking). These must not be returned by the frontend, or that would signal the server that the frontend prefers the old API. The reminderDates are set to null, or they will still be included (two places).

Maybe that's not the only migration strategy to avoid breaking changes, but I think now we should more or less stick to it. I will take care to remove reminderDates from the frontend in a final PR on this.

The server still sends old reminderDates (in order to be non-breaking). These must not be returned by the frontend, or that would signal the server that the frontend prefers the old API. The reminderDates are set to null, or they will still be included (two places). Maybe that's not the only migration strategy to avoid breaking changes, but I think now we should more or less stick to it. I will take care to remove reminderDates from the frontend in a final PR on this.
Owner

Can you add a cypress test for the new reminders?

EDIT (Dominik)
Please wait with this. See: #3248 (comment)

Can you add a cypress test for the new reminders? **EDIT (Dominik)** Please wait with this. See: https://kolaente.dev/vikunja/frontend/pulls/3248#issuecomment-47908
Owner

I wonder if we could move this and the date picker into one popup:

image

This is how TickTick does it:

image

image

We don't nessecarily need to do this here in this PR, just something to think about.

I wonder if we could move this and the date picker into one popup: ![image](/attachments/460a58f7-17e8-4d08-8e8b-25608ee91615) This is how TickTick does it: ![image](/attachments/08382185-490a-4b48-ad55-257529392da2) ![image](/attachments/ded0e364-2a15-4162-add6-aa501fa8228f) We don't nessecarily need to do this here in this PR, just something to think about.
ce72 added 1 commit 2023-03-29 21:56:50 +00:00
continuous-integration/drone/pr Build is passing Details
85f91c784f
Merge branch 'main' into main
Member

@ce72
I'm refactoring this pr a bit, since I have the feeling that noting what I would change would take much longer than just doing it. Hopefully you're fine with that considering you mentioned but I am not very good at that.

You can see what I did here until now: https://kolaente.dev/vikunja/frontend/compare/main...dpschen/frontend:edit-relative-reminders

It's currently in a broken in-between state.

When I'm finished with this I still do not want to immediately merge this, but instead take a little step back and think a bit in the direction that @konrad mentioned in his comment and change the implementation in that direction. Shouldn't be toooo hard after my changes.

The result doesn't have to be perfect (since I tend to strive in that direction I want to explicitly point this out), but the user should at least understand what the interface is for / doing. When I tried this the first time I must honestly say that I had no clue what I can select in this interface and what it is doing. That said I'm really happy that we are able to build on your fundamental work. Without your start this feature probably wouldn't have happened soon. 💯 💪


Sidenote:
Please don't merge in your branch if it's not really necessary. Merge commits make rebasing much harder, which is what we prefer when finally merging the pr.

@ce72 I'm refactoring this pr a bit, since I have the feeling that noting what I would change would take much longer than just doing it. Hopefully you're fine with that considering you mentioned `but I am not very good at that`. You can see what I did here until now: https://kolaente.dev/vikunja/frontend/compare/main...dpschen/frontend:edit-relative-reminders It's currently in a broken in-between state. When I'm finished with this I still do not want to immediately merge this, but instead take a little step back and think a bit in the direction that @konrad [mentioned in his comment](https://kolaente.dev/vikunja/frontend/pulls/3248#issuecomment-47466) and change the implementation in that direction. Shouldn't be toooo hard after my changes. The result doesn't have to be perfect (since I tend to strive in that direction I want to explicitly point this out), but the user should at least understand what the interface is for / doing. When I tried this the first time I must honestly say that I had no clue what I can select in this interface and what it is doing. That said I'm really happy that we are able to build on your fundamental work. Without your start this feature probably wouldn't have happened soon. 💯 💪 --- Sidenote: Please don't merge in your branch if it's not _really_ necessary. Merge commits make rebasing much harder, which is what we prefer when finally merging the pr.
Member

Can you add a cypress test for the new reminders?

Please wait before doing this. I added the component to histoire (see pnpm run story:dev) which makes building components in isolation / manual testing much easier.

> Can you add a cypress test for the new reminders? Please wait before doing this. I added the component to [histoire](https://histoire.dev/) (see `pnpm run story:dev`) which makes building components in isolation / manual testing much easier.
Author
Contributor

@ce72
I'm refactoring this pr a bit, since I have the feeling that noting what I would change would take much longer than just doing it. Hopefully you're fine with that considering you mentioned but I am not very good at that.
...

Great. I'm very fine with this.

> @ce72 > I'm refactoring this pr a bit, since I have the feeling that noting what I would change would take much longer than just doing it. Hopefully you're fine with that considering you mentioned `but I am not very good at that`. ... Great. I'm very fine with this.
Author
Contributor

Can you add a cypress test for the new reminders?

Please wait before doing this. I added the component to histoire (see pnpm run story:dev) which makes building components in isolation / manual testing much easier.

> > Can you add a cypress test for the new reminders? > > Please wait before doing this. I added the component to [histoire](https://histoire.dev/) (see `pnpm run story:dev`) which makes building components in isolation / manual testing much easier.
ce72 closed this pull request 2023-03-30 11:32:43 +00:00
Author
Contributor

Reopened

Reopened
ce72 reopened this pull request 2023-03-30 11:34:03 +00:00
Member

@ce72
Sry didn't want to edit your comment – reversed that.

I thought I made a mistake creating my comment, but your answer simply consisted of a quote of my comment instead.

@ce72 Sry didn't want to edit [your comment](https://kolaente.dev/vikunja/frontend/pulls/3248#issuecomment-47913) – reversed that. I thought I made a mistake creating [my comment](https://kolaente.dev/vikunja/frontend/pulls/3248#issuecomment-47908), but your answer simply consisted of a quote of my comment instead.
Author
Contributor

Relative reminders are now part of api:unstable and are coming in via CalDav sync and can be edited with beta version of vja. But at the moment the frontend overwrites relative reminders to absolute reminder dates. I think this should be fixed soon, by merging this PR or at least part of it (see also vikunja/api#1448 (comment)).

Can we maybe just split the make-it-work part from the make-it-nice part? I think that being more agile here and having more and smaller (focused) PRs, that actually get merged, would be much more encouraging to engage further.

@dpschen please let me know if I can help!

Relative reminders are now part of api:unstable and are coming in via CalDav sync and can be edited with beta version of vja. But at the moment the frontend overwrites relative reminders to absolute reminder dates. I think this should be fixed soon, by merging this PR or at least part of it (see also https://kolaente.dev/vikunja/api/pulls/1448#issuecomment-50106). Can we maybe just split the make-it-work part from the make-it-nice part? I think that being more agile here and having more and smaller (focused) PRs, that actually get merged, would be much more encouraging to engage further. @dpschen please let me know if I can help!
konrad added 2 commits 2023-06-05 14:16:16 +00:00
konrad added 1 commit 2023-06-09 10:07:28 +00:00
konrad added 1 commit 2023-06-09 11:19:51 +00:00
konrad added 1 commit 2023-06-09 11:54:28 +00:00
continuous-integration/drone/pr Build is failing Details
e6c4c18974
feat(reminders): translate all reminder form strings
konrad added 3 commits 2023-06-09 12:31:41 +00:00
konrad added 1 commit 2023-06-09 12:37:31 +00:00
konrad added 1 commit 2023-06-09 12:39:39 +00:00
continuous-integration/drone/pr Build is failing Details
eac19e28d6
feat(reminders): add more spacing
konrad added 1 commit 2023-06-09 12:43:06 +00:00
continuous-integration/drone/pr Build is failing Details
04642ae1ec
fix(reminders): set date over relative reminder
konrad added 1 commit 2023-06-09 12:46:38 +00:00
continuous-integration/drone/pr Build is failing Details
dd3a5fe6b5
fix(reminders): duplicate reminder for each change
Owner

I've now implemented a datepicker very similar to the one from TickTick, while incorporating the changes @dpschen already made.

Here's what it looks like:

image

image

image

image

There's still little rough edges, but I think it's a really good improvement already.

I've now implemented a datepicker very similar to the one from TickTick, while incorporating the changes @dpschen already made. Here's what it looks like: ![image](/attachments/f3ba416c-09a3-4676-bbc8-aadba9550d4b) ![image](/attachments/79f38c0b-3723-413d-a4ab-3a4f1894c85f) ![image](/attachments/16b77d2f-5dc8-4a3f-b555-69f8b5e1c177) ![image](/attachments/e9469545-a5a6-46c5-b45b-28b2fc19676c) There's still little rough edges, but I think it's a really good improvement already.
konrad added 1 commit 2023-06-10 15:26:13 +00:00
continuous-integration/drone/pr Build is passing Details
9ec29cad30
fix: lint
konrad added 1 commit 2023-06-10 15:29:34 +00:00
continuous-integration/drone/pr Build is passing Details
bfcb36e093
fix(reminders): align remove icon with the rest
konrad added 1 commit 2023-06-10 15:35:55 +00:00
konrad added 1 commit 2023-06-10 16:39:42 +00:00
konrad added 3 commits 2023-06-10 16:54:44 +00:00
konrad merged commit 3f8e457d52 into main 2023-06-10 17:04:10 +00:00
Owner

Thanks again @ce72 and @dpschen!

Thanks again @ce72 and @dpschen!
Author
Contributor

I have been testing this now for quite some time and am really happy with it.
(Just three things:

  • The sync between the value sign and the before/after box is confusing. I think it would be better to disallow entering negative values and just have the before/after field.
  • When you edit ("Custom") the preselected value "1 month before due date", then the option month is missing. (Month is maybe not a good recommendation for relative dates anyway, because it is not well-defined (one month before March 31 = ?))
  • Maybe you could show the absolute time of the reminder in a tooltip?
    )

Thanks for getting this change home. I really like Vikunja even more now!

I have been testing this now for quite some time and am really happy with it. (Just three things: - The sync between the value sign and the before/after box is confusing. I think it would be better to disallow entering negative values and just have the before/after field. - When you edit ("Custom") the preselected value "1 month before due date", then the option month is missing. (Month is maybe not a good recommendation for relative dates anyway, because it is not well-defined (one month before March 31 = ?)) - Maybe you could show the absolute time of the reminder in a tooltip? ) Thanks for getting this change home. I really like Vikunja even more now!
Owner

@ce72 Thanks for your feedback!

I've improved the things you mentioned plus something I noticed myself, see 1a792e0667, 928b338cf2, 32e5f9f757 and 5694b39489

@ce72 Thanks for your feedback! I've improved the things you mentioned plus something I noticed myself, see 1a792e0667d854b5e289bdf70c468436989e0608, 928b338cf273912884e84696e29ed75d51f1e045, 32e5f9f757e21a3cffc2240c33a9624ce6aa7b49 and 5694b39489fc49fc47b865d56134445546afe244
Author
Contributor

Just another 2 cents from me:

  • Could you add "On the due date" as the first entry in the drop down, when you click on "Add Reminder"? (I believe, this might be the 95% case)
  • Could you add a lower relative reminder like "1 hour before due date" (This may be the another 4%, because very-long-term reminders are probably worth a task on their own)
  • Also in the latest frontend version, the saving of Custom edits seems to be too eager. Modifications are saved before pressing "Confirm" and there is an error bar: "Assignment to constant variable"
Just another 2 cents from me: - Could you add "On the due date" as the first entry in the drop down, when you click on "Add Reminder"? (I believe, this might be the 95% case) - Could you add a lower relative reminder like "1 hour before due date" (This may be the another 4%, because very-long-term reminders are probably worth a task on their own) - Also in the latest frontend version, the saving of Custom edits seems to be too eager. Modifications are saved before pressing "Confirm" and there is an error bar: "Assignment to constant variable"
Owner

Added the two extra presets, but didn't manage to find the cause for the error message. It does not happen in Dev builds and the built files make it hard to debug. I guess that's another reason why we finally need source maps in sentry^^

Added the two extra presets, but didn't manage to find the cause for the error message. It does not happen in Dev builds and the built files make it hard to debug. I guess that's another reason why we finally need source maps in sentry^^
This repo is archived. You cannot comment on pull requests.
No description provided.