diff --git a/client/src/pages/home.tsx b/client/src/pages/home.tsx index 2720ede..5ce2a6b 100644 --- a/client/src/pages/home.tsx +++ b/client/src/pages/home.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react"; +import { useState, useEffect, useMemo } from "react"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { insertWorkoutSchema, type InsertWorkout } from "@shared/schema-static"; @@ -244,6 +244,11 @@ export default function Home() { defaults: SECTION_DEFAULTS, }); + const isQuickMode = useMemo( + () => new URLSearchParams(window.location.search).get('quick') === '1', + [] + ); + const watchedValues = form.watch(); const { isDirty } = form.formState; @@ -267,8 +272,8 @@ export default function Home() { } useEffect(() => { - setMarkdownOutput((isDirty || wasRestored) ? generateMarkdown(watchedValues) : ""); - }, [watchedValues, isDirty, wasRestored]); + setMarkdownOutput((isDirty || wasRestored || isQuickMode) ? generateMarkdown(watchedValues) : ""); + }, [watchedValues, isDirty, wasRestored, isQuickMode]); useEffect(() => { if (wasRestored) { @@ -280,8 +285,10 @@ export default function Home() { }, [wasRestored]); // eslint-disable-line react-hooks/exhaustive-deps const handleCopyToClipboard = async () => { - await form.trigger(); - autoExpandErrorSections(); + if (!isQuickMode) { + await form.trigger(); + autoExpandErrorSections(); + } const exportMarkdown = generateMarkdown(form.getValues()); try { // Try modern clipboard API first @@ -327,8 +334,10 @@ export default function Home() { }; const handleDownload = async () => { - await form.trigger(); - autoExpandErrorSections(); + if (!isQuickMode) { + await form.trigger(); + autoExpandErrorSections(); + } const exportMarkdown = generateMarkdown(form.getValues()); const blob = new Blob([exportMarkdown], { type: 'text/markdown' }); const url = URL.createObjectURL(blob); @@ -346,6 +355,214 @@ export default function Home() { }); }; + if (isQuickMode) { + return ( +
+
+
+
+
+
+ +
+

PedalNotes

+ Quick Entry +
+
+ + Full form + + +
+
+
+
+ +
+ + +
+

Quick Entry

+

+ Log the essentials now — open the{" "} + full form + {" "}to add more details later. +

+
+ +
+ +
+ ( + + + + Workout Date + + + + + + + )} + /> +
+ + { + const rpeDescriptions: { [key: number]: string } = { + 1: 'Nothing at all', 2: 'Very easy', 3: 'Easy', 4: 'Comfortable', + 5: 'Slightly challenging', 6: 'Difficult', 7: 'Hard', + 8: 'Very hard', 9: 'Extremely hard', 10: 'Max effort' + }; + return ( + + + + R (RPE): {field.value}/10 + + +
+ field.onChange(value[0])} + max={10} min={1} step={1} className="w-full" + /> +
+ 1 - Nothing at all + {field.value >= 2 && field.value <= 9 && {rpeDescriptions[field.value]}} + 10 - Max effort +
+
+
+ +
+ ); + }} + /> + + ( + + + + F (Feel): {feelOptions.find(opt => opt.value === field.value)?.label || 'Normal (N)'} + + +
+ opt.value === field.value) + 1]} + onValueChange={(value) => field.onChange(feelOptions[value[0] - 1]?.value || 'N')} + max={5} min={1} step={1} className="w-full" + /> +
+ WeakPoorNormalGoodStrong +
+
+
+ +
+ )} + /> + + ( + + WWW (What Went Well) + +