refactor(webui): centralize scheduling selection
This commit is contained in:
@@ -12,6 +12,7 @@ assert.match(page, /hasScope\(auth, "calendar:calendar:read"\)/);
|
|||||||
assert.match(page, /Boolean\(calendarPickerCapability\) && canReadCalendars && canReadAvailability && canWriteCalendarEvent/);
|
assert.match(page, /Boolean\(calendarPickerCapability\) && canReadCalendars && canReadAvailability && canWriteCalendarEvent/);
|
||||||
assert.doesNotMatch(page, /@govoplan\/calendar-webui|govoplan-calendar\/webui/);
|
assert.doesNotMatch(page, /@govoplan\/calendar-webui|govoplan-calendar\/webui/);
|
||||||
assert.match(page, /Card,[\s\S]*DataGrid,[\s\S]*DataGridEmptyAction,[\s\S]*DataGridRowActions,[\s\S]*ModuleSubnav,[\s\S]*ToggleSwitch,[\s\S]*from "@govoplan\/core-webui"/);
|
assert.match(page, /Card,[\s\S]*DataGrid,[\s\S]*DataGridEmptyAction,[\s\S]*DataGridRowActions,[\s\S]*ModuleSubnav,[\s\S]*ToggleSwitch,[\s\S]*from "@govoplan\/core-webui"/);
|
||||||
|
assert.match(page, /SelectionList,[\s\S]*SelectionListItem,[\s\S]*from "@govoplan\/core-webui"/);
|
||||||
assert.doesNotMatch(page, /@govoplan\/core-webui\/src\//);
|
assert.doesNotMatch(page, /@govoplan\/core-webui\/src\//);
|
||||||
assert.match(page, /className="scheduling-full-editor"/);
|
assert.match(page, /className="scheduling-full-editor"/);
|
||||||
assert.match(page, /className="scheduling-page-actions"/);
|
assert.match(page, /className="scheduling-page-actions"/);
|
||||||
@@ -36,6 +37,9 @@ assert.match(browseBranch, /<h1>\{I18N\.requests\}<\/h1>/);
|
|||||||
assert.match(browseBranch, /<Plus aria-hidden="true" size=\{16\} \/> \{I18N\.add\}/);
|
assert.match(browseBranch, /<Plus aria-hidden="true" size=\{16\} \/> \{I18N\.add\}/);
|
||||||
assert.match(page, /title=\{I18N\.myRequests\}/);
|
assert.match(page, /title=\{I18N\.myRequests\}/);
|
||||||
assert.match(page, /title=\{I18N\.invitedRequests\}/);
|
assert.match(page, /title=\{I18N\.invitedRequests\}/);
|
||||||
|
assert.match(page, /<SelectionList label=\{title\} className="scheduling-request-list">/);
|
||||||
|
assert.match(page, /<SelectionListItem[\s\S]*selected=\{selectedId === request\.id\}[\s\S]*className="scheduling-list-item"/);
|
||||||
|
assert.doesNotMatch(page, /<button[\s\S]{0,160}scheduling-list-item/);
|
||||||
assert.match(createBranch, /<Card title=\{I18N\.basicInformation\}>/);
|
assert.match(createBranch, /<Card title=\{I18N\.basicInformation\}>/);
|
||||||
assert.match(createBranch, /<Card title=\{I18N\.calendarIntegration\}>/);
|
assert.match(createBranch, /<Card title=\{I18N\.calendarIntegration\}>/);
|
||||||
assert.match(page, /<Card title=\{I18N\.candidateSlots\}>/);
|
assert.match(page, /<Card title=\{I18N\.candidateSlots\}>/);
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import {
|
|||||||
DataGridRowActions,
|
DataGridRowActions,
|
||||||
DateTimeField,
|
DateTimeField,
|
||||||
ModuleSubnav,
|
ModuleSubnav,
|
||||||
|
SelectionList,
|
||||||
|
SelectionListItem,
|
||||||
TableActionGroup,
|
TableActionGroup,
|
||||||
ToggleSwitch,
|
ToggleSwitch,
|
||||||
hasScope,
|
hasScope,
|
||||||
@@ -810,16 +812,20 @@ function RequestGroup({
|
|||||||
return (
|
return (
|
||||||
<Card title={title}>
|
<Card title={title}>
|
||||||
<div className="scheduling-list-group">
|
<div className="scheduling-list-group">
|
||||||
{requests.length ? requests.map((request) => (
|
{requests.length ? (
|
||||||
<button
|
<SelectionList label={title} className="scheduling-request-list">
|
||||||
key={request.id}
|
{requests.map((request) => (
|
||||||
className={`scheduling-list-item ${selectedId === request.id ? "is-selected" : ""}`}
|
<SelectionListItem
|
||||||
type="button"
|
key={request.id}
|
||||||
onClick={() => onSelect(request.id)}>
|
selected={selectedId === request.id}
|
||||||
<span><strong>{request.title}</strong><small>{formatRelevantDate(request)}</small></span>
|
className="scheduling-list-item"
|
||||||
<small className="scheduling-list-status">{requestStatusLabel(request, actor)}</small>
|
onClick={() => onSelect(request.id)}>
|
||||||
</button>
|
<span><strong>{request.title}</strong><small>{formatRelevantDate(request)}</small></span>
|
||||||
)) : <p className="scheduling-list-empty">{I18N.noRequestsInGroup}</p>}
|
<small className="scheduling-list-status">{requestStatusLabel(request, actor)}</small>
|
||||||
|
</SelectionListItem>
|
||||||
|
))}
|
||||||
|
</SelectionList>
|
||||||
|
) : <p className="scheduling-list-empty">{I18N.noRequestsInGroup}</p>}
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -136,30 +136,16 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scheduling-request-list {
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.scheduling-list-item {
|
.scheduling-list-item {
|
||||||
width: 100%;
|
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1fr) auto;
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 0 0 4px;
|
|
||||||
padding: 8px 10px;
|
|
||||||
border: 1px solid transparent;
|
|
||||||
border-radius: 7px;
|
|
||||||
color: var(--text);
|
|
||||||
background: transparent;
|
|
||||||
text-align: left;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scheduling-list-item:hover {
|
|
||||||
background: var(--hover-tint-soft);
|
|
||||||
}
|
|
||||||
|
|
||||||
.scheduling-list-item.is-selected {
|
|
||||||
border-color: color-mix(in srgb, var(--accent) 45%, transparent);
|
|
||||||
background: color-mix(in srgb, var(--accent) 10%, var(--panel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.scheduling-list-item > span {
|
.scheduling-list-item > span {
|
||||||
|
|||||||
Reference in New Issue
Block a user