Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

[WIP] Pay Dashboard #2607

Closed
wants to merge 119 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
15622fb
initial works
jnsdls Apr 30, 2024
5934810
refactor: Remove unused import in dashboard layout
jnsdls Apr 30, 2024
875e85f
style: update background color and text color in globals.css
jnsdls Apr 30, 2024
436d088
style: increase radius in globals.css
jnsdls Apr 30, 2024
3d171df
feat(chainlist): add suspense to ChainListModeSelect
jnsdls May 1, 2024
971fdad
Merge branch 'main' into jd/chain-updates
jnsdls May 2, 2024
711c14b
more updates
jnsdls May 2, 2024
77fb1bd
feat: Add GlobalError component
jnsdls May 2, 2024
2e1dc96
initial filter ui
jnsdls May 2, 2024
dc5c22c
chain list style updates, show all chains, fix icons
MananTank May 21, 2024
23a2c46
hook all states
MananTank May 21, 2024
9adb7b7
cleaner query params
MananTank May 21, 2024
9e07011
filter by search term
MananTank May 21, 2024
cb4eabe
lint and cleanup
MananTank May 21, 2024
cff856a
fix build
MananTank May 21, 2024
c720a2f
Add spinner
MananTank May 21, 2024
02454b7
add basic fallback
MananTank May 21, 2024
b372f3a
filter deprecated, testnet/mainnet
MananTank May 21, 2024
4ac036b
cleanup
MananTank May 21, 2024
c028fc2
basic table
MananTank May 21, 2024
e72296d
bolder text
MananTank May 21, 2024
bca9def
update table
MananTank May 22, 2024
dfbdd0d
style tweaks
MananTank May 22, 2024
1a7bb6b
revert temp change
MananTank May 22, 2024
9c486a7
add connect button in header
MananTank May 22, 2024
1c7aaf1
invert app route logic
jnsdls May 23, 2024
f5deb8e
add main dashboard layout up one level
jnsdls May 23, 2024
9517dcd
merge in main & upgade deps
jnsdls May 23, 2024
834f385
package lock
jnsdls May 23, 2024
f29cb6c
chore: Update third-party packages
jnsdls May 23, 2024
8700e42
refactor: add webpack externals
jnsdls May 23, 2024
0f1a254
fix: Update react-hook-form version to 7.51.4
jnsdls May 23, 2024
d9101c6
fix(next.config.js): disable Sentry Webpack plugin on server
jnsdls May 23, 2024
3031212
disable sentry for a minute
jnsdls May 23, 2024
411a6b7
test out updating
jnsdls May 23, 2024
424182f
lockfile
jnsdls May 23, 2024
711d0b7
fix: Update react and react-dom versions
jnsdls May 23, 2024
c821d2d
refactor: Remove unused code and update dependencies
jnsdls May 23, 2024
ee1908e
feat: Add new configuration options for next.config.js
jnsdls May 23, 2024
10b0b2e
refactor: optimize webpack config and static paths
jnsdls May 23, 2024
9b8b606
Improved header
MananTank May 23, 2024
e3b2878
table on desktop, cards otherwise
MananTank May 23, 2024
ed9454f
table styling updates, prettier fix build
MananTank May 23, 2024
af31021
layout adjustments
MananTank May 23, 2024
5fdc020
pagination
MananTank May 23, 2024
167bc16
reset page on filter change
MananTank May 23, 2024
a07a461
remove mode
MananTank May 23, 2024
789885f
pagination tweaks
MananTank May 23, 2024
2de62d2
fix lint
MananTank May 23, 2024
00b5e53
Fix skeleton
MananTank May 23, 2024
bb43b8b
tooltips and tags
MananTank May 23, 2024
a5c1450
Link product icons + tooltip
MananTank May 23, 2024
ab7797a
burger menu, toggle theme updates
MananTank May 23, 2024
6452b20
Add tabs in chain page
MananTank May 23, 2024
cb97b3e
add top loader
MananTank May 23, 2024
ae06682
update
MananTank May 23, 2024
e066964
update chain page header
MananTank May 23, 2024
3e5bffc
resolve vercel comments
MananTank May 24, 2024
2ed3ab9
tweaks
MananTank May 24, 2024
2d8db8c
chain overview tab grid
MananTank May 24, 2024
12f3ae4
add enabled services
MananTank May 24, 2024
c024217
show faucets and explorers
MananTank May 24, 2024
bfa6ae6
add styleguide page, fix colors, show deprecated
MananTank May 24, 2024
7d3841f
tweaks
MananTank May 24, 2024
0999a31
add contracts tab
MananTank May 24, 2024
5827d5e
show deprecated on card view, spacing tweaks
MananTank May 24, 2024
b30ac0e
use borders-b to provide structure
MananTank May 24, 2024
d567040
tab style adjustments
MananTank May 24, 2024
cf6064e
Update Contracts tab
MananTank May 25, 2024
6001d71
color tweaks, add connect sdk tab content
MananTank May 25, 2024
fad4401
Overview page card style tweaks
MananTank May 25, 2024
44feabf
more content
MananTank May 25, 2024
92ab0c8
tweaks
MananTank May 25, 2024
902ec50
improved tab style
MananTank May 26, 2024
fcb3170
tweaks
MananTank May 26, 2024
d59f629
move tabs on sidebar on lg
MananTank May 26, 2024
f07d3ed
updates
MananTank May 27, 2024
d608473
convert chakra to tailwind for charts components
MananTank May 31, 2024
8609f4d
use tailwind stuff
MananTank May 31, 2024
65eb5f3
Row 1
MananTank May 31, 2024
ff4ef38
Add payouts barchart
MananTank May 31, 2024
62daff4
just use one color
MananTank May 31, 2024
395fcb9
add success rate card
MananTank May 31, 2024
c0f9f10
update
MananTank May 31, 2024
0b211c6
Merge branch 'main' into mnn/charts
MananTank Jun 11, 2024
533f06e
merge main
MananTank Jun 11, 2024
72ca049
Fix build
MananTank Jun 11, 2024
e41759d
Remove switch
MananTank Jun 11, 2024
9a03fa0
Remove lottie change
MananTank Jun 11, 2024
aad976a
Hook in New Customers chart with data
MananTank Jun 12, 2024
ead781f
update
MananTank Jun 12, 2024
3527704
update
MananTank Jun 12, 2024
0b9c9a9
Add usePayPurchases
MananTank Jun 12, 2024
54c56c8
hook in Payouts bar chart
MananTank Jun 12, 2024
340026a
Date Range selector improvements
MananTank Jun 12, 2024
0fdcdb2
hook in SuccessRateCard
MananTank Jun 12, 2024
f75aaa1
UI cleanups
MananTank Jun 12, 2024
207cbd9
Improved Date picker UX
MananTank Jun 13, 2024
83b6646
Fix Payouts rendering
MananTank Jun 13, 2024
5df89f1
hook in TotalVolumePieChartCard
MananTank Jun 13, 2024
dac3c87
update
MananTank Jun 13, 2024
63d9718
Merge branch 'main' into mnn/charts
MananTank Jun 14, 2024
581bde6
improved layout
MananTank Jun 14, 2024
d39021f
layout updates
MananTank Jun 14, 2024
5d86746
update
MananTank Jun 14, 2024
52e1e22
add tx history table
MananTank Jun 15, 2024
4fcbf86
Fix lint
MananTank Jun 17, 2024
e73773c
show tokens in tx history
MananTank Jun 17, 2024
5899d05
various updates
MananTank Jun 17, 2024
ddec507
reorganize
MananTank Jun 17, 2024
c47b9c0
payouts skeletons
MananTank Jun 17, 2024
f3ec020
improve skeletons
MananTank Jun 17, 2024
4b374ae
table row skeletons
MananTank Jun 17, 2024
da4cd1c
API updated
MananTank Jun 17, 2024
c5496fa
update tx history table
MananTank Jun 17, 2024
eed5002
staggered skeletons in table
MananTank Jun 17, 2024
d871156
Fix pie chart
MananTank Jun 17, 2024
7786012
UI fixes for mobile
MananTank Jun 17, 2024
f6362ea
optimize table data query with useInfiniteQuery
MananTank Jun 18, 2024
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
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
"@emotion/styled": "^11.11.5",
"@hookform/resolvers": "^3.6.0",
"@n8tb1t/use-scroll-position": "^2.0.3",
"@radix-ui/react-aspect-ratio": "^1.0.3",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tooltip": "^1.0.7",
Expand Down Expand Up @@ -84,6 +86,7 @@
"qrcode": "^1.5.3",
"react": "18.3.1",
"react-children-utilities": "^2.10.0",
"react-day-picker": "^8.10.1",
"react-dom": "18.3.1",
"react-dropzone": "^14.2.3",
"react-hook-form": "7.51.4",
Expand Down
961 changes: 559 additions & 402 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions src/@/components/ui/CopyAddressButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"use client";

