You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e0359d7
Browse filesBrowse the repository at this point in the historyBrowse files
toast(result.ok ? `Took team ${row.team_number} off your list.` : result.error)
32
45
}
33
46
34
47
return(
35
48
<divclassName="stack">
36
49
<PageHeadtitle="My picklist">
37
-
Your own order for picking teams, with a note on any team. Everyone can see it, and the team picklist averages everyone's. It's saved to the team, so changing it needs a connection.
50
+
Your own order for picking teams, with a note on any team. Drag a team by the handle on the right, or use its ⋯ menu to move it to a place, add a note or take it off your list. Everyone can see your list, and the team picklist averages everyone's. It's saved to the team, so changing it needs a connection.
<inputclassName="input"style={{width: '5ch',minHeight: TAP_SIZE,fontSize: 16}}inputMode="numeric"aria-label={`Move team ${row.team_number} to place`}placeholder="#"
Copy file name to clipboardExpand all lines: src/modules/scouting/README.md
+38-4Lines changed: 38 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,15 +62,18 @@ The functions are in the "Shared picklist" part of `data.ts`:
62
62
|`startPicklist(teams)`| Starts an empty list with these teams, best first. Refuses if the list already has teams |
63
63
|`addMissingTeams(teams)`| Adds the teams that aren't on the list to the bottom |
64
64
|`moveTeam(id, -1 or 1)`| Moves a team one place up or down. Nothing happens at the top or bottom |
65
+
|`moveTeamTo(id, place)`| Moves a team to any place (1 is the top), for dragging and Move to…. Past either end means the top or bottom |
65
66
|`setPickStatus(id, status)`| Marks a team Open, Picked (on another alliance) or Do not pick. It keeps its place |
67
+
|`removeTeam(id)`| Takes a team off the list for everyone. The others keep their order, and only its row changes |
66
68
67
-
Each team has a `position`, smallest at the top, starting 1000 apart. A move changes only the moved team's position, to halfway between its new neighbours (`positionBetween()`), so two people moving different teams at once don't undo each other. If the halves get too close to tell apart, `moveTeam()` numbers the list 1000, 2000, … again. Only `position` and `status` can be changed, so not even a mentor can turn a row into a different team or event.
69
+
Each team has a `position`, smallest at the top, starting 1000 apart. A move changes only the moved team's position, to halfway between its new neighbours (`positionBetween()`), so two people moving different teams at once don't undo each other. If the halves get too close to tell apart, `moveTeamTo()` numbers the list 1000, 2000, … again. Only `position` and `status` can be changed, so not even a mentor can turn a row into a different team or event.
68
70
69
71
The page is `SharedPicklist.tsx`. Everyone signed in sees the list: rank, team (tap it for the team page) and status. Picked and Do not pick teams stay in their place, greyed out, and **Hide picked** hides the Picked ones. Student leaders, mentors and admins also see:
70
72
71
73
-**Start from the ranked list** when the list is empty: it starts with the teams on the Picklist page, in the order the weights on their phone give (`useRankedPicklist()`).
72
74
-**Add teams not on the list** when the ranked list has teams the picklist doesn't.
73
-
- Big up and down buttons on each team, which wait while a move saves, and an Open / Picked / Do not pick choice. Screen readers hear "Moved team 9991 to place 2."
75
+
- A drag handle (⠿) at the right of each team, and an Open / Picked / Do not pick choice beside it. See "Dragging and Move to…" below.
76
+
- A ⋯ menu on each team with **Move to…** (type a place, then **Move**), **Move to top**, **Move to bottom** and **Remove from the picklist**. Remove asks first, in the menu, and suggests Do not pick for a team that should keep its place. A removed team counts as "not on the list", so **Add teams not on the list** puts it back at the bottom.
74
77
75
78
Hiding the buttons is only tidiness: the table's rules are what stop anyone else changing the list.
76
79
@@ -308,8 +311,11 @@ Everyone signed in can make their own picklist for the event
308
311
(`MyPicklist.tsx`, at `#/scouting/my-picklist`): **Start my list** fills it
309
312
from the Picklist page's order with this phone's weights, **Add teams not
310
313
on my list** adds teams that joined later, the up and down buttons move a
311
-
team one place and **Move to…** moves it to any place. Each team can have a
312
-
note of up to 500 characters.
314
+
team by its handle (⠿), and the ⋯ menu has **Move to…**, **Move to top**,
315
+
**Move to bottom**, **Add a note** and **Remove from my list** (it asks
316
+
first; the note goes too, and **Add teams not on my list** would add the
317
+
team back). Each team can have a note of up to 500 characters. See
318
+
"Dragging and Move to…" below.
313
319
314
320
The team picklist (`TeamPicklist.tsx`, at `#/scouting/team-picklist`)
315
321
averages everyone's lists: each team's average place, its best and worst,
@@ -334,7 +340,9 @@ and say so.
334
340
|`startMyPicklist(teams)`| Starts an empty list in this order. Refuses if it's started |
335
341
|`addToMyPicklist(teams)`| Adds the missing teams to the bottom |
336
342
|`moveOnMyPicklist(team, place)`| Moves a team to a place; the teams between shift one place |
343
+
|`checkPlace(text, count)`| Reads a place typed into Move to…: a whole number from 1 to `count`, or an error saying which places there are |
337
344
|`setPicklistNote(team, note)`| Adds, changes or clears (with '') a note |
345
+
|`removeFromMyPicklist(team)`| Takes a team and its note off your list. The teams below move up a place, so a team added later goes last |
338
346
|`teamPicklist(rows)`, `useTeamPicklist()`| Everyone's lists averaged, as above |
339
347
340
348
Questions for the strategy team (from #151): should every list count the
@@ -382,3 +390,29 @@ makes it in the team database, with its permission rules and tests; see
382
390
one step.
383
391
384
392
**Works with:** Robot status (can show entries waiting to sync).
393
+
394
+
## Dragging and Move to…
395
+
396
+
My picklist and the Final picklist use the same pieces:
397
+
398
+
-`useDragOrder.ts` does the dragging. It's based on the pit checklist's
399
+
`usePitDrag.ts` in the status module (a module can't import another
400
+
module's files, so it's a copy; a mentor could move one into `src/core/`).
401
+
Drag a team by the ⠿ handle on the right with a finger or mouse: the
402
+
other teams slide out of the way, and the page scrolls near the top or
403
+
bottom edge. Let go outside the list to cancel. With a keyboard, focus the
404
+
handle and press Up or Down to move one place, or Home or End for the top
405
+
or bottom. Escape cancels a drag.
406
+
- The new order shows as soon as you let go, and stays on screen while it
407
+
saves. If saving fails, the list goes back and a message says why. Only
408
+
one move saves at a time.
409
+
- When the order changes, for any reason (another phone, too), teams slide
410
+
to their new places. A team you moved lights up for a moment and scrolls
411
+
into view if it went off screen. With "reduce motion" turned on in the
412
+
phone's settings, nothing slides.
413
+
-`RowMenu.tsx` is the ⋯ menu (it closes when you tap outside it or press
414
+
Escape), its **Move to…** dropdown, which checks the place with
415
+
`checkPlace()`, and `ConfirmAction`, the red Remove at the bottom that
416
+
asks before it does anything. A team being removed fades while it saves,
417
+
moves wait until it's done, and then the teams below slide up. The
0 commit comments