Repository navigation
Open shifts: fold into Roster and add more ways to find, share and fill shifts #3483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
69a846a
Open shifts: fold into Roster tabs, add requests strip, Fits your ros…
claude 9cdaddd
Open shifts: share, add to calendar, Month row, manager tools and upd…
claude 67c6abb
Open shifts: Roster badge on the pill, slimmer Request button
claude 0c2e9cc
Keep the header within its line budget
claude 0aad6cd
fix(open-shifts): meet the design-system contract ratchets
claude c484957
Merge remote-tracking branch 'origin/main' into claude/open-shifts-ex…
claude e335f40
fix(open-shifts): help link label no longer reads "Open Open shifts"
claude 28ca1dd
fix: Prevent dismissing an active posting confirmation
qodo-code-review[bot] cf5e866
fix: Reject unavailable copied teams explicitly
qodo-code-review[bot] 8c6c1ec
fix: 3 findings — Show roster warnings in both browse views; Improve emp
qodo-code-review[bot] d5a9004
fix: 2 findings — Fallback to clipboard after failed sharing; Disable ex
qodo-code-review[bot] e171228
fix: 2 findings — Exclude shift posters from candidates; Require claimab
qodo-code-review[bot] 858732d
fix(open-shifts): act on review findings before going live
claude d988ee7
Merge remote-tracking branch 'origin/claude/open-shifts-expansion-hj3…
claude 6a2d3a7
fix(open-shifts): second round of review findings
claude 518e380
fix(open-shifts): narrow the repost check and show hidden shifts on c…
claude 20463ea
fix(open-shifts): midnight-ending shifts, old-list wording and auto-a…
claude 79419b0
fix(open-shifts): only count your own new shift as a lost post
claude f72cdb5
fix(open-shifts): hold a retry until the team's shifts are read again
claude 0b5cec2
fix(open-shifts): never redirect an unanswered post to another team
claude 1bd776c
Merge branch 'main' into claude/open-shifts-expansion-hj3sp1
BigSimmo 346c161
Merge remote-tracking branch 'origin/claude/open-shifts-expansion-hj3…
claude b752fb4
fix(open-shifts): only hold a post when the form fell back from the c…
claude 18e779b
Merge remote-tracking branch 'origin/main' into claude/open-shifts-ex…
claude 9d26452
Merge origin/main into claude/open-shifts-expansion-hj3sp1
claude 94b2c73
fix(open-shifts): keep each day's hidden shifts reachable when nothin…
claude c1b0156
Merge remote-tracking branch 'origin/main' into claude/open-shifts-ex…
claude a3ab1cc
Merge remote-tracking branch 'origin/main' into claude/open-shifts-ex…
claude 2bb9c46
Merge remote-tracking branch 'origin/main' into claude/open-shifts-ex…
claude 49a075c
Open shifts: a repeat post with no answer waits for a newer read
claude 65773d5
Merge branch 'main' into claude/open-shifts-expansion-hj3sp1
BigSimmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| "use client"; | ||
|
|
||
| import { CalendarPlus, Check, Share2 } from "lucide-react"; | ||
| import { useState } from "react"; | ||
|
|
||
| import { useRosterNow } from "@/components/roster/roster-format"; | ||
| import { downloadTextFile } from "@/lib/admin/download-file"; | ||
| import { icsFileName, toIcs } from "@/lib/calendar/ics"; | ||
| import type { OpenShiftListing } from "@/lib/open-shifts/model"; | ||
| import { openShiftCalendarEvent, openShiftShareText } from "@/lib/open-shifts/share"; | ||
|
|
||
| import { advertHref } from "./open-shifts-ui"; | ||
|
|
||
| const action = | ||
| "inline-flex min-h-12 flex-1 items-center justify-center gap-2 rounded-md border border-[color:var(--border-strong)] px-3 text-sm font-semibold text-[color:var(--text-heading)] focus-visible:outline-2 focus-visible:outline-[color:var(--mode-identity)]"; | ||
|
|
||
| /** | ||
| * Share a shift with a colleague, and put a booked one in your phone's calendar | ||
| * (12 Oct 2026). Sharing sends only what the advert shows; the calendar file is | ||
| * made on this phone and nothing is sent anywhere. | ||
| */ | ||
| export function OpenShiftsAdvertActions({ | ||
| listing, | ||
| booked, | ||
| sample, | ||
| }: { | ||
| readonly listing: OpenShiftListing; | ||
| /** Example data: a made-up shift is never shared or put in a real calendar. */ | ||
| readonly sample: boolean; | ||
| /** Approved for you: the calendar button shows. */ | ||
| readonly booked: boolean; | ||
| }) { | ||
| const [copied, setCopied] = useState(false); | ||
| const now = useRosterNow(); | ||
| // A shift that has started can't be asked for, so it isn't passed on. | ||
| const shareable = listing.status === "open" && !listing.claimedByMe && Date.parse(listing.startsAt) > now.getTime(); | ||
| if (sample || (!shareable && !booked)) return null; | ||
|
|
||
| async function share() { | ||
| const link = `${window.location.origin}${advertHref(listing)}`; | ||
| const text = openShiftShareText(listing, link); | ||
| if (typeof navigator.share === "function") { | ||
| try { | ||
| await navigator.share({ title: "Open shift", text }); | ||
| return; | ||
| } catch (error) { | ||
| // A dismissed share sheet is not an error. Any other failure falls back to copying. | ||
| if (error instanceof DOMException && error.name === "AbortError") return; | ||
| } | ||
| } | ||
|
qodo-code-review[bot] marked this conversation as resolved.
Resolved
|
||
| try { | ||
| await navigator.clipboard.writeText(text); | ||
| setCopied(true); | ||
| } catch { | ||
| setCopied(false); | ||
| } | ||
| } | ||
|
|
||
| function addToCalendar() { | ||
| const event = openShiftCalendarEvent(listing); | ||
| downloadTextFile(toIcs([event]), icsFileName(event.title), "text/calendar;charset=utf-8"); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="flex gap-2 px-3 pt-3" data-testid="open-shifts-advert-actions"> | ||
| {booked ? ( | ||
| <button type="button" className={action} onClick={addToCalendar}> | ||
| <CalendarPlus aria-hidden="true" strokeWidth={1.6} className="size-icon-sm" /> | ||
| Add to calendar | ||
| </button> | ||
| ) : null} | ||
| {shareable ? ( | ||
| <button type="button" className={action} onClick={() => void share()}> | ||
| {copied ? ( | ||
| <Check aria-hidden="true" strokeWidth={1.6} className="size-icon-sm" /> | ||
| ) : ( | ||
| <Share2 aria-hidden="true" strokeWidth={1.6} className="size-icon-sm" /> | ||
| )} | ||
| <span>{copied ? "Copied to share" : "Share with a colleague"}</span> | ||
| <span aria-live="polite" className="sr-only"> | ||
| {copied ? "Copied to share" : ""} | ||
| </span> | ||
| </button> | ||
| ) : null} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.