feat(command-palette): add missing destinations, queue shortcuts, mini XP toggle
- Add 11 destinations that exist in the app but were absent from the palette: World Map, Event Log, Operations, Ops Ledger, Reservations, Supply Boxes, Promotions, Leaderboard, Minigame Leaderboards, Chronicle, Surveys - Show G N / G A shortcut labels for Notifications and Admin (chords were already wired in KeyboardShortcutsProvider but unlabelled) - Add a Toggle Mini XP Display action mirroring the sidebar control - Add an Open Unassigned Tickets queue shortcut and point Create Support Ticket at the compose deep link - Teach /helpdesk to open the create dialog via ?compose=1 and to preselect a filter tab via ?view=unassigned
This commit is contained in:
parent
16e4b9f60d
commit
6bcf229268
5 changed files with 164 additions and 7 deletions
|
|
@ -29,7 +29,15 @@ function HelpdeskDisabled() {
|
|||
);
|
||||
}
|
||||
|
||||
export default async function HelpdeskPage() {
|
||||
export default async function HelpdeskPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const compose = params.compose === "1" || params.compose === "true";
|
||||
const view = typeof params.view === "string" ? params.view : undefined;
|
||||
|
||||
const headers = await nextHeaders();
|
||||
const payload = await getPayload({ config });
|
||||
const { user } = await payload.auth({
|
||||
|
|
@ -74,7 +82,14 @@ export default async function HelpdeskPage() {
|
|||
<p className="text-sm text-muted-foreground">Submit and track support requests.</p>
|
||||
</div>
|
||||
|
||||
<TicketsView tickets={tickets} voteSummaries={voteSummaries} isStaff={isStaff} />
|
||||
<TicketsView
|
||||
key={`${compose ? "compose" : "list"}:${view ?? "default"}`}
|
||||
tickets={tickets}
|
||||
voteSummaries={voteSummaries}
|
||||
isStaff={isStaff}
|
||||
initialCompose={compose}
|
||||
initialView={view}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,6 +146,26 @@ export function CommandPalette({
|
|||
}
|
||||
break;
|
||||
}
|
||||
case "toggleMiniXp": {
|
||||
const result = await updatePreferences({
|
||||
mutedAll: preferences?.notifications?.mutedAll ?? false,
|
||||
mutedTypes: preferences?.notifications?.mutedTypes ?? [],
|
||||
showCallsign: preferences?.display?.showCallsign ?? false,
|
||||
showVersionOverlay: preferences?.display?.showVersionOverlay ?? true,
|
||||
showBackgroundTexture: preferences?.display?.showBackgroundTexture ?? true,
|
||||
leadOrActual: preferences?.display?.leadOrActual ?? "lead",
|
||||
discordEnabled: preferences?.discord?.enabled ?? false,
|
||||
discordMutedTypes: preferences?.discord?.mutedTypes ?? [],
|
||||
xpDisplayMini: !(preferences?.display?.xpDisplayMini ?? false),
|
||||
});
|
||||
if (result.success) {
|
||||
toast.success("XP display toggled");
|
||||
router.refresh();
|
||||
} else {
|
||||
toast.error(result.error ?? "Failed to update preferences");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "copyPageLink": {
|
||||
try {
|
||||
await navigator.clipboard.writeText(window.location.href);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import {
|
|||
Wallpaper,
|
||||
Tag,
|
||||
Link2,
|
||||
Inbox,
|
||||
Sparkles,
|
||||
} from "lucide-react";
|
||||
|
||||
export interface ActionCommand {
|
||||
|
|
@ -52,6 +54,14 @@ export const actionCommands: ActionCommand[] = [
|
|||
actionType: "callback",
|
||||
actionKey: "toggleCallsign",
|
||||
},
|
||||
{
|
||||
id: "action:toggle-mini-xp",
|
||||
label: "Toggle Mini XP Display",
|
||||
icon: Sparkles,
|
||||
keywords: ["display", "xp", "level", "compact", "sidebar", "progress"],
|
||||
actionType: "callback",
|
||||
actionKey: "toggleMiniXp",
|
||||
},
|
||||
{
|
||||
id: "action:copy-page-link",
|
||||
label: "Copy Page Link",
|
||||
|
|
@ -96,8 +106,16 @@ export const actionCommands: ActionCommand[] = [
|
|||
id: "action:create-ticket",
|
||||
label: "Create Support Ticket",
|
||||
icon: UserPlus,
|
||||
keywords: ["help", "support", "report"],
|
||||
keywords: ["help", "support", "report", "new", "compose"],
|
||||
actionType: "navigate",
|
||||
href: "/helpdesk",
|
||||
href: "/helpdesk?compose=1",
|
||||
},
|
||||
{
|
||||
id: "action:open-unassigned-tickets",
|
||||
label: "Open Unassigned Tickets",
|
||||
icon: Inbox,
|
||||
keywords: ["helpdesk", "support", "queue", "backlog", "triage", "staff"],
|
||||
actionType: "navigate",
|
||||
href: "/helpdesk?view=unassigned",
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ import {
|
|||
Club,
|
||||
Target,
|
||||
Swords,
|
||||
Radar,
|
||||
ClipboardList,
|
||||
Boxes,
|
||||
Medal,
|
||||
Trophy,
|
||||
ClipboardCheck,
|
||||
} from "lucide-react";
|
||||
|
||||
export interface NavigationCommand {
|
||||
|
|
@ -66,6 +72,20 @@ export const navigationCommands: NavigationCommand[] = [
|
|||
href: "/transfers",
|
||||
keywords: ["assignments", "requests", "moves"],
|
||||
},
|
||||
{
|
||||
id: "nav:map",
|
||||
label: "World Map",
|
||||
icon: Map,
|
||||
href: "/map",
|
||||
keywords: ["tiles", "terrain", "atlas", "geography", "planet"],
|
||||
},
|
||||
{
|
||||
id: "nav:events",
|
||||
label: "Event Log",
|
||||
icon: ScrollText,
|
||||
href: "/events",
|
||||
keywords: ["activity", "history", "audit", "feed"],
|
||||
},
|
||||
{
|
||||
id: "nav:helpdesk",
|
||||
label: "Helpdesk",
|
||||
|
|
@ -89,6 +109,28 @@ export const navigationCommands: NavigationCommand[] = [
|
|||
keywords: ["find", "query", "issues"],
|
||||
},
|
||||
|
||||
{
|
||||
id: "nav:operations",
|
||||
label: "Operations",
|
||||
icon: Radar,
|
||||
href: "/operations",
|
||||
keywords: ["ops", "overview", "theater", "campaign map"],
|
||||
},
|
||||
{
|
||||
id: "nav:operations-ledger",
|
||||
label: "Ops Ledger",
|
||||
icon: ClipboardList,
|
||||
href: "/operations/ledger",
|
||||
keywords: ["operations", "history", "records", "log"],
|
||||
},
|
||||
{
|
||||
id: "nav:operations-reservations",
|
||||
label: "Reservations",
|
||||
icon: CalendarDays,
|
||||
href: "/operations/reservations",
|
||||
keywords: ["operations", "slots", "bookings", "schedule"],
|
||||
},
|
||||
|
||||
{
|
||||
id: "nav:campaigns",
|
||||
label: "Campaigns",
|
||||
|
|
@ -182,6 +224,14 @@ export const navigationCommands: NavigationCommand[] = [
|
|||
keywords: ["active", "field"],
|
||||
requires: "logistics",
|
||||
},
|
||||
{
|
||||
id: "nav:supply-boxes",
|
||||
label: "Supply Boxes",
|
||||
icon: Boxes,
|
||||
href: "/logistics/supply-boxes",
|
||||
keywords: ["logistics", "crates", "storage", "supplies"],
|
||||
requires: "logistics",
|
||||
},
|
||||
{
|
||||
id: "nav:banking",
|
||||
label: "Banking",
|
||||
|
|
@ -215,6 +265,14 @@ export const navigationCommands: NavigationCommand[] = [
|
|||
href: "/personnel/statistics",
|
||||
keywords: ["personnel", "stats", "vendors", "distribution"],
|
||||
},
|
||||
{
|
||||
id: "nav:promotions",
|
||||
label: "Promotions",
|
||||
icon: Medal,
|
||||
href: "/personnel/promotions",
|
||||
keywords: ["personnel", "rank", "advancement", "nominations", "medals"],
|
||||
requires: "logistics",
|
||||
},
|
||||
|
||||
{
|
||||
id: "nav:locker",
|
||||
|
|
@ -231,6 +289,13 @@ export const navigationCommands: NavigationCommand[] = [
|
|||
href: "/awards",
|
||||
keywords: ["medals", "decorations", "commendations"],
|
||||
},
|
||||
{
|
||||
id: "nav:contributions",
|
||||
label: "Leaderboard",
|
||||
icon: Trophy,
|
||||
href: "/contributions",
|
||||
keywords: ["contributions", "rankings", "top", "scoreboard", "standings"],
|
||||
},
|
||||
{
|
||||
id: "nav:voiceover",
|
||||
label: "Voiceover Scripts",
|
||||
|
|
@ -301,6 +366,27 @@ export const navigationCommands: NavigationCommand[] = [
|
|||
href: "/minigames/blackjack",
|
||||
keywords: ["minigame", "blackjack", "21", "cards", "training"],
|
||||
},
|
||||
{
|
||||
id: "nav:minigame-leaderboards",
|
||||
label: "Minigame Leaderboards",
|
||||
icon: Trophy,
|
||||
href: "/minigames/leaderboards",
|
||||
keywords: ["minigame", "leaderboards", "standings", "scores", "rankings", "training"],
|
||||
},
|
||||
{
|
||||
id: "nav:story",
|
||||
label: "Chronicle",
|
||||
icon: BookOpen,
|
||||
href: "/story",
|
||||
keywords: ["lore", "narrative", "story", "history", "beats"],
|
||||
},
|
||||
{
|
||||
id: "nav:surveys",
|
||||
label: "Surveys",
|
||||
icon: ClipboardCheck,
|
||||
href: "/surveys",
|
||||
keywords: ["feedback", "polls", "questionnaire"],
|
||||
},
|
||||
{
|
||||
id: "nav:account",
|
||||
label: "Account",
|
||||
|
|
@ -314,6 +400,7 @@ export const navigationCommands: NavigationCommand[] = [
|
|||
icon: Bell,
|
||||
href: "/notifications",
|
||||
keywords: ["alerts", "messages"],
|
||||
shortcut: "G N",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -323,5 +410,6 @@ export const navigationCommands: NavigationCommand[] = [
|
|||
href: "/admin",
|
||||
keywords: ["cms", "manage"],
|
||||
roles: ["admin", "developer"],
|
||||
shortcut: "G A",
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ interface TicketsViewProps {
|
|||
readonly tickets: readonly Ticket[];
|
||||
readonly voteSummaries: readonly TicketVoteSummary[];
|
||||
readonly isStaff: boolean;
|
||||
/** Open the create dialog on mount (deep link from the command palette). */
|
||||
readonly initialCompose?: boolean;
|
||||
/** Preselect a filter tab on mount (e.g. "unassigned" from the palette). */
|
||||
readonly initialView?: string;
|
||||
}
|
||||
|
||||
const OPEN_STATUSES: readonly TicketStatus[] = [
|
||||
|
|
@ -55,10 +59,22 @@ function isUnassignedTicket(ticket: Ticket): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
export function TicketsView({ tickets, voteSummaries, isStaff }: TicketsViewProps) {
|
||||
const [activeFilter, setActiveFilter] = useState<TicketFilter>("all");
|
||||
export function TicketsView({
|
||||
tickets,
|
||||
voteSummaries,
|
||||
isStaff,
|
||||
initialCompose = false,
|
||||
initialView,
|
||||
}: TicketsViewProps) {
|
||||
const [activeFilter, setActiveFilter] = useState<TicketFilter>(() => {
|
||||
// Honor ?view= only when it maps to a filter the user may actually see.
|
||||
if (initialView && isTicketFilter(initialView) && (isStaff || initialView !== "unassigned")) {
|
||||
return initialView;
|
||||
}
|
||||
return "all";
|
||||
});
|
||||
const [search, setSearch] = useState("");
|
||||
const [createOpen, setCreateOpen] = useState(false);
|
||||
const [createOpen, setCreateOpen] = useState(initialCompose);
|
||||
const votesByTicket = useMemo(
|
||||
() => new Map(voteSummaries.map((summary) => [summary.ticketId, summary])),
|
||||
[voteSummaries],
|
||||
|
|
|
|||
Loading…
Reference in a new issue