Skip to content

Commit f8057a3

Browse files
committed
More UI updates
1 parent 4b9e52d commit f8057a3

File tree

11 files changed

+403
-312
lines changed

11 files changed

+403
-312
lines changed

apps/dashboard/src/@/actions/billing.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use server";
22

3-
import "server-only";
43
import { API_SERVER_URL } from "@/constants/env";
54
import { redirect } from "next/navigation";
65
import { getAuthToken } from "../../app/api/lib/getAuthToken";

apps/dashboard/src/app/(dashboard)/support/create-ticket/components/create-ticket.action.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"use server";
2-
import "server-only";
32

43
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
54
import { API_SERVER_URL } from "@/constants/env";

apps/dashboard/src/app/login/auth-actions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"use server";
2-
import "server-only";
32

43
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
54
import { API_SERVER_URL } from "@/constants/env";

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/actions/create-ecosystem.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"use server";
2-
import "server-only";
32
import { API_SERVER_URL, BASE_URL } from "@/constants/env";
43
import { getThirdwebClient } from "@/constants/thirdweb.server";
54
import { redirect } from "next/navigation";
Lines changed: 65 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
import { Box, Flex, Icon } from "@chakra-ui/react";
1+
import {
2+
Accordion,
3+
AccordionContent,
4+
AccordionItem,
5+
AccordionTrigger,
6+
} from "@/components/ui/accordion";
7+
import { Button } from "@/components/ui/button";
8+
import { ToolTipLabel } from "@/components/ui/tooltip";
9+
import { cn } from "@/lib/utils";
210
import type { AbiParameter } from "abitype";
3-
import { PlusIcon } from "lucide-react";
11+
import { PlusIcon, TrashIcon } from "lucide-react";
412
import { useFieldArray, useFormContext } from "react-hook-form";
5-
import { Button, Text } from "tw-components";
613
import { DecodedInputSet } from "./decoded-input-set";
714

815
interface DecodedInputArrayFieldsetProps {
@@ -20,39 +27,62 @@ export const DecodedInputArrayFieldset: React.FC<
2027
});
2128

2229
return (
23-
<Flex gap={8} direction="column" as="fieldset">
24-
<Flex gap={2} direction="column">
25-
<Text>Set decoded values for this bytes param.</Text>
26-
</Flex>
27-
<Flex flexDir="column" gap={4}>
30+
<fieldset>
31+
<div className={cn(fields.length > 0 && "border-border border-b")}>
2832
{fields.map((item, index) => (
29-
<DecodedInputSet
30-
key={item.id}
31-
removeSet={remove}
32-
setIndex={index}
33-
param={param}
34-
/>
33+
<Accordion type="single" collapsible className="-mx-1" key={item.id}>
34+
<AccordionItem value="metadata" className="border-none">
35+
<AccordionTrigger className="gap-3 border-border border-t px-1">
36+
<div className="flex grow items-center justify-between gap-4">
37+
Parameter set {index + 1}
38+
<ToolTipLabel label="Remove parameter set">
39+
<Button
40+
asChild
41+
size="sm"
42+
className="!text-destructive-text h-auto w-auto p-2"
43+
variant="ghost"
44+
onClick={(e) => {
45+
e.preventDefault();
46+
e.stopPropagation();
47+
remove(index);
48+
}}
49+
>
50+
<div role="button" tabIndex={0}>
51+
<TrashIcon className="size-4" />
52+
</div>
53+
</Button>
54+
</ToolTipLabel>
55+
</div>
56+
</AccordionTrigger>
57+
<AccordionContent className="px-1 pb-6">
58+
<div className="rounded-lg border border-border px-6 pt-1 pb-6">
59+
<DecodedInputSet setIndex={index} param={param} />
60+
</div>
61+
</AccordionContent>
62+
</AccordionItem>
63+
</Accordion>
3564
))}
36-
<Box>
37-
<Button
38-
type="button"
39-
size="sm"
40-
colorScheme="primary"
41-
borderRadius="md"
42-
leftIcon={<Icon as={PlusIcon} />}
43-
isDisabled={param.type === "bytes" && fields.length >= 1}
44-
onClick={() =>
45-
append({
46-
contractId: "",
47-
version: "",
48-
publisherAddress: "",
49-
})
50-
}
51-
>
52-
New param set
53-
</Button>
54-
</Box>
55-
</Flex>
56-
</Flex>
65+
</div>
66+
67+
<div className="mt-6 flex justify-start">
68+
<Button
69+
type="button"
70+
size="sm"
71+
className="gap-2 bg-background"
72+
variant="outline"
73+
disabled={param.type === "bytes" && fields.length >= 1}
74+
onClick={() =>
75+
append({
76+
contractId: "",
77+
version: "",
78+
publisherAddress: "",
79+
})
80+
}
81+
>
82+
<PlusIcon className="size-4" />
83+
Add parameter set
84+
</Button>
85+
</div>
86+
</fieldset>
5787
);
5888
};
Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
import { Box, Flex, Icon, IconButton } from "@chakra-ui/react";
1+
import {
2+
Accordion,
3+
AccordionContent,
4+
AccordionItem,
5+
AccordionTrigger,
6+
} from "@/components/ui/accordion";
7+
import { Button } from "@/components/ui/button";
8+
import { ToolTipLabel } from "@/components/ui/tooltip";
29
import type { AbiParameter } from "abitype";
310
import { PlusIcon, TrashIcon } from "lucide-react";
411
import { useFieldArray, useFormContext } from "react-hook-form";
5-
import { Button } from "tw-components";
612
import { DecodedInput } from "./decoded-input";
713

