Skip to content

Commit

Permalink
Merge pull request #68 from angsongyee/update-contact
Browse files Browse the repository at this point in the history
Update UG, DG for command history feature
  • Loading branch information
angsongyee authored Mar 21, 2024
2 parents 58bc7df + c0ebc40 commit 07c2dcc
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 21 deletions.
22 changes: 20 additions & 2 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,27 @@ Classes used by multiple components are in the `seedu.address.commons` package.

This section describes some noteworthy details on how certain features are implemented.

### Command history feature

This feature saves previously entered commands so that the user can easily view them again.

#### Steps to trigger
1. User focuses the command input.
2. User presses the Up arrow key to view the previous command in history, or Down arrow key to view the next.
3. `updateCommandInput()` saves the currently edited command to the command buffer.
4. `next()`/`previous()` in `CommandHistoryView` is called and if a next/previous command exists, the command text field is updated.

The following sequence diagram shows what happens as the user requests to view the command history, and what happens after
the command is executed:
<puml src="diagrams/CommandHistorySequenceDiagram.puml" alt="Sequence Diagram for Command History" />

#### Possible enhancements
* The history size could be made to be configurable by the user.
* The history could be saved to disk so that it persists between app launches.

### \[Proposed\] Undo/redo feature

#### Proposed Implementation
#### Proposed Implementation

The proposed undo/redo mechanism is facilitated by `VersionedCodeConnect`. It extends `CodeConnect` with an undo/redo
history, stored internally as `codeConnectStateList` and `currentStatePointer`. Additionally, it implements the
Expand Down Expand Up @@ -440,7 +458,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
* 1b1. CodeConnect shows an error message.
Use case ends.

* 1c. No fields are entered.
* 1c. Updated value does not follow format of the specific field.
* 1b1. CodeConnect shows an error message.
Use case ends.

Expand Down
51 changes: 32 additions & 19 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ CodeConnect (CC) is a **desktop app for managing student contacts, optimized for

## Features

### Commands

<box type="info" seamless>

**Notes about the command format:**<br>
Expand All @@ -66,15 +68,15 @@ CodeConnect (CC) is a **desktop app for managing student contacts, optimized for
- If you are using a PDF version of this document, be careful when copying and pasting commands that span multiple lines as space characters surrounding line-breaks may be omitted when copied over to the application.
</box>

### Viewing help : `help`
#### Viewing help : `help`

Shows a message explaning how to access the help page.

![help message](images/helpMessage.png)

Format: `help`

### Adding a contact: `add`
#### Adding a contact: `add`

Adds a contact to the address book.

Expand All @@ -90,19 +92,13 @@ Examples:
- `add n/John Doe p/98765432 e/[email protected] a/John street, block 123, #01-01 g/johnDoee`
- `add n/Betsy Crowe t/friend e/[email protected] a/Newgate Prison p/1234567 g/betBetty t/criminal ts/Flutter`

### Listing all contacts : `list`
#### Listing all contacts : `list`

Shows a list of all contacts in the address book.

Format: `list`

### Sending an email to a specific contact

Opens the desktop mail application to directly send an email to a specific contact.

How to use: Click on the contact's email.

### Editing a contact : `edit`
#### Editing a contact : `edit`

Edits an existing contact in the address book.

Expand All @@ -120,7 +116,7 @@ Examples:
- `edit 1 p/91234567 e/[email protected]` Edits the phone number and email address of the 1st contact to be `91234567` and `[email protected]` respectively.
- `edit 2 n/Betsy Crower t/` Edits the name of the 2nd contact to be `Betsy Crower` and clears all existing tags.

### Locating contacts by name: `find`
#### Locating contacts by name: `find`

Finds contacts whose names contain any of the given keywords.

Expand All @@ -139,7 +135,7 @@ Examples:
- `find alex david` returns `Alex Yeoh`, `David Li`<br>
![result for 'find alex david'](images/findAlexDavidResult.png)

### Locating contacts by tags: `find-tags`
#### Locating contacts by tags: `find-tags`

Finds contacts whose tags contain all the given keywords.

