From e68dee7978928da950b98af7ab6599e0bceae20e Mon Sep 17 00:00:00 2001 From: Abbas Ali Date: Mon, 23 Dec 2024 18:07:12 +0530 Subject: [PATCH] cleanup: removed unused and old ui components --- .../proposal/proposal-view/index.tsx | 53 --------- .../proposal/proposal-view/style.module.scss | 29 ----- .../components/proposal/proposal/index.tsx | 108 ------------------ .../proposal/proposal/style.module.scss | 42 ------- .../components/proposal/vote-block/index.tsx | 37 ------ .../proposal/vote-block/style.module.scss | 40 ------- .../migration/metamask-privatekey.tsx | 14 ++- 7 files changed, 13 insertions(+), 310 deletions(-) delete mode 100644 packages/fetch-extension/src/components/proposal/proposal-view/index.tsx delete mode 100644 packages/fetch-extension/src/components/proposal/proposal-view/style.module.scss delete mode 100644 packages/fetch-extension/src/components/proposal/proposal/index.tsx delete mode 100644 packages/fetch-extension/src/components/proposal/proposal/style.module.scss delete mode 100644 packages/fetch-extension/src/components/proposal/vote-block/index.tsx delete mode 100644 packages/fetch-extension/src/components/proposal/vote-block/style.module.scss diff --git a/packages/fetch-extension/src/components/proposal/proposal-view/index.tsx b/packages/fetch-extension/src/components/proposal/proposal-view/index.tsx deleted file mode 100644 index bce8b9ec66..0000000000 --- a/packages/fetch-extension/src/components/proposal/proposal-view/index.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React from "react"; -import { FunctionComponent } from "react"; -import style from "./style.module.scss"; -import classnames from "classnames"; -import { FormattedMessage } from "react-intl"; -import { Button } from "reactstrap"; -import { useNavigate } from "react-router"; -import { useStore } from "../../../stores"; - -export const ProposalView: FunctionComponent = () => { - const navigate = useNavigate(); - const { analyticsStore } = useStore(); - - return ( -
-
-

- -

-

- -

-
-
- - -
- ); -}; diff --git a/packages/fetch-extension/src/components/proposal/proposal-view/style.module.scss b/packages/fetch-extension/src/components/proposal/proposal-view/style.module.scss deleted file mode 100644 index 8aa6285a66..0000000000 --- a/packages/fetch-extension/src/components/proposal/proposal-view/style.module.scss +++ /dev/null @@ -1,29 +0,0 @@ -@import "../../../styles/var"; - -.containerInner { - display: flex; - flex-direction: row; - - height: 48px; - justify-content: center; - align-items: center; - - .paragraphMain { - line-height: 1.35; - } - - .paragraphSub { - line-height: 1.35; - color: #8898aa; - } - - .vertical { - display: flex; - flex-direction: column; - } - - .button { - min-width: 76px; - padding: 6px 10px 4px; - } -} diff --git a/packages/fetch-extension/src/components/proposal/proposal/index.tsx b/packages/fetch-extension/src/components/proposal/proposal/index.tsx deleted file mode 100644 index b969ffb107..0000000000 --- a/packages/fetch-extension/src/components/proposal/proposal/index.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import React, { useEffect, useState } from "react"; -import { FunctionComponent } from "react"; -import style from "./style.module.scss"; -import { GovStatusChip } from "@components/chips/gov-chip"; -import { useNavigate } from "react-router"; -import { proposalOptions } from "../../../pages/proposals"; -import { useStore } from "../../../stores"; -import { fetchVote } from "@utils/fetch-proposals"; -import { ProposalSetup } from "src/@types/proposal-type"; - -interface Props { - title: string; - id: string; - status: string; -} - -export const Proposal: FunctionComponent = (props) => { - const { title, status, id } = props; - const { chainStore, accountStore, proposalStore, analyticsStore } = - useStore(); - const navigate = useNavigate(); - let icon, color, background, name; - const storedProposals: ProposalSetup = proposalStore.proposals; - - const accountInfo = accountStore.getAccount(chainStore.current.chainId); - const [alreadyVoted, setAlreadyVoted] = useState(""); - useEffect(() => { - (async () => { - const proposalItem = storedProposals.votedProposals.find( - (proposal) => proposal.proposal_id === id - ); - if (!proposalItem) { - return; - } - try { - const vote = await fetchVote( - id, - accountInfo.bech32Address, - chainStore.current.rest - ); - const voted = vote.vote.option; - setAlreadyVoted(voted); - } catch (e) {} - })(); - }, []); - - switch (status) { - case proposalOptions.ProposalPassed: - icon = "gov-tick.svg"; - color = "#6AB77A"; - background = "#E3F4E7"; - name = "Passed"; - break; - case proposalOptions.ProposalActive: - icon = "gov-clock.svg"; - color = "#3B82F6"; - background = "#D0DEF5"; - name = "Active"; - break; - case proposalOptions.ProposalRejected: - icon = "gov-cross.svg"; - color = "#DC6461"; - background = "#FBECEC"; - name = "Rejected"; - break; - default: - icon = "gov-cross.svg"; - color = "#DC6461"; - background = "#FBECEC"; - name = "Failed"; - } - const handleClick = () => { - analyticsStore.logEvent("proposal_detail_click"); - if (alreadyVoted !== "" && alreadyVoted !== "Unspecified") { - const voteArr = [ - "VOTE_OPTION_UNSPECIFIED", - "VOTE_OPTION_YES", - "VOTE_OPTION_ABSTAIN", - "VOTE_OPTION_NO", - "VOTE_OPTION_NO_WITH_VETO", - ]; - navigate( - `/proposal-vote-status/${voteArr.indexOf(alreadyVoted)}/${id}?true` - ); - return; - } - navigate(`/proposal-detail/${id}`); - }; - return ( -
-
-

{title}

-

{id}

-
- -
- -
-
- ); -}; diff --git a/packages/fetch-extension/src/components/proposal/proposal/style.module.scss b/packages/fetch-extension/src/components/proposal/proposal/style.module.scss deleted file mode 100644 index a49ddb4e15..0000000000 --- a/packages/fetch-extension/src/components/proposal/proposal/style.module.scss +++ /dev/null @@ -1,42 +0,0 @@ -.proposal { - display: flex; - line-height: 20px; - justify-content: space-between; - margin: 12px 0; - background: #ffffff; - cursor: pointer; - .pContent { - width: 65%; - .pTitle { - font-weight: 400; - font-size: 16px; - color: #525f7f; - margin: 0; - line-height: 22px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - margin-right: 10px; - &::first-letter { - text-transform: capitalize; - } - } - - .pDesc { - font-weight: 400; - font-size: 15px; - color: #808da0; - margin: 0; - line-height: 22px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - } - - .govStatus { - display: flex; - width: 30%; - justify-content: space-between; - } -} diff --git a/packages/fetch-extension/src/components/proposal/vote-block/index.tsx b/packages/fetch-extension/src/components/proposal/vote-block/index.tsx deleted file mode 100644 index 45db83d10c..0000000000 --- a/packages/fetch-extension/src/components/proposal/vote-block/index.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React, { FunctionComponent } from "react"; -import style from "./style.module.scss"; -import classNames from "classnames"; -interface Props { - title: string; - icon: string; - color: string; - activeColor: string; - id: number; - selected: number; - handleClick: any; - closed: boolean; -} -export const VoteBlock: FunctionComponent = (props) => { - const { title, icon, color, activeColor, id, selected, handleClick, closed } = - props; - const isSelected = id === selected; - const bgColor = isSelected ? activeColor : color; - const txtColor = isSelected ? "white" : "#525F7F"; - const Icon = isSelected ? icon + "-white" : icon; - const cursor = closed ? "not-allowed" : "pointer"; - return ( -
handleClick(id)} - > - -

