Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 5 additions & 149 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/api/storyline/[storylineId]/metadata/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export async function PATCH(
}

// Build update payload
const update: Record<string, string> = {};
const update: { genre?: string; language?: string } = {};
if (genre) update.genre = genre;
if (language) update.language = language;

Expand Down
7 changes: 4 additions & 3 deletions src/app/api/user/agent-update/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ export async function POST(request: NextRequest) {
"agent_name", "agent_description", "agent_genre",
"agent_llm_model", "agent_wallet", "agent_owner",
];
const sanitized: Record<string, string | null> = {};
type AgentField = "agent_name" | "agent_description" | "agent_genre" | "agent_llm_model" | "agent_wallet" | "agent_owner";
const sanitized: Partial<Record<AgentField, string | null>> = {};
for (const key of allowedKeys) {
if (key in fields) {
sanitized[key] = fields[key] != null ? String(fields[key]).toLowerCase() : null;
sanitized[key as AgentField] = fields[key] != null ? String(fields[key]).toLowerCase() : null;
}
}
// Name/description/genre/model should preserve case
for (const key of ["agent_name", "agent_description", "agent_genre", "agent_llm_model"]) {
for (const key of ["agent_name", "agent_description", "agent_genre", "agent_llm_model"] as const) {
if (key in fields) {
sanitized[key] = fields[key] || null;
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/profile/[address]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { getFullUserProfile, getFarcasterProfile } from "../../../../lib/actions";
import { truncateAddress } from "../../../../lib/utils";
import { formatPrice, formatSupply } from "../../../../lib/format";
import { getTokenPrice, mcv2BondAbi, erc20Abi, type TokenPriceInfo, get24hPriceChange, getTokenTVL } from "../../../../lib/price";

Check warning on line 14 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'TokenPriceInfo' is defined but never used
import { browserClient } from "../../../../lib/rpc";
import type { FarcasterProfile } from "../../../../lib/farcaster";
import type { AgentMetadata } from "../../../../lib/contracts/erc8004";
Expand Down Expand Up @@ -122,21 +122,21 @@

useEffect(() => {
if (!dbUser?.steemhunt_fetched_at) {
setCooldownRemaining(0);
queueMicrotask(() => setCooldownRemaining(0));
return;
}
const computeRemaining = () => {
const age = Date.now() - new Date(dbUser.steemhunt_fetched_at!).getTime();
return Math.max(0, COOLDOWN_MS - age);
};
setCooldownRemaining(computeRemaining());
queueMicrotask(() => setCooldownRemaining(computeRemaining()));
const interval = setInterval(() => {
const r = computeRemaining();
setCooldownRemaining(r);
if (r <= 0) clearInterval(interval);
}, 1000);
return () => clearInterval(interval);
}, [dbUser?.steemhunt_fetched_at]);
}, [dbUser?.steemhunt_fetched_at, COOLDOWN_MS]);

const onCooldown = cooldownRemaining > 0;

Expand Down Expand Up @@ -743,7 +743,7 @@
});

// Claimable royalties (own profile only)
const { data: royaltyInfo } = useQuery({

Check warning on line 746 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'royaltyInfo' is assigned a value but never used
queryKey: ["profile-royalties", address],
queryFn: async () => {
const [balance, claimed] = await browserClient.readContract({
Expand Down Expand Up @@ -900,7 +900,7 @@
}) {
const tokenAddr = storyline.token_address as Address;

const { data: priceInfo } = useQuery({

Check warning on line 903 in src/app/profile/[address]/page.tsx

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

'priceInfo' is assigned a value but never used
queryKey: ["profile-story-price", storyline.token_address],
queryFn: () => getTokenPrice(tokenAddr, browserClient),
enabled: !!storyline.token_address,
Expand Down
10 changes: 6 additions & 4 deletions src/components/AgentManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ export function AgentManage({ agentId, role, source }: AgentManageProps) {
// Populate edit fields when metadata loads
useEffect(() => {
if (metadata) {
setEditName(metadata.name);
setEditDescription(metadata.description);
setEditGenre(metadata.genre ?? "");
setEditLlmModel(metadata.llmModel ?? "");
queueMicrotask(() => {
setEditName(metadata.name);
setEditDescription(metadata.description);
setEditGenre(metadata.genre ?? "");
setEditLlmModel(metadata.llmModel ?? "");
});
}
}, [metadata]);

Expand Down
26 changes: 9 additions & 17 deletions src/components/RatingWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useState, useEffect, useCallback } from "react";
import { useState, useCallback, useRef } from "react";
import { useAccount, useSignMessage } from "wagmi";
import { useQuery } from "@tanstack/react-query";
import { browserClient as publicClient } from "../../lib/rpc";
Expand Down Expand Up @@ -69,22 +69,14 @@ export function RatingWidget({ storylineId, tokenAddress }: RatingWidgetProps) {
enabled: isConnected && !!address,
});

// Pre-fill existing rating or reset when wallet changes
useEffect(() => {
if (ratingsData && address) {
const existing = ratingsData.myRating;
if (existing) {
setSelectedRating(existing.rating);
setComment(existing.comment ?? "");
} else {
setSelectedRating(0);
setComment("");
}
} else if (!address) {
setSelectedRating(0);
setComment("");
}
}, [ratingsData, address]);
// Pre-fill existing rating or reset when data changes
const myRating = ratingsData?.myRating;
const prevMyRatingRef = useRef(myRating);
if (myRating !== prevMyRatingRef.current) {
prevMyRatingRef.current = myRating;
setSelectedRating(myRating?.rating ?? 0);
setComment(myRating?.comment ?? "");
}

const submitRating = useCallback(async () => {
if (!address || selectedRating === 0) return;
Expand Down
1 change: 1 addition & 0 deletions src/components/ReadingMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface ReadingModeProps {
}

export function ReadingMode({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
storylineId,
storylineTitle,
chapters,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useDraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function useDraft<T extends Record<string, unknown>>(
didRestore = true;
}
}
if (didRestore) setRestored(true);
if (didRestore) queueMicrotask(() => setRestored(true));
} catch {
// Corrupt data — ignore
}
Expand Down
Loading