Skip to content

Commit

Permalink
Merge pull request PotLock#88 from PotLock/feat/dao-flow
Browse files Browse the repository at this point in the history
Feat/dao flow
  • Loading branch information
lachlanglen authored Nov 28, 2023
2 parents 193492a + 7bc6b6e commit 0f90d10
Show file tree
Hide file tree
Showing 8 changed files with 658 additions and 188 deletions.
10 changes: 10 additions & 0 deletions apps/potlock/widget/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const Theme = styled.div`
}
`;

const NEAR_ACCOUNT_ID_REGEX = /^(?=.{2,64}$)(?!.*\.\.)(?!.*-$)(?!.*_$)[a-z\d._-]+$/i;

State.init({
registeredProjects: null,
cart: null,
Expand Down Expand Up @@ -214,6 +216,14 @@ const props = {
setIsNavMenuOpen: (isOpen) => {
State.update({ isNavMenuOpen: isOpen });
},
validateNearAddress: (address) => {
let isValid = NEAR_ACCOUNT_ID_REGEX.test(address);
// Additional ".near" check for IDs less than 64 characters
if (address.length < 64 && !address.endsWith(".near")) {
isValid = false;
}
return isValid;
},
CATEGORY_MAPPINGS: {
"social-impact": "Social Impact",
"non-profit": "NonProfit",
Expand Down
55 changes: 46 additions & 9 deletions apps/potlock/widget/Inputs/Checkbox.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
const Container = styled.div`
display: flex;
gap: 8px;
flex-direction: row;
align-items: center;
`;

const CheckBox = styled.input`
width: 18px;
height: 18px;
Expand All @@ -7,16 +14,46 @@ const CheckBox = styled.input`
// TODO: update background color when selected
`;

const Label = styled.label``;

const Error = styled.span`
display: inline-block;
font-style: normal;
font-weight: 400;
font-size: 0.75em;
line-height: 1.25em;
color: #ff4d4f;
height: 0;
overflow: hidden;
transition: height 0.3s ease-in-out;
&.show {
height: 1.25em;
}
`;

const { id, disabled, checked, onClick } = props;
const style = props.style ?? {};

const containerStyle = props.containerStyle ?? {};
const checkBoxStyle = props.checkBoxStyle ?? {};
const labelStyle = props.labelStyle ?? {};
const error = props.error ?? "";

return (
<CheckBox
type="checkbox"
style={style}
id={id}
disabled={disabled}
checked={checked}
onClick={onClick}
/>
<Container style={containerStyle}>
<CheckBox
type="checkbox"
style={checkBoxStyle}
id={id}
disabled={disabled}
checked={checked}
onClick={onClick}
/>
{props.label && (
<Label for={id} style={labelStyle}>
{props.label}
</Label>
)}
<Error className={error ? "show" : ""}>{error}</Error>
</Container>
);
1 change: 0 additions & 1 deletion apps/potlock/widget/Inputs/Text.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const Input = styled.input`
align-items: center;
padding: 0.5em 0.75em;
gap: 0.5em;
box-shadow: 0px -2px 0px rgba(93, 93, 93, 0.24) inset;
color: #101828;
width: 100%;
border-radius: 4px;
Expand Down
Loading

0 comments on commit 0f90d10

Please sign in to comment.