diff --git a/release-notes/1.0.7.md b/release-notes/1.0.7.md index 03ab93cfe..3841fc733 100644 --- a/release-notes/1.0.7.md +++ b/release-notes/1.0.7.md @@ -156,11 +156,11 @@ message saying so — straight away, not after several tries. ## A walkthrough for a timesheet change, recorded or uploaded -When a change to your timesheet waits for approval, **Walkthrough** with -**Pulse** and **Upload** sits beside _Pending approval_. Record a short -walkthrough of the change, or upload one, and it's added to the request as -soon as it uploads, so your approver sees it alongside your explanation. You -can also attach one while you write the change, under the same name. +When a change to your timesheet waits for approval, two buttons sit beside +_Pending approval_: the Pulse logo to record a walkthrough on your phone, and +the upload arrow for a video you already have. The walkthrough is added to the +request as soon as it uploads, so your approver sees it alongside your +explanation. You can also attach one while you write the change. ## Pulse fits every screen @@ -168,8 +168,9 @@ Every place Pulse appears was checked on a phone, a tablet, a laptop and a wide screen. On a phone your timesheet keeps each session's buttons in view while the table scrolls, and a pending change's walkthrough gets a line of its own; on the Work page the walkthrough moves under the entry instead of being cut -off. The Pulse window fits a phone held sideways, and **Approve** is no longer -cut short when reviewing a change. +off. While a video uploads, its progress shows on the **Upload** button itself. +The Pulse window fits a phone held sideways, and **Approve** is no longer cut +short when reviewing a change. ## Pull requests in this release @@ -184,3 +185,4 @@ cut short when reviewing a change. - Ticket names on Huddle posts link to the ticket ([#751](https://github.com/mieweb/timehuddle/pull/751)) - Upload beside Pulse, and uploaded videos converted to the Pulse format when they can be ([#746](https://github.com/mieweb/timehuddle/pull/746)) - Links go in the text, and Videos on every ticket and clock session ([#746](https://github.com/mieweb/timehuddle/pull/746)) +- A pending change and an upload's progress fit every screen ([#747](https://github.com/mieweb/timehuddle/pull/747)) diff --git a/src/features/clock/AttachmentsPanel.tsx b/src/features/clock/AttachmentsPanel.tsx index 66e6a6b1e..35c731b11 100644 --- a/src/features/clock/AttachmentsPanel.tsx +++ b/src/features/clock/AttachmentsPanel.tsx @@ -68,14 +68,15 @@ export const AttachmentsPanel: React.FC = ({ return (
- {/* Wraps instead of squeezing: on a phone the chips (and the upload's - status line beside them) drop under the heading. */} -
+ {/* Wraps instead of squeezing: on a phone the chips drop under the + heading. Top-aligned: a message that doesn't fit beside the chips + drops under them, and the heading stays level with the chips. */} +
{showHeading && ( Videos @@ -85,6 +86,7 @@ export const AttachmentsPanel: React.FC = ({ destination={{ kind, id: entityId }} ariaLabel="Add a video with Pulse" allowFile + card={showHeading ? 'end' : 'start'} onSettled={(status) => status.state === 'done' && void fetchAttachments()} />
diff --git a/src/features/clock/ChangeRequestWalkthrough.tsx b/src/features/clock/ChangeRequestWalkthrough.tsx index d702a1796..929975f10 100644 --- a/src/features/clock/ChangeRequestWalkthrough.tsx +++ b/src/features/clock/ChangeRequestWalkthrough.tsx @@ -6,7 +6,7 @@ * to its destination when it lands, and the request doesn't exist until it's * submitted. Once it lands the approver sees it in Timesheet Approvals. */ -import { Badge, Text } from '@mieweb/ui'; +import { Badge } from '@mieweb/ui'; import React from 'react'; import type { TimesheetChangeRequest } from '../../lib/api'; @@ -67,15 +67,14 @@ const WalkthroughUpload: React.FC<{ }, }, ); - // Named like the form's "Walkthrough" field, so both read as the same thing. + // Pulse and Upload, before "Pending approval" (icons only on a phone). + // `contents`: they join the host's own row, so they line up with the badge + // on one line, wrapping where there's no room. return ( <> {children( -
- - Walkthrough - - +
+
, )} diff --git a/src/features/clock/ClockPage.tsx b/src/features/clock/ClockPage.tsx index f66bfc71a..3c96291d4 100644 --- a/src/features/clock/ClockPage.tsx +++ b/src/features/clock/ClockPage.tsx @@ -67,9 +67,8 @@ import { useRouter } from '../../ui/router'; /** The compact "X or Y" pair beside the plan/wrap-up input — the submit * button and the Pulse chip share this exact class list so the two read as * equal alternatives rather than a primary action and an afterthought. `h-10` - * is explicit because Pulse's chip is always rendered at Button `size="lg"` - * (h-12) internally — without overriding the height directly, matching - * padding alone still left it visibly taller than the plan/wrap-up button. */ + * is explicit so both stay the same height whatever Button size either one + * defaults to. */ const COMPACT_PILL = 'h-10 gap-2 rounded-full px-4 text-sm font-semibold shrink-0'; /** "or Clock in/out with Pulse" — beside every way this page clocks in or out. */ diff --git a/src/features/clock/TimesheetRow.tsx b/src/features/clock/TimesheetRow.tsx index eda28e91e..0d1bc0f13 100644 --- a/src/features/clock/TimesheetRow.tsx +++ b/src/features/clock/TimesheetRow.tsx @@ -52,7 +52,7 @@ interface Props { changeStatus?: 'pending' | 'rejected'; /** The reviewer's reason, shown on a declined change. */ changeNote?: string; - /** Shown beside "Pending approval" on the session's first row: the walkthrough control. */ + /** Shown before "Pending approval" on the session's first row: the walkthrough's Pulse and Upload. */ pendingAction?: React.ReactNode; } @@ -319,15 +319,16 @@ export const TimesheetRow: React.FC = ({ {showTeam ? teamName : ''} {row.isContinued ? null : changeStatus === 'pending' ? ( -
+
+ {showActions && !walkthroughOwnLine && pendingAction} Pending approval - {showActions && !walkthroughOwnLine && pendingAction}
) : changeStatus === 'rejected' ? ( // The reviewer's note is shown, not hidden in a tooltip: a @@ -399,14 +400,15 @@ export const TimesheetRow: React.FC = ({ its padding, and less the sidebar from md up) so it wraps there instead of running past the edge. */}
+ {pendingAction} Pending approval - {pendingAction}
diff --git a/src/features/huddle/ComposerChipButton.tsx b/src/features/huddle/ComposerChipButton.tsx index 2fa1e1bfd..2e8702475 100644 --- a/src/features/huddle/ComposerChipButton.tsx +++ b/src/features/huddle/ComposerChipButton.tsx @@ -13,7 +13,7 @@ * `ghost` plus the border below is that reconciliation, in one place. If * @mieweb/ui gains a neutral outline variant, this collapses to it. */ -import { Button } from '@mieweb/ui'; +import { Button, cn } from '@mieweb/ui'; import { forwardRef, type ReactElement, type ReactNode } from 'react'; interface ComposerChipButtonProps { @@ -28,10 +28,15 @@ interface ComposerChipButtonProps { 'aria-expanded'?: boolean; /** Only where the visible label isn't already a sufficient accessible name. */ 'aria-label'?: string; + /** + * Below `sm`, just the icon in a circle: the label is kept for screen + * readers only, so a row of chips fits a phone. + */ + compact?: boolean; } export const ComposerChipButton = forwardRef( - function ComposerChipButton({ children, leftIcon, onClick, disabled, ...aria }, ref) { + function ComposerChipButton({ children, leftIcon, onClick, disabled, compact, ...aria }, ref) { return ( ); }, diff --git a/src/features/pulse-upload/PulseButton.tsx b/src/features/pulse-upload/PulseButton.tsx index 896bcbe24..839e0c4f7 100644 --- a/src/features/pulse-upload/PulseButton.tsx +++ b/src/features/pulse-upload/PulseButton.tsx @@ -27,13 +27,22 @@ interface PulseChipProps { /** What pressing it does, for screen readers: "Add a video with Pulse". */ ariaLabel: string; /** - * Where Pulse is the page's main way in (the Clock page), the page's primary - * pill with this label. Otherwise it's a "Pulse" chip like the ones beside it. + * Where Pulse is the page's main way in (the Clock page), a primary button + * with the Pulse logo and this label. Otherwise it's a "Pulse" chip like the + * ones beside it. */ main?: { label: string; className: string }; disabled?: boolean; /** Also offer "Upload": a video file from this device, sent to the same place. */ allowFile?: boolean; + /** + * The card layout (a Videos section): an upload's progress is the Upload + * button's own label ("Uploading 42%", "Processing…"), and errors and notes + * come before the buttons rather than after them. + */ + card?: boolean; + /** Below `sm`, the chips show only their icons (see ComposerChipButton `compact`). */ + compact?: boolean; } /** @@ -47,28 +56,39 @@ export const PulseChip: React.FC = ({ main, disabled, allowFile, + card, + compact, }) => { const { reserving, error, status, modalOpen, destination, progress, processing } = pulse; const fileInput = useRef(null); const sending = progress !== null || processing; + // A file on its way: said beside the chips, or (card) on the Upload button. + const inFlight = + progress !== null + ? `${card ? 'Uploading' : 'Uploading…'} ${Math.round(progress * 100)}%` + : processing + ? card + ? 'Processing…' + : 'Processing your video…' + : ''; // Phones have no modal: the same words the modal uses, beside the chip. A // landed video says nothing here — unless a step after delivery failed // (the plan posted but the clock-in didn't), which the note then says. - const note = - progress !== null - ? `Uploading… ${Math.round(progress * 100)}%` - : processing - ? 'Processing your video…' - : modalOpen - ? '' - : status?.state === 'kept' - ? keptMessage(status.reason) - : status?.state === 'expired' - ? EXPIRED_MESSAGE - : status?.state === 'done' - ? followUpNote(destination, status.note) - : ''; - const announced = !modalOpen && status?.state === 'done' ? landedLabel(destination) : ''; + const note = inFlight + ? card + ? '' + : inFlight + : modalOpen + ? '' + : status?.state === 'kept' + ? keptMessage(status.reason) + : status?.state === 'expired' + ? EXPIRED_MESSAGE + : status?.state === 'done' + ? followUpNote(destination, status.note) + : ''; + const announced = + (card && inFlight) || (!modalOpen && status?.state === 'done' ? landedLabel(destination) : ''); const shared = { onClick: () => void pulse.start(), disabled: disabled || reserving || sending, @@ -79,7 +99,6 @@ export const PulseChip: React.FC = ({ ) : ( - } {...shared}> + } compact={compact} {...shared}> Pulse ); - return ( + const chips = allowFile ? ( + + { + const file = e.target.files?.[0]; + e.target.value = ''; + if (file) void pulse.upload(file); + }} + /> + {pulseControl} + fileInput.current?.click()} + disabled={disabled || reserving || sending} + aria-busy={sending} + aria-label="Upload a video file" + leftIcon={ + sending ? ( + + ) : ( + + ) + } + > + {inFlight && card ? inFlight : 'Upload'} + + + ) : ( + pulseControl + ); + const errorText = error && ( + + {error} + + ); + // Mounted while there's a link, so the update is announced. + const statusText = (status || sending) && ( + + {note || announced} + + ); + // Card: messages come first, so they sit to the left of the buttons. + return card ? ( <> - {allowFile && ( - - { - const file = e.target.files?.[0]; - e.target.value = ''; - if (file) void pulse.upload(file); - }} - /> - {pulseControl} - fileInput.current?.click()} - disabled={disabled || reserving || sending} - aria-busy={sending} - aria-label="Upload a video file" - leftIcon={ - sending ? ( - - ) : ( - - ) - } - > - Upload - - - )} - {!allowFile && pulseControl} - - {error && ( - - {error} - - )} - {/* Mounted while there's a link, so the update is announced. */} - {(status || sending) && ( - - {note || announced} - - )} + {errorText} + {statusText} + {chips} + + ) : ( + <> + {chips} + {errorText} + {statusText} ); }; @@ -156,6 +191,15 @@ interface PulseButtonProps { disabled?: boolean; /** Also offer "Upload": a video file from this device, sent to the same place. */ allowFile?: boolean; + /** + * The card layout (see PulseChip `card`), with the buttons at the row's + * `end` (a section header) or `start`. Messages sit to the left of the + * buttons; where the row has no room for them (a phone) they wrap onto a + * line of their own under the buttons. + */ + card?: 'start' | 'end'; + /** Below `sm`, the chips show only their icons. */ + compact?: boolean; } export const PulseButton: React.FC = ({ destination, onSettled, ...rest }) => { @@ -176,10 +220,30 @@ export const PulseControls: React.FC = ({ ariaLabel, disabled, allowFile, + card, + compact, }) => { return ( -
- +
+ { )} {pendingRequest && ( - <> + // One group: it moves under the title as a whole + // when it doesn't fit beside it, so the badge never + // ends up on a line apart from its Pulse and Upload. +
+ Pending approval - - +
)}