Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
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
11 changes: 5 additions & 6 deletions src/common/api/hive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, RCAPI, utils } from "@hiveio/dhive";
import { Client, RCAPI, SMTAsset, utils } from "@hiveio/dhive";

import { RCAccount } from "@hiveio/dhive/lib/chain/rc";

Expand Down Expand Up @@ -447,11 +447,7 @@ export const getWitnessesByVote = (from: string, limit: number): Promise<Witness

export interface Proposal {
creator: string;
daily_pay: {
amount: string;
nai: string;
precision: number;
};
daily_pay: string | SMTAsset;
end_date: string;
id: number;
permlink: string;
Expand All @@ -474,6 +470,9 @@ export const getProposals = (): Promise<Proposal[]> =>
})
.then((r) => r.proposals);

export const findProposals = (id: number): Promise<Proposal> =>
client.call("condenser_api", "find_proposals", [[id]]).then((r) => r[0]);

export interface ProposalVote {
id: number;
proposal: Proposal;
Expand Down
3 changes: 3 additions & 0 deletions src/common/components/landing-page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export default (props: any) => {
<div className="flex flex-wrap justify-center items-center">
<p className="mb-3 w-88">{_t("landing-page.what-is-ecency")}</p>
</div>
{/*<button className="get-started mx-auto" onClick={() => props.setStep(2)}>
{_t("landing-page.how-it-works")}
</button>*/}
<button className="get-started mx-auto" onClick={() => props.setStep(2)}>
{_t("landing-page.get-started")}
</button>
Expand Down
7 changes: 4 additions & 3 deletions src/common/components/proposal-list-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { _t } from "../../i18n";
import { linkSvg } from "../../img/svg";
import { Skeleton } from "../skeleton";
import "./_index.scss";
import parseAsset from "../../helper/parse-asset";

interface Props {
history: History;
Expand Down Expand Up @@ -123,10 +124,10 @@ export class ProposalListItem extends Component<Props, State> {
const votesHP = (Number(proposal.total_votes) / 1e12) * dynamicProps.hivePerMVests;
const strVotes = numeral(votesHP).format("0.00,") + " HP";

const dailyPayment = Number(proposal.daily_pay.amount) / 1e3;
const strDailyHdb = numeral(dailyPayment).format("0.0a");
const dailyPayment = parseAsset(proposal.daily_pay);
const strDailyHdb = numeral(dailyPayment.amount).format("0.0a");

const allPayment = dailyPayment * duration;
const allPayment = dailyPayment.amount * duration;
const strAllPayment = numeral(allPayment).format("0.0a");
const diff = endDate.diff(moment(now()), "days");
const remaining = diff < 0 ? 0 : diff;
Expand Down
2 changes: 1 addition & 1 deletion src/common/constants/servers.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
"https://api.hive.blog",
"https://anyx.io",
"https://techcoderx.com",
"https://api.hive.blog",
"https://api.openhive.network",
"https://api.deathwing.me",
"https://hived.emre.sh",
Expand Down
3 changes: 2 additions & 1 deletion src/common/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,8 @@
"welcome-text": "Welcome to Ecency!",
"what-is-ecency": "Decentralized, rewarding, true ownership social network",
"powered-by-hive": "powered by Hive",
"get-started": "Get started",
"how-it-works": "HOW IT WORKS?",
"get-started": "JOIN NOW",
"earn-money": "Earn money",
"earn-money-block-chain-based": "Blockchain-based social network, ",
"join-us": "join-us",
Expand Down
18 changes: 13 additions & 5 deletions src/common/pages/proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import SearchBox from "../components/search-box";
import { _t } from "../i18n";
import { Tsx } from "../i18n/helper";

import { getAccount, getPost, getProposals, Proposal } from "../api/hive";
import { findProposals, getAccount, getPost, getProposals, Proposal } from "../api/hive";

import { pageMapDispatchToProps, pageMapStateToProps, PageProps } from "./common";

Expand Down Expand Up @@ -370,14 +370,22 @@ class ProposalDetailPage extends BaseComponent<DetailProps, DetailState> {
const proposalId = Number(match.params.id);

this.stateSet({ loading: true });
getProposals()
.then((proposals) => {
const proposal = proposals.find((x) => x.id === proposalId);
findProposals(proposalId)
.then((proposal) => {
if (
new Date(proposal.start_date) < new Date() &&
new Date(proposal.end_date) >= new Date()
) {
proposal.status = "active";
} else if (new Date(proposal.end_date) < new Date()) {
proposal.status = "expired";
} else {
proposal.status = "inactive";
}
if (proposal) {
this.stateSet({ proposal });
return getPost(proposal.creator, proposal.permlink);
}

return null;
})
.then((entry) => {
Expand Down