import { CheckIcon, CopyIcon } from "lucide-react";
import { Button } from "./button";
import { useState } from "react";
import { cn } from "../../lib/utils";
import { ToolTipLabel } from "./tooltip";

export function CopyAddressButton(props: {
address: string;
className?: string;
iconClassName?: string;
variant?:
| "primary"
| "default"
| "destructive"
| "outline"
| "secondary"
| "ghost";
}) {
const [isCopied, setIsCopied] = useState(false);
const shortenedAddress = `${props.address.slice(0, 6)}...${props.address.slice(0, 4)}`;

return (
<ToolTipLabel label="Copy address">
<Button
variant={props.variant || "outline"}
aria-label="Copy"
className={cn(
"h-auto w-auto px-2.5 py-1.5 flex gap-2 text-xs rounded-lg font-mono text-foreground",
props.className,
)}
onClick={() => {
navigator.clipboard.writeText(props.address);
setIsCopied(true);
setTimeout(() => setIsCopied(false), 1000);
}}
>
{isCopied ? (
<CheckIcon
className={cn("size-3 text-green-500", props.iconClassName)}
/>
) : (
<CopyIcon
className={cn("size-3 text-muted-foreground", props.iconClassName)}
/>
)}
{shortenedAddress}
</Button>
</ToolTipLabel>
);
}
152 changes: 152 additions & 0 deletions src/@/components/ui/DatePickerWithRange.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
"use client";

