Skip to content

Commit 0c8b634

Browse files
authored
Merge pull request #429 from keep-network/feat/srt-85-news-update
feat(Data)/SRT-85: News data update
2 parents c2416de + 2935d45 commit 0c8b634

2 files changed

Lines changed: 72 additions & 47 deletions

File tree

src/pages/press.md

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,63 @@ news:
2727
title: In the News
2828
body: Featured Coverage
2929
cards:
30-
- title: How Millennial Finance Will Make The Legacy Banking System Irrelevant
31-
source: IBTimes
32-
excerpt: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Elit cursus sed feugiat iaculis dictumst.
33-
date: "2020-09-22T13:00:00.000Z"
30+
- title: Keep Network unveils v2 specs for tBTC protocol
31+
source: Cointelegraph
32+
excerpt: The second iteration of tBTC is expected to require stakers to only lock up Keep rather than both Keep and ETH, alongside introducing changes to its wallet-generation mechanism. The protocol allows users to tokenize their Bitcoin for use on the Ethereum network.
33+
date: "4/12/2021"
3434
icon:
3535
image: /images/home/keep-blog.png
36-
alt: Forbes
37-
url: https://www.coindesk.com/thesis-bitcoin-token-tbtc-relaunches-following-buggy-debut
38-
- title: Bitcoin-Backed Ethereum Token tBTC Launches—for the Second Time
39-
source: Decrypt
40-
excerpt: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Elit cursus sed feugiat iaculis dictumst.
41-
date: "2020-09-22T13:00:00.000Z"
36+
alt: Cointelegraph
37+
url: https://cointelegraph.com/news/keep-network-unveils-v2-specs-for-tbtc-protocol
38+
- title: "‘Keanu’ Explained: What It Means to Merge Two Ethereum Projects"
39+
source: CoinDesk
40+
excerpt: "Two encryption projects, Keep and NuCypher, both running on the Ethereum blockchain, have begun discussing what they are calling a “hard merge,” codename: Keanu. Crucially, this would be a merger of their protocols’ functions and communities, not of their companies."
41+
date: "3/11/2021"
4242
icon:
4343
image: /images/home/keep-blog.png
44-
alt: Forbes
45-
url: https://www.coindesk.com/thesis-bitcoin-token-tbtc-relaunches-following-buggy-debut
44+
alt: CoinDesk
45+
url: https://www.coindesk.com/keanu-explained-nucypher-keep-merger-ethereum
46+
- title: Keep Network, NuCypher teams pitch protocol merger on the Ethereum blockchain
47+
source: The Block
48+
excerpt: Development teams for Keep Protocol and NuCypher are proposing an on-chain merger in a network first for Ethereum.
49+
date: "3/8/2021"
50+
icon:
51+
image: /images/home/keep-blog.png
52+
alt: The Block
53+
url: https://www.theblockcrypto.com/post/97634/keep-protocol-nucypher-ethereum-merger
4654
press_items_section:
4755
title: Latest Coverage
4856
press_items:
57+
- date: "2020-09-24T19:25:00.000Z"
58+
title: Keep Network Launches tBTC with KEEP Liquidity Mining Plans
59+
source: DeFi Rate
60+
excerpt: tBTC is an ERC-20 token that allows Bitcoin to be securely on Ethereum as as tBTC. Unlike WBTC, tBTC allows users to trustlessly go to and from the bridge without having to use a centralized custodian.
61+
url: https://defirate.com/tbtc-launch/
62+
- date: "2020-09-30T13:00:00.000Z"
63+
title: Nexus Mutual Launches Shield Mining with KEEP Network tBTC
64+
source: DeFi Rate
65+
excerpt: Nexus Mutual has announced a new staking feature called “shield mining” to incentivize smart contract cover, starting with Keep Network.
66+
url: https://defirate.com/nexus-mutual-shield-mining/
67+
- date: "2020-12-15T03:50:00.000Z"
68+
title: Exchange adds tBTC minting capabilities, lowering barrier to entry
69+
source: Cointelegraph
70+
excerpt: Users can now mint tBTC, a decentralized version of Bitcoin on the Ethereum blockchain, right on the CoinList exchange.
71+
url: https://cointelegraph.com/news/exchange-adds-tbtc-minting-capabilities-lowering-barrier-to-entry
72+
- date: "2020-09-02T16:36:44.400Z"
73+
title: "Messari: $500M in BTC tokenized for DeFi is just the beginning"
74+
source: Cointelegraph
75+
excerpt: With more than half a billion dollars worth BTC already tokenized, Messari believes that projects bringing Bitcoin to DeFi will emerge as leaders of the crypto sector.
76+
url: https://cointelegraph.com/news/messari-500m-in-btc-tokenized-for-defi-is-just-the-beginning
77+
- date: "2020-10-12T16:38:19.751Z"
78+
title: "Blockchain Bites: Bitcoin on Ethereum – The Whos, Whats and Whys"
79+
source: CoinDesk
80+
excerpt: These DeFi applications offer an increasingly large array of potential use cases for bitcoin investors looking for alternative ways to issue loans or make trades on new exchange platforms.
81+
url: https://www.coindesk.com/bitcoin-ethereum-musk-bitmex
82+
- date: "2020-06-26T16:00:00.000Z"
83+
title: Anchorage Launches Support for DeFi Token KEEP
84+
source: Cointelegraph
85+
excerpt: Crypto custodian Anchorage has launched support for KEEP in its latest bid to emerge as a leading custodian for DeFi tokens.
86+
url: https://cointelegraph.com/news/anchorage-launches-support-for-defi-token-keep
4987
- date: "2020-09-22T19:25:00.000Z"
5088
title: Bitcoin-on-Ethereum Token tBTC Relaunches Following Buggy Debut in May
5189
source: Coindesk

