init
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { AiAnalysisCard } from "@/components/ai-analysis-card";
|
||||
import { ElevationChart } from "@/components/elevation-chart";
|
||||
import { NotesEditor } from "@/components/notes-editor";
|
||||
import { RouteMapSection } from "@/components/route-map-section";
|
||||
import { GcbChart } from "@/components/gcb-chart";
|
||||
import { RunMetricChart } from "@/components/run-metric-chart";
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
type RunningActivity,
|
||||
} from "@/lib/models/running";
|
||||
import { getCurrentUserId } from "@/lib/session";
|
||||
import { saveRunningNotes } from "@/app/running/actions";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -198,6 +200,11 @@ export default async function RunningActivityPage({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<NotesEditor
|
||||
initialNotes={activity.notes ?? ""}
|
||||
onSave={saveRunningNotes.bind(null, activity._id.toString())}
|
||||
/>
|
||||
|
||||
<AiAnalysisCard
|
||||
targetType="running"
|
||||
targetId={activity._id.toString()}
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
listRunningActivities,
|
||||
setLastSyncAt,
|
||||
setRunningActivityMetrics,
|
||||
setRunningActivityNotes,
|
||||
setRunningActivityRoutePoints,
|
||||
upsertRunningActivity,
|
||||
} from "@/lib/models/running";
|
||||
@@ -151,3 +152,9 @@ export async function loadActivityRoute(activityMongoId: string): Promise<LoadRo
|
||||
return { error: error instanceof Error ? error.message : "Nie udało się pobrać mapy trasy." };
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveRunningNotes(activityId: string, notes: string): Promise<void> {
|
||||
const userId = await getCurrentUserId();
|
||||
await setRunningActivityNotes(userId, activityId, notes);
|
||||
revalidatePath(`/running/${activityId}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user