People Editing!
In this session, I implemented the menus for adding, removing, and editing people from a DM or Space. I decided to make the editing menus popup menus to avoid having to redo the sidebar with more menu switches. To make the popups work better, I separated the styling for popups into their own tcss file from the licence popup styles.
Part 1: Editing Buttons
The first order of business was to add the buttons for adding, editing, and removing people. They are setup so that the first person cannot be edited or removed, as they are the main user in all DMs and Spaces. A maximum number of people is passed to the people editing widget- two people for DMs, and 400 people for Spaces. 400 is the limit for personal use, and I don’t think any more than that is really required.
Part 2: Adding People
The people adding popup has two labels, one for the name and one for the email. The default values are generated based on the number of items so there are hopefully no duplicates. The UI design has each input labelled, and buttons to cancel or save the new person. Designing this was really interesting, as I found that nesting containers using their constructor, not a with statement, allows event bindings to bind correctly to the main container. This nested structure is surprisingly quite a bit like the Flutter child/children structure.
Horizontal(
Label("Name: "),
Input(placeholder=self._name, id = "name")
),
In order to make the table reload, I just switch back to the menu with a switch command; this works, although that fact that there is no default menu so it returns to the void menu means it isn’t a perfect solution.
Part 3: Removing People
This was fairly simple; the index for the person is passed into the constructor, so the person’s name can be referenced in the confirmation message. An option to remove the person or cancel is provided.
Part 4: Editing People
This popup is in part a modification of adding people and removing people. The person’s index is passed into the constructor so they can be found, and text boxes are provided to modify the person’s name.
Part 5: Adding people to Spaces
I was originally going to stop at adding people to DMs, but I thought that the larger number of people in Spaces would make a better demo. I unfortunately hadn’t actually made it easy to add this to spaces; I just forgot I would need to make this work for the separate Spaces and DMs. Making this separate is required as I store DMs and Spaces in separate dictionaries, and the command to return to the correct menu needs to be different for spaces and menus. To fix this, I pass a type to the constructor, which is used to determine which dictionary to use, and which call to make when closing the popup
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.