Skip to content

Commit

Permalink
Frontend fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Akim Mamedov committed Feb 27, 2024
1 parent a7dc92a commit 1bdbb2a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions web/src/components/LinkWithIcon/LinkWithIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const LinkWithIcon = ({
return (
<Link
to={url}
target="_blank"
className={`${styles["link-with-icon"]} ${color === "white" && styles["link-with-icon_color_white"]}`}
>
<div style={color === "white" ? styleWhite : style} />
Expand Down
16 changes: 6 additions & 10 deletions web/src/pages/begin-page/begin-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import TimeUntilReduce from "../../components/TimeUntilReduce/TimeUntilReduce";

import styles from "./begin-page.module.css";
import { checkEligibility } from "../../utils/metadata";
import { ROUTE_WALLET } from "../../constants/routes";
import { ROUTE_NOT_FOUND, ROUTE_WALLET } from "../../constants/routes";

const PageBegin = memo(() => {
const navigate = useNavigate();
Expand All @@ -28,23 +28,20 @@ const PageBegin = memo(() => {

const [inputValid, setInputValid] = useState(true);
const [inputPressed, setInputPressed] = useState(false);
const [isEligible, setIsEligible] = useState(true);

const onEligibilityCheckButtonClick = () => {
if (checkEligibility(username)) {
navigate(ROUTE_WALLET);
} else {
setIsEligible(false);
navigate(ROUTE_NOT_FOUND);
}
};

const handleChangeUsername = (e) => {
e.target.value !== "" ? setInputPressed(true) : setInputPressed(false);
setInputValid(githubUsernameRegex.test(e.target.value));
setUsername(e.target.value);
if (!isEligible) {
setIsEligible(true);
}
const value = e.target.value.toLowerCase();
value !== "" ? setInputPressed(true) : setInputPressed(false);
setInputValid(githubUsernameRegex.test(value));
setUsername(value);
};

const getInputClassName = () => {
Expand Down Expand Up @@ -105,7 +102,6 @@ const PageBegin = memo(() => {
text="Check if I’m eligible"
callback={onEligibilityCheckButtonClick}
/>
<p className={styles.incorrect}>{isEligible ? <>&nbsp;</> : "This github username not eligible for reward"}</p>
</li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,19 @@ const AccountNotFound = () => {
<LinkWithIcon
text="Join the Discord server"
icon={discordBlack}
url="https://fluence.chat"
/>
</li>
<li className={styles.dashboard__item}>
<LinkWithIcon
text="Connect on Telegram"
style={{ backgroundSize: "14px" }}
icon={telegramBlack}
url="https://t.me/fluence_project"
/>
</li>
<li className={styles.dashboard__item}>
<LinkWithIcon text="Governance forum" icon={dialogBlack} />
<LinkWithIcon text="Governance forum" icon={dialogBlack} url="https://gov.fluence.network/" />
</li>
</ul>
</Dashboard>
Expand Down

0 comments on commit 1bdbb2a

Please sign in to comment.