src/templates/press-page.js

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from "react"
1+
import React, { useEffect, useMemo, useState } from "react"
22
import ClampLines from "react-clamp-lines"
33
import { Col, Row } from "reactstrap"
44
import PropTypes from "prop-types"
@@ -62,28 +62,9 @@ export const PressPageTemplate = ({
6262
}) => {
6363
const { press_items: pressItems } = pressItemsSection
6464
const [allPressEntries, setAllPressEntries] = useState([])
65-
const [pressEntries, setPressEntries] = useState([])
6665
const [year, setYear] = useState(null)
67-
68-
const entries2019 = allPressEntries.filter((entry) =>
69-
entry.date.includes("2019")
70-
)
71-
const entries2020 = allPressEntries.filter((entry) =>
72-
entry.date.includes("2020")
73-
)
74-
const entries2021 = allPressEntries.filter((entry) =>
75-
entry.date.includes("2021")
76-
)
77-
78-
useEffect(() => {
79-
year === 2019
80-
? setPressEntries(entries2019)
81-
: year === 2020
82-
? setPressEntries(entries2020)
83-
: year === 2021 && entries2021
84-
? setPressEntries(entries2021)
85-
: setPressEntries(allPressEntries)
86-
}, [year])
66+
const [entrySize, setEntrySize] = useState(0)
67+
const [isShowAll, setShowAll] = useState(false)
8768

8869
useEffect(() => {
8970
const dateOptions = { year: "numeric", month: "long", day: "numeric" }
@@ -96,18 +77,19 @@ export const PressPageTemplate = ({
9677
date: new Date(item.date).toLocaleDateString("en-US", dateOptions),
9778
}))
9879
setAllPressEntries(sortedAndFormatted)
99-
setPressEntries(sortedAndFormatted.slice(0, 10))
10080
}, [pressItems])
10181

102-
const handleShowAll = () => {
103-
year === 2019
104-
? setPressEntries(entries2019)
105-
: year === 2020
106-
? setPressEntries(entries2020)
107-
: year === 2021 && entries2021
108-
? setPressEntries(entries2021)
109-
: setPressEntries(allPressEntries)
110-
}
82+
const pressEntries = useMemo(() => {
83+
const entires = year
84+
? allPressEntries.filter((entry) => entry.date.includes(year))
85+
: [...allPressEntries]
86+
setEntrySize(entires.length)
87+
if (isShowAll) {
88+
return entires
89+
} else {
90+
return entires.slice(0, 10)
91+
}
92+
}, [allPressEntries, year, isShowAll])
11193

11294
return (
11395
<div className="press-content">
@@ -197,12 +179,17 @@ export const PressPageTemplate = ({
197179
))}
198180
</Col>
199181
</Row>
200-
{allPressEntries.length > 10 && pressEntries.length ? (
182+
{entrySize === 0 ? (
183+
"No posts available"
184+
) : entrySize > 10 ? (
201185
<div className="pagination">
202-
<SeeAllButton onClick={handleShowAll} />
186+
<SeeAllButton
187+
collapsed={!isShowAll}
188+
onClick={() => setShowAll(!isShowAll)}
189+
/>
203190
</div>
204191
) : (
205-
"No posts available"
192+
<></>
206193
)}
207194
</PageSection>
208195
</div>

0 commit comments

Comments
 (0)