Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix account velords and delegation randomisation #327

Merged
merged 2 commits into from
Jan 8, 2025
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
25 changes: 15 additions & 10 deletions apps/nextjs/src/app/(app)/account/delegates/DelegatesList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use client";
import { api } from "@/trpc/react";

import type { RouterOutputs } from "@realms-world/api";
import { use } from "react";
import { api } from "@/trpc/react";

import { DelegateCard } from "./DelegateCard";

export const DelegatesList = ({
Expand All @@ -18,17 +20,20 @@ export const DelegatesList = ({
},
);

const shuffledDelegates = delegatesInfo.items
.filter(
(delegate) =>
delegate.user !==
"0x0000000000000000000000000000000000000000000000000000000000000000",
)
.sort(() => Math.random() - 0.5)
.sort((a, b) => (a.delegatedVotesRaw === "0" ? 1 : -1));

return (
<div className="my-4 grid grid-cols-1 gap-4 overflow-x-hidden md:grid-cols-3">
{delegatesInfo.items
.filter(
(delegate) =>
delegate.user !==
"0x0000000000000000000000000000000000000000000000000000000000000000",
)
.map((delegate) => (
<DelegateCard key={delegate.id} delegate={delegate} />
))}
{shuffledDelegates.map((delegate) => (
<DelegateCard key={delegate.id} delegate={delegate} />
))}
</div>
);
};
4 changes: 2 additions & 2 deletions apps/nextjs/src/app/(app)/account/lords/velords/VeLords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export const VeLords = () => {
blockIdentifier: BlockTag.PENDING as BlockNumber,
});

const { data: veLordsBurns } = api.veLordsBurns.sumByWeek.useQuery();
//const { data: veLordsBurns } = api.veLordsBurns.sumByWeek.useQuery();
const { data: veLordsBurns } = api.veLordsBurns.all.useQuery({});

const [amount, setAmount] = useState<string>("");
const [lockWeeks, setLockWeeks] = useState<number>(0);
Expand Down Expand Up @@ -310,7 +311,6 @@ export const VeLords = () => {
</CardHeader>
<CardContent>
<div className="prose text-primary">
{" "}
<p>Lock your Lords for veLords and:</p>
<ul className="ml-5 list-disc">
<li>
Expand Down
10 changes: 7 additions & 3 deletions apps/nextjs/src/app/(app)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import CollectionsList from "./collection/CollectionsList";

export default async function Home() {
const games = await reader().collections.games.all();

// Randomize the order of games
const shuffledGames = games.sort(() => Math.random() - 0.5);

const carouselItems = games
.filter((a) => a.slug === "realms-eternum")
.concat(
Expand Down Expand Up @@ -90,11 +94,11 @@ export default async function Home() {
All Games
</h2>
<div className="">
<Carousel opts={{ dragFree: true }} className="w-full">
<Carousel opts={{ startIndex: 1 }} className="w-full">
<CarouselContent>
{games.map((game, index) => (
{shuffledGames.map((game, index) => (
<CarouselItem
className="translate-3d flex-[0_0_25%] pl-0"
className="translate-3d flex-[0_0_55%] pl-1 sm:flex-[0_0_25%]"
key={index}
>
<GameCard
Expand Down
15 changes: 10 additions & 5 deletions apps/nextjs/src/app/_components/AgentBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ export const AgentBanner = () => {
const isInView = useInView(ref, { margin: "-250px" }); // Trigger animation once
return (
<div ref={ref} className="my-12 flex flex-col items-center md:flex-row">
<div className="w-full md:w-1/2">
<motion.div
className="mx-4 w-full px-16 md:w-1/2"
initial={{ x: "-100%", opacity: 0 }}
animate={isInView ? { x: 0, opacity: 1 } : {}}
transition={{ type: "spring", stiffness: 50, damping: 20 }}
>
<Image
src="/elizaOS.avif"
alt="Banner Image"
width={800}
height={600}
width={400}
height={300}
className="h-full w-full object-cover"
/>
</div>
</motion.div>
<div className="w-full p-4 md:w-1/2">
<div className="mx-auto max-w-lg">
<motion.h2
Expand All @@ -40,7 +45,7 @@ export const AgentBanner = () => {
thrive in Realms World
</motion.p>
<motion.a
className="mt-4 text-sm sm:text-base md:text-lg"
className="mt-4 text-xs underline sm:text-base md:text-lg"
initial={{ opacity: 0 }}
animate={isInView ? { opacity: 1 } : {}}
transition={{ delay: 0.6, duration: 1 }}
Expand Down
Loading