814
interface DecodedInputSetProps {
915
param: AbiParameter;
1016
setIndex: number;
11-
removeSet: (index: number) => void;
1217
}
1318

1419
export const DecodedInputSet: React.FC<DecodedInputSetProps> = ({
1520
param,
1621
setIndex,
17-
removeSet,
1822
}) => {
1923
const form = useFormContext();
2024

@@ -24,42 +28,64 @@ export const DecodedInputSet: React.FC<DecodedInputSetProps> = ({
2428
});
2529

2630
return (
27-
<Flex gap={8} direction="column" as="fieldset">
28-
<Flex flexDir="column" gap={4}>
29-
{fields.map((item, index) => (
30-
<DecodedInput
31-
key={item.id}
32-
removeParam={remove}
33-
paramIndex={index}
34-
setIndex={setIndex}
35-
param={param}
36-
/>
37-
))}
38-
<Box>
39-
<Button
40-
type="button"
41-
size="sm"
42-
colorScheme="primary"
43-
borderRadius="md"
44-
leftIcon={<Icon as={PlusIcon} />}
45-
isDisabled={param.type === "bytes" && fields.length >= 1}
46-
onClick={() =>
47-
append({
48-
type: "",
49-
defaultValue: "",
50-
})
51-
}
52-
>
53-
Add param
54-
</Button>
55-
</Box>
56-
</Flex>
57-
<IconButton
58-
icon={<Icon as={TrashIcon} boxSize={5} />}
59-
aria-label="Remove set"
60-
onClick={() => removeSet(setIndex)}
61-
alignSelf="end"
62-
/>
63-
</Flex>
31+
<fieldset>
32+
{fields.map((item, index) => (
33+
<Accordion type="single" collapsible className="-mx-1" key={item.id}>
34+
<AccordionItem value="metadata" className="border-border border-b">
35+
<AccordionTrigger className="gap-3 border-0 px-1 ">
36+
<div className="flex grow items-center justify-between gap-4">
37+
<span className="font-medium text-sm">
38+
Parameter {index + 1}
39+
</span>
40+
<ToolTipLabel label="Remove Parameter">
41+
<Button
42+
asChild
43+
size="sm"
44+
className="!text-destructive-text h-auto w-auto p-2"
45+
variant="ghost"
46+
onClick={(e) => {
47+
e.preventDefault();
48+
e.stopPropagation();
49+
remove(index);
50+
}}
51+
>
52+
<div role="button" tabIndex={0}>
53+
<TrashIcon className="size-4" />
54+
</div>
55+
</Button>
56+
</ToolTipLabel>
57+
</div>
58+
</AccordionTrigger>
59+
<AccordionContent className="px-1 pb-6">
60+
<DecodedInput
61+
key={item.id}
62+
paramIndex={index}
63+
setIndex={setIndex}
64+
param={param}
65+
/>
66+
</AccordionContent>
67+
</AccordionItem>
68+
</Accordion>
69+
))}
70+
71+
<div className="mt-6 flex justify-start">
72+
<Button
73+
type="button"
74+
size="sm"
75+
className="gap-2"
76+
variant="outline"
77+
disabled={param.type === "bytes" && fields.length >= 1}
78+
onClick={() =>
79+
append({
80+
type: "",
81+
defaultValue: "",
82+
})
83+
}
84+
>
85+
<PlusIcon className="size-4" />
86+
Add Parameter
87+
</Button>
88+
</div>
89+
</fieldset>
6490
);
6591
};

0 commit comments

Comments
 (0)