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

feat(spaceward): Further intents enhancements #168

Merged
merged 20 commits into from
Apr 11, 2024
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
*.local

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.tmp
Expand Down
26 changes: 24 additions & 2 deletions spaceward/src/components/add-person-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState } from "react";
import { useMemo, useState } from "react";
import Portal from "./ui/portal";
import clsx from "clsx";
import { fromBech32 } from "@cosmjs/encoding";

const AddPersonModal = ({
onClose,
Expand All @@ -13,6 +14,14 @@ const AddPersonModal = ({
}) => {
const [addPersonValue, setAddPersonValue] = useState<string>("");

const isValid = useMemo(() => {
try {
return Boolean(fromBech32(addPersonValue));
} catch {
return false;
}
}, [addPersonValue]);

return (
<Portal domId="intent-modal">
<div className="bg-[rgba(64,64,64,0.40)] absolute left-0 top-0 w-full h-full backdrop-blur-[20px] flex items-center justify-center min-h-[600px]">
Expand All @@ -38,11 +47,18 @@ const AddPersonModal = ({
<div className="font-bold text-5xl mb-6 leading-[56px]">
Add a person
</div>

<div>Enter an address</div>

<form
action=""
className="mt-12 text-left flex items-center justify-between gap-2 bg-[rgba(229,238,255,0.15)] border-[1px] border-white px-4 h-[60px]"
className={clsx(
`mt-12 text-left flex items-center justify-between gap-2 bg-[rgba(229,238,255,0.15)] border-[1px] border-white px-4 h-[60px]`,
!isValid &&
addPersonValue &&
`
border-[#E54545] border-[1px]`,
)}
>
<div className="w-full">
<label
Expand All @@ -65,6 +81,12 @@ const AddPersonModal = ({
</button>
</form>

{!isValid && addPersonValue && (
<div className="text-[#E54545] text-xs text-left mt-1">
Enter correct address
</div>
)}

<div className="mt-12 pt-6">
<button
onClick={() => {
Expand Down
19 changes: 15 additions & 4 deletions spaceward/src/components/change-person-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const ChangePersonModal = ({
addresses.map((address) => users.includes(address)),
);

const handleSelectAll = () => {
setSelected(Array.from({ length: addresses.length }).map(() => true));
};

return (
<Portal domId="intent-modal">
<div className="bg-[rgba(64,64,64,0.40)] absolute left-0 top-0 w-full h-full backdrop-blur-[20px] flex items-center justify-center min-h-[600px]">
Expand Down Expand Up @@ -49,17 +53,24 @@ const ChangePersonModal = ({
>
Add Person
</button>
<button className="px-5 hover:text-white transition-all duration-200">
Select All
</button>
{addresses.length ? (
<button
onClick={() => handleSelectAll()}
className="px-5 hover:text-white transition-all duration-200"
>
Select All
</button>
) : (
<div></div>
)}
</div>
<div className="flex flex-col text-left">
{addresses
// ?.slice(0, 4)
.map((address, i) => (
<PersonSelect
address={address}
key={i}
key={`${i}${selected[i]}`}
selected={selected[i]}
onChange={(value) => {
setSelected((prev) => {
Expand Down
1 change: 0 additions & 1 deletion spaceward/src/components/create-intent-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const CreateIntentModal = ({
onClose();
}
};

return (
<Portal domId="intent-modal">
<div className="bg-[rgba(64,64,64,0.40)] absolute left-0 top-0 w-full h-full backdrop-blur-[20px] flex items-center justify-center min-h-[480px]">
Expand Down
Loading
Loading