Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Jikugodwill committed Nov 27, 2024
1 parent 35e684c commit b6a6af7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 20 deletions.
34 changes: 24 additions & 10 deletions src/common/ui/components/molecules/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react";
import { cn } from "../../utils";
import { ButtonProps, buttonVariants } from "../atoms/button";

export const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
export const Pagination = ({
className,
...props
}: React.ComponentProps<"nav">) => (
<nav
role="navigation"
aria-label="pagination"
Expand All @@ -16,17 +19,25 @@ export const Pagination = ({ className, ...props }: React.ComponentProps<"nav">)

Pagination.displayName = "Pagination";

export const PaginationContent = forwardRef<HTMLUListElement, React.ComponentProps<"ul">>(
({ className, ...props }, ref) => (
<ul ref={ref} className={cn("flex flex-row items-center gap-1", className)} {...props} />
),
);
export const PaginationContent = forwardRef<
HTMLUListElement,
React.ComponentProps<"ul">
>(({ className, ...props }, ref) => (
<ul
ref={ref}
className={cn("flex flex-row items-center gap-1", className)}
{...props}
/>
));

PaginationContent.displayName = "PaginationContent";

export const PaginationItem = forwardRef<HTMLLIElement, React.ComponentProps<"li">>(
({ className, ...props }, ref) => <li ref={ref} className={cn("", className)} {...props} />,
);
export const PaginationItem = forwardRef<
HTMLLIElement,
React.ComponentProps<"li">
>(({ className, ...props }, ref) => (
<li ref={ref} className={cn("", className)} {...props} />
));

PaginationItem.displayName = "PaginationItem";

Expand Down Expand Up @@ -90,7 +101,10 @@ export const PaginationNext = ({

PaginationNext.displayName = "PaginationNext";

export const PaginationEllipsis = ({ className, ...props }: React.ComponentProps<"span">) => (
export const PaginationEllipsis = ({
className,
...props
}: React.ComponentProps<"span">) => (
<span
aria-hidden
className={cn("flex h-9 w-9 items-center justify-center", className)}
Expand Down
23 changes: 16 additions & 7 deletions src/modules/project/hooks/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { useMemo, useState } from "react";

import { indexer } from "@/common/api/indexer";
import { toChronologicalOrder } from "@/common/lib";
import { ByListId, ChronologicalSortOrder, ChronologicalSortOrderVariant } from "@/common/types";
import {
ByListId,
ChronologicalSortOrder,
ChronologicalSortOrderVariant,
} from "@/common/types";

import { ProjectCategory, ProjectListingStatusVariant } from "../types";

Expand All @@ -13,11 +17,11 @@ export const useProjectLookup = ({ listId }: ProjectLookupParams) => {
const [searchTerm, setSearchTerm] = useState<string | undefined>(undefined);
const [categoryFilter, setCategoryFilter] = useState<ProjectCategory[]>([]);

const [statusFilter, setStatusFilter] = useState<ProjectListingStatusVariant>("Approved");
const [statusFilter, setStatusFilter] =
useState<ProjectListingStatusVariant>("Approved");

const [sortingOrder, setSortingOrder] = useState<ChronologicalSortOrderVariant>(
ChronologicalSortOrder.recent,
);
const [sortingOrder, setSortingOrder] =
useState<ChronologicalSortOrderVariant>(ChronologicalSortOrder.recent);

const {
data: listRegistrations,
Expand All @@ -32,9 +36,14 @@ export const useProjectLookup = ({ listId }: ProjectLookupParams) => {
});

const results = useMemo(() => {
const oldToRecent = toChronologicalOrder("submitted_at", listRegistrations?.results ?? []);
const oldToRecent = toChronologicalOrder(
"submitted_at",
listRegistrations?.results ?? [],
);

return sortingOrder === ChronologicalSortOrder.older ? oldToRecent : oldToRecent.toReversed();
return sortingOrder === ChronologicalSortOrder.older
? oldToRecent
: oldToRecent.toReversed();
}, [listRegistrations?.results, sortingOrder]);

return {
Expand Down
14 changes: 11 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { ProjectDiscovery, ProjectDiscoveryFeatured } from "@/modules/project";
import { useTypedSelector } from "@/store";

const WelcomeBanner = () => {
const { defaultAddress, toggle } = useTypedSelector((state) => state.nav.actAsDao);
const { defaultAddress, toggle } = useTypedSelector(
(state) => state.nav.actAsDao,
);

const daoAddress = toggle && defaultAddress ? defaultAddress : "";
const wallet = useWallet();
Expand All @@ -38,7 +40,11 @@ const WelcomeBanner = () => {
<DonateRandomly />

{isAuthenticated && !loading && (
<Button className="md:w-[180px] w-full" variant={"brand-tonal"} asChild>
<Button
className="md:w-[180px] w-full"
variant={"brand-tonal"}
asChild
>
<Link
href={
isRegisteredProject
Expand All @@ -47,7 +53,9 @@ const WelcomeBanner = () => {
}
prefetch={true}
>
{isRegisteredProject ? "View Your Project" : "Register Your Project"}
{isRegisteredProject
? "View Your Project"
: "Register Your Project"}
</Link>
</Button>
)}
Expand Down

0 comments on commit b6a6af7

Please sign in to comment.