- {title} -

-
- ); -}; diff --git a/packages/fetch-extension/src/components/proposal/vote-block/style.module.scss b/packages/fetch-extension/src/components/proposal/vote-block/style.module.scss deleted file mode 100644 index 396504d104..0000000000 --- a/packages/fetch-extension/src/components/proposal/vote-block/style.module.scss +++ /dev/null @@ -1,40 +0,0 @@ -.voteBlock { - display: flex; - justify-content: center; - align-items: center; - padding: 10px; - gap: 5px; - cursor: pointer; - - border-radius: 4px; - - .voteImage { - width: 20px; - height: 20px; - } - - .voteText { - margin: 0; - text-align: center; - font-weight: 700; - line-height: 14px; - color: #525f7f; - font-size: 14px; - } -} - -.voteTick { - background: rgba(106, 183, 122, 0.3); -} - -.voteCross { - background: rgba(220, 100, 97, 0.3); -} - -.voteAbstain { - background: rgba(236, 170, 93, 0.3); -} - -.voteNoVeto { - background: rgba(62, 100, 196, 0.3); -} diff --git a/packages/fetch-extension/src/pages/register/migration/metamask-privatekey.tsx b/packages/fetch-extension/src/pages/register/migration/metamask-privatekey.tsx index a7d4e3d630..eb1f5cdf5b 100644 --- a/packages/fetch-extension/src/pages/register/migration/metamask-privatekey.tsx +++ b/packages/fetch-extension/src/pages/register/migration/metamask-privatekey.tsx @@ -1,5 +1,4 @@ import React, { FunctionComponent } from "react"; -import { BackButton } from "../index"; import { FormattedMessage, useIntl } from "react-intl"; import { Input, TextArea } from "@components/form"; import style from "../style.module.scss"; @@ -10,6 +9,19 @@ import { parseEthPrivateKey } from "@fetchai/eth-migration"; import { RegisterConfig } from "@keplr-wallet/hooks"; import { useStore } from "../../../stores"; +export const BackButton: FunctionComponent<{ onClick: () => void }> = ({ + onClick, +}) => { + return ( +
+ +
+ ); +}; + interface FormData { name: string; ethAddress: string;