feat(preferences): add xpDisplayMini preference and update action
Add the xpDisplayMini checkbox to user display preferences, regenerate types, and accept it in updatePreferences. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
a0c4eaabcf
commit
b581670e72
3 changed files with 39 additions and 30 deletions
|
|
@ -207,6 +207,7 @@ export async function updatePreferences(input: {
|
||||||
leadOrActual: "lead" | "actual";
|
leadOrActual: "lead" | "actual";
|
||||||
discordEnabled: boolean;
|
discordEnabled: boolean;
|
||||||
discordMutedTypes: string[];
|
discordMutedTypes: string[];
|
||||||
|
xpDisplayMini: boolean;
|
||||||
}): Promise<ActionResult> {
|
}): Promise<ActionResult> {
|
||||||
try {
|
try {
|
||||||
const { payload, user } = await authenticate();
|
const { payload, user } = await authenticate();
|
||||||
|
|
@ -219,7 +220,7 @@ export async function updatePreferences(input: {
|
||||||
(MUTEABLE_NOTIFICATION_VALUES as readonly string[]).includes(t),
|
(MUTEABLE_NOTIFICATION_VALUES as readonly string[]).includes(t),
|
||||||
);
|
);
|
||||||
|
|
||||||
await payload.update({
|
await payload.update({
|
||||||
collection: "users",
|
collection: "users",
|
||||||
id: userId,
|
id: userId,
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -229,6 +230,7 @@ export async function updatePreferences(input: {
|
||||||
showCallsign: input.showCallsign,
|
showCallsign: input.showCallsign,
|
||||||
showVersionOverlay: input.showVersionOverlay,
|
showVersionOverlay: input.showVersionOverlay,
|
||||||
leadOrActual: input.leadOrActual,
|
leadOrActual: input.leadOrActual,
|
||||||
|
xpDisplayMini: input.xpDisplayMini,
|
||||||
},
|
},
|
||||||
discord: {
|
discord: {
|
||||||
enabled: input.discordEnabled,
|
enabled: input.discordEnabled,
|
||||||
|
|
|
||||||
|
|
@ -268,35 +268,41 @@ export const Users: CollectionConfig = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "display",
|
name: "display",
|
||||||
label: "Display",
|
label: "Display",
|
||||||
type: "group",
|
type: "group",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "showCallsign",
|
name: "showCallsign",
|
||||||
label: "Show callsign (username) instead of display name in the sidebar",
|
label: "Show callsign (username) instead of display name in the sidebar",
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "leadOrActual",
|
name: "leadOrActual",
|
||||||
label: 'Use "Lead" or "Actual" when reviewing the unit roster',
|
label: 'Use "Lead" or "Actual" when reviewing the unit roster',
|
||||||
type: "select",
|
type: "select",
|
||||||
options: [
|
options: [
|
||||||
{ label: "Lead", value: "lead" },
|
{ label: "Lead", value: "lead" },
|
||||||
{ label: "Actual", value: "actual" },
|
{ label: "Actual", value: "actual" },
|
||||||
],
|
],
|
||||||
defaultValue: "lead",
|
defaultValue: "lead",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "showVersionOverlay",
|
name: "showVersionOverlay",
|
||||||
label: "Show version overlay at top of page",
|
label: "Show version overlay at top of page",
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
},
|
name: "xpDisplayMini",
|
||||||
|
label: "Use mini mode for XP display",
|
||||||
|
type: "checkbox",
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "discord",
|
name: "discord",
|
||||||
label: "Discord",
|
label: "Discord",
|
||||||
|
|
|
||||||
|
|
@ -1313,6 +1313,7 @@ export interface User {
|
||||||
showCallsign?: boolean | null;
|
showCallsign?: boolean | null;
|
||||||
leadOrActual?: ('lead' | 'actual') | null;
|
leadOrActual?: ('lead' | 'actual') | null;
|
||||||
showVersionOverlay?: boolean | null;
|
showVersionOverlay?: boolean | null;
|
||||||
|
xpDisplayMini?: boolean | null;
|
||||||
};
|
};
|
||||||
discord?: {
|
discord?: {
|
||||||
enabled?: boolean | null;
|
enabled?: boolean | null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue