diff --git a/.changeset/afraid-cougars-tease.md b/.changeset/afraid-cougars-tease.md new file mode 100644 index 0000000..5c0197a --- /dev/null +++ b/.changeset/afraid-cougars-tease.md @@ -0,0 +1,5 @@ +--- +"namesake": minor +--- + +Display additional context beside time required diff --git a/convex/constants.ts b/convex/constants.ts index b3a2bcc..27942e4 100644 --- a/convex/constants.ts +++ b/convex/constants.ts @@ -375,6 +375,7 @@ export type TimeRequired = { min: number; max: number; unit: TimeUnit; + description?: string; }; export const DEFAULT_TIME_REQUIRED: TimeRequired = { diff --git a/convex/quests.ts b/convex/quests.ts index 45a3cb0..32a403e 100644 --- a/convex/quests.ts +++ b/convex/quests.ts @@ -78,6 +78,7 @@ export const updateQuest = userMutation({ min: v.number(), max: v.number(), unit: timeRequiredUnit, + description: v.optional(v.string()), }), ), urls: v.optional(v.array(v.string())), diff --git a/convex/schema.ts b/convex/schema.ts index 1de6d81..989b3e6 100644 --- a/convex/schema.ts +++ b/convex/schema.ts @@ -41,6 +41,7 @@ const quests = defineTable({ min: v.number(), max: v.number(), unit: timeRequiredUnit, + description: v.optional(v.string()), }), urls: v.optional(v.array(v.string())), deletionTime: v.optional(v.number()), diff --git a/src/routes/_authenticated/_home/quests.$questId.tsx b/src/routes/_authenticated/_home/quests.$questId.tsx index 8fc48a8..7d5d3d9 100644 --- a/src/routes/_authenticated/_home/quests.$questId.tsx +++ b/src/routes/_authenticated/_home/quests.$questId.tsx @@ -111,7 +111,23 @@ const QuestTimeRequired = ({ }; const formattedTime = getFormattedTime(timeRequired); - return ; + return ( + + {timeRequired.description && ( + + + + See details + + +

{timeRequired.description}

+
+
+ )} +
+ ); }; const QuestUrls = ({ urls }: { urls?: string[] }) => { diff --git a/src/routes/_authenticated/admin/quests/$questId.tsx b/src/routes/_authenticated/admin/quests/$questId.tsx index 87c1bc7..39f5c75 100644 --- a/src/routes/_authenticated/admin/quests/$questId.tsx +++ b/src/routes/_authenticated/admin/quests/$questId.tsx @@ -156,48 +156,62 @@ const TimeRequiredInput = memo(function TimeRequiredInput({ if (!timeRequired) return null; return ( -
- - onChange({ - ...timeRequired, - min: value, - }) - } - /> - +
+ + onChange({ + ...timeRequired, + min: value, + }) + } + /> + + onChange({ + ...timeRequired, + max: value, + }) + } + /> + +
+ onChange({ ...timeRequired, - max: value, + description: value || undefined, }) } /> -
); });