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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotlink",
"version": "0.1.19",
"version": "0.1.20",
"private": true,
"workspaces": [
"packages/*"
Expand Down
29 changes: 18 additions & 11 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 @@ -133,7 +133,7 @@
if (r <= 0) clearInterval(interval);
}, 1000);
return () => clearInterval(interval);
}, [dbUser?.steemhunt_fetched_at]);

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

View workflow job for this annotation

GitHub Actions / lint-and-typecheck

React Hook useEffect has a missing dependency: 'COOLDOWN_MS'. Either include it or remove the dependency array

const onCooldown = cooldownRemaining > 0;

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

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

Check warning on line 686 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 @@ -840,7 +840,7 @@
}) {
const tokenAddr = storyline.token_address as Address;

const { data: priceInfo } = useQuery({

Check warning on line 843 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 Expand Up @@ -884,18 +884,25 @@
enabled: !!storyline.token_address,
});

const checkExpired = useCallback(
() => !storyline.sunset && storyline.has_deadline && !!storyline.last_plot_time &&
Date.now() > new Date(storyline.last_plot_time).getTime() + DEADLINE_MS,
[storyline.sunset, storyline.has_deadline, storyline.last_plot_time],
);
const [isExpired, setIsExpired] = useState(checkExpired);
const [isExpired, setIsExpired] = useState(false);
useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect -- initial sync needed for SSR hydration safety
setIsExpired(checkExpired());
const interval = setInterval(() => setIsExpired(checkExpired()), 1_000);
return () => clearInterval(interval);
}, [checkExpired]);
if (storyline.sunset || !storyline.has_deadline || !storyline.last_plot_time) {
// eslint-disable-next-line react-hooks/set-state-in-effect -- reset when props change (e.g. deadline extension)
setIsExpired(false);
return;
}
const expiryTime = new Date(storyline.last_plot_time).getTime() + DEADLINE_MS;
const remaining = expiryTime - Date.now();
if (remaining <= 0) {
// eslint-disable-next-line react-hooks/set-state-in-effect -- one-time sync for already-expired storylines
setIsExpired(true);
return;
}
// eslint-disable-next-line react-hooks/set-state-in-effect -- reset in case props changed from expired to active
setIsExpired(false);
const timeout = setTimeout(() => setIsExpired(true), remaining);
return () => clearTimeout(timeout);
}, [storyline.sunset, storyline.has_deadline, storyline.last_plot_time]);

return (
<>
Expand Down
Loading