Expand All @@ -154,7 +150,7 @@ Examples:
- image to be replaced
![result for 'find alex david'](images/findAlexDavidResult.png)

### Locating contacts by tech stack: `find-ts`
#### Locating contacts by tech stack: `find-ts`

Finds contacts whose tech stack contain all the given keywords.

Expand All @@ -168,7 +164,7 @@ Format: `find-ts KEYWORD [MORE_KEYWORDS]`
Examples:
- image to be inserted

### Deleting a contact : `delete`
#### Deleting a contact : `delete`

Deletes the specified contact from the address book.

Expand All @@ -183,23 +179,40 @@ Examples:
- `list` followed by `delete 2` deletes the 2nd contact in the address book.
- `find Betsy` followed by `delete 1` deletes the 1st contact in the results of the `find` command.

### Clearing all entries : `clear`
#### Clearing all entries : `clear`

Clears all entries from the address book.

Format: `clear`

### Exiting the program : `exit`
#### Exiting the program : `exit`

Exits the program.

Format: `exit`

### Saving the data
### Other features

#### Sending an email to a specific contact

Opens the desktop mail application to directly send an email to a specific contact.

**How to use:** Click on the contact's email.


#### View your previous commands

Any commands you have run previously are saved in the command history, so that you can easily refer to them if you need to.
Any edits you make to a command will be saved while navigating through your history, so you can go to a another command
to refer to it, and then return back to your edited command to finish typing.

**How to use:** Use the up and down arrow keys to navigate through your history while the command input is focused,

#### Saving the data

CodeConnect data are saved in the hard disk automatically after any command that changes the data. There is no need to save manually.

### Editing the data file
#### Editing the data file

CodeConnect data are saved automatically as a JSON file `[JAR file location]/data/addressbook.json`. Advanced users are welcome to update data directly by editing that data file.

Expand All @@ -210,7 +223,7 @@ If your changes to the data file makes its format invalid, CodeConnect will disc
Furthermore, certain edits can cause the CodeConnect to behave in unexpected ways (e.g., if a value entered is outside the acceptable range). Therefore, edit the data file only if you are confident that you can update it correctly.
</box>

### Archiving data files `[coming in v2.0]`
#### Archiving data files `[coming in v2.0]`

_Details coming soon ..._

Expand Down
64 changes: 64 additions & 0 deletions docs/diagrams/CommandHistorySequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box UI UI_COLOR_T1
participant ":CommandBox" as CommandBox UI_COLOR
participant "commandInput:TextField" as TextField UI_COLOR
end box

box Logic LOGIC_COLOR_T1
participant "view:CommandHistoryView" as CommandHistoryView LOGIC_COLOR
participant "h:CommandHistory" as CommandHistory LOGIC_COLOR
participant "nextView:CommandHistoryView" as NCommandHistoryView LOGIC_COLOR
end box

[-> CommandBox : <KeyEvent>
activate CommandBox
CommandBox -> TextField : getText()
activate TextField

CommandBox <-- TextField : input
deactivate TextField

CommandBox -> CommandHistoryView : updateCurrentCommand(input)

alt #00ff0000 eventCode = UP
CommandBox -> CommandHistoryView : next()
activate CommandHistoryView

CommandBox <-- CommandHistoryView : c
deactivate CommandHistoryView

else eventCode = DOWN
CommandBox -> CommandHistoryView : previous()
activate CommandHistoryView

CommandBox <-- CommandHistoryView : c
deactivate CommandHistoryView
end

CommandBox -> TextField : setText(c)

[<--CommandBox
deactivate CommandBox


[-> CommandBox : handleCommandEntered()
activate CommandBox

CommandBox -> CommandHistory : h.add("list")

create NCommandHistoryView

CommandBox -> NCommandHistoryView : CommandHistoryView(h)
activate NCommandHistoryView

CommandBox <-- NCommandHistoryView : nextView
deactivate NCommandHistoryView

destroy CommandHistoryView

[<--CommandBox
deactivate CommandBox
@enduml

0 comments on commit 07c2dcc

Please sign in to comment.