Skip to content

Commit 0404787

Browse files
authored
Merge pull request #159 from cytechmobile/feat/78-support-general-comments
2 parents 07c833d + 4d0c271 commit 0404787

19 files changed

+1501
-1095
lines changed

CHANGELOG.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,58 @@
11
# Radicle VS Code Extension Change Log
22

3+
## _(WIP, yet unreleased version)_
4+
5+
### 🚀 Enhancements
6+
7+
- **patch-detail:** add a new "Comment" button next to the revision selector
8+
- clicking the button shows a new patch-comment form in the top of the Activity section
9+
- the form consists of
10+
- a text-field where the user can type their comment
11+
- the target revision under which the comment is to be created
12+
- form control buttons
13+
- if in single-column mode due to narrow viewport the active tab automatically switches to the Activity section
14+
- form state is preserved (as described in [v0.5.0#enhancements](#v050-july-22nd-2024)) individually for each revision
15+
- clicking the form's "Comment" button or the keyboard shortcut `Ctrl/Cmd + Enter` submits the form
16+
- attempts to create a new comment on radicle under the selected revision
17+
- informs the user of the action's result (created and announced / created only locally / failed) and offers follow-up actions as needed
18+
- upon the comment's successful creation, it is shown directly in place of the patch-comment form as a new event at the top of the Activity section with the time-ago indicator showing "now" and a short "pulse-outline" animation around it
19+
- **patch-detail:** in the patch-edit form
20+
- show placeholder text when either text-field is empty
21+
- change button label "Save" to "Update"
22+
- **patch-detail:** in both patch-comment and patch-edit forms
23+
- add a new button with a coffee icon between "Update"/"Comment" and "Discard"
24+
- clicking it "pauses" editing, hiding the form but preserving the current changes for later (a.k.a. aforementioned form state preservation)
25+
- also triggerable with keyboard shortcut `Escape`
26+
- also acts as a safe "spacer" between the two aforementioned buttons protecting against misclicks that would otherwise come with a big penalty
27+
- add a new button to toggle a markdown preview of the current changes before submitting
28+
- also triggerable with keyboard shortcut `Alt + P`
29+
- after toggling to markdown preview and back to editing the undo/redo history (Ctrl/Cmd + Z and Ctrl/Cmd + Shift + Z) is still available. Even if the form contains multiple controls (e.g. two text-areas) then the undo/redo history spanning _all of them in the order they were changed_ is still retained
30+
- polish text-field sizing dynamics:
31+
- use 1 line of text as starting height when empty for the patch title field and 4 lines for the patch description
32+
- respectively limit the max vertical lines for the former and the latter
33+
- fields offer 65 characters of horizontal space (when there's enough viewport width, whatever fits otherwise), which also happens to be the Markdown renderer's wrapping limit (with exceptions). This can double as a subtle hint that we may be typing too much. Longer lines of text widen the fields to fit the content as long as there's enough viewport space, at which point they'll wrap into a new line, line-breaking at at appropriate point.
34+
- previously typing or focusing any of the form's fields would always scroll the viewport to align the form at its bottom. Now this happens only if the form doesn't already fit on the viewport, leaving the scroll position wherever it was already set by the user and resulting in a less constricting experience
35+
- although fields remain manually user-resizeable (pursposefully only across height) by mouse-dragging the bottom-right handle of each field _and_ dynamically resizeable as content grows (with contextual restrictions) and shrinks, if the user indeed defines a preferred height using the former method, then it is respected by the latter
36+
- the aforementioned coupled with the pre-existing feature of optimally auto-aligning the form as it resizes should seamlessly provide a smooth authoring experience
37+
- adjust the hover text of all form buttons to advertise their respective keyboard shortcut (if any)
38+
- **patch-detail:** preselect the merged revision, if any, in the revision selector instead of always the latest
39+
- **patch-detail:** don't mention the revision and its identifier in events in the Activity section if there's only one revision
40+
- **patch-detail:** align the UX for every revision identifier shown in the patch-major-events section (top of the view) with the behaviour of those in the Activity section, i.e. showing the revision description on hover, and when clicked scrolling to the Revision section wherin more info about it is shown
41+
- **patch-detail:** don't mention the related commit in the patch-major-events section (~~"Last updated by W with revision X at commit Y Z time ago"~~). This information is still available in the Revision section.
42+
- **patch-detail:** keep the labels of the main buttons (top-right of the view) as a single line of text, even if the viewport is narrow enough to compress them
43+
- **patch-detail:** add themed styling to `<summary>` elements when tabbed into
44+
45+
### 🩹 Fixes
46+
47+
- **patch-detail:** don't disappear the Activity and Revision sections sometimes, e.g. when a new revision is detected
48+
- **patch-detail:** make "Refresh" button work again, fetching latest patch data
49+
- **patch-detail:** don't show big gap between patch title and next section if the patch description is empty
50+
51+
### 🏡 Chores
52+
53+
- **ts:** enforce stricter type-checking for webview apps
54+
- **deps:** upgrade webview app dependencies, including latest Vue v3.5
55+
356
## **v0.5.1** (September 10th, 2024)
457

558
### 🩹 Fixes
@@ -45,7 +98,7 @@
4598
- responds to viewport size changes applying sizing limits on top of the aforementioned content-relative resizing
4699
- is set with (generous) max char count limits to limit abuse
47100
- pressing the Enter key enters a new line but pressing Ctrl/Cmd+Enter behaves as if the "Save" button was clicked
48-
- the value of each text-area is auto-saved in memory as a draft while typing, as well as the "is editing" status of the form, and those will be attempted to be restored:
101+
- the value of each text-area is preserved as an in-extension draft while typing, as well as the "is editing" status of the form, and those will be attempted to be restored:
49102
- if the editor panel is hidden (another panel is selected placing it in the background) and then re-viewed (same session)
50103
- if VS Code is terminated or crashes (across sessions)
51104
- if the form submission fails

src/helpers/command.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ export function registerAllCommands(): void {
105105
registerVsCodeCmd('radicle.refreshAllPatches', () => {
106106
usePatchStore().resetAllPatches()
107107
})
108-
registerVsCodeCmd('radicle.refreshOnePatch', (patch: Patch | undefined) => {
109-
assert(patch)
110-
usePatchStore().refetchPatch(patch?.id)
108+
registerVsCodeCmd('radicle.refreshOnePatch', (patchId: Patch['id'] | undefined) => {
109+
assert(patchId)
110+
usePatchStore().refetchPatch(patchId)
111111
})
112112
registerVsCodeCmd('radicle.checkoutPatch', checkOutPatch)
113113
registerVsCodeCmd('radicle.checkoutDefaultBranch', checkOutDefaultBranch)

src/helpers/webview.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@ function handleMessageFromWebviewPatchDetail(
313313
}
314314
}
315315
break
316+
case 'createPatchComment':
317+
mutatePatch(message.payload.patch.id, message.payload.patch.title, (timeout?: number) =>
318+
execPatchMutation(
319+
['comment', message.payload.revisionId, '--message', message.payload.comment],
320+
timeout,
321+
),
322+
)
323+
break
316324
default:
317325
assertUnreachable(message)
318326
}

src/utils/webview-messaging.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {
44
Patch,
55
PatchDetailWebviewInjectedState,
66
PatchStatus,
7+
Revision,
78
} from '../types'
89
import { getVscodeRef } from '../webviews/src/utils/getVscodeRef'
910

@@ -28,6 +29,10 @@ type MessageToExtension =
2829
{ patchId: Patch['id']; newTitle: string; newDescr: string; oldTitle: string }
2930
>
3031
| Message<'updatePatchStatus', { patch: Patch; newStatus: Exclude<PatchStatus, 'merged'> }>
32+
| Message<
33+
'createPatchComment',
34+
{ patch: Patch; revisionId: Revision['id']; comment: string }
35+
>
3136

3237
/**
3338
* Sends a message, usually from the host window, to the provided webview.

src/webviews/package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,35 @@
1717
},
1818
"dependencies": {
1919
"@vscode/webview-ui-toolkit": "^1.4.0",
20-
"@vueuse/core": "^10.9.0",
21-
"highlight.js": "^11.9.0",
22-
"javascript-time-ago": "^2.5.9",
23-
"pinia": "^2.1.7",
24-
"vue": "^3.4.20",
20+
"@vueuse/core": "^10.11.1",
21+
"highlight.js": "^11.10.0",
22+
"javascript-time-ago": "^2.5.11",
23+
"pinia": "^2.2.6",
24+
"vue": "^3.5.12",
2525
"vue3-markdown-it": "^1.0.10"
2626
},
2727
"devDependencies": {
28-
"@rushstack/eslint-patch": "^1.7.2",
29-
"@tsconfig/node18": "^18.2.2",
28+
"@rushstack/eslint-patch": "^1.10.4",
29+
"@tsconfig/node18": "^18.2.4",
3030
"@types/javascript-time-ago": "^2.0.8",
31-
"@types/jsdom": "^21.1.6",
32-
"@types/node": "^20.11.21",
33-
"@vitejs/plugin-vue": "^5.0.4",
31+
"@types/jsdom": "^21.1.7",
32+
"@types/node": "^20.17.6",
33+
"@vitejs/plugin-vue": "^5.1.4",
3434
"@vue/eslint-config-prettier": "^8.0.0",
3535
"@vue/eslint-config-typescript": "^12.0.0",
36-
"@vue/test-utils": "^2.4.4",
36+
"@vue/test-utils": "^2.4.6",
3737
"@vue/tsconfig": "^0.4.0",
38-
"autoprefixer": "^10.4.17",
39-
"eslint": "^8.57.0",
40-
"eslint-plugin-vue": "^9.22.0",
41-
"jsdom": "^24.0.0",
42-
"npm-run-all2": "^6.1.1",
43-
"postcss": "^8.4.35",
44-
"prettier": "^3.2.5",
45-
"tailwindcss": "^3.4.1",
38+
"autoprefixer": "^10.4.20",
39+
"eslint": "^8.57.1",
40+
"eslint-plugin-vue": "^9.30.0",
41+
"jsdom": "^24.1.3",
42+
"npm-run-all2": "^6.2.6",
43+
"postcss": "^8.4.47",
44+
"prettier": "^3.3.3",
45+
"tailwindcss": "^3.4.14",
4646
"typescript": "~5.2.2",
47-
"vite": "^5.2.10",
48-
"vitest": "^1.3.1",
47+
"vite": "^5.4.10",
48+
"vitest": "^1.6.0",
4949
"vue-tsc": "^1.8.27"
5050
}
5151
}

0 commit comments

Comments
 (0)