import * as React from "react";
import { format, isBefore } from "date-fns";
import {
Calendar as CalendarIcon,
CalendarX2Icon,
ChevronDownIcon,
} from "lucide-react";

import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import { Calendar } from "@/components/ui/calendar";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { TabButtons } from "./tabs";
import { DynamicHeight } from "./DynamicHeight";

export function DatePickerWithRange(props: {
from: Date;
to: Date;
setFrom: (from: Date) => void;
setTo: (to: Date) => void;
className?: string;
header?: React.ReactNode;
footer?: React.ReactNode;
labelOverride?: string;
}) {
const [screen, setScreen] = React.useState<"from" | "to">("from");
const { from, to, setFrom, setTo } = props;

const isValid = React.useMemo(() => isBefore(from, to), [from, to]);
const [isOpen, setIsOpen] = React.useState(false);

return (
<div className={cn("grid gap-2", props.className)}>
<Popover
open={isOpen}
onOpenChange={(v) => {
if (!v) {
setScreen("from");
}
setIsOpen(v);
}}
>
{/* Button */}
<PopoverTrigger asChild>
<Button
id="date"
variant={"outline"}
className={cn(
"min-w-[200px] justify-start text-left font-normal gap-1",
)}
>
<CalendarIcon className="mr-2 h-4 w-4" />
{props.labelOverride || (
<>
{format(from, "LLL dd, y")} - {format(to, "LLL dd, y")}
</>
)}
<ChevronDownIcon className="h-4 w-4 ml-auto" />
</Button>
</PopoverTrigger>

{/* Popover */}
<PopoverContent className="w-auto p-0" align="start">
<DynamicHeight>
<div>
{!isValid && (
<p className="text-sm pt-2 justify-center text-destructive-foreground text-center flex items-center gap-2">
<CalendarX2Icon className="h-4 w-4" />
Invalid date range
</p>
)}
{props.header}

<div className="px-4">
<TabButtons
tabClassName="!text-sm"
activeTabClassName="!bg-inverted !text-inverted-foreground"
tabContainerClassName="gap-2"
tabs={[
{
name: "From",
onClick: () => setScreen("from"),
isActive: screen === "from",
isEnabled: true,
},
{
name: "To",
onClick: () => setScreen("to"),
isActive: screen === "to",
isEnabled: true,
},
]}
/>
</div>

{screen === "from" && (
<Calendar
key={from.toString()}
mode="range"
selected={{
from,
to,
}}
defaultMonth={from}
onDayClick={(newFrom) => {
if (isBefore(newFrom, to)) {
setFrom(newFrom);
}
}}
classNames={{
day_range_start: "!bg-inverted",
day_range_end:
"!bg-inverted/20 !text-inverted pointer-events-none",
}}
/>
)}

{screen === "to" && (
<Calendar
key={to.toString()}
mode="range"
selected={{
from,
to,
}}
defaultMonth={to}
onDayClick={(newTo) => {
if (isBefore(from, newTo)) {
setTo(newTo);
}
}}
classNames={{
day_range_end: "!bg-inverted",
day_range_start:
"!bg-inverted/20 !text-inverted pointer-events-none",
}}
/>
)}
{props.footer}
</div>
</DynamicHeight>
</PopoverContent>
</Popover>
</div>
);
}
58 changes: 58 additions & 0 deletions src/@/components/ui/DynamicHeight.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* eslint-disable react/forbid-dom-props */
"use client";

