Skip to content

Feature/create custom preset UI#607

Merged
malinduc-apadmi merged 15 commits into
develop-ui-redesignfrom
feature/create-custom-preset-ui
Jun 8, 2026
Merged

Feature/create custom preset UI#607
malinduc-apadmi merged 15 commits into
develop-ui-redesignfrom
feature/create-custom-preset-ui

Conversation

@malinduc-apadmi

@malinduc-apadmi malinduc-apadmi commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Redesigns the Create/Edit Preset panel with a clean flat layout, replacing the previous card-based approach.

Changes
UI / Layout

Flat panel with gray SectionLabel section headers (RESPONSE, HEADERS (N))
PanelHeader with bold title, endpoint subtitle, Cancel + Save buttons, and a slim progress indicator
Preset panel is now bounded between the top bar and the logs panel — no longer overlaps either
Removed rounded top-start corner from the preset panel overlay
Status Code

Custom StatusCodeDropdown with a StatusChip showing semantic colour coding (2xx = Ok/green, 3xx = Info, 4xx = Warn, 5xx = Err)
Dropdown wraps content, label left / control right (SpaceBetween)
Body

Segmented BodyTypeToggle (JSON / Plain Text) with teal selected state
JsonBodyTextField — BasicTextField + TextFieldValue with live JSON syntax highlighting via buildHighlightedAnnotatedString (reformat = false so typing is never interrupted)
Body header row shows char count + validity icon inline, both in primary (teal) colour
Headers

Existing headers displayed as inline key : value × rows (teal key, muted value)
Section label includes live count — HEADERS (1)
Add-header row: two single-line CustomTextField inputs with muted placeholder hints + teal + button
Architecture

Extracted MiddleContentArea composable to fix ColumnScope.AnimatedVisibility ambiguity
Added reformat: Boolean = true param to buildHighlightedAnnotatedString
Added onCancel to public CreateEditPresetWidget API
Added i18n strings: cancel, endpointSubtitle, statusCodeRowLabel, bodyTypeLabel, responseSectionLabel, bodyLabel
Testing
Build and run the desktop app
Open the Create Preset panel and verify: status code dropdown, body type toggle, JSON highlighting, header add/remove, cancel/save buttons, panel bounds (does not overlap top bar or logs)

Replace card-based layout with flat design using gray section headers
Add syntax-highlighted JSON body editor (BasicTextField + TextFieldValue)
Add custom status code chip dropdown with semantic colour coding
Add segmented JSON/Plain Text body type toggle
Inline char count and JSON validity indicator in Body header row
Bound preset panel between top bar and logs (Column layout)
Extract MiddleContentArea composable to fix ColumnScope.AnimatedVisibility ambiguity
Remove rounded corner from preset panel overlay
Add cancel/save header with progress indicator
Add reformat param to buildHighlightedAnnotatedString for in-place highlighting
Add missing i18n strings (cancel, endpointSubtitle, statusCodeRowLabel, etc.)
@malinduc-apadmi malinduc-apadmi requested review from SamC-Apadmi and piriyas-code and removed request for SamC-Apadmi June 3, 2026 05:01
@malinduc-apadmi malinduc-apadmi self-assigned this Jun 3, 2026
// ── Middle content area (bounded: never spills into logs) ────
// Extracted to its own composable so that ColumnScope is not an
// ambient implicit receiver — otherwise the compiler resolves
// AnimatedVisibility to ColumnScope.AnimatedVisibility and errors.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure this comment is needed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Resolved

val bodyTitle: String,
val bodyTypeJson: String,
val bodyTypePlain: String,
val bodyTypeXml: String,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we remove XML? Don't really want to support that

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Resolved, removed from Enum

modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
.padding(horizontal = 16.dp, vertical = 14.dp),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We try to stick to multiples of 4 for padding, can this be 12 or 16?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, Resolved

State.Editing.ResponseType.PlainText,
State.Editing.ResponseType.Xml,
State.Editing.ResponseType.Html,
State.Editing.ResponseType.None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can this not just use State.Editing.ResponseType.entries?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, of course can, the list was there to guard against Diktat reordering the enum alphabetically and breaking the UI order. Fixed by adding @Suppress("EnumEntryOrder") to the enum declaration so the order is owned by the enum itself, resolved switched to entries.

Modifier
}
)
.padding(horizontal = 14.dp, vertical = 8.dp),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Resolved

@malinduc-apadmi malinduc-apadmi merged commit 7818d07 into develop-ui-redesign Jun 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants