1
0
Fork 0

Compare commits

..

No commits in common. "fee337747482b309a1096aa331560571a69ff5ae" and "2f81cc9ede0e081081fc0403373496b4b91562d0" have entirely different histories.

5 changed files with 9 additions and 32 deletions

View file

@ -1,15 +1,5 @@
# Changelog # Changelog
# v0.13.2
Seniors rating a junior from their profile now see "Rate subordinate" instead of "Rate leadership".
### Fixes
- **Profile ratings.** On a subordinate's profile, the rating button and dialog now read "Rate subordinate", and the dialog explains that the review goes to operators ranked above them. Ratings from junior to senior keep the "Rate leadership" label.
---
# v0.13.1 # v0.13.1
Officers now review logistics extractions before they reach HQ, vehicle cards show their stats, and ribbon devices are brass-embossed with a Valor "V" in place of the arrow. Officers now review logistics extractions before they reach HQ, vehicle cards show their stats, and ribbon devices are brass-embossed with a Valor "V" in place of the arrow.

View file

@ -1,6 +1,6 @@
{ {
"name": "polaris-task-force", "name": "polaris-task-force",
"version": "0.13.2", "version": "0.13.1",
"description": "Web app for the Arma 3 unit Polaris Task Force. Uses Next.js for client- and server-side rendering, with a Postgres database and some other neat libraries.", "description": "Web app for the Arma 3 unit Polaris Task Force. Uses Next.js for client- and server-side rendering, with a Postgres database and some other neat libraries.",
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",

View file

@ -610,7 +610,6 @@ export default async function ProfilePage({ params }: ProfilePageProps) {
latestMissionRows={latestMissionRows} latestMissionRows={latestMissionRows}
canSubmitEvaluation={canSubmitEvaluation} canSubmitEvaluation={canSubmitEvaluation}
canViewSubordinate={canViewSubordinate} canViewSubordinate={canViewSubordinate}
ratingDirection={rankGap}
/> />
{/* ── Dossier ────────────────────────────────────────── */} {/* ── Dossier ────────────────────────────────────────── */}

View file

@ -10,7 +10,6 @@ import {
isPerformanceLevelId, isPerformanceLevelId,
type PerformanceLevelId, type PerformanceLevelId,
} from "@/lib/evaluations/levels"; } from "@/lib/evaluations/levels";
import type { RankDirection } from "@/lib/evaluations/ranks";
import { submitEvaluation } from "@/app/(frontend)/profile/[username]/actions"; import { submitEvaluation } from "@/app/(frontend)/profile/[username]/actions";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Combobox } from "@/components/ui/combobox"; import { Combobox } from "@/components/ui/combobox";
@ -38,7 +37,6 @@ import type { EvaluationMissionOption } from "./evaluation-types";
interface LeadershipEvaluationDialogProps { interface LeadershipEvaluationDialogProps {
readonly username: string; readonly username: string;
readonly missions: readonly EvaluationMissionOption[]; readonly missions: readonly EvaluationMissionOption[];
readonly direction: RankDirection;
} }
function formatMissionDate(value: string): string { function formatMissionDate(value: string): string {
@ -52,11 +50,8 @@ function formatMissionDate(value: string): string {
export function LeadershipEvaluationDialog({ export function LeadershipEvaluationDialog({
username, username,
missions, missions,
direction,
}: LeadershipEvaluationDialogProps) { }: LeadershipEvaluationDialogProps) {
const router = useRouter(); const router = useRouter();
const isUpward = direction === "upward";
const triggerLabel = isUpward ? "Rate leadership" : "Rate subordinate";
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [missionId, setMissionId] = useState(""); const [missionId, setMissionId] = useState("");
const [level, setLevel] = useState<PerformanceLevelId | "">(""); const [level, setLevel] = useState<PerformanceLevelId | "">("");
@ -104,7 +99,7 @@ export function LeadershipEvaluationDialog({
setOpen(false); setOpen(false);
reset(); reset();
toast.success(isUpward ? "Leadership rating saved" : "Subordinate rating saved"); toast.success("Leadership rating saved");
router.refresh(); router.refresh();
} catch (caught) { } catch (caught) {
setError(caught instanceof Error ? caught.message : "Could not save the rating."); setError(caught instanceof Error ? caught.message : "Could not save the rating.");
@ -125,16 +120,16 @@ export function LeadershipEvaluationDialog({
<DialogTrigger asChild> <DialogTrigger asChild>
<Button type="button" size="sm" variant="outline"> <Button type="button" size="sm" variant="outline">
<PencilIcon data-icon="inline-start" /> <PencilIcon data-icon="inline-start" />
{triggerLabel} Rate leadership
</Button> </Button>
</DialogTrigger> </DialogTrigger>
<DialogContent> <DialogContent>
<DialogHeader> <DialogHeader>
<DialogTitle>{triggerLabel}</DialogTitle> <DialogTitle>Rate leadership</DialogTitle>
<DialogDescription> <DialogDescription>
{isUpward Submit a new rating or update your existing rating for one completed mission. Ratings
? "Rate this senior operator for one completed mission you both attended. Your rating is included anonymously in the leadership aggregate." follow rank: only operators strictly above or below your own rank can be rated here.
: "Rate this junior operator for one completed mission you both attended. Your rating is recorded as a command review and shown only to operators ranked above them."} Your rating is included anonymously.
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>

View file

@ -14,7 +14,6 @@ import {
} from "@/components/ui/item"; } from "@/components/ui/item";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import { getLeadershipDisplayLabel, PERFORMANCE_LEVELS } from "@/lib/evaluations/levels"; import { getLeadershipDisplayLabel, PERFORMANCE_LEVELS } from "@/lib/evaluations/levels";
import type { RankDirection } from "@/lib/evaluations/ranks";
import { LeadershipEvaluationDialog } from "./LeadershipEvaluationDialog"; import { LeadershipEvaluationDialog } from "./LeadershipEvaluationDialog";
import type { import type {
EvaluationMissionOption, EvaluationMissionOption,
@ -30,7 +29,6 @@ interface LeadershipEvaluationSectionProps {
readonly latestMissionRows: readonly LatestMissionRow[]; readonly latestMissionRows: readonly LatestMissionRow[];
readonly canSubmitEvaluation: boolean; readonly canSubmitEvaluation: boolean;
readonly canViewSubordinate: boolean; readonly canViewSubordinate: boolean;
readonly ratingDirection: RankDirection | null;
} }
const PERFORMANCE_GRADIENT = `linear-gradient(to right, ${[...PERFORMANCE_LEVELS] const PERFORMANCE_GRADIENT = `linear-gradient(to right, ${[...PERFORMANCE_LEVELS]
@ -58,7 +56,6 @@ export function LeadershipEvaluationSection({
latestMissionRows, latestMissionRows,
canSubmitEvaluation, canSubmitEvaluation,
canViewSubordinate, canViewSubordinate,
ratingDirection,
}: LeadershipEvaluationSectionProps) { }: LeadershipEvaluationSectionProps) {
return ( return (
<section className="flex flex-col gap-3" aria-labelledby="leadership-evaluation-heading"> <section className="flex flex-col gap-3" aria-labelledby="leadership-evaluation-heading">
@ -76,12 +73,8 @@ export function LeadershipEvaluationSection({
<CardHeader> <CardHeader>
<CardTitle className="flex flex-wrap items-center justify-between gap-3 text-base"> <CardTitle className="flex flex-wrap items-center justify-between gap-3 text-base">
<span>Leadership performance</span> <span>Leadership performance</span>
{canSubmitEvaluation && ratingDirection && eligibleMissions.length > 0 && ( {canSubmitEvaluation && eligibleMissions.length > 0 && (
<LeadershipEvaluationDialog <LeadershipEvaluationDialog username={username} missions={eligibleMissions} />
username={username}
missions={eligibleMissions}
direction={ratingDirection}
/>
)} )}
</CardTitle> </CardTitle>
<CardDescription> <CardDescription>