import React, { useState, useRef, useLayoutEffect } from "react";

export function DynamicHeight(props: {
children: React.ReactNode;
maxHeight?: string;
transition?: string;
}) {
const { height, elementRef } = useHeightObserver();

return (
<div
style={{
height: height ? `${height}px` : "auto",
transition:
props.transition ||
"height 210ms cubic-bezier(0.175, 0.885, 0.32, 1.1)",
overflow: "hidden",
boxSizing: "border-box",
}}
>
<div
ref={elementRef}
style={{
maxHeight: props.maxHeight,
}}
>
{props.children}
</div>
</div>
);
}

export function useHeightObserver() {
const elementRef = useRef<HTMLDivElement>(null);
const [height, setHeight] = useState<number | undefined>();

useLayoutEffect(() => {
const element = elementRef.current;
if (!element) {
return;
}

const resizeObserver = new ResizeObserver(() => {
setHeight(element.scrollHeight);
});

resizeObserver.observe(element);

return () => {
resizeObserver.disconnect();
};
}, [elementRef]);

return { height, elementRef };
}
2 changes: 2 additions & 0 deletions src/@/components/ui/ScrollShadow/ScrollShadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export function ScrollShadow(props: {
children: React.ReactNode;
className?: string;
scrollableClassName?: string;
disableTopShadow?: boolean;
}) {
const scrollableEl = useRef<HTMLDivElement>(null);
const shadowTopEl = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -79,6 +80,7 @@ export function ScrollShadow(props: {
ref={shadowTopEl}
style={{
opacity: "0",
display: props.disableTopShadow ? "none" : "block",
}}
></div>
<div
Expand Down
7 changes: 7 additions & 0 deletions src/@/components/ui/aspect-ratio.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use client";

import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";

const AspectRatio = AspectRatioPrimitive.Root;

export { AspectRatio };
5 changes: 4 additions & 1 deletion src/@/components/ui/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";

const badgeVariants = cva(
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 leading-4",
{
variants: {
variant: {
Expand All @@ -14,7 +14,10 @@ const badgeVariants = cva(
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
warning: "border-transparent bg-warning text-warning-foreground",
outline: "text-foreground",
success:
"border-transparent bg-success text-success-foreground hover:bg-success/80",
},
},
defaultVariants: {
Expand Down
2 changes: 1 addition & 1 deletion src/@/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils";

const buttonVariants = cva(
export const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
Expand Down
Loading