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

Update coaching sessions #96

Merged
merged 21 commits into from
Apr 9, 2025
Merged

Update coaching sessions #96

merged 21 commits into from
Apr 9, 2025

Conversation

calebbourg
Copy link
Collaborator

Description

This PR adds the ability to update an existing Coaching Session.

It also adds a new type of menu to the coaching session component. Open to suggestion on if this is what we want.

Changes

  • Updated the add-new-coaching-session dialog component to be re-usable for creating new coaching session and updating existing coaching sessions
  • Adds a "3 dot" menu to the coaching sessions component
  • Adds a "Delete Coaching Session" link that will be used later

Screenshots / Videos Showing UI Changes (if applicable)

Screenshot 2025-04-02 at 6 56 35 AM

Testing Strategy

tested locally

Concerns

describe any concerns that might be worth mentioning or discussing

@calebbourg calebbourg self-assigned this Apr 2, 2025
@calebbourg calebbourg requested review from jhodapp and zgavin1 April 2, 2025 11:01
@calebbourg calebbourg added the feature work Specifically implementing a new feature label Apr 2, 2025
@calebbourg calebbourg added this to the 1.0-beta1 milestone Apr 2, 2025
Comment on lines 123 to 146
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="session-date">Session Date</Label>
<Calendar
mode="single"
selected={sessionDate}
onSelect={(date) => setSessionDate(date)}
/>
</div>
<div className="space-y-2">
<Label htmlFor="session-time">Session Time</Label>
<input
type="time"
id="session-time"
value={sessionTime}
onChange={(e) => setSessionTime(e.target.value)}
className="w-full border rounded p-2"
required
/>
</div>
<Button type="submit" disabled={!sessionDate || !sessionTime}>
{mode === "create" ? "Create Session" : "Update Session"}
</Button>
</form>
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want the form itself (and its submit logic) moved into it's own react component and then composed into the dialog component. Separates concerns of the dialog UI vs the form pretty nicely that way.

<CoachingSessionDialog ...props >
    <CoachingSessionForm ...props />
</CoachingSessionDialog>

Copy link
Member

Choose a reason for hiding this comment

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

I think that's a sensible suggestion Zach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes total sense. This is my pass at separating the two dea2db8

* @param actionId The ID of the action to delete
* @returns Promise resolving to the deleted Action object
*/
deleteNested: async (_entityId: Id, _actionId: Id): Promise<Action> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

forgive me I just haven't noticed this until now - what are the underscore prefixes on the params? Just acknowledging the api method isn't implemented yet?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a convention that I see in other languages that just means that the arguments aren't actually going to be used in the function (because, like you said, it's not implemented)

*/
deleteNested: async (
_entityId: Id,
coachingSessionId: Id
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need the underscore?

@calebbourg calebbourg changed the base branch from main to 88-feature-add-member-management-page-delete-users April 2, 2025 16:02
@jhodapp
Copy link
Member

jhodapp commented Apr 2, 2025

@calebbourg Thanks for this, it's nice to see this functionality in place!!

Can you move the "Join Session" back out into a primary button that sits just to the left of the new vertical "..." menu and change the text to "Join"? And then change "Edit Session" and "Delete Session" to "Edit" and "Delete"?

Copy link
Member

@jhodapp jhodapp left a comment

Choose a reason for hiding this comment

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

Looking great, a few inline suggestions.

Comment on lines 22 to 28
coachingSession: {
id: Id;
date: string;
coaching_relationship_id: Id;
created_at: DateTime;
updated_at: DateTime;
};
Copy link
Member

Choose a reason for hiding this comment

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

Change this to use the type defined in src/types/coaching-session.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup e0074c6

onOpenChange={setUpdateDialogOpen}
onCoachingSessionUpdated={() => {
// Refresh the list of coaching sessions
window.location.reload();
Copy link
Member

Choose a reason for hiding this comment

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

Is there a hook for the coaching sessions that we can call refresh() on instead of this? I may be confused on what this is for otherwise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes this was something that AI added that I didn't see. Good catch! dea2db8

Comment on lines 123 to 146
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="session-date">Session Date</Label>
<Calendar
mode="single"
selected={sessionDate}
onSelect={(date) => setSessionDate(date)}
/>
</div>
<div className="space-y-2">
<Label htmlFor="session-time">Session Time</Label>
<input
type="time"
id="session-time"
value={sessionTime}
onChange={(e) => setSessionTime(e.target.value)}
className="w-full border rounded p-2"
required
/>
</div>
<Button type="submit" disabled={!sessionDate || !sessionTime}>
{mode === "create" ? "Create Session" : "Update Session"}
</Button>
</form>
Copy link
Member

Choose a reason for hiding this comment

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

I think that's a sensible suggestion Zach.

@calebbourg calebbourg force-pushed the 88-feature-add-member-management-page-delete-users branch from accebcf to dfa4cb3 Compare April 4, 2025 10:48
@calebbourg calebbourg force-pushed the update_coaching_sessions branch from e5142b5 to e0074c6 Compare April 4, 2025 12:10
@calebbourg
Copy link
Collaborator Author

@jhodapp I moved the join session button back out in e18bfed
Screenshot 2025-04-04 at 8 27 39 AM

Let me know how this works for now.

Base automatically changed from 88-feature-add-member-management-page-delete-users to main April 4, 2025 17:13
@calebbourg calebbourg force-pushed the update_coaching_sessions branch from e18bfed to f18b415 Compare April 4, 2025 17:14
@jhodapp
Copy link
Member

jhodapp commented Apr 4, 2025

@jhodapp I moved the join session button back out in e18bfed Screenshot 2025-04-04 at 8 27 39 AM

Let me know how this works for now.

@calebbourg

Closer, but now I see the "Create New Coaching Session" button repeated above every session. Are you seeing this too?

Screenshot 2025-04-04 at 12 19 04

@jhodapp
Copy link
Member

jhodapp commented Apr 4, 2025

@calebbourg Your latest changes also seem to degrade the AddEntity component up top on the Dashboard page as well:

Screenshot 2025-04-04 at 12 23 15

@calebbourg
Copy link
Collaborator Author

@jhodapp oh haha for some reason I thought that had something to do with changes you were making on the dashboard being in an in between state.. I see now that that would be really weird :) I'll fix it

@jhodapp
Copy link
Member

jhodapp commented Apr 4, 2025

@jhodapp oh haha for some reason I thought that had something to do with changes you were making on the dashboard being in an in between state.. I see now that that would be really weird :) I'll fix it

Not yet, I haven't made any changes yet. Thanks brother!

@calebbourg
Copy link
Collaborator Author

@jhodapp @zgavin1 I took another crack at this. I realized that we were using the CoachingSessionDialog component in multiple places throughout the larger dashboard page and so attempted to declare it once and provide hooks for the various other components to call into it's functionality. I defined the hooks in the top level dashboard page. In order to do that I needed to separate some of the code into a client rendered function. that is called by page.tsx which remains server-rendered. I think that's a reasonable approach but open to thoughts.

Another spin-off of this was that I removed the "Create Coaching Session" button from the actual list of coaching sessions as It seemed redundant given the add-entities buttons above.

@jhodapp
Copy link
Member

jhodapp commented Apr 5, 2025

Another spin-off of this was that I removed the "Create Coaching Session" button from the actual list of coaching sessions as It seemed redundant given the add-entities buttons above.

@calebbourg this is awesome, it was something I was going to do anyway when I moved the coaching sessions list down in the page for exactly the reason you mentioned. Thanks for doing this!

Copy link
Member

@jhodapp jhodapp left a comment

Choose a reason for hiding this comment

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

Such an awesome change set, thank you Caleb. Just a few more suggestions and I'll be ready to approve.

<AddEntities onCreateSession={() => handleOpenDialog()} />
</div>
</div>
<DashboardContainer>
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to suggest that we should merge DashboardContainer and DashboardContent and I suggest DashboardContainer as the name since we have precedence for this already. Unless I'm misunderstanding things, I don't see any value or requirement to have the extra div layer.

I do think you did take the right approach though in making the Dashboard page as simple as possible and trying to keep it rendered on the server side.

Copy link
Member

Choose a reason for hiding this comment

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

I did some updating here, but not all of what I suggested. But you'll want to check it out so we don't step on each other directly: https://github.com/refactor-group/refactor-platform-fe/pull/102/files#diff-1b7538b3757a933d976e1a796af3bbf3bc3895ae83f60d5a0562db4d2f6bbc02

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jhodapp thanks for the heads up! It looks like that branch is based off of this one right? Do you have a preference of making this change in this branch vs yours?

Copy link
Member

Choose a reason for hiding this comment

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

@calebbourg It is based off of this one indeed. I'm good either way. Maybe it makes the most sense to retarget my PR to merge into yours instead of into main?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok made this change e3ef1f5

Comment on lines +28 to +30
<AddCoachingSessionButton
disabled={!isCoach || !currentOrganizationId}
onClick={onCreateSession}
Copy link
Member

Choose a reason for hiding this comment

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

Yes!! This fulfills my TODO item, so thank you for refactoring this to match the style of AddMemberButton. What a pleasant surprise to discover. :)

</Link>
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setUpdateDialogOpen(true)}>
<DropdownMenuItem onClick={onUpdate}>
Copy link
Member

Choose a reason for hiding this comment

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

To be consistent with Agreements and Actions, can you update the drop down menu item text to be "Edit" and "Delete" instead of "Update Session" and "Delete Session"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated 536a763

@jhodapp jhodapp mentioned this pull request Apr 5, 2025
jhodapp added 4 commits April 5, 2025 15:22
…age. Moves CoachingSessionList left. Adds a tab bar splitting sessions out by upcoming/previous sessions.
…or the layout of this component on the Dashboard page, and make logout more robust.
Copy link
Member

@jhodapp jhodapp left a comment

Choose a reason for hiding this comment

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

Awesome set of changes, thanks Caleb!

@jhodapp jhodapp merged commit a536f36 into main Apr 9, 2025
4 checks passed
@jhodapp jhodapp deleted the update_coaching_sessions branch April 9, 2025 15:50
@github-project-automation github-project-automation bot moved this from Review to ✅ Done in Refactor Coaching Platform Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature work Specifically implementing a new feature
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants